Use after free in Guest View (CVE-2026-11674)
A use-after-free vulnerability exists in the MimeHandlerView implementation where retrieving the 'postMessage' property can trigger synchronous JavaScript execution. If the target frame is same-origin, an attacker-controlled getter can detach the frame, synchronously destroying the PostMessageSupport object, and subsequent execution accesses the deleted 'this' object.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 13 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 MimeHandlerView implementation where retrieving the 'postMessage' property can trigger synchronous JavaScript execution. If the target frame is same-origin, an attacker-controlled getter can detach the frame, synchronously destroying the PostMessageSupport object. Subsequent execution continues and accesses the deleted 'this' object, leading to a Use-After-Free.
Affected files:
extensions/renderer/guest_view/mime_handler_view/post_message_support.ccextensions/renderer/guest_view/mime_handler_view/mime_handler_view_container_manager.cc
Estimated timestamp from git blame: 2019-04-23
Detailed Writeup
Vulnerability Analysis
In PostMessageSupport::PostJavaScriptMessage (located in extensions/renderer/guest_view/mime_handler_view/post_message_support.cc), the code performs a property lookup on the target window proxy to retrieve the postMessage function:
gin::Dictionary window_object(isolate, target_window_proxy);
v8::Local<v8::Function> post_message;
if (!window_object.Get(std::string(kPostMessageName), &post_message)) {
return;
}
If the target window is same-origin and has a custom getter defined on the postMessage property, calling window_object.Get() will synchronously execute JavaScript. Inside this getter, the attacker can detach the frame (for instance, by removing the embedding element from the DOM).
Detaching the frame synchronously triggers the destruction of the underlying RenderFrameImpl, which destroys the MimeHandlerViewContainerManager and the associated PostMessageSupport instance.
Upon returning from the V8 property lookup, PostJavaScriptMessage continues execution:
delegate_->GetSourceFrame()->CallFunctionEvenIfScriptDisabled(
post_message.As<v8::Function>(), target_window_proxy, std::size(args),
args);
Since this has already been deleted, dereferencing delegate_ (which is a member variable of PostMessageSupport) results in a Use-After-Free (UAF) on the this pointer.
Potential Trigger Scenario
An attacker could potentially trigger this by:
- Embedding a MimeHandlerView-supported document (such as a PDF).
- Caching the
postMessagefunction of the plugin element. - Setting up a same-origin target iframe named after the plugin's internal ID, and defining a custom getter on its
postMessageproperty. - Invoking the cached
postMessagefunction, forcing the property lookup on the custom getter. - Synchronously detaching the frame during the getter invocation to destroy the
PostMessageSupportinstance before the lookup returns.
Note: These are potential steps based on source code analysis; our tools have not executed this code to verify a functional proof-of-concept.
Suggested Fix
To prevent this issue, verify that the PostMessageSupport instance is still alive after executing any operation that can run user-defined JavaScript. This can be achieved by checking a base::WeakPtr<PostMessageSupport> immediately after the property lookup.
auto weak_this = weak_factory_.GetWeakPtr();
v8::Local<v8::Function> post_message;
if (!window_object.Get(std::string(kPostMessageName), &post_message)) {
return;
}
if (!weak_this) {
return;
}
Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8
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.
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
The code performs a property lookup that can execute JavaScript, and after that lookup it does not check whether the object it is operating on has been destroyed.
Impact
An attacker could potentially trigger a use-after-free, which may lead to memory corruption or code execution, though the report notes that a functional proof-of-concept has not been executed.
What the attacker needed
Same-origin target iframe; ability to embed a MimeHandlerView document; attacker-controlled getter on postMessage
The fix
The issue should be fixed by verifying that the PostMessageSupport instance is still alive after executing any operation that can run user-defined JavaScript, for example by checking a base::WeakPtr<PostMessageSupport> immediately after the property lookup.
How it was found
- Embed a MimeHandlerView-supported document (such as a PDF).
- Cache the postMessage function of the plugin element.
- Set up a same-origin target iframe named after the plugin's internal ID, and define a custom getter on its postMessage property.
- Invoke the cached postMessage function, forcing the property lookup on the custom getter.
- Synchronously detach the frame during the getter invocation to destroy the PostMessageSupport instance before the lookup returns.
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 is a type of memory bug where a program keeps using a piece of memory after it has been freed. Here, a web page component can be tricked into running attacker JavaScript that deletes the component, but the code then continues to use the deleted component, which could lead to crashes or worse.
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.