Inappropriate implementation in Headless (CVE-2026-17883)
Headless Chrome's OpenURLFromTab handler creates a new WebContents without passing an opener reference, so sandbox flags are not inherited from the initiating frame. An attacker in a sandboxed iframe with allow-popups could trigger a new tab via a synthetic middle-click and have it load without the sandbox restrictions.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 47 days
Flapjack, 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: Headless Chrome fails to propagate sandbox flags when a navigation opens a new tab via OpenURLFromTab. An attacker in a sandboxed iframe with allow-popups can use a synthetic middle-click to trigger this path, bypassing the sandbox restrictions and the headless popup blocker.
Affected files:
headless/lib/browser/headless_web_contents_impl.cc
Estimated timestamp from git blame: Unknown (Google3 checkout)
Description
In Headless Chrome, the HeadlessWebContentsImpl::Delegate::OpenURLFromTab method handles navigations that open in a new tab or window (e.g., via a middle-click). When processing NEW_FOREGROUND_TAB or NEW_BACKGROUND_TAB dispositions, the method creates a new WebContents instance using CreateWebContentsBuilder().Build().
However, this creation path fails to provide an opener reference to the WebContents::CreateParams. In Chromium's content layer, sandbox flags and security policies are inherited from the opener during the creation of a new WebContents (specifically in WebContentsImpl::CreateWithOpener). Because the opener IDs are left uninitialized (defaulting to kInvalidUniqueID and kRoutingIdNone), the new window is created with a default, unrestricted security context. It fails to inherit the sandbox restrictions of the initiating frame.
Potential Attack Steps
(Note: These are suggested steps; our tooling agent does not yet have the ability to run code to verify them dynamically.)
- An attacker embeds a sandboxed iframe in a page loaded by Headless Chrome. The iframe has
sandbox="allow-scripts allow-popups"(notably lackingallow-popups-to-escape-sandbox). - Inside the iframe, the attacker executes JavaScript to create an anchor (
<a>) and dispatches a synthetic middle-click event on it:a.dispatchEvent(new MouseEvent('click', {button: 1})). - The Blink renderer evaluates the middle-click as an untrusted event targeting a new tab. Because
allow-popupsis present in the sandbox flags, Blink allows the untrusted event to proceed (FrameLoader::StartNavigation) and routes it toRenderFrameImpl::OpenURL. - The browser process receives the IPC and invokes
HeadlessWebContentsImpl::Delegate::OpenURLFromTabwith aNEW_FOREGROUND_TABorNEW_BACKGROUND_TABdisposition. - The new
WebContentsis created viaHeadlessWebContentsImpl::Create, missing theopenermetadata. - The new tab loads the attacker's URL without the sandbox restrictions of the initiating iframe, granting full privileges of the origin.
This attack vector is highly reliable in Headless Chrome because it lacks the standard popup blocker that would typically block synthetic popup events in regular Chrome. Furthermore, this specific code path completely bypasses the Headless block_new_web_contents() setting, which embedders rely on to prevent untrusted popups.
Vulnerable Code
In headless/lib/browser/headless_web_contents_impl.cc, the OpenURLFromTab implementation creates the new contents without specifying an opener:
case WindowOpenDisposition::NEW_POPUP:
case WindowOpenDisposition::NEW_WINDOW:
case WindowOpenDisposition::NEW_BACKGROUND_TAB:
case WindowOpenDisposition::NEW_FOREGROUND_TAB: {
HeadlessWebContentsImpl* child_contents = HeadlessWebContentsImpl::From(
headless_web_contents_->browser_context()
->CreateWebContentsBuilder()
.SetWindowBounds(source->GetContainerBounds())
.Build());
target = child_contents->web_contents();
break;
}
The Build() call invokes HeadlessWebContentsImpl::Create, which initializes content::WebContents::CreateParams without the opener reference:
std::unique_ptr<HeadlessWebContentsImpl> HeadlessWebContentsImpl::Create(
HeadlessWebContents::Builder* builder) {
content::WebContents::CreateParams create_params(builder->browser_context_);
auto headless_web_contents = base::WrapUnique(
new HeadlessWebContentsImpl(content::WebContents::Create(create_params)));
// ...
}
Suggested Fix
- Update
HeadlessWebContents::Builderto accept an optional openercontent::WebContents*reference. - In
HeadlessWebContentsImpl::Create, use the provided opener reference to set theopener_render_process_id,opener_render_frame_id, andopener_suppressedfields incontent::WebContents::CreateParams. - In
HeadlessWebContentsImpl::Delegate::OpenURLFromTab, pass thesourceWebContentsas the opener to the builder before callingBuild().
Evaluated with Chrome root at commit: 65b3256311f3ab6fb9870eaa522de7e6dd2663bb
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
Likely the new WebContents is built without an opener reference, so the content layer has nothing to inherit sandbox flags from and falls back to an unrestricted default.
Impact
The new tab could load with full privileges of the origin, bypassing the sandbox and the headless block_new_web_contents setting; the report notes the steps were not dynamically verified.
What the attacker needed
Headless Chrome as the target; attacker page with a sandboxed iframe; iframe allows scripts and popups; victim loads the attacker page
The fix
The builder should accept an opener WebContents, set the opener render process and frame IDs plus opener_suppressed in CreateParams, and OpenURLFromTab should pass the source as opener.
How it was found
- Embed a sandboxed iframe with allow-scripts and allow-popups but without allow-popups-to-escape-sandbox.
- Inside the iframe, create an anchor and dispatch a synthetic middle-click event on it.
- Blink treats the middle-click as a new-tab navigation and forwards it to the browser process.
- The browser calls OpenURLFromTab with a new-tab disposition.
- A new WebContents is created without opener metadata.
- The new tab loads the attacker's URL without the iframe's sandbox restrictions.
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 sandbox is a way to run untrusted content with fewer permissions, like a locked room inside the browser. When a page opens a new tab, the browser is supposed to copy those restrictions to the new tab. Here, Headless Chrome forgot to copy them, so a page that should be locked down could open a tab that is not locked down at all.
What is UI spoofing?
The interface lies to the user: a framed page catches their clicks, or a browser shows the wrong address or a fake prompt. Paid when it leads to a sensitive action or convincing phishing.