Firefox SpiderMonkey Generator For-in Iterator Use-After-Free (CVE-2026-2763)
Published: 2026-11-27 • Researcher: ppwwiinn (GitHub; upstream commit author "pwn")
- Severity
- Critical
- CVE
- CVE-2026-2763 / MFSA 2026-13, 2026-14, 2026-15, 2026-16
- Category
- binary
- Affected product
- Mozilla Firefox and Thunderbird, SpiderMonkey JavaScript engine (for-in iteration and generators)
- Affected versions
- Firefox before 148; Firefox ESR before 115.33 and ESR 128.x before 140.8; Thunderbird before 148 and Thunderbird 140.x before 140.8 (NVD CPE ranges)
- Disclosed
- 2026-11-27
- Patch status
- Patched
Tags
References
- https://nvd.nist.gov/vuln/detail/CVE-2026-2763
- https://www.mozilla.org/security/advisories/mfsa2026-13/
- https://www.mozilla.org/security/advisories/mfsa2026-15/
- https://bugzilla.mozilla.org/show_bug.cgi?id=2012018
- https://github.com/ppwwiinn/CVE-2026-2763-POC
- https://cvereports.com/reports/CVE-2026-2763
- https://access.redhat.com/security/cve/CVE-2026-2763
Archive entry
intelseclab/poc-archiveOn this page
Metadata
| Field | Value |
|---|---|
| Date Added | 2026-11-27 |
| Last Updated | 2026-03-05 |
| Author / Researcher | ppwwiinn (GitHub; upstream commit author “pwn”) |
| CVE / Advisory | CVE-2026-2763 / MFSA 2026-13, 2026-14, 2026-15, 2026-16 |
| Category | binary |
| Severity | Critical |
| CVSS Score | 9.8 (CVSSv3.1, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, NVD) |
| Status | PoC (research-grade exploit harness; successful OOB access not independently verified) |
| Tags | firefox, thunderbird, spidermonkey, javascript-engine, use-after-free, for-in, generator, proxy, garbage-collection, CWE-416, browser, out-of-bounds |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Mozilla Firefox and Thunderbird, SpiderMonkey JavaScript engine (for-in iteration and generators) |
| Versions Affected | Firefox before 148; Firefox ESR before 115.33 and ESR 128.x before 140.8; Thunderbird before 148 and Thunderbird 140.x before 140.8 (NVD CPE ranges) |
| Language / Platform | JavaScript; SpiderMonkey in Firefox/Thunderbird on Windows, Linux and macOS; browser or JavaScript shell |
| Authentication Required | No |
| Network Access Required | Yes (victim loads an attacker-supplied web page); a local JavaScript shell also works |
Summary
SpiderMonkey mishandles the lifetime of the iterator object created for a for-in loop when the loop is suspended by yield inside a generator. The iterator is registered in a compartment-wide list but is kept alive only by the interpreter stack, so garbage collection during the suspended generator can free it while the engine still considers it active. A later delete operation walks the stale list entry, producing a use-after-free that the public PoC turns into a constrained one-bit write and then an out-of-bounds JavaScript array primitive. An attacker who can run JavaScript in a vulnerable browser can therefore corrupt memory in the content process, with remote code execution possible after further exploitation.
Vulnerability Details
Root Cause
The engine creates a PropertyIteratorObject / NativeIterator pair when a for-in loop begins. In JSOP::Iter, ValueToIterator() allocates the iterator and RegisterEnumerator() links the NativeIterator into the compartment-wide enumerators list. The interpreter keeps the only strong reference to the iterator on its own stack.
When yield suspends a generator inside the for-in body, the loop has not reached JSOP::EndIter, so CloseIterator() has not run and the iterator remains linked in the compartment list. If the suspended generator itself becomes unreachable and garbage collection runs, the PropertyIteratorObject is collected and its finalizer frees the associated NativeIterator, but the stale list link is never removed.
A subsequent delete on the object calls SuppressDeletedPropertyHelper(), which walks the compartment enumerators list and passes the freed NativeIterator to SuppressDeletedProperty(). That function reads the freed property cursor and performs cursor->markDeleted(), an OR of a single bit at an address derived from the stale iterator, giving the attacker a constrained one-bit write at an 8-byte-aligned address.
The upstream analysis observes that NativeIterator comes from the malloc arena, so ordinary GC-object spraying is unsuitable for adjacency. It instead grooms with ImmutableScriptData, which also lives in the malloc arena and stores JavaScript bytecode. Flipping a bit in the four-byte index operand of an InitElemArray bytecode causes setDenseInitializedLength() to exceed the array’s real capacity, which yields the out-of-bounds array primitive used by the PoC.
The precise heap layout described above is the upstream author’s analysis and has not been independently reproduced during archival.
Attack Vector
Remote, unauthenticated, via JavaScript executed in a web page. The script builds an object with many properties, wraps it in a Proxy whose getPrototypeOf trap triggers garbage collection while a generator is suspended in a for-in loop, then deletes one property to invoke the stale-iterator walk. The same trigger can be exercised locally in the JavaScript shell. No user interaction beyond loading the page is required.
Impact
- Use-after-free of a
NativeIteratorand a one-bit write primitive in the content process. - Corruption of a bytecode immediate leading to an array with an initialized length beyond its capacity, i.e. out-of-bounds read/write.
- Potential remote code execution inside the Firefox content sandbox; a separate sandbox escape is required for full host compromise.
- At minimum, a renderer crash and denial of service; repeated loads can keep the browser unstable.
Environment / Lab Setup
OS: Ubuntu 24.04 LTS or Windows 11, disposable VM with snapshots
Target: Firefox 147 or Firefox ESR 140.7 (both predate the 148 / 140.8 fixes);
Thunderbird 147 / 140.7; or a pre-fix mozilla-central jsshell build
Attacker: Static HTTP server serving poc.html and poc.js
Tools: Firefox DevTools console, optional ASan jsshell build, gdbSetup Steps
| |
The archive did not execute this PoC; no vulnerable browser build was used during review.
Proof of Concept
Step-by-Step Reproduction
- Prepare the lab — Boot a disposable VM image with a vulnerable Firefox, Thunderbird or jsshell. Ensure crash reporting or a debugger is available.
- Serve the files — Start the static server from this folder and open
poc.htmlin the vulnerable browser, or runpoc.jsunder the JavaScript shell. - Trigger the lifetime bug — The page/script evaluates 64 candidate functions, builds a Proxy target with about 31 properties, and starts a generator that iterates it with for-in and yields. The Proxy
getPrototypeOftrap calls the script’s garbage collector on its second invocation, while the generator is suspended. - Trigger the stale-list walk — The script deletes property
A11, forcingSuppressDeletedPropertyHelperto traverse the freed iterator. - Observe the primitive — The script calls each candidate and looks for the one whose array-literal check succeeds, then prints the resulting array length and out-of-bounds elements. A vulnerable build may crash instead of printing.
- Clean up — Discard the VM snapshot; do not reuse the profile.
Exploit Code
Full trigger:
poc.js(three upstream files archived, see Notes).
| |
The full file also contains the 64 array-literal candidates, the ArrayBuffer pressure loop used as gc(), and the out-of-bounds printing loop.
Expected Output
evil_func = <candidate index>
<array length greater than 8>
<out-of-bounds element values ...>This output is illustrative; no live capture was produced during archival. On a patched build, no candidate reports success: evil_func stays undefined and the following call typically raises a TypeError, or the array length remains normal.
Detection & Indicators of Compromise
AddressSanitizer: heap-use-after-free ... js::SuppressDeletedProperty
AddressSanitizer: heap-use-after-free ... js::CloseIterator
SIGSEGV in js::NativeIterator::markDeleted / SuppressDeletedPropertyHelper
MOZ_CRASH / compartment or GC assertions in the JavaScript engine
for-in loop inside a generator that yields
Proxy getPrototypeOf trap that allocates large ArrayBuffers or forces GC
delete of a property while the same object is being enumeratedThere is no distinctive network indicator: delivery is an ordinary web page or script. Detection depends on crash telemetry, endpoint JavaScript scanning, and browser exploit-protection alerts.
SIEM / IDS note: browser crash reports containing SuppressDeletedProperty, CloseIterator or NativeIterator use-after-free frames from the same host in a short window are a strong signal of attempted exploitation.
Remediation
| Action | Detail |
|---|---|
| Patch | Update Firefox to 148+, Firefox ESR to 115.33+ or 140.8+, and Thunderbird to 148+ or 140.8+. |
| Workaround | Disable JIT compilation (javascript.options.ion, javascript.options.baseline, and where applicable Wasm) as defense in depth; this reduces exploitability but does not fix the iterator lifetime bug. |
| Config Hardening | Keep the content sandbox enabled, apply site isolation, block untrusted JavaScript, and monitor browser crash telemetry. |
| Detection | Hunt for the crash signatures above and for the generator/for-in/Proxy/delete pattern in untrusted content. |
References
Notes
Verdict: ingested as a genuine, non-malicious research PoC. The repository contains a working-style JavaScript trigger plus a detailed root-cause analysis, with no network code, persistence, credential theft, miner or other malware modules.
CVE mapping: the upstream README does not print the CVE identifier. The mapping is supported by NVD CVE-2026-2763 (SpiderMonkey use-after-free, CWE-416, fixed in Firefox 148 / ESR 115.33 / ESR 140.8 and Thunderbird 148 / 140.8), MFSA 2026-13 through 2026-16, restricted Bugzilla bug 2012018, and a public report that specifically describes a SpiderMonkey generator for-in iterator use-after-free with a write primitive.
License: the repository has no LICENSE file, so the upstream code is formally unlicensed. It is archived here with attribution for defensive research only; do not redistribute commercially.
Limitations: static review only, not executed. The exploit is research-grade and depends on precise garbage-collection timing, malloc-arena grooming and heap layout; the upstream README does not include a captured successful run, a full arbitrary read/write stage, a RCE/Wasm payload, or a sandbox escape. The OOB primitive may therefore be unreliable or incomplete, and a vulnerable browser can crash before any output. The 64-candidate array-literal detection loop is heuristic and may not fire on every build.
Omitted from upstream: only the .git directory (not copied by policy). There are no binaries, archives, lockfiles, credentials or media files in this repository; all three upstream files are included. A short authorized-research disclaimer header was prepended to poc.js; the code itself is unchanged.
| |