Skip to content
Memory corruption Advisory Advanced CVE-2026-17836

Use after free in V8 (CVE-2026-17836)

A use-after-free in V8's inspector addBindings loop occurs because a raw InspectedContext pointer is held across a JavaScript-reentrant call that can destroy the context. An attacker could trigger this from inspected web content or a debugger-permission extension, leading to out-of-sandbox read and write primitives.

yupyon.itome Follow

Originally disclosed on Chrome VRP

  • Fix shipped in 2 months

Steps to reproduce the problem

Attached: poc-uaf.js, poc-sandbox-read.js

  1. Build inspector-test (HEAD 6ac60d22f45, V8 15.0.0).

    gn gen out/asan --args='is_debug=false symbol_level=2
    v8_enable_sandbox=true is_asan=true' gn gen out/sandbox --args='is_debug=false symbol_level=2
    v8_enable_sandbox=true is_asan=false' autoninja -C out/asan inspector-test autoninja -C out/sandbox inspector-test

  2. Run UAF PoC under ASan.

    ASAN_OPTIONS='abort_on_error=0:halt_on_error=1:detect_leaks=0'
    ./out/asan/inspector-test
    test/inspector/protocol-test.js
    poc-uaf.js

    Output:

    PoC H-2026-2981: addBindings loop UAF after iter-0 destroys context. Step 1: enable Runtime agent. Step 2: persist two global bindings ("a","b"). Step 3: delete own bindings; install Object.prototype.a setter that destroys the inspected context. Step 4: reconnect to drive restore() -> addBindings(ctx).

    ==148588==ERROR: AddressSanitizer: heap-use-after-free on address 0x74957f5f4f50 at pc 0x5f6fac5bed1b READ of size 4 at 0x74957f5f4f50 thread T7 (Task Runner) #0 v8_inspector::V8RuntimeAgentImpl::addBinding(...) src/inspector/inspected-context.h:49:34 #1 v8_inspector::V8RuntimeAgentImpl::addBindings(...) src/inspector/v8-runtime-agent-impl.cc:1081:7 #2 v8_inspector::V8InspectorImpl::forEachContext(...) #3 v8_inspector::V8RuntimeAgentImpl::restore() src/inspector/v8-runtime-agent-impl.cc:1116:16 #4 v8_inspector::V8InspectorSessionImpl::V8InspectorSessionImpl(...) src/inspector/v8-inspector-session-impl.cc:153:21 ...

    0x74957f5f4f50 is located 16 bytes inside of 232-byte region [0x74957f5f4f40,0x74957f5f5028) freed by thread T7 (Task Runner) here: #0 operator delete(void*, unsigned long) #1 v8_inspector::V8InspectorImpl::contextCollected(int, int) third_party/libc++/.../shared_count.h:65:7 #2 v8::internal::InspectorIsolateData::FireContextDestroyed(...) test/inspector/isolate-data.cc:438:15 ... (setter callback) #15 v8_inspector::V8RuntimeAgentImpl::addBinding(...) src/inspector/v8-runtime-agent-impl.cc:996:39 <- iter-0 Set #16 v8_inspector::V8RuntimeAgentImpl::addBindings(...) src/inspector/v8-runtime-agent-impl.cc:1081:7

    previously allocated by thread T7 (Task Runner) here: #0 operator new(unsigned long) #1 v8_inspector::V8InspectorImpl::contextCreated(...) src/inspector/v8-inspector-impl.cc:288:19

    SUMMARY: AddressSanitizer: heap-use-after-free src/inspector/inspected-context.h:49:34 in v8_inspector::V8RuntimeAgentImpl::addBinding(...) ==148588==ABORTING

  3. Run out-of-sandbox-read PoC under V8 sandbox crash filter.

    The same trigger plus a freelist spray inside the setter callback substitutes attacker bytes into the freed slot at offset 8 (v8::Globalv8::Context::slot_). Iteration N+1's context() dereference at line 988 follows the substituted pointer.

    ./out/sandbox/inspector-test --sandbox-testing
    test/inspector/protocol-test.js
    poc-sandbox-read.js

    Output:

    Sandbox testing mode is enabled. Only sandbox violations will be reported, all other crashes will be ignored. Sandbox bounds: [0x85300000000,0x95300000000) PoC H-2026-2981 byte-controlled spray. Step 1: enable Runtime agent. Step 2: persist two distinct global bindings ("a","b"). Step 3: install setter that frees + sprays. Step 4: reconnect to drive restore() -> addBindings(ctx).

    V8 sandbox violation detected!

    The sandbox violation was a read access which is technically not a sandbox violation. This requires manual investigation. UndefinedBehaviorSanitizer:DEADLYSIGNAL ==148664==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x00077d2e40a0 (pc 0x5c482db56605 ...) ==148664==The signal is caused by a READ memory access. #0 v8_inspector::InspectedContext::context() const src/inspector/inspected-context.cc:117 #1 v8_inspector::V8RuntimeAgentImpl::addBinding(...) src/inspector/v8-runtime-agent-impl.cc:988:50 #2 v8_inspector::V8RuntimeAgentImpl::addBindings(...) src/inspector/v8-runtime-agent-impl.cc:1081:7 #3 v8_inspector::V8InspectorImpl::forEachContext(...) #4 v8_inspector::V8RuntimeAgentImpl::restore() src/inspector/v8-runtime-agent-impl.cc:1116:16 #5 v8_inspector::V8InspectorSessionImpl::V8InspectorSessionImpl(...) src/inspector/v8-inspector-session-impl.cc:153:21 ...

    The read address (0x00077d2e40a0) lies outside the V8 sandbox cage (0x85300000000 - 0x95300000000), confirming that the UAF yields a read primitive crossing the V8 sandbox boundary.

