out-of-bound access in ShmemTextureReadLock::ReadUnlock
An out-of-bounds decrement in ShmemTextureReadLock::ReadUnlock allows an attacker to manipulate adjacent memory fields, potentially leading to further exploitation. The report demonstrates the issue via a callstack and logs, though a full ASAN report was not obtained.
Originally disclosed on Mozilla
- Fixed in 28 days
- Paid in 40 days
- Disclosed after 28 days
Created attachment 9407239
patch.diff
In |ReadUnlock()|, |mShmemSection|'s memory region is accessed without validation of offset[1]. An attacker can achieve an `out of bound decrement` using this vulnerability. It can manipulate the field of adjacent objects (e.g., length, Reference count, etc.) and there are already many public exploits related to this.
I attempted to get ASAN report but sadly, it didn't work. I guess that ASAN doesn't recognize |PR_ATOMIC_DECREMENT| macro. Therefore, I explain `out of bound decrement` with a callstack and some logs.
With the attached file, you can see that |info->readCount|, the argument of |PR_ATOMIC_DECREMENT|, is out of the memory region of |mShmemSection| and the destination is in another memory region.
Besides |ReadUnlock()|, the constructors of |ReadLock|, |GetReadCount| and |ShmemTextureReadLock| also have a similar pattern. Though I've only found the way to |ReadUnlock()|, I suggest adding some checks for the offset.
[1]: https://searchfox.org/mozilla-central/source/gfx/layers/client/TextureClient.cpp#1854
REPRODUCTION CASE
Type of vulnerbility: GPU Process
To reproduce crash, please follow these steps:
Apply patch.diff
Open https://webrtc.github.io/samples/src/content/capture/video-pc/ in browser
// patch.diff emulates a compromised content process
Even if running this Poc on the ASAN build, it is unlikely that a crash or ASAN report will occur. I recommend using a debugger to identify the point where the vulnerability occurs.
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
Likely the offset used to access the shared memory section is not validated before performing an atomic decrement, allowing access beyond the allocated region.
Impact
An attacker could manipulate adjacent memory fields, such as length or reference count, potentially leading to further exploitation, though the report only demonstrates the out-of-bounds decrement.
What the attacker needed
Compromised content process; debugger for observation
The fix
The offset should be validated before accessing the shared memory region, and similar checks should be added to other functions with the same pattern.
How it was found
- Apply the provided patch.diff to emulate a compromised content process.
- Open the WebRTC sample page in the browser.
- Use a debugger to observe the out-of-bounds decrement, as ASAN may not detect it.
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 a memory safety issue where a program writes to a memory location outside the intended buffer. An attacker could use this to corrupt nearby data, which might lead to crashes or worse, but the report only shows the out-of-bounds write, not full exploitation.
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.