Compromised content can instantiate a second socket service and corrupt the Firefox parent
A compromised content process can send serialized object bytes in an actor message that the browser parent deserialises with ReadObject(true), which constructs an attacker-chosen class before checking the expected interface. Choosing the socket transport service starts a second socket thread, corrupting parent networking state and leading to crashes and memory corruption in the parent process.
Originally disclosed on Mozilla
- Fixed in 22 days
- Paid in 2 months
- Disclosed after 22 days
Created attachment 9618598 root_cause.md
Summary
A compromised web-content process can place serialized object bytes in a
Content:Click actor message. The browser parent passes those bytes to
nsIObjectInputStream::ReadObject(true).
ReadObject() constructs the attacker-selected CID before checking whether
the result implements the expected serialized interface. Selecting
nsSocketTransportService therefore runs its constructor and registered
Init() method even though its later nsISerializable query fails.
The second service overwrites the process-global socket-service and
socket-thread pointers and starts a second native Socket Thread. Existing
HTTP work remains associated with the original thread while new transports
can capture the replacement service. Both threads then mutate networking
objects whose code assumes single-thread confinement.
Current official Nightly reproduces the second parent socket thread and a native parent failure. Local Nightly ASan runs independently report parent double-free, heap-use-after-free, and heap-buffer-overflow.
A separate SHA-pinned, instrumented PGO/full-LTO experiment joins one concrete
table UAF to an exact content-controlled replacement and executes a fixed
content-supplied UD2 instruction from the parent heap in two runs.
Threat model
- The attacker already has arbitrary code execution in a normal sandboxed content process and can send actor/IPC messages with chosen parameters.
- No target-user preference, extension, permission, hardware, prompt, or later user interaction is required. Reproduction uses the normal browser-chrome harness to model raw actor messaging after renderer compromise.
- The test models a compromised renderer. It is not reachable from ordinary webpage JavaScript and is not claimed as a visit-only drive-by.
Tested configurations
Official optimized Nightly
Firefox: 155.0a1
Build ID: 20260729095131
Source stamp: aea36f7c13cee7e70f5b27c073c11088c6e1725e
libxul SHA-256: 958be0508bd0625040629686a6657c895a0fc026c2466424c6758c0debd89236
Platform: Linux x86-64
Runtime: e10s=true, fission=true, has_sandbox=true
Preferences changed by PoC: none
Two fresh profiles each recorded one parent Socket Thread before the forged
factory and two distinct native thread IDs afterward. The original thread
then terminated the main process:
- run 1: shipping
MOZ_CRASH(OOM)null write with allocator-poison-shaped register values; - run 2:
MOZ_DIAGNOSTIC_ASSERT(OnSocketThread()), symbolized throughnsHttpTransaction::MaybeCancelFallbackTimer().
A final fresh run through the supplied run_root.sh nightly entry point used
the same current official image. It confirmed four live pre-trigger sockets,
the expected post-factory deserialization failure, and then a parent
Socket Thread MOZ_CRASH(OOM) null write. Its complete-log SHA-256 is
97eee63738cd6810d26a18a83c803d2856f2b6bfba882d516ed8c2be555489a4.
These official runs prove production reachability and parent failure. They do not prove controlled instruction execution.
Local Nightly ASan
Firefox: 155.0a1
Build ID: 20260728203812
Build: optimized ASan, non-debug, default ASan memory configuration
Runtime: e10s=true, fission=true, has_sandbox=true
Preferences changed by PoC: none
Independent runs report:
ConnectionAttemptPool::mAttempts: double-free;mConnectionEstablisherTable: heap-use-after-free;- pending-transaction arrays: heap-use-after-free and double-free; and
ConnectionAttemptPool::mAttempts: heap-buffer-overflow read.
These are different consequences of the same duplicate-service/thread root, not separate vulnerability claims.
Instrumented optimized impact experiment
Baseline revision: 0e9cfbb4fca901314b1b18f871ae23d5adb16c0f
libxul SHA-256: c6a001f2ffc74b6b1d7efc8a30ce98f611d3400b1dc50b47795e356454d1b7cf
GNU Build ID: b1a11f524a1a41f73fa4242f1ae8a5ab
Build: -O3, PGO, full cross-language LTO, non-debug, ASan disabled
Runtime: e10s=true, fission=true, has_sandbox=true
Two independent runs record:
- a real capacity-eight parent
PLDHashTablewith one live index-seven entry; - free of its 160-byte store on the competing socket thread;
- WebTransport allocation ordinal one reusing the exact address for an eight-byte array header and 152 content-supplied bytes;
- dispatch through the compiled copy of baseline
iter.Data()->IsUDP()at RVA0x508ab6a; - successful
mprotect(page, 0x2000, 6); and - a context-trusted parent
Socket Threadframe at the supplied heapUD2.
The retained runs used different parent and heap ASLR addresses. Their crash contexts both satisfy:
RIP = P+0x24
R12 = RBP = P
RSP = P+0x74
RSI = 0x2000
RDX = 6
RAX = 0
Reproduction
Detailed commands are in poc.md.
For the root alone, apply poc.patch, build normally or with ASan, and run:
FIREFOX_SOURCE_DIR=/path/to/firefox \
FIREFOX_OBJDIR=/path/to/firefox/objdir \
./run_root.sh source
To launch the same root testcase through an official Nightly binary while using build-tree test utilities:
FIREFOX_SOURCE_DIR=/path/to/firefox \
FIREFOX_OBJDIR=/path/to/firefox/objdir \
FIREFOX_NIGHTLY_BINARY=/path/to/nightly/firefox \
./run_root.sh nightly
For the exact instrumented execution experiment, build with the supplied PGO/full-LTO inputs and run:
FIREFOX_SOURCE_DIR=/path/to/firefox \
FIREFOX_OBJDIR=/path/to/firefox/obj-sts-real-loop-clean \
STS_PGO_INPUT_DIR=/path/to/sts-pgo-inputs \
./run_exec.sh heap-exec
The positive execution mode intentionally terminates with SIGILL; a nonzero
harness exit is expected. run_exec.sh zero-final and
run_exec.sh bad-jmp exercise the two stage-specific controls.
Impact
The production bug gives a compromised content process a reliable way to violate the parent networking thread-ownership invariant and reach confirmed parent memory corruption.
The instrumented result demonstrates that one concrete stale-table geometry can be replaced with content bytes and can transfer native execution into the parent heap. It is evidence supporting a parent-process execution capability, not merely a crash or parent memory read.
Important boundary
The end-to-end execution result is not from an untouched official Nightly. The SHA-pinned image contains test-only IPC wrappers, deterministic barriers, allocator observation, fixed-payload validation, and an instrumented copy of the baseline virtual-call expression. Those changes can affect timing, heap placement, and register allocation.
The safety validator accepts only the fixed UD2 body. No unrestricted
payload, persistence action, or stock-Nightly RCE is claimed. Effective
NoNewPrivs/seccomp state was measured in separate exact-binary
browser-chrome captures, not in the two positive content PIDs themselves.
Supplied files
root_cause.md: exact source-line trace and execution boundary.poc.md: step-by-step root and impact reproduction.poc.patch: one consolidated patch containing the root testcase, instrumented impact testcase, and required test hooks.run_root.sh: source-build or official-Nightly root runner.run_exec.sh: exact-image impact runner and controls.mozconfigandpgo-inputs.tar.xz: exact impact-build inputs.validation.log: concise results, decisive evidence, hashes, and limits.
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 deserialiser constructs the attacker-selected class before verifying it implements the expected serialised interface, so a constructor and its Init() run as a side effect even though the interface check later fails.
Impact
A compromised content process can reliably break the parent's networking thread-ownership invariant and cause confirmed parent memory corruption; the instrumented build shows one concrete case where content bytes redirect native execution into the parent heap, though this is not claimed as stock-Nightly remote code execution.
What the attacker needed
Code execution in a sandboxed content process; ability to send actor/IPC messages
How it was found
- Apply the supplied patch and build Firefox normally or with ASan.
- Run the root runner against the source build.
- Alternatively run the same testcase through an official Nightly binary using build-tree test utilities.
- Observe a second native socket thread appear in the parent after the forged factory message.
- Observe the original socket thread terminate the main process with a crash.
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 its work into a sandboxed part that renders web pages and a more powerful parent part that manages the browser. If an attacker can already run code inside the sandboxed part, they can send a crafted message that makes the parent create a second copy of a networking service it should only ever have one of. Two copies fighting over the same data causes crashes and memory corruption in the parent, which is the more trusted side.
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.