DEV Community

CVE Reports
CVE Reports

Posted on Originally published at cvereports.com

CVE-2026-69155: CVE-2026-69155: Stored Cross-Site Scripting in Atomic Server File Download Handler

CVE-2026-69155: Stored Cross-Site Scripting in Atomic Server File Download Handler

Vulnerability ID: CVE-2026-69155
CVSS Score: 8.7
Published: 2026-11-18

CVE-2026-69155 (GHSA-x277-3wcg-g9r2) is a stored cross-site scripting (XSS) vulnerability in Atomic Server versions 0.30.0 prior to 0.40.3. The vulnerability resides in the HTTP file-download handler (server/src/handlers/download.rs), which serves user-uploaded files with an inline Content-Disposition and attacker-controlled MIME types such as text/html or image/svg+xml. Because the endpoint lacks X-Content-Type-Options: nosniff and Content-Security-Policy restrictions, an authenticated user with upload privileges can store malicious JavaScript that executes within a victim's browser in the primary application origin. Executing code in this context grants access to non-HttpOnly session cookies and unencrypted Ed25519 cryptographic private keys stored in IndexedDB, leading to full account takeover.

TL;DR

Atomic Server prior to v0.40.3 serves user-uploaded files inline from the primary origin without forcing an attachment disposition or setting nosniff headers. An authenticated attacker can upload an HTML or SVG document containing JavaScript to extract a victim's session cookie and Ed25519 private signing keys from IndexedDB when the victim navigates to the download URL.


⚠️ Exploit Status: POC

Technical Details

  • Vulnerability Type: CWE-79: Stored Cross-Site Scripting (XSS)
  • Affected Component: server/src/handlers/download.rs (GET /download/{path})
  • CVSS v3.1 Score: 8.7 High (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N)
  • EPSS Score: 0.43% (37.87th percentile)
  • Primary Impact: Exfiltration of non-HttpOnly session cookies and IndexedDB Ed25519 private keys
  • Patched Version: Atomic Server v0.40.3
  • Exploit Status: Proof-of-Concept documented in security advisory
  • CISA KEV Status: Not Listed

Affected Systems

  • Atomic Server (ontola/atomic-server)
  • atomic_lib Rust crate
  • atomic-cli Rust crate
  • atomic-server-tauri
  • atomic-server: >= 0.30.0, < 0.40.3 (Fixed in: 0.40.3)

Code Analysis

Commit: 8a8badf

fix(security): serve uploaded files as attachment to prevent stored XSS

@@ -1,5 +1,8 @@
 use crate::{appstate::AppState, errors::AtomicServerResult, helpers::get_client_agent};
 use actix_files::NamedFile;
+use actix_web::http::header::{
+    ContentDisposition, DispositionParam, DispositionType, HeaderName, HeaderValue,
+};
 use actix_web::{web, HttpRequest, HttpResponse};
 use atomic_lib::{urls, Resource, Storelike};

@@ -71,13 +74,14 @@ pub fn download_file_handler_partial(
         .map_err(|e| format!("Internal ID of file could not be resolved. {}", e))?
         .to_string();
     let filename = sanitize_filename::sanitize(&raw_filename);
+    let download_name = resource.get(urls::FILENAME).ok().map(|v| v.to_string());

     let file_path = safe_join_uploads_path(&appstate.config.uploads_path, &filename)?;

     // No params were given, so we just return the file.
     if params.q.is_none() && params.w.is_none() && params.f.is_none() {
         let file = NamedFile::open(&file_path)?;
-        return Ok(file.into_response(req));
+        return Ok(force_attachment(file, req, download_name));
     }

     create_processed_folder_if_not_exists(&appstate.config.uploads_path)?;
@@ -86,7 +90,7 @@ pub fn download_file_handler_partial(

     if processed_file_path.exists() {
         let file = NamedFile::open(processed_file_path)?;
-        return Ok(file.into_response(req));
+        return Ok(force_attachment(file, req, download_name));
     }

     // only if image feature flag is on
@@ -101,7 +105,7 @@ pub fn download_file_handler_partial(
     }

     let file = NamedFile::open(processed_file_path)?;
-    Ok(file.into_response(req))
+    Ok(force_attachment(file, req, download_name))
 }

 /// Joins `filename` onto `base`, refusing to serve anything outside `base`.
@@ -124,6 +128,27 @@ fn safe_join_uploads_path(base: &PathBuf, filename: &str) -> AtomicServerResult<
     Ok(candidate)
 }

