Earned $3,500 : How I Gained Shell Access on a Company
A file upload server accepted a PHP file with a mixed-case extension, which then executed on the server. The attacker used this to run system commands and obtain a reverse shell, leading to remote code execution on a production-facing server.
Published on medium.com
In the bug bounty space, RCE (Remote Code Execution) or shell access is the holy grail. It’s high-impact, rare, and usually well-defended.
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
Impact
The attacker could execute arbitrary commands and gain a reverse shell on a production-facing server, potentially leading to further compromise, though no data was exfiltrated and access was dropped immediately.
What the attacker needed
Public bug bounty program; file upload endpoint accessible; no authentication required
The fix
The file upload validation should be strengthened to block executable file types regardless of extension case, and uploaded files should be stored outside the web root or served without execution.
How it was found
- Perform passive subdomain enumeration and identify a file upload server.
- Upload a PHP file with a mixed-case extension (.pHp5) which is accepted.
- Access the uploaded file and confirm code execution.
- Run system commands via a query parameter to verify command execution.
- Upload a reverse shell payload and trigger it to gain shell access.
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.
A file upload feature let someone upload a file that the server then ran as a program, instead of just storing it. By naming the file with a slightly different extension, the upload check was bypassed, and the server executed the code. This gave the attacker control over the server, like having a command prompt on it.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.