How to fix: SharedArrayBuffer Used Without Cross-Origin Isolation
An inline script on the page constructs a SharedArrayBuffer, but the response headers do not establish cross-origin isolation: Cross-Origin-Opener-Policy: same-origin combined with Cross-Origin-Embedder-Policy: require-corp or credentialless.
Why it matters
Modern browsers only expose a working, high-resolution SharedArrayBuffer inside a crossOriginIsolated context. Without both headers set correctly, the constructor throws or self.crossOriginIsolated is false, and none of the Spectre-class side-channel protections that cross-origin isolation exists for are actually active on the page, even though the code was written assuming they are.
SharedArrayBuffer lets two agents on the same page read and write the same block of memory, which combined with a high-resolution timer is exactly the primitive a Spectre-style attack needs. Browsers gate access behind crossOriginIsolated (Cross-Origin-Opener-Policy: same-origin plus Cross-Origin-Embedder-Policy: require-corp or credentialless) so only pages that isolate themselves from unrelated cross-origin resources get it back.
How to fix it
- 1Send Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp (or credentialless) on every response that loads this script.
- 2After adding COEP: require-corp, verify every cross-origin subresource (images, iframes, fonts, scripts) sends Cross-Origin-Resource-Policy or passes CORS, since require-corp blocks anything that doesn't.
- 3Check self.crossOriginIsolated in the browser console after deploying to confirm isolation is actually active.
Code examples
Next.js
// next.config.mjs
export default {
async headers() {
return [{
source: "/(.*)",
headers: [
{ key: "Cross-Origin-Opener-Policy", value: "same-origin" },
{ key: "Cross-Origin-Embedder-Policy", value: "require-corp" },
],
}];
},
};References
Detected automatically by VulnRadar. The check id is shared-array-buffer-not-isolated, stable across every scan so you can filter or diff on it.
More headers checks
Questions
- How severe is SharedArrayBuffer Used Without Cross-Origin Isolation?
- VulnRadar rates this medium severity in the headers category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id shared-array-buffer-not-isolated, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does SharedArrayBuffer Used Without Cross-Origin Isolation map to?
- It maps to CWE-693. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.