Closed Bug 636921 Opened 15 years ago Closed 15 years ago

WebGL crash [@ns_if_addref<nsISupports*>]

Categories

(Core :: Graphics: CanvasWebGL, defect)

x86_64
macOS
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla2.0
Tracking Status
firefox5 --- unaffected
blocking2.0 --- .x+
status1.9.2 --- unaffected
status1.9.1 --- unaffected

People

(Reporter: posidron, Assigned: bjacob)

References

Details

(Keywords: crash, testcase, Whiteboard: [sg:critical?] [has patch])

Crash Data

Attachments

(3 files)

Attached file testcase —
I am currently not sure whether eax can be manipulated or not. 0x1000ffb91 <_Z12ns_if_addrefIP11nsISupportsEvT_+57>: mov rax,QWORD PTR [rax] 0x1000ffb94 <_Z12ns_if_addrefIP11nsISupportsEvT_+60>: add rax,0x8 0x1000ffb98 <_Z12ns_if_addrefIP11nsISupportsEvT_+64>: mov rax,QWORD PTR [rax] 0x1000ffb9b <_Z12ns_if_addrefIP11nsISupportsEvT_+67>: mov rdi,QWORD PTR [rbp-0x8] 0x1000ffb9f <_Z12ns_if_addrefIP11nsISupportsEvT_+71>: call rax
Attached file callstack —
callstack
We're not sure if this is sg:critical. As listed, this is a null dereference, but it looks like we're taking a type from untrusted code. I'm willing to listen to someone who says that this isn't exploitable, but it looks sort of scary. Benoit, is there some sort of comparison or validation we can do? Apparently there's a type in mAttribBuffers[index].
Assignee: nobody → bjacob
blocking2.0: --- → ?
Whiteboard: [sg:critical?]
Yeah, this looks very exploitable to me.
blocking2.0: ? → .x+
Just before the crash, I get: ###!!! ASSERTION: invalid array index: 'i < Length()', file ../../../dist/include/nsTArray.h, line 455 Running with XPCOM_DEBUG_BREAK=trap, I get this stack trace for it: #0 RealBreak () at /home/bjacob/mozilla-central/xpcom/base/nsDebugImpl.cpp:421 #1 0x00007ffff645b39b in Break ( aMsg=0x7fffffff9430 "###!!! ASSERTION: invalid array index: 'i < Length()', file ../../../dist/include/nsTArray.h, line 455") at /home/bjacob/mozilla-central/xpcom/base/nsDebugImpl.cpp:517 #2 0x00007ffff645b362 in NS_DebugBreak_P (aSeverity=1, aStr=0x7ffff6d9d779 "invalid array index", aExpr=0x7ffff6d9d76c "i < Length()", aFile=0x7ffff6d9d710 "../../../dist/include/nsTArray.h", aLine=455) at /home/bjacob/mozilla-central/xpcom/base/nsDebugImpl.cpp:385 #3 0x00007ffff5347b20 in nsTArray<mozilla::WebGLVertexAttribData, nsTArrayDefaultAllocator>::ElementAt (this=0x7fffe45bcc78, i=16) at ../../../dist/include/nsTArray.h:455 #4 0x00007ffff5345c40 in nsTArray<mozilla::WebGLVertexAttribData, nsTArrayDefaultAllocator>::operator[] (this=0x7fffe45bcc78, i=16) at ../../../dist/include/nsTArray.h:488 #5 0x00007ffff5327fbe in mozilla::WebGLContext::GetVertexAttrib (this=0x7fffe45bcbe0, index=16, pname=34975, retval=0x7fffffff9be0) at /home/bjacob/mozilla-central/content/canvas/src/WebGLContextGL.cpp:2528 #6 0x00007ffff646959f in NS_InvokeByIndex_P (that=0x7fffe45bcbe0, methodIndex=81, paramCount=3, params=0x7fffffff9bb0) at /home/bjacob/mozilla-central/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_unix.cpp:195 #7 0x00007ffff5b97ca0 in CallMethodHelper::Invoke (this=0x7fffffff9b70) at /home/bjacob/mozilla-central/js/src/xpconnect/src/xpcwrappednative.cpp:3124 And doing 'call DumpJSStack()' I get this JS stack: 0 boom() ["file:///home/bjacob/ns_if_addref/testcase.html":126] v15 = undefined v14 = undefined v13 = undefined v12 = [object WebGLRenderbuffer @ 0x7fffe48b1910 (native @ 0x7fffe48ac950)] v11 = [object WebGLTexture @ 0x7fffe48abb40 (native @ 0x7fffe48ac760)] v10 = [object HTMLImageElement @ 0x7fffe11d7a50 (native @ 0x7fffe48b5c00)] v9 = [object WebGLTexture @ 0x7fffe48add00 (native @ 0x7fffe48cbdc0)] v8 = [object WebGLProgram @ 0x7fffe48cb390 (native @ 0x7fffe48cb1d0)] v7 = [object WebGLBuffer @ 0x7fffe48ca310 (native @ 0x7fffe48c9bb0)] v6 = [object WebGLRenderbuffer @ 0x7fffe48ba200 (native @ 0x7fffe48b7bc0)] v5 = [object HTMLImageElement @ 0x7fffe11d7318 (native @ 0x7fffe48b79c0)] v4 = [object WebGLTexture @ 0x7fffe430ef20 (native @ 0x7fffe48b6480)] v3 = [object WebGLShader @ 0x7fffe48ac4d0 (native @ 0x7fffe48b6030)] v2 = [object WebGLFramebuffer @ 0x7fffe48b0850 (native @ 0x7fffe48b0430)] v1 = 13,13,5,0,4,9,9,13,3,6,8,14,9,8,14,2,3,9,14,2,12,0,8,3 v0 = [object WebGLProgram @ 0x7fffe48b4580 (native @ 0x7fffe48ba5a0)] webgl = [object Object] this = [object Window @ 0x7fffe4073700 (native @ 0x7fffe4440f78)] 1 onload(event = [object Event @ 0x7fffe44a9200 (native @ 0x7fffe4592f60)]) ["file:///home/bjacob/ns_if_addref/testcase.html":1] this = [object Window @ 0x7fffe4073700 (native @ 0x7fffe4440f78)]
This patch fixes the crash here.
Whiteboard: [sg:critical?] → [sg:critical?] [has patch]
By the way, I checked that this is *not* a regression from the recent patch in bug 636002 where this was centralized in this one place: the bug (using > instead of >=) existed before that patch.
Comment on attachment 516583 [details] [diff] [review] one byte patch: fix attrib index validation bug (> versus >=) r=jag
Attachment #516583 - Flags: review? → review+
http://hg.mozilla.org/mozilla-central/rev/195a7aceb72b And sorry for the wrong commit message :-(
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Group: core-security
Target Milestone: --- → mozilla2.0
Crash Signature: [@ns_if_addref<nsISupports*>]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: