Use after free in MimeHandlerView (CVE-2026-10956)
A use-after-free flaw in PostMessageSupport::SetActive allows a malicious getter to destroy the object during message flushing, leading to a dangling pointer. An attacker could exploit this to achieve an arbitrary write primitive via heap spraying.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 39 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 without the Chrome Security team. 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 vulnerability exists in the renderer process within PostMessageSupport::SetActive. Synchronous JavaScript execution during the flushing of pending messages can lead to the destruction of the PostMessageSupport instance while its member vector is still being iterated.
Affected files:
extensions/renderer/guest_view/mime_handler_view/post_message_support.ccextensions/renderer/guest_view/mime_handler_view/mime_handler_view_frame_container.ccextensions/renderer/guest_view/mime_handler_view/mime_handler_view_container_manager.cc
Estimated timestamp from git blame: 2025-09-19
Summary
A potential Use-After-Free (UAF) vulnerability exists in extensions/renderer/guest_view/mime_handler_view/post_message_support.cc. The function PostMessageSupport::SetActive() flushes a queue of pending messages by iterating over the pending_messages_ vector and calling PostJavaScriptMessage() for each entry. Because PostJavaScriptMessage() eventually calls the target window's postMessage which triggers synchronous JavaScript execution (via structured cloning of the message payload), a malicious getter can detach the underlying frame.
This detachment causes the MimeHandlerViewFrameContainer (the delegate) to synchronously delete the PostMessageSupport instance. Upon return from the JavaScript execution, SetActive() continues to iterate over the now-freed memory and uses a dangling this pointer.
Exploitation Path
- The attacker embeds a
MimeHandlerView-handled type (like a PDF) using a plugin element (e.g.,<embed>) and queues multiple messages viaplugin.postMessage()before the guest has finished loading. - The payloads contain malicious getters.
- When the guest loads, the browser sends a
DidLoadIPC, triggeringSetActive(). SetActive()iterates over the queued messages and callsPostJavaScriptMessage(). This calls the guest window'spostMessage, which invokes V8's structured clone algorithm, executing the attacker's first getter synchronously.- The getter calls
plugin.remove()to detach the frame, and makes a re-entrantpostMessagecall. - The re-entrant
postMessagecall eventually invokesMimeHandlerViewFrameContainer::AreFramesAlive(), which detects the frame detachment and callscontainer_manager_->RemoveFrameContainer(this). This synchronously destroys the delegate and thePostMessageSupportobject. - The first getter completes, and the second getter is invoked. The second getter executes a heap spray to reclaim the memory previously occupied by the
PostMessageSupportobject and itsstd::vectorbacking store. - When the JavaScript execution finishes,
SetActive()resumes iteration. The stack iterators point to the reclaimed backing store, and the implicitthispointer points to the reclaimedPostMessageSupportobject. - If the attacker sprays the
is_active_flag asfalse, the subsequent call toPostJavaScriptMessage()will executepending_messages_.push_back(...). Operating on attacker-controlledstd::vectorinternal pointers, this yields a reliable arbitrary write primitive.
Suggested Fix
PostMessageSupport::SetActive() should be protected against re-entrancy and synchronous deletion. One approach is to use a base::WeakPtr to check if the object has been destroyed during iteration, or move the pending_messages_ into a local variable before iterating:
void PostMessageSupport::SetActive() {
// ...
std::vector<v8::Global<v8::Value>> messages_to_send = std::move(pending_messages_);
base::WeakPtr<PostMessageSupport> weak_this = weak_factory_.GetWeakPtr();
for (const auto& pending_message : messages_to_send) {
PostJavaScriptMessage(isolate,
v8::Local<v8::Value>::New(isolate, pending_message));
if (!weak_this) {
return;
}
}
}
Evaluated with Chrome root at commit: a1e33f5848218e21d4a16ae2c1bc94e815c30c7f
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; 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.
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 SetActive() function iterates over pending_messages_ without guarding against re-entrant destruction of the PostMessageSupport object caused by synchronous JavaScript execution.
Impact
An attacker could achieve a reliable arbitrary write primitive, potentially leading to code execution in the renderer process.
What the attacker needed
Victim loads a malicious page; browser supports MimeHandlerView (e.g., PDF plugin); attacker can embed a plugin element
The fix
The fix should protect SetActive() against re-entrancy and synchronous deletion, for example by using a base::WeakPtr or moving pending_messages_ to a local variable before iterating.
How it was found
- Embed a MimeHandlerView-handled type (like a PDF) using a plugin element and queue multiple messages via plugin.postMessage() before the guest loads.
- Include malicious getters in the message payloads.
- When the guest loads, the browser sends a DidLoad IPC, triggering SetActive().
- SetActive() iterates over queued messages and calls PostJavaScriptMessage(), which invokes the guest window's postMessage and executes the first getter synchronously.
- The getter calls plugin.remove() to detach the frame and makes a re-entrant postMessage call, which eventually destroys the PostMessageSupport object.
- The second getter executes a heap spray to reclaim the freed memory, and when SetActive() resumes, it operates on attacker-controlled memory, yielding an arbitrary write primitive.
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 report describes a memory safety bug in a browser component. When a PDF is embedded, the browser queues messages to send to it. If a malicious message triggers JavaScript that removes the PDF, the code that sends messages keeps using memory that has been freed, which can let an attacker write to arbitrary memory locations.
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.