Per src/inspector/SEC

Problem Description

Variant of bug 507508114 (commit 5a7de4a07b0). The prior fix protected the leaf function addBinding but left the outer-loop caller addBindings unprotected. addBindings holds a raw InspectedContext* across multiple addBinding calls; iteration N's global->Set() is JS-reentrant via Object.prototype setters, and a setter that destroys the inspected context drops the sole shared_ptr to InspectedContext. Iteration N+1 dereferences the freed pointer at its first statement.

Vulnerable loop (src/inspector/v8-runtime-agent-impl.cc:1073-1096):

void V8RuntimeAgentImpl::addBindings(InspectedContext* context) { ... for (size_t i = 0; i < globalBindings->size(); ++i) { addBinding(context, globalBindings->at(i).first); // 1081 } for (size_t i = 0; i < bindings->size(); ++i) { addBinding(context, bindings->at(i).first); // 1092 } }

Each addBinding(context, name):

  1. int contextId = context->contextId(); // 982 DEREF
  2. v8::Localv8::Context ctx = context->context(); // 988 DEREF
  3. global->Set(ctx, v8Name, fn); // 996 JS-REENTRANT
  4. if (m_inspector->getContext(...) != context) // 1001 5a7de4a07b0 guard return; (protects iter-N write, not iter-N+1 entry)
  5. m_activeBindings[name].insert(contextId);

The freed object InspectedContext is allocated via new InspectedContext(...) at src/inspector/v8-inspector-impl.cc:288 on the libc C++ heap, outside the V8 sandbox. The UAF therefore yields a primitive that crosses the V8 sandbox boundary unconditionally, with no prior memory primitive assumed.

Observed primitive 1 (ASan oracle): 4-byte read of m_contextId at offset 16 of the freed slot.

Observed primitive 2 (out-of-sandbox read): standard libc-heap freelist spray during the synchronous setter callback substitutes attacker bytes into the freed slot at offset 8 (v8::Globalv8::Context::slot_). Iteration N+1's context->context() at line 988 loads the substituted pointer and dereferences it, reaching memory outside the V8 sandbox cage. Confirmed under --sandbox-testing: V8's sandbox crash filter reports "sandbox violation detected" with a SEGV READ at an address outside the cage bounds.

Composable write: the subsequent global->Set(ctx, v8Name, fn) at line 996 writes a JSFunction handle to the target reached through context()->Global(), yielding an out-of-sandbox write on the same trigger.

Attacker model: web-content. Reachable from any page being inspected by DevTools (SECURITY.md: high severity, "minimal user interaction"), or from a Chrome extension with the "debugger" permission. Triggers automatically on session reattach once persisted globalBindings is populated: Runtime.addBinding survives across sessions in m_state, so two addBinding commands plus a setter on Object.prototype plus a session reattach are sufficient.

In Chromium production, the test-only inspector.fireContextDestroyed() in the PoC is replaced by any setter body that synchronously triggers V8InspectorClient::contextDestroyed on the current LocalFrame (e.g. detaching the frame).

Fix: re-validate context between iterations of the addBindings loops via m_inspector->getContext(groupId, contextId), mirroring the 5a7de4a07b0 shape one frame up. Capture contextId before the loop; do not carry the raw InspectedContext* across the JS-reentrant call.

Source references (HEAD 6ac60d22f45, V8 15.0.0):

src/inspector/v8-runtime-agent-impl.cc:1073-1096 vulnerable loop src/inspector/v8-runtime-agent-impl.cc:982 UAF read 1 (contextId) src/inspector/v8-runtime-agent-impl.cc:988 UAF read 2 (context, OOS) src/inspector/v8-runtime-agent-impl.cc:996 JS-reentrant Set (OOS write) src/inspector/v8-runtime-agent-impl.cc:1001 5a7de4a07b0 guard src/inspector/v8-runtime-agent-impl.cc:1116 restore() caller src/inspector/v8-inspector-impl.cc:288 alloc (libc heap, OOS) src/inspector/v8-inspector-impl.cc:460 free (discardInspectedContext)

Summary

Heap-UAF in V8RuntimeAgentImpl::addBindings: raw InspectedContext* deref after JS-reentrant free

Custom Questions

Type of crash:

TAB

Additional Data

Category: Security
Chrome Channel: Not sure
Regression: No \

The original report as published on the Chromium issue tracker, by yupyon.itome. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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

Impact

The use-after-free yields a read primitive crossing the V8 sandbox boundary and a composable out-of-sandbox write, reachable from inspected web content or a debugger-permission extension.

What the attacker needed

Page being inspected by DevTools; or extension with debugger permission; two addBinding commands; setter on Object.prototype

The fix

The addBindings loops should re-validate the context between iterations using m_inspector->getContext(groupId, contextId) and avoid carrying the raw InspectedContext pointer across the JS-reentrant call.

How it was found

  1. Build inspector-test with ASan and sandbox configurations.
  2. Run the UAF PoC under ASan to observe the heap-use-after-free.
  3. Run the out-of-sandbox-read PoC under the V8 sandbox crash filter to observe a read outside the sandbox cage.

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.

A use-after-free happens when a program keeps using a piece of memory after it has been freed. Here, the inspector code frees an object during a JavaScript callback but then reads it again on the next loop iteration. This can let an attacker read or write memory outside the V8 sandbox.

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.

More by yupyon.itome

View all

1 more disclosed report, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.