IPCImage signed-stride confusion leaks browser-parent memory to compromised content
A compromised Firefox content process could send an IPCImage with a stride value that the browser parent validated as unsigned but passed to a graphics API as a signed integer, causing a negative stride and an out-of-bounds read. The parent then copied a row from an address 2 GiB below the attacker's shared-memory mapping, leaking 65,536 bytes of parent heap memory including pointers.
Originally disclosed on Mozilla
- Fixed in 2 days
- Paid in 17 days
- Disclosed after 2 days
Created attachment 9621016 run.sh
Overview
A compromised Firefox Web Content process can send PContent::SetClipboard
an IPCImage whose IPDL stride is 0x80000000. The browser parent validates
that field as an unsigned size_t, but then passes it to a graphics API that
takes int32_t. The resulting wrapping source surface has stride
INT32_MIN.
The graphics copy path accepts that negative stride because
GetStrideGap() performs an unchecked signed subtraction. In the tested
optimized Nightly binary, the subtraction wraps to a positive gap, passes the
negative-gap check, and makes the second source row advance by exactly
-0x80000000. The parent therefore copies row 1 from an address exactly 2 GiB
below the attacker-supplied shared-memory mapping.
The supplied PoC uses the supported R5G6B5_UINT16 format so PNG conversion is
reversible. It places a live parent-only allocation at the out-of-bounds
address and recovers 65,536 contiguous parent bytes in the compromised content
process. An instrumented provenance run proved that the recovered row and the
parent bytes immediately before the copy were byte-for-byte identical.
This is a compromised-content-process IPC reproducer, not a claim that ordinary web JavaScript can forge IPDL. After the compromised-content capability is modeled, the trigger is automatic: page load, a five-second timer, and one ordinary marker request. No click, prompt, permission, picker, WebDriver/Marionette action, simulated user input, or prior handler configuration is required.
The vulnerable unsigned-size change was introduced by Bug 2054740, represented
in the audited Git mirror by commit
abf79171ccbaa86809d3b7de2db74ace1848b674 (2026-08-01).
Build / Environment
Validated with an unmodified official Firefox Nightly binary:
Firefox: 155.0a1, Linux x86_64
BuildID: 20260802092052
OS: Ubuntu 24.04.4 LTS, Linux 6.8.0-136-generic, x86_64
Compiler for hook: GCC 13.3.0
Python: 3.12.3
The source line numbers in root_cause.md were checked against the exact
SourceStamp above. Stock-binary disassembly was also checked at
libxul.so+0x5aeca60 (mozilla::gfx::SwizzleData).
Each final replay used a newly created profile with no user.js, policy file,
sandbox override, clipboard override, or automation preference. The Linux Web
Content process was alive after disclosure with:
NoNewPrivs: 1
Seccomp: 2
The PoC uses LD_PRELOAD to model arbitrary IPC sends from an already
compromised content process without modifying Firefox. The same library is
loaded into the parent, but mutation/reply capture is gated on -contentproc;
parent wrappers delegate directly when diagnostics are absent. The final
logging-free run enabled no parent copy, map, row, or stop instrumentation.
Steps To Reproduce
-
Install the PoC build/runtime dependencies. On Debian or Ubuntu these are:
Shell sudo apt install build-essential python3 libx11-dev libxfixes-dev xvfb -
If no graphical display is available, start an isolated Xvfb display:
Shell Xvfb :99 -screen 0 1280x1024x24 & export DISPLAY=:99 -
From this submission directory, run:
Shell cd poc export NIGHTLY=/path/to/firefox-nightly/firefox ./run.shThe runner compiles the transport hook, verifies the exact BuildID and SourceStamp, creates a fresh per-run profile, serves
trigger.htmlon loopback, launches the unmodified browser, captures the asynchronous raw reply in the compromised process, decodes the returned PNG, reverses RGB565, and records parent and content-process liveness. -
A successful run exits with status 0 and prints lines equivalent to:
Text dimensions=32768x2 recovered_row0_rgb565_sha256=e882fdb8a1c6f0d9ce1b66799be849726e45f57d53bdcc34ec68a3c06928d2f3 recovered_row1_parent_bytes_sha256=<varies with ASLR/allocator state> row0_marker_match=1 row1_distinct_nonzero=1 alpha_opaque=1 parent_alive_after_capture=1 pid=<pid> content_alive_after_capture=1 pid=<pid> NoNewPrivs=1 Seccomp=2
The strict decoder fails unless the image is exactly 32768x2, row 0 is the
known attacker marker, row 1 is distinct and nonzero, and both rows are opaque
after RGB565 expansion. See poc_readme.md for the threat model and file-level
details.
Actual Results
The strongest instrumented stock-Nightly run recorded:
shared source base: 0x719255eb0000
row-1 source: 0x7191d5eb0000
source delta: -2147483648
row bytes: 65536
target parent VMA: 0x7191cdc00000-0x7191d6000000 [anon:jemalloc]
The target row contained 431 unique pointer values mapped in the browser parent and absent from the saved content/forkserver maps. All 430 successive records were exactly 152 bytes apart. The parent target dump and the bytes recovered from the PNG were identical:
7556111b03d151a1ff676c8c876d46d511554d6eb9cab1e67628a778bc422ca7 parent bytes before copy
7556111b03d151a1ff676c8c876d46d511554d6eb9cab1e67628a778bc422ca7 recovered RGB565 row
A separate logging-free run produced another 65,536-byte disclosed row with 431 parent-only pointers at the same 152-byte spacing. Parent and compromised content remained alive and polling after capture.
The final run of the exact files in this submission is recorded in
validation.log.
Expected Results
The parent must reject an IPCImage stride that cannot be represented by the
downstream signed graphics API. In particular, a stride with bit 31 set must
not reach CreateDataSourceSurfaceFromData() as a negative int32_t.
Buffer validation must bind the following invariants together before mapping or copying the image:
stride <= INT32_MAX;stride >= width * BytesPerPixel(format);- all required/used-size calculations remain valid;
- row-gap subtraction remains checked and nonnegative; and
- every source row lies inside the supplied
BigBuffer.
Invalid image metadata should fail the IPC image conversion without reading outside the transferred shared-memory mapping.
Security Impact
This is a controlled browser-parent out-of-bounds read across the content
sandbox boundary. The demonstrated primitive returns 65,536 contiguous bytes
from an address at a controlled -2 GiB displacement. The recovered data
included dense parent heap pointers, providing direct browser-parent ASLR and
heap-layout disclosure. A different allocation occupying the same address can
expose other parent-resident data.
The PoC uses GetClipboardDataIfSmallerThan(image/png) only to return the
already-corrupted retained image. A prior report covers direct clipboard-read
authorization. That authorization issue is not claimed here; the new root
cause is the IPCImage size/stride type confusion and graphics OOB source
read.
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 a signed/unsigned type confusion: the stride is validated as an unsigned size_t but passed to a graphics API taking int32_t, and the row-gap subtraction is unchecked, so a negative stride wraps to a positive gap.
Impact
A compromised content process could read 65,536 contiguous bytes of browser-parent memory, disclosing heap pointers and ASLR layout; the text notes a different allocation at the same address could expose other parent data, and the exploit requires an already-compromised content process rather than ordinary web JavaScript.
What the attacker needed
Compromised content process; ability to send crafted IPC messages; unmodified Firefox Nightly build
The fix
The parent should reject an IPCImage stride that cannot be represented by the signed graphics API and bind stride, size and row-gap checks together before mapping or copying.
How it was found
- Install the PoC build and runtime dependencies.
- Start an isolated virtual display if no graphical display is available.
- Run the provided runner script, which compiles the transport hook, checks the build, creates a fresh profile, serves the trigger page and launches the browser.
- Observe the runner decode the returned PNG and confirm the recovered row differs from the attacker marker and is nonzero.
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.
Firefox splits itself into a main 'parent' process that holds sensitive data and separate 'content' processes that render web pages, so a hacked page cannot easily reach the main process. Here, a content process that is already compromised can send a crafted image message whose size field is misread, making the parent read memory from the wrong place. That leaks chunks of the parent's memory, which helps an attacker defeat protections like address randomisation.
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.