How I Accidentally Hacked a Government Payment Portal While Looki
A demo file-upload endpoint from the jQuery File Upload library was left in production on a government payment portal, with no authentication or file-type checks. Because uploaded PHP files were stored in the web root and executed, an attacker could upload a script and run code on the server.
It was a Tuesday night. I was sitting in my room, staring at my terminal with the determination of someone who definitely should have been doing something more productive.
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 a bundled demo upload script was deployed to production without authentication, file-type validation, or preventing execution of uploaded files.
Impact
An attacker could run arbitrary code on the server, which could lead to access to citizen payment data, ransomware, or persistent backdoors; the author notes the server had all dangerous PHP functions enabled.
What the attacker needed
Internet access; no account needed; basic command-line knowledge
The fix
The demo upload endpoint should be removed from production, uploaded files should be stored outside the web root with validation and authentication, and PHP execution in upload folders should be disabled.
How it was found
- Find the forgotten upload endpoint through archived URLs of the site
- Upload a harmless text file to the endpoint
- Notice the upload returns an error but the file is still stored
- Fetch the file from the predictable uploads folder to confirm it is public
- Upload a PHP file containing only a configuration display function
- Request the uploaded PHP file and see the server execute it
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 web server can be told to run small programs written in a language called PHP. This site kept a sample upload page that anyone could use and that saved files into a folder the server would happily run. So a visitor could upload their own little program and make the server do things for them.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.