# Zero to Calc in Six Days: Inside XBOW’s Chrome Full Chain

Three chained Chrome bugs—Maglev mutable HeapNumber reuse, animated-WebP TOCTOU, and Crashpad retry overread—turned a web page into unsandboxed code execution launching calc.exe.

- Payout: $250,000
- Severity: critical
- Program: Google
- Found by: Brendan Dolan-Gavitt
- Disclosed: 2026-10-13
- Write-up quality: 10/10
- Original: https://xbow.com/labs/research/zero-to-calc-in-six-days-inside-xbow-chrome-full-chain
- Library page: https://bugbountylibrary.com/r/blog%3Axbow-com-labs-research-zero-to-calc-in-six-days-inside-xbow-chrome-full-chain
- Tags: area:os domain:browser impact:rce kind:bounty platform:blog sev:critical tech:chromium technique:chained technique:race-window technique:source-review vuln:memory-corruption vuln:race-condition vuln:sandbox-escape

**Target:** Chrome renderer: V8 Maglev, WebCodecs ImageDecoder/WebP, Crashpad handler
**Root cause:** Stage 1: Maglev stored a mutable HeapNumber as a deopt literal, so reconstructed objects shared one mutable box, breaking the immutable-HeapNumber invariant. Stage 2: Blink trusted a transferred ArrayBuffer as exclusive while V8 sandbox permits in-cage mutation, letting cached WebP frame geometry combine with changed bytes. Stage 3: Crashpad's ERROR_PARTIAL_COPY retry assumed a suspended process's page protections were stable, but a BYPASS_PROCESS_FREEZE thread could flip them.
**Steps:**
1. Stage 1: trigger Maglev deopt with nested virtual objects holding a double field; the shared mutable HeapNumber lets Array.prototype.at() bounds reasoning and load offset disagree, yielding in-cage R/W.
2. Use large-object-space reference to recover stable in-cage addresses across GC; forge a Uint8Array to span the 4 GiB cage.
3. Stage 2: remove a live Uint8Array view from its JSArrayBuffer detach chain via in-cage write, then transfer the buffer to ImageDecoder so the view survives detachment.
4. Place two same-length animated WebPs in the backing store: A caches a 48px frame at x=16 on 64x64 canvas; swap bytes to B with full 64px payload; WebPIUpdate writes past SkBitmap by 64 bytes.
5. Production: 2px frame at x=124 on 126px canvas; 504-byte pixel alloc adjacent to 496-byte WebPIDecoder in 512 bucket; overflow rewrites decoder fields to stage WebPDecBuffer records, yielding one chosen 64-bit native write via WebPCopyDecBufferPixels.
6. Use write to change Wasm Code Pointer table base; 13 Liftoff immediates form ~70-byte island-hopping loader that allocates RWX and runs Crashpad payload.
7. Stage 3: renderer payload spawns thread with flags 0x42 (BYPASS_PROCESS_FREEZE|SKIP_THREAD_ATTACH) flipping pages PAGE_NOACCESS/PAGE_READWRITE.
8. Crashpad reads 0xb8 bytes at page offset 0xe98, gets ERROR_PARTIAL_COPY, retries 0x168 bytes into 0xc0 slot, overflowing 0xa8 bytes into adjacent live SnapshotMinidumpMemoryWriter.
9. Overwrite writer vtable/state/delegate vtable to route WriteObject through CopyingOutputStreamAdaptor; controlled 0xd0-byte read constructs fake stream and launcher, flush calls FallbackUnhandledExceptionFilter -> LaunchAndWaitForHandler -> `cmd /k calc.exe`.
10. Derive handler addresses from renderer image base (ASLR shared across processes) and validate build via timestamp/size.
**How found:** Deliberately avoided attacking the V8 sandbox itself; instead reasoned about obligations the sandbox threat model imposes on downstream consumers (concurrent in-cage mutation, pointer swaps) and looked for code that assumed transferred buffers were immutable. For Crashpad, noticed the ERROR_PARTIAL_COPY retry inferred source geometry from a failed read, an assumption broken by THREAD_CREATE_FLAGS_BYPASS_PROCESS_FREEZE.
**Exploitation:** Full chain from a web page in signed Chrome Beta: V8 Maglev bug gives in-cage R/W; animated-WebP TOCTOU converts to one chosen native write; that write retargets the Wasm Code Pointer table to a 13-island JIT-immediate loader; loader runs a renderer payload that races Crashpad's retry read via a freeze-exempt thread, corrupting a live SnapshotMinidumpMemoryWriter to hijack its delegate vtable and invoke FallbackUnhandledExceptionFilter, which CreateProcessW's calc.exe outside the sandbox.
**Escalation:** Chained three independent invariant violations across V8 cage, renderer sandbox, and Crashpad handler; modular stages with backups replaced a colliding Gin-based escape with the WebP stage.
**Insight:** Hunt for code that treats a V8-sandbox 'detached' or 'frozen' state as immutable—transferred ArrayBuffers, suspended-process page protections—since the sandbox explicitly does not enforce those semantics; and check retry/short-read fallbacks that infer buffer geometry from a first failed read.

## Proof of concept (copied exactly from the original report)

**Vulnerable Maglev BuildHeapNumber literal code**

```
void BuildHeapNumber(const VirtualObject* vobject) {
 DCHECK_EQ(vobject->object_type(), vobj::ObjectType::kHeapNumber);
 ValueNode* value_node = vobject->get(offsetof(HeapNumber, value_));
 return BuildHeapNumber(value_node->Cast<Float64Constant>()->value());
}

void BuildHeapNumber(Float64 number) {
 DirectHandle<Object> value =
 local_isolate_->factory()->NewHeapNumberFromBits<AllocationType::kOld>(
 number.get_bits());
 translation_array_builder_->StoreLiteral(GetDeoptLiteral(*value));
}
```

**Vulnerable WebP decoder buffer setup**

```
const gfx::Rect& frame_rect = buffer.OriginalFrameRect();
if (!decoder_) {
 // Set up decoder_buffer_ with output mode
 if (!WebPInitDecBuffer(&decoder_buffer_)) {
 return SetFailed();
 }
 decoder_buffer_.colorspace = RGBOutputMode();
 decoder_buffer_.u.RGBA.stride =
 Size().width() * sizeof(ImageFrame::PixelData);
 decoder_buffer_.u.RGBA.size =
 decoder_buffer_.u.RGBA.stride * frame_rect.height();
 decoder_buffer_.is_external_memory = 1;
 decoder_ = WebPINewDecoder(&decoder_buffer_);
 if (!decoder_) {
 return SetFailed();
 }
}
decoder_buffer_.u.RGBA.rgba = reinterpret_cast<uint8_t*>(
 buffer.GetAddr(frame_rect.x(), frame_rect.y()));
```

