File Upload (RCE) to Bounty | HackerOne
An internet-facing host on a non-standard port accepted uploads of any file type and served them back from an uploads folder, so a PHP script placed there executed on the server. The author reports that this allowed remote command execution and was accepted as valid with a bounty.
medium.com
Published on medium.com
So it’s a Private Program in Hackerone. So I started with Subdomain Enumeration.
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
Likely the upload endpoint did not restrict file types and stored uploads in a web-served directory that executes server-side scripts.
Impact
An attacker could run arbitrary commands on the server hosting the upload endpoint.
What the attacker needed
Internet-reachable host on port 8443; upload endpoint accepts any file type
How it was found
- Enumerate subdomains of the target domain.
- Search Shodan for hosts belonging to the domain.
- Find a host on port 8443 that accepts uploads of any file type.
- Upload a PHP script that runs a command from a query parameter.
- Request the uploaded file in the uploads folder with a command to confirm execution.
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.
Some web servers will run any file you upload if it ends in a scripting extension such as .php. If the upload folder is reachable from the internet, an attacker can upload a small program and then ask the server to run it, which lets them run commands on the machine. This is called remote code execution, or RCE.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.