Skip to content
Disclosed report CVE-2015-2712

Incorrect asm.js bounds check elimination vulnerability (Firefox 37.0.1)

Dougall Johnson Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 13 days
  • Paid in 19 days
  • Disclosed after 13 days
Text
Created attachment 8589587
poc.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36

Steps to reproduce:

An out-of-bounds read/write vulnerability exists in Firefox 37.0.1 (32-bit), which is similar to (but distinct from) a recent Pwn2Own vulnerability. This was tested on Windows.

To trigger the vulnerability, an asm.js change-heap function must be defined with a minLengthExclusive of 0xFFFFFFFF. This function is parsed by CheckHeapLengthCondition in AsmJSValidate.cpp, which validates this value, then adds one to it, wrapping the value to zero. This zero is then stored as the module's minHeapLength, allowing heaps of any (otherwise valid) size to be used.

In FoldMaskedArrayIndex, one is subtracted from the minHeapLength, wrapping back to 0xFFFFFFFF, which is assumed to be less than the heap size for bounds checking purposes. This function will then omit bounds checks for masks as large as 0x7FFFFFFF, even though much smaller heaps can be used. This allows asm.js code to read and write past the end of its heap.

To reproduce, see the attached proof of concept.


Actual results:

Arbitrary read/write.


Expected results:

Probably an error or something.

The original report as published on Mozilla's Bugzilla, by Dougall Johnson. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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 security bug in JavaScript Engine. Mozilla made it public on 20 April 2015 as CVE-2015-2712.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.