News for hackers. Stuff that matters.
Re:Exploiting the Math.expm1 typing bug in V8 by jancsika on Wednesday January 02, 2019 @10:41PM (#18812642)
> The fundamental bug here is really slick. The static analyzer in the JIT incorrectly believes Math.expm1(x) can't return -0.

I can't get past this part.

When a Googler "believes" Union(PlainNumber, NaN) represents the set of possible return values for a math function and commits that in the code, how is there not an automated set of tests that use one out of every other IEEE754-associated type as input to then check whether it generates output which falls outside the assumed set of types?

I mean in this case you've even got NegativeZero as its own type. What's even the point of having a type with a single value if you don't hurl it at every manually-entered optimization that it could conceivably invalidate?

Re:Exploiting the Math.expm1 typing bug in V8 by tptacek on Wednesday January 02, 2019 @10:57PM (#18812694)
I don't know, to me, this sounds like one of the more subtle examples of the kinds of mistakes that lead to security failures. Like, it might be an almost archetypical example of the "all bugs are security vulnerabilities" hypothesis. They got code execution from expm1!

But if you believe that this is an example of wanton abuse at Google, you can trade on that belief, and in a sense put your money where your mouth is, because this is a whole class of potential bugs, not just one bug; the same pattern will recur for other places where the v8 typer is wrong about the possible results of functions. Go do a sweep! If you find one, the value of the resulting bug might be pretty decent.

Re:Exploiting the Math.expm1 typing bug in V8 by laurentl on Thursday January 03, 2019 @03:14AM (#18813621)
> it might be an almost archetypical example of the "all bugs are security vulnerabilities" hypothesis

This article will be my new go-to example when someone handwaves a bug away with a complacent “it’ll never happen” and “it’s not that big of a deal”. Yes it will, and yes it is.

Re:Exploiting the Math.expm1 typing bug in V8 by wglb on Thursday January 03, 2019 @10:21AM (#18815700)
Right, and it is right up there with https://www.blackhat.com/us-18/briefings/schedule/index.html, whose security value was unappreciated by some very smart folks.
Re:Exploiting the Math.expm1 typing bug in V8 by EE84M3i on Thursday January 03, 2019 @12:02PM (#18816671)
Were you trying to link to a specific briefing? Your link just goes to the full schedule for me.
Re:Exploiting the Math.expm1 typing bug in V8 by wglb on Friday January 04, 2019 @08:15PM (#18829238)
Re:Exploiting the Math.expm1 typing bug in V8 by diamondo25 on Thursday January 03, 2019 @01:42AM (#18813348)
If they just didnt discard the OutOfBounds check, the V8 JS engine would be a lot safer...
Re:Exploiting the Math.expm1 typing bug in V8 by userbinator on Thursday January 03, 2019 @02:15AM (#18813457)
...and probably a lot slower. Google loves to make claims about V8's performance, but not so much about security.
Re:Exploiting the Math.expm1 typing bug in V8 by tokyodude on Thursday January 03, 2019 @05:06AM (#18814062)
certainly V8 tries to be correct and this bug will be fixed. Chromium's position is "security in depth". They know it's impossible to have zero bugs therefore the entire architure assumes there will be bugs and tries to prevent them from causing any harm. This is also why there are roughly 10x less code execution bugs in chrome vs other browsers. same number of bugs overall but most lead nowhere
Re:Exploiting the Math.expm1 typing bug in V8 by blattimwind on Thursday January 03, 2019 @06:45AM (#18814427)
> Chromium's position is "security in depth".

Yet the exploit in WebSQL a few weeks ago gave RCE from a component directly reachable by page scripts.

Re:Exploiting the Math.expm1 typing bug in V8 by librarian42 on Saturday January 05, 2019 @09:36AM (#18831813)
Technically that was an SQL injection attack. :)
Re:Exploiting the Math.expm1 typing bug in V8 by tom_ on Thursday January 03, 2019 @09:29AM (#18815294)
That must have been one of the bugs that lead somewhere.
Re:Exploiting the Math.expm1 typing bug in V8 by pcwalton on Wednesday January 02, 2019 @11:54PM (#18812918)
I wouldn't be surprised if NegativeZero got introduced to fix some other bug along the same lines involving a different function, and when fixing that bug they neglected to notice that it applies to expm1 as well. Math.expm1 is... a bit obscure. I could certainly see myself making the same mistake.
Re:Exploiting the Math.expm1 typing bug in V8 by pdpi on Thursday January 03, 2019 @09:21AM (#18815247)
> how is there not an automated set of tests that use one out of every other IEEE754-associated type as input to then check whether it generates output which falls outside the assumed set of types?

It's slightly worse than that. Math.expm1(-0) = -0 is explicitly called out as part of the standard[1]. You don't need to throw every IEEE754 at your functions to make sure they're all correct, but validating the explicitly defined corner cases is table stakes.

1. https://www.ecma-international.org/ecma-262/6.0/#sec-math.ex...

Re:Exploiting the Math.expm1 typing bug in V8 by dnautics on Wednesday January 02, 2019 @11:09PM (#18812750)
serious question - does the V8 team do property checking?