Skip to content
XSS Advisory Advanced CVE-2025-13097

Inappropriate implementation in DevTools (CVE-2025-13097)

A malicious WebSocket server could cause JavaScript to run in the devtools://devtools origin when a user double-clicks a network log row with a javascript: URL. This allowed universal XSS, local file read, and sandbox escape by opening a downloaded file.

Alesandro Ortiz Follow

Originally disclosed on Chrome VRP

Bounty$4,000 Medium View original
  • Fix shipped in 48 days

SUMMARY

This is a variation of issue 40942152 due to incomplete fix.

With devtools://devtools/bundled/integration_test_runner.html connected to a malicious remote WebSocket server, after user double-clicks on a network log item, an attacker can run JavaScript in devtools://devtools origin.

Impacts include universal XSS, browser sandbox escape by opening downloaded file, local file read, user interaction requirements bypass, and access to most CDP commands.

Initial report has PoCs for browser sandbox escape initiated from web page. I will provide the other PoCs once I've cleaned them up, including extension PoCs that reduce user interaction.

VULNERABILITY DETAILS

devtools:// URLs can be opened with drag-and-drop from any page, or automatically by an extension with devtools_page in manifest or debugger permission.

devtools://devtools/bundled/integration_test_runner.html renders data provided by the WebSocket server specified via ?ws= param [1], including remotely-hosted WS servers.

A malicious WS server can generate network log rows for a resource with a javascript: URL. Double-clicking [2] a network log row will call InspectorFrontendHost.openInNewTab() [3] which calls window.open(url, '_blank') [4] with the URL of the resource, in this case the javascript: URL. (Right-clicking the row and selecting Open in new tab works similarly.)

Because integration_test_runner.html does not have CSP, the JS runs in a new window with the devtools://devtools origin. At this point, attacker can read/write to localStorage and set console pins. We then ask the user to press F12 to run the malicious console pins, which perform the rest of the attack. After the keypress, we also download the file we want to open (this download can occur at any point during the attack).

Because devtools:// pages cannot directly navigate to chrome:// URLs, the console pins will navigate to the PDF component extension (chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/pdf_viewer_wrapper.js), then use the extension's chrome.tabs API to navigate to chrome://downloads, then execute JS in chrome://downloads to open the download.

In the provided PoCs, we then clean up the attack by deleting the malicious console pins, and either closing tabs or navigating tabs to benign pages.

Opening a downloaded file requires [5] a user interaction within the past 5 seconds, tracked per-tab using WebContentsImpl::last_interaction_time_ [6]. In faster devices, this is satisified by the earlier F12 keypress because the attack takes less than 5 seconds (see Scenario 1a). For 100% reliability, particularly on slower devices, we can generate a user interaction using CDP Input.* commands immediately before the file open attempt (see Scenario 1b).

Impacts

Immediately after initial XSS:

  • Local file read: Read local files and directories with DevToolsUIBindings::LoadNetworkResource() [7] (which is handler of loadNetworkResource message sent through DevToolsHost.sendMessageToEmbedder()).
  • Set console pins: UXSS where DevTools is opened in the future, used for further impacts

After opening DevTools with malicious console pins:

  • Sandbox escape by opening downloaded file: See main vuln description.
  • UXSS: We can navigate current tab to any page and execute arbitrary JS regardless of CSP.
  • Open DevTools-on-DevTools to gain CDP access: We can open chrome://inspect and run JS to inspect the current DevTools instance (i.e. DevTools-on-Devtools), used for further impacts

After obtaining CDP access via DevTools-on-DevTools:

  • Interaction requirement bypasses: We can send CDP Input.* commands to simulate user interaction and bypass user interaction restrictions.
  • Parallel UXSS via CDP: For more efficient attacks, we can open multiple tabs and attack each of them simultaneously via CDP.
  • Do anything else interesting with CDP against any listed target

[1] ws param read: https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/core/sdk/Connections.ts;l=292;drc=5efc7e9be253ceb20ebc8fcc1710f42623272bf7

