Summary
Atomic Server can serve uploaded HTML or SVG as inline content from the application's origin, allowing it to run as active browser content. If an authenticated Agent can write to a folder and a victim opens the uploaded content, its script may access same-origin credentials and enable account impersonation.
Affected context
The issue affects Atomic Server deployments where an authenticated Agent has folder write access and uploaded content can be retrieved through GET /download/{path}. The download handler serves HTML or SVG inline from the application origin without forcing attachment handling or setting X-Content-Type-Options: nosniff, so a victim's browser may render the content as active same-origin content.
Exploit preconditions
- Attack surface: The upload and download endpoints
- Required access: An authenticated Agent with write access to a folder
- Trigger point: A victim opens a link to the uploaded content
- Why exploitation is possible: The response permits active HTML or SVG to execute in the application's origin, where browser scripts may access JavaScript-readable same-origin data
Why this happens
The download handler serves user-controlled HTML or SVG inline from the application origin without sufficient safeguards to prevent browser execution. This is a stored cross-site scripting flaw mapped to CWE-79: Improper Neutralization of Input During Web Page Generation. The insecure pattern is allowing uploaded active content to be interpreted as trusted application-origin content rather than isolating it or serving it as a download.
Potential impact
- A victim's browser may execute attacker-controlled script in the application's origin
- The script could access the JavaScript-readable
atomic_sessioncookie - The script could access the Agent private key stored in same-origin IndexedDB
- Stolen credentials may enable persistent account impersonation
General mitigation guidance
Defensive patterns focus on preventing user-controlled active content from executing in the application's security origin.
- Serve uploaded files as attachments by default, with an appropriate
Content-Dispositionheader - Set
X-Content-Type-Options: nosniffand use carefully controlled content types - Store or serve user uploads from a separate origin that does not share application credentials
- Reduce the trust placed in uploaded content and restrict which users or Agents can write to served folders
- Protect sensitive credentials with least-privilege access and avoid exposing long-lived secrets to browser-accessible storage where possible
How teams detect issues like this
- Review upload and download handlers for user-controlled HTML or SVG served inline from the application origin
- Use static analysis and code review checks to identify missing attachment handling and content-sniffing protections
- Apply response-header policies that require safe defaults for untrusted file downloads
- Test whether uploaded active content can execute in the application origin and access browser-accessible credentials
- Monitor for unusual uploads of active-content formats and unexpected access to download links

