Bug 656752 (CVE-2011-2367)

WebGL crash [@gleRunVertexSubmitImmediate()]

RESOLVED FIXED

Status

()

Core
Canvas: WebGL
--
critical
RESOLVED FIXED
6 years ago
3 years ago

People

(Reporter: posidron, Unassigned)

Tracking

(Blocks: 1 bug, {crash, testcase})

Trunk
x86_64
Mac OS X
crash, testcase
Points:
---

Firefox Tracking Flags

(firefox5+ fixed, blocking2.0 ?, status2.0 wanted, status1.9.2 unaffected, status1.9.1 unaffected)

Details

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

Attachments

(3 attachments)

(Reporter)

Description

6 years ago
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
(Reporter)

Comment 1

6 years ago
Created attachment 532024 [details]
callstack
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.
Group: core-security
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.
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.
tracking-firefox5: --- → ?
Important: this bug has been open for 1 day before getting hidden.
Ugh, been open for 4 days actually.

Comment 11

6 years ago
Comment on attachment 532684 [details] [diff] [review]
fix bindBuffer() bookkeeping

Approved for mozilla-aurora
Attachment #532684 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
status1.9.1: --- → unaffected
status1.9.2: --- → unaffected
status2.0: --- → wanted
status-firefox5: --- → affected
tracking-firefox5: ? → +
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?]

Comment 13

6 years ago
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?

Updated

6 years ago
status-firefox5: affected → fixed
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.
status-firefox5: fixed → affected
FIXED in firefox 5 and 6, but the question is still open for Firefox 4.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
status-firefox5: affected → fixed
(Reporter)

Updated

6 years ago
Blocks: 658170
(Assignee)

Updated

6 years ago
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.