SharedWorker and AudioWorklet bypass --blockedUrlPattern/--allowedUrlPattern

Open
#3,399 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
8/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Domain
devtools, security

Research direction

The bypass sits in how Puppeteer enforces the URL allow/block callbacks: build/src/third_party/index.js (#maybeSetupNetworkConditions, #attachToServiceWorkers) and the MCP side in src/utils/logger.ts and src/bin/chrome-devtools.ts. Reproduce with the PoC scripts described in the issue and a local server on 127.0.0.1:18999 and 19000. Done means shared-worker and audio-worklet loads are blocked under both flags, with tests, plus the status args redaction fix.

Written by the indexing model from the issue text.

Description

confirmed p3

Version: 1.12.0 (npm), Chrome 156, Windows 11, bundled puppeteer-core 25.16.0.

Description

A page can bypass both network guardrail flags by issuing requests from a
SharedWorker. The page's own fetch and the same fetch from a dedicated
Worker are blocked; the identical fetch from a SharedWorker reaches the
blocked origin and returns its body.

The worker needs no server-side script: a blob worker created with
new SharedWorker(URL.createObjectURL(new Blob([...]))) is enough, so any page
that can run JavaScript is sufficient.

Impact: with --allowedUrlPattern, an allowed page can reach arbitrary
excluded origins, read CORS-enabled responses (including intranet/admin
endpoints) and trigger side effects; the same applies to blocked origins under
--blockedUrlPattern. Exfiltrated bodies can be posted back through the
MessagePort into the allowed page DOM, where the server returns them.

This is distinct from the service-worker bypass (#2990, fixed): the fix only
added service_worker handling. Shared workers are still unhandled on
puppeteer/main.

Reproduction

The PoCs are standalone (Node 24, Chrome 156; set PUPPETEER_BASE to a
directory where puppeteer resolves if it is not installed in the cwd).
poc-server.mjs starts 127.0.0.1:18999 (allowed) and 127.0.0.1:19000
(blocked) and always sends Access-Control-Allow-Origin: *.

node poc-server.mjs                    # terminal 1
node poc-shared-worker.mjs allowlist   # terminal 2
node poc-shared-worker.mjs blocklist

The scripts pass the patterns directly to puppeteer.launch({allowlist}) /
({blocklist}), which is what the MCP server does with the CLI flags.

The same was reproduced end-to-end through the MCP server with
--allowedUrlPattern=http://127.0.0.1:18999/* (and with
--blockedUrlPattern=*://127.0.0.1:19000/*), navigating to the allowed page
and running the page script above.

Observed, both list types:

control fetch          ERR:TypeError: Failed to fetch
dedicated worker       ERR:TypeError: Failed to fetch
shared worker (bypass) OK:{"label":"blocked","path":"/ping"}

Also reproduced from https://example.com with --allowedUrlPattern=https://example.com/*:
the page and a blob dedicated worker cannot reach https://example.org, the
blob shared worker can.

Second vector: AudioWorklet

AudioWorklet.addModule() needs no user gesture and loads its module from the
audio service rather than the page's network context. The same allowlist /
blocklist is not applied, and the module executes (registerProcessor, then
new AudioWorkletNode(...) succeeds). This also works with
--no-javascript-evaluation, from page inline script only.

const ac = new AudioContext();
await ac.audioWorklet.addModule('http://127.0.0.1:19000/audioworklet.js');
const node = new AudioWorkletNode(ac, 'w');
node.port.onmessage = e => console.log(e.data);   // worklet code ran

AudioWorkletGlobalScope has no fetch, so this vector gives code execution
from an excluded origin rather than body exfiltration.

Mechanism detail (page session): Network.setBlockedURLs does not block the
module load, Fetch interception does. For shared workers it is the opposite
(setBlockedURLs works, Fetch.enable on the worker session does not). Neither
single mechanism closes both.

Confirmed blocked neighbours: paint worklet, animation worklet, FontFace,
<audio>/<video>, fetch, workers, iframes, navigations.

Root cause

BlocklistCallback/AllowlistCallback are forwarded to Puppeteer, which
enforces them with Network.emulateNetworkConditionsByRule. That command is a
silent no-op on shared_worker sessions. Fetch.enable on the session is also
a no-op; Network.setBlockedURLs works. Audio worklet modules are loaded by the
audio service, outside the page's network context, and no worklet target exists
to attach, so the page-session rule never sees them either. See
build/src/third_party/index.js #attachToServiceWorkers (service workers
only) and #maybeSetupNetworkConditions.

Expectation

The same fetch inside a shared worker, and the audio worklet module load,
should fail, for both flags.

Fix options

  • Puppeteer: send Network.setBlockedURLs on shared-worker sessions
    (blocklist works today); enforce page sessions with Fetch interception
    (required for audio worklets). Document the allowlist gap until a mechanism
    or a Chrome fix exists.
  • MCP: bump Puppeteer; optionally add the page-session Fetch enforcement in
    McpPage/McpContext and document both exceptions in puppeteer-options.ts,
    docs/configuration.md and SECURITY.md in the meantime.

Separate minor finding: status leaks daemon arguments

chrome-devtools status prints DaemonStatusResult.args unredacted:

args=["--viaCli","--ws-endpoint=ws://127.0.0.1:65535/devtools/browser/x?token=SECRET","--ws-headers={\"Authorization\":\"Bearer TOPSECRET\"}"]

redactDaemonArgsForLogging already exists in src/utils/logger.ts and is
applied by daemon/client.ts before the start log, but the daemon stores and
returns the raw mcpArgs and src/bin/chrome-devtools.ts prints
JSON.stringify(data.args). status is the documented health check, so
bearer tokens end up in pasted reports and CI logs. Redacting in the daemon
when building the status result (or applying the helper before printing) fixes
it.

Dominant language
TypeScript
Stars
59.8k
Forks
4.8k
Avg merge
2d 10h
Merged PRs (30d)
162

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ChromeDevTools/chrome-devtools-mcp

All issues in ChromeDevTools/chrome-devtools-mcp

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.