+/// Serves user-uploaded content as a forced download rather than rendering it inline.
+/// Uploaded HTML/SVG would otherwise be rendered by the browser in the app's own
+/// origin (actix-files defaults those mimetypes to `inline`), letting a stored script
+/// read the same-origin session cookie and the Agent's private key out of IndexedDB.
+fn force_attachment(file: NamedFile, req: &HttpRequest, filename: Option<String>) -> HttpResponse {
+    let parameters = match filename {
+        Some(name) => vec![DispositionParam::Filename(name)],
+        None => vec![],
+    };
+    let file = file.set_content_disposition(ContentDisposition {
+        disposition: DispositionType::Attachment,
+        parameters,
+    });
+    let mut response = file.into_response(req);
+    response.headers_mut().insert(
+        HeaderName::from_static("x-content-type-options"),
+        HeaderValue::from_static("nosniff"),
+    );
+    response
+}
Enter fullscreen mode Exit fullscreen mode

Commit: 457c1dc

fix(security): serve blobs as attachment to prevent stored XSS

@@ -2,6 +2,7 @@ use crate::{
     appstate::AppState, context::RequestContext, errors::AtomicServerResult,
     helpers::get_client_agent,
 };
+use actix_web::http::header::{ContentDisposition, DispositionType};
 use actix_web::{web, HttpRequest, HttpResponse};
 use atomic_lib::{urls, Resource, Storelike};

@@ -43,9 +44,7 @@ pub async fn handle_download(
     if params.q.is_none() && params.w.is_none() && params.f.is_none() {
         if let Some(hash_hex) = subject_path.strip_prefix("/files/") {
             if let Some(bytes) = blob_by_hash_hex(hash_hex, &appstate)? {
-                return Ok(HttpResponse::Ok()
-                    .content_type("application/octet-stream")
-                    .body(bytes));
+                return Ok(user_blob_response("application/octet-stream", bytes));
             }
         }
     }
@@ -56,9 +55,7 @@ pub async fn handle_download(
     if subject.is_blob_did() {
         if let Some(hash_hex) = subject.blob_hash_hex() {
             if let Some(bytes) = blob_by_hash_hex(hash_hex, &appstate)? {
-                return Ok(HttpResponse::Ok()
-                    .content_type("application/octet-stream")
-                    .body(bytes));
+                return Ok(user_blob_response("application/octet-stream", bytes));
             }
         }
     }
@@ -76,6 +73,32 @@ pub async fn handle_download(
     download_file_handler_partial(&resource, &req, &params, &appstate)
 }

+fn user_blob_response(content_type: impl AsRef<str>, bytes: Vec<u8>) -> HttpResponse {
+    HttpResponse::Ok()
+        .content_type(content_type.as_ref())
+        .insert_header((
+            actix_web::http::header::CONTENT_DISPOSITION,
+            ContentDisposition {
+                disposition: DispositionType::Attachment,
+                parameters: vec![],
+            },
+        ))
+        .insert_header((
+            actix_web::http::header::HeaderName::from_static("x-content-type-options"),
+            actix_web::http::header::HeaderValue::from_static("nosniff"),
+        ))
+        .body(bytes)
+}
Enter fullscreen mode Exit fullscreen mode

Mitigation Strategies

  • Upgrade Atomic Server and associated Rust crates to version 0.40.3 or later to enforce Content-Disposition: attachment and X-Content-Type-Options: nosniff on all download responses.
  • Configure fronting reverse proxies (NGINX, Caddy, Cloudflare, Traefik) to inject Content-Disposition: attachment, X-Content-Type-Options: nosniff, and Content-Security-Policy: sandbox on the /download/ path prefix.
  • Audit existing uploaded resources for active document MIME types (text/html, image/svg+xml) and rotate Agent Ed25519 cryptographic keys if compromise is suspected.
  • Harden client-side credential storage by enforcing HttpOnly on session cookies and utilizing non-exportable WebCrypto CryptoKey objects in IndexedDB.

Remediation Steps:

  1. Download and deploy the official Atomic Server v0.40.3 release binary or container image from https://github.com/ontola/atomic-server/releases/tag/v0.40.3.
  2. If building from source, update Cargo dependencies for atomic-server and atomic_lib to >= 0.40.3 and recompile the workspace.
  3. Verify the patch by issuing a curl -I request against a known /download/{path} endpoint and confirming the presence of Content-Disposition: attachment and x-content-type-options: nosniff in the HTTP response headers.
  4. If patching is delayed, apply the NGINX location /download/ header override block and reload the proxy configuration.

References


Read the full report for CVE-2026-69155 on our website for more details including interactive diagrams and full exploit analysis.

Top comments (0)