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

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

A potential heap use-after-free and double-free exists in the browser process when clearing the attached sessions map in DevTools, because destroying a session can synchronously trigger reentrant erasure of sibling entries. An attacker with a trusted DevTools client could crash the browser or possibly achieve memory corruption.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 3 months

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 high-severity heap use-after-free and double-free vulnerability exists in the browser process due to reentrancy in content::TargetHandler::Disable(). Synchronous destruction of target sessions during map clearance can trigger a recursive deletion cascade that modifies the same map mid-operation. This corrupts the underlying libc++ tree structure, leading to memory corruption without MiraclePtr protection.

Affected files:

  • content/browser/devtools/protocol/target_handler.cc
  • content/browser/devtools/protocol/target_handler.h

Estimated timestamp from git blame: 2017-07-20

Summary

There is a potential reentrancy-driven heap use-after-free (UAF) and double-free vulnerability in the browser process within content::TargetHandler::Disable(). When clearing attached_sessions_ (a std::map<std::string, std::unique_ptr<Session>>), the value destructor (~Session()) can run synchronously. Under specific teardown conditions (such as when a renderer process has crashed), this destruction triggers a recursive cascade that synchronously unlinks and deallocates sibling entries from the same map via S_Bi->AgentHostClosed() -> Detach(true).

Because libc++ __tree::clear() is not reentrancy-safe (it performs a recursive post-order traversal and caches the right-hand child node pointer before invoking the value destructor), the reentrant erase() call executes a search starting from the tree root. This results in Use-After-Free reads on already-freed tree node pointers and keys. Furthermore, if a sibling entry resides in the cached right subtree, the inner erase() deallocates it immediately, causing a Use-After-Free dereference, double-destruction of its unique_ptr payload, and a double-free of the node structure when the outer clear() loop subsequently attempts to visit it.

Affected Locations

  • content/browser/devtools/protocol/target_handler.cc (specifically within TargetHandler::Disable(), ~Session(), and Session::Detach()).
  • content/browser/devtools/protocol/target_handler.h

Potential Trigger Mechanism

Note: The following are potential steps to trigger the issue, as our automated tooling does not currently have the capability to execute code or run a working Proof-of-Concept.

  1. Establish a trusted Chrome DevTools Protocol (CDP) client session S1 connected to the root browser session (e.g., via --remote-debugging-pipe).
  2. Attach a child session S_X via Target.attachToTarget with the flatten: true option. This populates T1->attached_sessions_ and instantiates a headless session HDS_X and headless handler HT_X.
  3. Through child session sX, create several hidden targets $B_1 \dots B_n$ via Target.createTarget with hidden: true. This places the hidden target IDs into HT_X->hidden_web_contents_.
  4. Attach all hidden targets $B_1 \dots B_n$ to the root session S1 using Target.attachToTarget(Bi). This stores sibling sessions S_Bi alongside S_X in T1->attached_sessions_.
  5. Crash the renderer processes associated with the hidden targets $B_1 \dots B_n$, so that their respective main frames report IsRenderFrameLive() == false.
  6. Close the root pipe connection S1. This triggers BrowserDevToolsAgentHost::DetachInternal(S1) on the UI thread, invoking T1->Disable() and calling attached_sessions_.clear().
  7. When the outer __tree::clear() deletes node S_X, its destructor synchronously detaches the agent host. Because the renderers are dead, this triggers a synchronous fallback branch in RenderFrameHostImpl::ClosePage that destroys the headless WebContents synchronously.
  8. The WebContents destruction fires frame deletion notifications synchronously, reaching the other attached sessions $S_{Bi}$ on T1 via AgentHostClosed() -> Detach(true).
  9. This triggers handler_->attached_sessions_.erase(id_SBi) reentrantly on T1, corrupting the __tree during the outer clear() operation.

Suggested Fix

To eliminate this reentrancy vulnerability, attached_sessions_ should be swapped to a local map before clearance, or cleared in a reentrancy-safe loop. Swapping the map ensures that any reentrant deletion calls operate on an empty map rather than mutating a container currently undergoing destruction.

C++
Response TargetHandler::Disable() {
  SetAutoAttachInternal(false, false, false, base::DoNothing());
  SetDiscoverTargets(false, {});
  hidden_target_manager_.Clear();
  auto_attached_sessions_.clear();

  // Swap to local map to prevent reentrancy issues during clearance
  std::map<std::string, std::unique_ptr<Session>> attached_sessions;
  attached_sessions.swap(attached_sessions_);
  attached_sessions.clear();
  ...

Evaluated with Chrome root at commit: 3947e01999a53d4e2382e39736cb79d79c7dffcf


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 map's clear operation is not reentrancy-safe: destroying a session synchronously triggers erasure of sibling entries from the same map while it is being cleared.

Impact

An attacker with a trusted DevTools client could crash the browser and potentially achieve memory corruption, though the report notes the trigger is only potential and no working proof-of-concept exists.

What the attacker needed

Trusted DevTools client access; ability to crash renderer processes; remote debugging pipe enabled

The fix

The map should be swapped to a local map before clearing, so reentrant deletions operate on an empty map rather than mutating the container being destroyed.

How it was found

  1. Establish a trusted DevTools client session connected to the root browser session.
  2. Attach a child session with flattening enabled, populating the attached sessions map.
  3. Create several hidden targets through the child session.
  4. Attach all hidden targets to the root session, adding sibling sessions to the map.
  5. Crash the renderer processes for the hidden targets so their frames are no longer live.
  6. Close the root pipe connection, triggering the disable routine and the reentrant map corruption.

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.

This is a memory safety bug in a web browser's developer tools. When the browser tries to clean up a list of debugging connections, one cleanup step can unexpectedly trigger another cleanup step on the same list, causing the browser to use memory it has already freed. This can crash the browser and, in theory, let an attacker run harmful 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.