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

Use after free in DevTools (CVE-2026-79266)

A DevTools agent in the renderer kept a bare pointer to a V8 inspector session that could be freed while a nested message loop was running, leaving a dangling pointer. If the session was detached during that pause, the agent could make a virtual call on freed memory when it resumed.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 36 days

Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A potential Use-After-Free (UAF) vulnerability exists in the renderer process within InspectorDOMDebuggerAgent due to the use of a bare pointer to a V8InspectorSession that can be destroyed during a nested message loop. If the debugger session is detached while inside this nested loop, the session is freed, potentially leading to a virtual call on the freed memory upon resuming. This occurs because Blink-domain Chrome DevTools Protocol (CDP) dispatches lack a session-pinning scope.

Affected files:

  • third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc
  • third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.h
  • third_party/blink/renderer/core/inspector/devtools_session.cc
  • third_party/blink/renderer/core/inspector/devtools_session.h

Estimated timestamp from git blame: 2016-04-27

Detailed Description

A potential Use-After-Free (UAF) vulnerability has been identified in InspectorDOMDebuggerAgent. The agent holds a bare (non-raw_ptr) pointer to a v8_inspector::V8InspectorSession object. During the dispatch of certain Blink-domain Chrome DevTools Protocol (CDP) commands, virtual methods are called on this session inside loops that can re-enter page JavaScript via custom object formatters. If the DevTools session is detached while JavaScript execution is paused in a nested message loop, the underlying V8InspectorSession is deleted, leaving the agent with a dangling pointer when execution resumes.

Root Cause

  1. Lack of Pinning Scope on Blink Dispatch Path: When a CDP command is executed, DevToolsSession::DispatchProtocolCommandImpl checks whether the command can be handled by V8. If so, it uses V8's dispatch path which implicitly instantiates a KeepSessionAliveScope (keeping the session's reference count > 0). If it is a Blink-domain command (such as DOMDebugger.getEventListeners), it is dispatched directly via inspector_backend_dispatcher_->Dispatch(dispatchable) without any pinning scope on the stack.

  2. Bare Pointer Usage: InspectorDOMDebuggerAgent stores v8_session_ as a bare raw pointer:

    C++
    // third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.h
    v8_inspector::V8InspectorSession* v8_session_;
    

    Unlike other agents (e.g., InspectorDOMAgent), InspectorDOMDebuggerAgent does not override Dispose() to nullify v8_session_ upon detachment.

  3. Nested Pause and Teardown: In InspectorDOMDebuggerAgent::BuildObjectForEventListener, v8_session_->wrapObject is called on the event listener's handler function. If custom formatters are enabled, this triggers V8's generateCustomPreview which runs user-supplied formatter JavaScript. If a debugger; statement is encountered during formatting, the debugger pauses and enters a nested message loop (base::RunLoop(kNestableTasksAllowed).Run()).

    While paused in this nested loop, a detach request (such as closing DevTools or calling chrome.debugger.detach()) will trigger DevToolsSession::Detach(). This resets the strong std::shared_ptr<v8_inspector::V8InspectorSession> reference to 0, freeing the object. When the pause loop terminates and the stack unwinds, InspectorDOMDebuggerAgent attempts to execute the next statement:

    C++
    value->setOriginalHandler(v8_session_->wrapObject(context, info.handler, object_group_id, false));
    

    This results in a virtual method call on the freed v8_session_ pointer.

Suggested Potential Steps to Reproduce

Note: These steps are suggested/potential based on static code analysis; our automated tooling does not have the capability to execute code.

  1. Load a target page containing multiple event listeners registered on document.body.

  2. Configure a custom object formatter on the page's global scope:

    JavaScript
    window.devtoolsFormatters = [{ 
      header() { 
        debugger; 
        return null; 
      } 
    }];
    
  3. Attach a chrome.debugger extension to the page and enable custom formatters via Runtime.setCustomObjectFormatterEnabled(true).

  4. Request the event listeners for document.body using the DOMDebugger.getEventListeners command, passing a non-empty objectGroup ID.

  5. Once V8 hits the programmatic breakpoint inside the custom formatter, it enters a nested message loop on pause.

  6. Have the extension call chrome.debugger.detach() to disconnect the session.

  7. Resume/quit the pause loop. The agent resumes execution in BuildObjectForEventListener and attempts to perform a virtual call to v8_session_->wrapObject using the freed pointer.

Suggested Fix

To prevent this issue, InspectorDOMDebuggerAgent should align with the design pattern of other agents (such as InspectorDOMAgent and InspectorPageAgent) by implementing a Dispose() override to clear the v8_session_ pointer upon session teardown, and adding null-checks before referencing it:

  1. In InspectorDOMDebuggerAgent:

    C++
    void InspectorDOMDebuggerAgent::Dispose() override {
      v8_session_ = nullptr;
      InspectorBaseAgent::Dispose();
    }
    
  2. Add checks to verify that v8_session_ is non-null before invoking any methods on it within getEventListeners and BuildObjectForEventListener.

Evaluated with Chrome root at commit: bf775e5d75cb9e1767e2cd02cc93efa0077d14a5


Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:

  • If you are familiar with the severity guidelines, you may adjust the severity.
  • If this is a false positive, and there's no work to be done, please close as WAI.
  • If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.

Data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.

The original report as published on the Chromium issue tracker. 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

Root cause

Likely the Blink-domain CDP dispatch path lacked a session-pinning scope, and the agent stored the V8 inspector session as a bare pointer without clearing it on detach.

Impact

A virtual call on freed memory could crash the renderer and, in principle, may be exploitable, though the text only describes a potential issue found by static analysis and does not demonstrate code execution.

What the attacker needed

A debugger extension attached; custom object formatters enabled; page runs attacker-influenced formatter code

The fix

The agent should override Dispose() to clear the session pointer on teardown and check it for null before use, matching other agents.

How it was found

  1. Load a page with several event listeners on the document body.
  2. Set a custom object formatter on the page that hits a debugger statement.
  3. Attach a debugger extension and enable custom object formatters.
  4. Request the body's event listeners with a non-empty object group.
  5. When the breakpoint pauses execution, detach the debugger session.
  6. Resume the pause so the agent uses the freed session pointer.

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.

When a program frees a piece of memory but keeps a reference to it, that reference is called a dangling pointer. If the program later uses it, it may read or call whatever now occupies that memory, which can crash the browser or, in the worst case, let an attacker run their own code. Here the browser's developer tools code kept such a reference while it paused to run page-supplied formatting code.

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 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.