Created attachment 532023 [details] testcase Environment: ProductName: Mac OS X ProductVersion: 10.6.7 BuildVersion: 10J869 OpenGL renderer string: NVIDIA GeForce GT 330M OpenGL Engine OpenGL version string: 2.1 NVIDIA-1.6.26 and OpenGL renderer string: ATI Radeon HD 6750M OpenGL Engine OpenGL version string: 2.1 ATI-1.6.32
Bingo: I can reproduce on Linux: https://crash-stats.mozilla.com/report/index/a58d28f4-8125-447b-8ff8-39d102110516 That means it's almost certainly a bug in my code.
Seems to be that the WebGL state tracking code is getting confused into believing that there is an element array buffer bound (mBoundElementArrayBuffer is non-null) when there really isn't.
Seems like you might be able to use this to upload arbitrary data to the gpu and then extract it's contents.
Indeed... very scary.
Created attachment 532684 [details] [diff] [review] fix bindBuffer() bookkeeping There you go: bindBuffer() was updating its bookkeeping before parameter validation was complete. The testcase was hitting a case where the bookkeeping was updated but the corresponding GL call was not performed, so the bookkeeping was no longer reflecting the actual GL state.
(In reply to comment #4) > Seems like you might be able to use this to upload arbitrary data to the gpu > and then extract it's contents. Just for the record, here's how an attack could have proceeded, to implement PEEK: 1. set up vertex data (bound vertex buffers) so that the i-th vertex contains the value i. 2. set up a trivial vertex shader that just copies the vertex, and a fragment shader that encodes the vertex x-coord as color 3. reproduce the situation hit by Christoph's test case, call glDrawElements drawing 1 vertex as GL_POINTS, with an 'indices' parameter equal to some pointer you want to read the memory at. 4. now your rendered pixel's color tells you what was at this memory location
For sure we want this in Firefox 5. What do we do for Firefox 4? Is this worth a chemspill? Note, regarding comment 7: there's one little mitigation of the severity of this bug, it's that this pointer parameter gets validated as an index into a vertex array, so if it's greater than the length of currently bound arrays, it gets rejected. Of course that's not enough to make one feel comfortable.
Important: this bug has been open for 1 day before getting hidden.
Ugh, been open for 4 days actually.
Comment on attachment 532684 [details] [diff] [review] fix bindBuffer() bookkeeping Approved for mozilla-aurora
If we did a 4.0.x chemspill it might be worth it to take this fix.
Can someone land this. We are soon going to merge over to Beta.
Landed on Mozilla-Aurora: http://hg.mozilla.org/mozilla-aurora/rev/549dfefec7c0 But now I'm a bit scared: what if the bad guys are watching the logs?
Maybe I shouldn't land this on mozilla-central for now. In case the bad guys are watching only mozilla-central and not mozilla-aurora.
After discussion with Jeff and Ehsan, landed this on mozilla-central http://hg.mozilla.org/mozilla-central/rev/db4ba8614fb6 Looking back at the patch, I find some relative comfort in the fact that it's only touching bindBuffer() and doesn't give away the clue that there was an exploit specifically with element array pointers i.e. the old OpenGL-1-ish signature of glDrawElements that's not supposed to be exposed by WebGL.
FIXED in firefox 5 and 6, but the question is still open for Firefox 4.
6 years ago