Skip to content
Memory corruption Disclosed report Advanced CVE-2017-7754

Out-of-bounds array access in WebGLTexture::ImageInfoAtFace

An out-of-bounds array access occurs in WebGLTexture::ImageInfoAtFace when a large level value is passed to gl.texParameterf, allowing a bogus ImageInfo object to be returned. This could potentially lead to an exploitable state.

Tobias Klein Follow

Originally disclosed on Mozilla

  • Fixed in 35 days
  • Paid in 49 days
  • Disclosed after 35 days
Text
Created attachment 8858813
testcase.html

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36

Steps to reproduce:

Tested on:
 - Mozilla Firefox 52.0.2 (32-bit) on Windows 10
 - Nightly 55.0a1 (2017-04-10) (64-bit) on Ubuntu 16.04 LTS
 
Details:

dom/canvas/WebGLTexture.h:

..
313    ImageInfo& ImageInfoAtFace(uint8_t face, uint32_t level) {
314        MOZ_ASSERT(face < mFaceCount);
315        MOZ_ASSERT(level < kMaxLevelCount);
316        size_t pos = (level * mFaceCount) + face;
317        return mImageInfoArr[pos];
318    }
..

By supplying a sufficiently large value to 'level' (see the third parameter of gl.texParameterf() in the provided testcase file), it is possible to cause an out-of-bounds array access in line 317. This may result in a bogus ImageInfo object being returned to the calling function, possibly leading to an exploitable state.

Provided files:

- testcase.html -- Testcase to trigger the issue.
- ASAN_output.txt -- Detailed ASAN output (Linux).
- WinDbg_output.txt -- Further debugging information (Windows).

The original report as published on Mozilla's Bugzilla, by Tobias Klein. 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.

How it worked

Root cause

The level parameter is not validated against the maximum allowed level before being used to index the mImageInfoArr array.

Impact

This may result in a bogus ImageInfo object being returned to the calling function, possibly leading to an exploitable state.

What the attacker needed

Victim visits a malicious webpage

How it was found

  1. Open the provided testcase.html in Firefox.
  2. The testcase calls gl.texParameterf with a large level value.
  3. This triggers an out-of-bounds array access in WebGLTexture::ImageInfoAtFace.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

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

This bug is in a web browser's graphics code. When a webpage asks the browser to set a texture parameter with a very large 'level' number, the code uses that number to calculate a position in an array without checking if it's too big. That can make the browser read or write memory outside the array, which might let an attacker run harmful code.

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.

More by Tobias Klein

View all

3 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.