[2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/panels/network/NetworkDataGridNode.ts;l=1085;drc=ebb421b7cdc02be3ee4abf49d6bad7646b3da9ab

[3] https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/panels/network/NetworkDataGridNode.ts;l=1069;drc=ebb421b7cdc02be3ee4abf49d6bad7646b3da9ab

[4] InspectorFrontendHost.openInNewTab() https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/core/host/InspectorFrontendHost.ts;l=190;drc=4ab8cec6e9a5640f553f44afeec821b9e7050eb9

[5] DownloadsDOMHandler::OpenFileRequiringGesture() https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/webui/downloads/downloads_dom_handler.cc;l=244;drc=b37413daa8803e67405b635419ab665e0374a093

[6] WebContentsImpl::last_interaction_time_ https://source.chromium.org/chromium/chromium/src/+/main:content/browser/web_contents/web_contents_impl.h;l=2380;drc=ebb421b7cdc02be3ee4abf49d6bad7646b3da9ab

[7] DevToolsUIBindings::LoadNetworkResource() https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/devtools/devtools_ui_bindings.cc;l=1100;drc=de65c59454bb29fff1e642fb3528cd2c80e52fb4

ADDITIONAL CONTEXT

Reduction of attack user interactions

For extensions with devtools_page in manifest, we can open devtools:// URLs automatically. For extensions with debugger permission, most steps are automatic. I'll provide extension PoCs in comments.

Other ways to reach openInNewTab()

While we use the Network panel to exploit this, any other usage of InspectorFrontendHost.openInNewTab() [4] is also vulnerable if attacker controls the URL (see Code Search [4]). Double clicking on network log row seemed like the easiest way to exploit.

VERSION

Verified repro on these versions:

Chrome Version: 134.0.6998.37 Stable, 135.0.7049.17 Beta, 136.0.7052.2 Dev, 136.0.7065.0 Canary

Operating System: Windows 10 (should repro for all desktop platforms)

PROPOSED PATCH

InspectorFrontendHost.openInNewTab() has many call sites. For example, most Linkfier methods call it but don't check for unsafe schemes except for Linkifier::linkifyURL() [1]. There are other ways to reach openInNewTab() outside of Linkifier.

To ensure all current and future call sites are protected, adding the scheme check in InspectorFrontendHost.openInNewTab(), right before the window.open() call, seems like the best approach. AFAICT none of the current callers have a legitimate need to pass JS URLs.

I'll upload a CL within a day or so.

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/ui/legacy/components/utils/Linkifier.ts;l=533;drc=aec1575a78abeec098d606c3c738215ca874b3b4

BISECT

Had to do two bisects for the DevTools XSS. Earliest repro is Feb 2018 with inspector.html.

  1. For integration_test_runner.html:


Bisected to https://chromium.googlesource.com/devtools/devtools-frontend.git/+/9327dc31d27d2a5061636ce35e726dfd755a6dd3 (Mar 2021)
integration_test_runner.html fails to load a JS file before then, so PoC fails. But you can use devtools_app.html as shown in second bisect.
The devtools-frontend commit above was rolled into Chromium in https://crrev.com/ab3bc54ec9d1e6204ff73d71e4390903842af64b

  1. For devtools_app.html/inspector.html (and probably other "production" entrypoints):


Bisected to https://crrev.com/abbb84580486221060a05e452652e045086ebc6c (Feb 2018) when unsafe-inline was added to CSP. Repro'd with chrome-devtools://devtools/bundled/inspector.html.
Stopped reproducing in https://chromium.googlesource.com/devtools/devtools-frontend.git/+/1e2c0032dae51afc104b525b621ad723c0501361 (Oct 2021) when unsafe-inline was removed for the non-test entrypoints.

REPRODUCTION CASE

Additional PoCs will be provided in the coming days.

One-time setup for WebSocket server:

  1. Download package.json and websocket-server.js
  2. Run npm i to install dependency
  3. Set desired port in source code (default 1337)

Setup for each scenario:

  1. Host per-scenario payload remotely or locally. Payload must be served with Access-Control-Allow-Origin: * and Content-Type: text/javascript headers.
  2. Update WebSocket server source to point to per-scenario payload URL.
  3. Run attacker WebSocket server with node websocket-server.js, remotely or locally.

Scenario 1a: Sandbox escape via download

Payload: devtools-xss-download-sandbox-escape-1a

This depends on the automated steps occuring within 5 seconds. In slower devices, scenario 1b may be needed for 100% reliability.

Repro steps:

  1. Navigate to https://alesandroortiz.com/security/chromium/devtools-drag.html?ws=host:port (replace host:port with your WS server)
  2. Drag the icon to a new tab (or existing tab)
  3. Double-click where DevTools says "CLICK TWICE HERE" to run JS payload (after this step, we have initial XSS with some impacts)
  4. Press F12 when prompted, then wait a few moments

Observed: JavaScript runs in devtools://devtools origin. Downloaded file is opened.

Expected: JavaScript is blocked from executing in any devtools:// origin. Downloaded file is not opened.

Scenario 1b: Sandbox escape via download + generated user interaction via CDP

Payload: devtools-xss-download-sandbox-escape-1b

Optional: To verify that this PoC does not depend on user interaction, set simulateDelayedLoading to true in payload.

Same impacts as 1a, but with 100% reliability because it uses DevTools-on-DevTools to access CDP and generate user interaction.

Repro steps: Same as scenario 1a (with different payload).

Observed/Expected: Same as scenario 1a.

Credit Information

Reporter credit: Alesandro Ortiz https://AlesandroOrtiz.com and Daniel Fröjdendahl https://FrojdenSec.com

The original report as published on the Chromium issue tracker, by Alesandro Ortiz. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

Context

Chrome DevTools ships a set of pages under the devtools://devtools origin. Among them is devtools://devtools/bundled/integration_test_runner.html, a test harness that renders data supplied by a remote WebSocket server. The server is chosen through a ?ws= query parameter, and the report notes that this can point at a remotely hosted WS server, not just a local one.

Because these pages live on a privileged devtools:// origin, any JavaScript that runs there is far more powerful than script on a normal web page. The report describes this issue as a variation of an earlier one (issue 40942152) that was fixed incompletely.

Setup

The attack needs a malicious WebSocket server and a payload served over HTTP. The one-time server setup in the report is:

  1. Download package.json and websocket-server.js.
  2. Run npm i to install the dependency.
  3. Set the desired port in the source code (default 1337).

For each scenario:

  1. Host the per-scenario payload remotely or locally. The payload must be served with Access-Control-Allow-Origin: * and Content-Type: text/javascript headers.
  2. Update the WebSocket server source to point to the per-scenario payload URL.
  3. Run the attacker WebSocket server with node websocket-server.js, remotely or locally.

The researcher verified the repro on these versions:

Channel Version
Stable 134.0.6998.37
Beta 135.0.7049.17
Dev 136.0.7052.2
Canary 136.0.7065.0

Operating system: Windows 10, with the expectation that it reproduces on all desktop platforms.

Finding it

The researcher noticed that integration_test_runner.html renders data provided by the WebSocket server specified via the ?ws= parameter, including remotely hosted servers. A malicious WS server can therefore generate network log rows for a resource whose URL is a javascript: URL.

Double-clicking such a network log row calls InspectorFrontendHost.openInNewTab(), which calls window.open(url, '_blank') with the URL of the resource, in this case the javascript: URL. Right-clicking the row and selecting Open in new tab works similarly.

Because integration_test_runner.html does not have a CSP, the JavaScript runs in a new window with the devtools://devtools origin. That is the initial XSS.

Exploitation

Step 1: Get the victim onto the harness page

devtools:// URLs can be opened with drag-and-drop from any page, or automatically by an extension that has devtools_page in its manifest or the debugger permission. The report's repro page is:

Text
https://alesandroortiz.com/security/chromium/devtools-drag.html?ws=host:port

Replace host:port with your WS server. The user drags the icon on that page to a new tab (or an existing tab).

Step 2: Trigger the javascript: URL

The malicious WS server generates a network log row for a resource with a javascript: URL. The user double-clicks where DevTools says CLICK TWICE HERE. That calls InspectorFrontendHost.openInNewTab(), which calls window.open(url, '_blank') with the javascript: URL, and the script executes in a new window on the devtools://devtools origin.

At this point the attacker can read and write localStorage and set console pins.

Step 3: Console pins and the F12 keypress

The attacker asks the user to press F12 to run the malicious console pins, which perform the rest of the attack. After the keypress, the file to be opened is also downloaded; the report notes this download can occur at any point during the attack.

Because devtools:// pages cannot directly navigate to chrome:// URLs, the console pins navigate to the PDF component extension:

Text
chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/pdf_viewer_wrapper.js

They then use the extension's chrome.tabs API to navigate to chrome://downloads, and execute JavaScript in chrome://downloads to open the download.

Step 4: Clean up

In the provided PoCs the attack is cleaned up by deleting the malicious console pins and either closing tabs or navigating tabs to benign pages.

The five-second interaction window

Opening a downloaded file requires a user interaction within the past 5 seconds, tracked per tab using WebContentsImpl::last_interaction_time_. On faster devices this is satisfied by the earlier F12 keypress because the attack takes less than 5 seconds (Scenario 1a). For 100% reliability, particularly on slower devices, a user interaction can be generated with CDP Input.* commands immediately before the file open attempt (Scenario 1b).

Scenario 1a: Sandbox escape via download

Payload: devtools-xss-download-sandbox-escape-1a.

This depends on the automated steps occurring within 5 seconds. On slower devices, Scenario 1b may be needed for 100% reliability.

Repro steps:

  1. Navigate to https://alesandroortiz.com/security/chromium/devtools-drag.html?ws=host:port (replace host:port with your WS server).
  2. Drag the icon to a new tab (or existing tab).
  3. Double-click where DevTools says CLICK TWICE HERE to run the JS payload. After this step there is initial XSS with some impacts.
  4. Press F12 when prompted, then wait a few moments.

Observed: JavaScript runs in the devtools://devtools origin and the downloaded file is opened.

Expected: JavaScript is blocked from executing in any devtools:// origin and the downloaded file is not opened.

Scenario 1b: Sandbox escape via download plus generated user interaction via CDP

Payload: devtools-xss-download-sandbox-escape-1b.

Optionally, to verify that this PoC does not depend on user interaction, set simulateDelayedLoading to true in the payload.

The impacts are the same as 1a, but with 100% reliability because it uses DevTools-on-DevTools to access CDP and generate user interaction. The repro steps are the same as Scenario 1a with a different payload, and the observed and expected results are the same.

Impacts after the initial XSS

Immediately after the initial XSS:

  • Local file read: read local files and directories with DevToolsUIBindings::LoadNetworkResource(), which is the handler of the loadNetworkResource message sent through DevToolsHost.sendMessageToEmbedder().
  • Set console pins: UXSS where DevTools is opened in the future, used for further impacts.

After opening DevTools with the malicious console pins:

  • Sandbox escape by opening a downloaded file.
  • UXSS: navigate the current tab to any page and execute arbitrary JavaScript regardless of CSP.
  • Open DevTools-on-DevTools to gain CDP access: open chrome://inspect and run JavaScript to inspect the current DevTools instance, used for further impacts.

After obtaining CDP access via DevTools-on-DevTools:

  • Interaction requirement bypasses: send CDP Input.* commands to simulate user interaction and bypass user interaction restrictions.
  • Parallel UXSS via CDP: open multiple tabs and attack each of them simultaneously via CDP.
  • Anything else interesting with CDP against any listed target.

Root cause

The chain starts with InspectorFrontendHost.openInNewTab() passing an attacker-controlled URL straight to window.open(url, '_blank'). The harness page integration_test_runner.html has no CSP, so a javascript: URL opened this way executes on the devtools://devtools origin.

The proposed patch notes that openInNewTab() has many call sites. Most Linkifier methods call it but do not check for unsafe schemes, except for Linkifier::linkifyURL(), and there are other ways to reach openInNewTab() outside of Linkifier. The researcher's view is that none of the current callers have a legitimate need to pass JS URLs.

On the bisect side, the researcher had to do two bisects for the DevTools XSS. The earliest repro is February 2018 with inspector.html.

  1. For integration_test_runner.html, bisected to a devtools-frontend commit from March 2021. Before that commit, integration_test_runner.html fails to load a JS file, so the PoC fails, but devtools_app.html can be used as in the second bisect. That devtools-frontend commit was rolled into Chromium in a separate Chromium revision.
  2. For devtools_app.html/inspector.html (and probably other production entrypoints), bisected to a February 2018 Chromium revision when unsafe-inline was added to the CSP. It was reproduced with chrome-devtools://devtools/bundled/inspector.html. It stopped reproducing in an October 2021 devtools-frontend commit when unsafe-inline was removed for the non-test entrypoints.

Impact

The report lists universal XSS, browser sandbox escape by opening a downloaded file, local file read, user interaction requirement bypass, and access to most CDP commands. The initial report has PoCs for browser sandbox escape initiated from a web page; the researcher said the other PoCs, including extension PoCs that reduce user interaction, would follow once cleaned up.

On user interaction: opening a downloaded file requires a user interaction within the past 5 seconds, tracked per tab. Scenario 1a relies on the F12 keypress falling inside that window; Scenario 1b removes the dependency by generating the interaction through CDP. For extensions with devtools_page in the manifest, devtools:// URLs can be opened automatically, and for extensions with the debugger permission most steps are automatic.

Fix

The proposed patch is to add the scheme check in InspectorFrontendHost.openInNewTab(), right before the window.open() call, so that all current and future call sites are protected. The researcher said a CL would be uploaded within a day or so. The report does not describe the final landed change.

Variants to test

  • Other call sites of InspectorFrontendHost.openInNewTab(): any place where an attacker controls the URL passed to it is a candidate. A positive result is a javascript: URL executing in a devtools:// origin.
  • Other DevTools entrypoints: the bisect shows devtools_app.html and inspector.html were reachable historically when unsafe-inline was in the CSP. Testing entrypoints for missing or permissive CSP is worthwhile; a positive result is script execution on a devtools:// origin.
  • Other ?ws=-style parameters that load remote data into a privileged page: a positive result is attacker-supplied content being rendered and acted on by the page.
  • Extension-driven delivery: extensions with devtools_page or the debugger permission can open devtools:// URLs automatically. A positive result is the chain running with fewer or no user gestures.
  • Interaction-gated actions: look for actions that check a recent user interaction per tab and see whether CDP Input.* commands can satisfy the check. A positive result is the action succeeding without a real gesture.

Credit for the report goes to Alesandro Ortiz and Daniel Fröjdendahl.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 15 min read.

What happened, in plain words

Chrome has a set of built-in pages that make up the developer tools, the panel you open with F12 to inspect web pages. These pages live at a special internal address that starts with devtools://. Because they are part of the browser itself, any JavaScript that manages to run on those pages is far more powerful than script running on an ordinary website. It can reach parts of the browser that a normal page can never touch.

One of these internal pages is a test harness called integration_test_runner.html. A test harness is a page built to run automated checks. This particular one can be told to connect to a WebSocket server, and it then displays whatever data that server sends it. A WebSocket is a two-way, always-open connection between a browser and a server, like a phone call that stays connected instead of a series of separate letters. The address of the server is chosen by a ?ws= parameter in the page's URL, and that server can be anywhere on the internet, not just on the same machine.

A researcher found that if the server is malicious, it can send a fake network log entry whose address begins with javascript:. A javascript: URL is not a real web address: it is a way of writing a small program, and when a browser opens one it runs the program instead of loading a page. When the user double-clicks that log entry, the developer tools open the address in a new tab. Because the page that does the opening has no Content Security Policy (CSP, a set of rules a page can use to say which scripts are allowed to run), the little program runs, and it runs with the privileges of the internal devtools:// address. That is the core bug: a page that should be trusted ends up running code chosen by an attacker.

From there the attacker can do several things: read local files, plant persistent snippets in the developer tools console (called console pins) that run the next time the tools are opened, and eventually escape the browser's sandbox (the wall that keeps web content away from your operating system) by making the browser open a downloaded file. The report describes two versions of the attack, one that relies on the user pressing F12 within five seconds, and one that removes that timing dependency by driving the browser through its own debugging protocol.

The report was filed by Alesandro Ortiz, with credit also given to Daniel Fröjdendahl. The proposed fix was to add a check in the developer tools code that refuses to open javascript: addresses.

Background: the pieces involved

Before walking through the attack, here are the concepts it uses, explained from scratch.

  • Origin: the combination of scheme, host and port that identifies where a page came from, for example https://example.com. Browsers use the origin as a security boundary: script from one origin normally cannot read data belonging to another. The devtools://devtools origin is a privileged one, reserved for the browser's own developer tools.
  • XSS (cross-site scripting): a class of bug where an attacker gets their own JavaScript to run inside a page or origin that should not run it. A normal XSS runs in a website's origin. A universal XSS (UXSS) runs in a privileged browser origin, so it is not limited to one site.
  • CSP (Content Security Policy): a rule set a page can send to tell the browser which scripts may run. If a page has no CSP, the browser applies no such restriction, so any script that gets in will run.
  • WebSocket: a persistent two-way connection between a browser and a server. Unlike a normal request, which ends when the response arrives, a WebSocket stays open and either side can send messages at any time.
  • API: a defined set of functions one piece of software offers to another. When the report says the extension's chrome.tabs API, it means the built-in functions Chrome gives extensions for working with tabs.
  • CDP (Chrome DevTools Protocol): the language the developer tools use to talk to the browser. It can inspect pages, run script, and simulate input. Anything that can speak CDP can drive the browser almost like a user would.
  • Sandbox: the isolation layer that keeps web pages from directly touching your files and operating system. Escaping it means getting code to run with the operating system's own privileges.
  • Console pins: small snippets of JavaScript that a developer can save in the DevTools console so they run automatically each time the console opens. Handy for developers, dangerous if an attacker can plant one.
  • Bisect: a technique for finding when a bug was introduced by testing versions of the software at different points in its history, halving the range each time, like a guessing game.
  • CL: changelist, a proposed code change waiting to be reviewed and merged.

Context

Chrome DevTools ships a set of pages under the devtools://devtools origin. Among them is devtools://devtools/bundled/integration_test_runner.html, a test harness that renders data supplied by a remote WebSocket server. The server is chosen through a ?ws= query parameter, and the report notes that this can point at a remotely hosted WS server, not just a local one.

Because these pages live on a privileged devtools:// origin, any JavaScript that runs there is far more powerful than script on a normal web page. The report describes this issue as a variation of an earlier one (issue 40942152) that was fixed incompletely. In other words, a previous bug of the same shape was patched, but the patch did not close every route to the same dangerous behaviour.

Setup

The attack needs two things: a malicious WebSocket server, and a payload (the JavaScript the attacker wants to run) served over HTTP. The one-time server setup in the report is:

  1. Download package.json and websocket-server.js.
  2. Run npm i to install the dependency.
  3. Set the desired port in the source code (default 1337).

package.json is a file that lists the libraries a Node.js project needs. npm i is the command that reads that list and downloads them. A port is a numbered door on a machine that a server listens on; 1337 is simply the default the report uses.

For each scenario:

  1. Host the per-scenario payload remotely or locally. The payload must be served with Access-Control-Allow-Origin: * and Content-Type: text/javascript headers.
  2. Update the WebSocket server source to point to the per-scenario payload URL.
  3. Run the attacker WebSocket server with node websocket-server.js, remotely or locally.
Bash
node websocket-server.js

This line starts the malicious WebSocket server using Node.js, a program that runs JavaScript outside the browser. The two headers in step 1 matter: Access-Control-Allow-Origin: * tells the browser that any page is allowed to fetch this file, and Content-Type: text/javascript tells the browser the file is JavaScript.

The researcher verified the repro on these versions:

Channel Version
Stable 134.0.6998.37
Beta 135.0.7049.17
Dev 136.0.7052.2
Canary 136.0.7065.0

Operating system: Windows 10, with the expectation that it reproduces on all desktop platforms. Chrome's release channels are Stable (the normal release), Beta (one step ahead), Dev (further ahead) and Canary (the most experimental).

Finding it

The researcher noticed that integration_test_runner.html renders data provided by the WebSocket server specified via the ?ws= parameter, including remotely hosted servers. A malicious WS server can therefore generate network log rows for a resource whose URL is a javascript: URL. A network log row is one line in the developer tools' list of requests the page made; here the attacker is inventing a line that was never real.

Double-clicking such a network log row calls InspectorFrontendHost.openInNewTab(), which calls window.open(url, '_blank') with the URL of the resource, in this case the javascript: URL. Right-clicking the row and selecting Open in new tab works similarly. window.open is the browser function that opens a new tab or window at a given address; '_blank' means a new tab.

Because integration_test_runner.html does not have a CSP, the JavaScript runs in a new window with the devtools://devtools origin. That is the initial XSS.

Exploitation

Step 1: Get the victim onto the harness page

devtools:// URLs can be opened with drag-and-drop from any page, or automatically by an extension that has devtools_page in its manifest or the debugger permission. An extension is a small add-on installed in the browser; its manifest is the file that declares what it is allowed to do. The report's repro page is:

Text
https://alesandroortiz.com/security/chromium/devtools-drag.html?ws=host:port

Replace host:port with your WS server. The user drags the icon on that page to a new tab (or an existing tab). The ?ws= part tells the harness which WebSocket server to connect to, so the attacker puts their own server's address there.

Step 2: Trigger the javascript: URL

The malicious WS server generates a network log row for a resource with a javascript: URL. The user double-clicks where DevTools says CLICK TWICE HERE. That calls InspectorFrontendHost.openInNewTab(), which calls window.open(url, '_blank') with the javascript: URL, and the script executes in a new window on the devtools://devtools origin.

At this point the attacker can read and write localStorage and set console pins. localStorage is a small storage area a page can use to keep data between visits; reading and writing it on a privileged origin lets the attacker plant things that persist.

Step 3: Console pins and the F12 keypress

The attacker asks the user to press F12 to run the malicious console pins, which perform the rest of the attack. After the keypress, the file to be opened is also downloaded; the report notes this download can occur at any point during the attack.

Because devtools:// pages cannot directly navigate to chrome:// URLs, the console pins navigate to the PDF component extension:

Text
chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/pdf_viewer_wrapper.js

This is the address of a built-in extension that displays PDF files. The attacker uses it as a stepping stone to reach chrome://downloads. They then use the extension's chrome.tabs API to navigate to chrome://downloads, and execute JavaScript in chrome://downloads to open the download. chrome://downloads is the browser's own downloads page, another privileged internal page.

Step 4: Clean up

In the provided PoCs the attack is cleaned up by deleting the malicious console pins and either closing tabs or navigating tabs to benign pages.

The five-second interaction window

Opening a downloaded file requires a user interaction within the past 5 seconds, tracked per tab using WebContentsImpl::last_interaction_time_. This is a deliberate safety measure: the browser will not open a downloaded file unless you did something recently, so a page cannot silently launch a file. On faster devices this is satisfied by the earlier F12 keypress because the attack takes less than 5 seconds (Scenario 1a). For 100% reliability, particularly on slower devices, a user interaction can be generated with CDP Input.* commands immediately before the file open attempt (Scenario 1b). Input.* commands are CDP instructions that pretend a user clicked or typed.

Scenario 1a: Sandbox escape via download

Payload: devtools-xss-download-sandbox-escape-1a.

This depends on the automated steps occurring within 5 seconds. On slower devices, Scenario 1b may be needed for 100% reliability.

Repro steps:

  1. Navigate to https://alesandroortiz.com/security/chromium/devtools-drag.html?ws=host:port (replace host:port with your WS server).
  2. Drag the icon to a new tab (or existing tab).
  3. Double-click where DevTools says CLICK TWICE HERE to run the JS payload. After this step there is initial XSS with some impacts.
  4. Press F12 when prompted, then wait a few moments.

Observed: JavaScript runs in the devtools://devtools origin and the downloaded file is opened.

Expected: JavaScript is blocked from executing in any devtools:// origin and the downloaded file is not opened.

Scenario 1b: Sandbox escape via download plus generated user interaction via CDP

Payload: devtools-xss-download-sandbox-escape-1b.

Optionally, to verify that this PoC does not depend on user interaction, set simulateDelayedLoading to true in the payload.

The impacts are the same as 1a, but with 100% reliability because it uses DevTools-on-DevTools to access CDP and generate user interaction. DevTools-on-DevTools means opening the developer tools to inspect the developer tools themselves, which gives the attacker a CDP connection. The repro steps are the same as Scenario 1a with a different payload, and the observed and expected results are the same.

Impacts after the initial XSS

Immediately after the initial XSS:

  • Local file read: read local files and directories with DevToolsUIBindings::LoadNetworkResource(), which is the handler of the loadNetworkResource message sent through DevToolsHost.sendMessageToEmbedder(). In plain terms, the developer tools have a built-in way to load resources, and the attacker can abuse it to read files on the machine.
  • Set console pins: UXSS where DevTools is opened in the future, used for further impacts. The attacker's code runs again the next time the victim opens the developer tools.

After opening DevTools with the malicious console pins:

  • Sandbox escape by opening a downloaded file.
  • UXSS: navigate the current tab to any page and execute arbitrary JavaScript regardless of CSP.
  • Open DevTools-on-DevTools to gain CDP access: open chrome://inspect and run JavaScript to inspect the current DevTools instance, used for further impacts. chrome://inspect is the browser's page for inspecting other pages and processes.

After obtaining CDP access via DevTools-on-DevTools:

  • Interaction requirement bypasses: send CDP Input.* commands to simulate user interaction and bypass user interaction restrictions.
  • Parallel UXSS via CDP: open multiple tabs and attack each of them simultaneously via CDP.
  • Anything else interesting with CDP against any listed target.

Root cause

The chain starts with InspectorFrontendHost.openInNewTab() passing an attacker-controlled URL straight to window.open(url, '_blank'). The harness page integration_test_runner.html has no CSP, so a javascript: URL opened this way executes on the devtools://devtools origin. Two mistakes combine: the code does not check what kind of address it is opening, and the page has no rule that would stop the resulting script.

The proposed patch notes that openInNewTab() has many call sites. Most Linkifier methods call it but do not check for unsafe schemes, except for Linkifier::linkifyURL(), and there are other ways to reach openInNewTab() outside of Linkifier. A call site is simply a place in the code that uses a function; a scheme is the first part of an address, like https: or javascript:. The researcher's view is that none of the current callers have a legitimate need to pass JS URLs.

On the bisect side, the researcher had to do two bisects for the DevTools XSS. The earliest repro is February 2018 with inspector.html.

  1. For integration_test_runner.html, bisected to a devtools-frontend commit from March 2021. Before that commit, integration_test_runner.html fails to load a JS file, so the PoC fails, but devtools_app.html can be used as in the second bisect. That devtools-frontend commit was rolled into Chromium in a separate Chromium revision.
  2. For devtools_app.html/inspector.html (and probably other production entrypoints), bisected to a February 2018 Chromium revision when unsafe-inline was added to the CSP. It was reproduced with chrome-devtools://devtools/bundled/inspector.html. It stopped reproducing in an October 2021 devtools-frontend commit when unsafe-inline was removed for the non-test entrypoints.

A commit is a saved change in a code repository. unsafe-inline is a CSP keyword that allows scripts written directly inside the page to run; removing it closes one route for injected script.

Impact

The report lists universal XSS, browser sandbox escape by opening a downloaded file, local file read, user interaction requirement bypass, and access to most CDP commands. The initial report has PoCs for browser sandbox escape initiated from a web page; the researcher said the other PoCs, including extension PoCs that reduce user interaction, would follow once cleaned up.

On user interaction: opening a downloaded file requires a user interaction within the past 5 seconds, tracked per tab. Scenario 1a relies on the F12 keypress falling inside that window; Scenario 1b removes the dependency by generating the interaction through CDP. For extensions with devtools_page in the manifest, devtools:// URLs can be opened automatically, and for extensions with the debugger permission most steps are automatic. The report says extension PoCs that reduce user interaction would be provided later.

Fix

The proposed patch is to add the scheme check in InspectorFrontendHost.openInNewTab(), right before the window.open() call, so that all current and future call sites are protected. The researcher said a CL would be uploaded within a day or so. The report does not describe the final landed change.

Variants to test

  • Other call sites of InspectorFrontendHost.openInNewTab(): any place where an attacker controls the URL passed to it is a candidate. A positive result is a javascript: URL executing in a devtools:// origin.
  • Other DevTools entrypoints: the bisect shows devtools_app.html and inspector.html were reachable historically when unsafe-inline was in the CSP. Testing entrypoints for missing or permissive CSP is worthwhile; a positive result is script execution on a devtools:// origin.
  • Other ?ws=-style parameters that load remote data into a privileged page: a positive result is attacker-supplied content being rendered and acted on by the page.
  • Extension-driven delivery: extensions with devtools_page or the debugger permission can open devtools:// URLs automatically. A positive result is the chain running with fewer or no user gestures.
  • Interaction-gated actions: look for actions that check a recent user interaction per tab and see whether CDP Input.* commands can satisfy the check. A positive result is the action succeeding without a real gesture.

Credit for the report goes to Alesandro Ortiz and Daniel Fröjdendahl.

Glossary

  • Bisect: finding when a bug was introduced by testing versions across history, halving the range each time.
  • Call site: a place in code that uses a particular function.
  • CDP (Chrome DevTools Protocol): the protocol the developer tools use to inspect and control the browser.
  • Commit: a saved change in a code repository.
  • Console pins: saved JavaScript snippets that run each time the DevTools console opens.
  • CSP (Content Security Policy): rules a page sends to say which scripts may run.
  • DevTools: the browser's built-in developer tools, opened with F12.
  • Extension: a small add-on installed in the browser, with a manifest declaring its permissions.
  • Extension manifest: the file that declares what an extension is allowed to do.
  • javascript: URL: an address that contains a small program; opening it runs the program.
  • localStorage: a small per-origin storage area a page can use to keep data between visits.
  • Origin: scheme, host and port that identify where a page came from; the browser's security boundary.
  • Payload: the JavaScript an attacker wants to run.
  • Port: a numbered door on a machine that a server listens on.
  • Sandbox: the isolation layer keeping web content away from the operating system.
  • Scheme: the first part of an address, such as https: or javascript:.
  • UXSS (universal XSS): XSS that runs in a privileged browser origin rather than a single website.
  • XSS (cross-site scripting): a bug where an attacker's JavaScript runs in a page or origin that should not run it.

More by Alesandro Ortiz

View all

33 more disclosed reports, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.