Hacking NASA Without a Login: How One Clojure Function Gave Me Root Access
A Clojure validation function used the unsafe read-string on a user-supplied URL parameter, allowing code execution. An unauthenticated attacker could run arbitrary OS commands as root on the server.
You get used to looking at a lot of source code when bug hunting. Most of the time it’s a grind, but every once in a while, you spot something so blatantly dangerous you have to double-check your screen.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The code used clojure.core/read-string, which evaluates reader macros such as #=(), on unsanitised user input instead of the safe clojure.edn/read-string.
Impact
Any unauthenticated internet user could have executed arbitrary OS commands as root, exfiltrated sensitive databases, or pivoted into NASA’s internal AWS VPC network.
What the attacker needed
No account needed; network access to the search API
The fix
The fix was to replace clojure.core/read-string with clojure.edn/read-string.
How it was found
- Send a payload that evaluates to a positive integer and observe HTTP 200 OK.
- Send a payload that evaluates to a negative integer and observe HTTP 400 Bad Request.
- Send a payload that sleeps for four seconds and observe the delayed response.
- Send a payload that divides by zero and observe HTTP 500 Internal Server Error.
- Send a payload that triggers an out-of-band DNS lookup and observe the canary logs.
- Use a binary-search script that reads files with slurp and asks yes/no maths questions to extract characters.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The server took a value from the web address and fed it to a Clojure function that can run code, not just read data. Because the value was not checked, the author could make the server do maths, sleep, and eventually read files as the root user.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.