Closed Bug 656752 (CVE-2011-2367) Opened 13 years ago Closed 13 years ago

WebGL crash [@gleRunVertexSubmitImmediate()]


(Core :: Graphics: CanvasWebGL, defect)

Not set



Tracking Status
firefox5 + fixed
blocking2.0 --- ?
status2.0 --- wanted
status1.9.2 --- unaffected
status1.9.1 --- unaffected


(Reporter: posidron, Unassigned)


(Keywords: crash, testcase, Whiteboard: [sg:high] arbitrary memory read [4.0.x ridealong?])

Crash Data


(3 files)

Attached file testcase

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


OpenGL renderer string: ATI Radeon HD 6750M OpenGL Engine
OpenGL version string: 2.1 ATI-1.6.32
Attached file callstack
Bingo: I can reproduce on Linux:

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.
Group: core-security
Indeed... very scary.
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.
Attachment #532684 - Flags: review?(jmuizelaar)
(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
Attachment #532684 - Flags: review?(jmuizelaar) → review+
Attachment #532684 - Flags: approval-mozilla-aurora?
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
Attachment #532684 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
status2.0: --- → wanted
Keywords: crash, testcase
Whiteboard: [sg:high] arbitrary memory read
If we did a 4.0.x chemspill it might be worth it to take this fix.
blocking2.0: --- → ?
Whiteboard: [sg:high] arbitrary memory read → [sg:high] arbitrary memory read [4.0.x ridealong?]
Can someone land this. We are soon going to merge over to Beta.
Landed on Mozilla-Aurora:

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

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.
Closed: 13 years ago
Resolution: --- → FIXED
Crash Signature: [@gleRunVertexSubmitImmediate()]
Alias: CVE-2011-2367
Group: core-security
You need to log in before you can comment on or make changes to this bug.