Upload. Execute. Compromise. The Hidden Danger of Unrestricted Fi
A file upload feature accepted a server-side script disguised as a document, with no validation of extension, content type or content. After a checker account approved the upload through the normal workflow, the file was reachable and the server executed commands passed to it, giving remote code execution.
Published on medium.com
File upload functionalities are everywhere — profile pictures, documents, invoices, reports. They feel harmless.
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 server trusted client-supplied file metadata and stored uploaded files in a web-accessible directory where scripts could execute, with no extension whitelist, content inspection or execution restriction.
Impact
An attacker could run arbitrary system commands, potentially leading to a reverse shell, full server compromise, data exfiltration and lateral movement; the text does not mention any defence that limited the exploit.
What the attacker needed
A user account able to upload files; a checker account to approve the upload
The fix
Uploads should be validated server-side against an extension whitelist and file signatures, stored outside the web root with randomised names, and served through a download handler with script execution disabled in the upload directory.
How it was found
- Find the file upload component in the document submission workflow.
- Intercept the upload request and change the file name, extension, content type and content to a server-side script.
- Approve the uploaded file using a checker account, following the normal workflow.
- Open the approved file in a new browser tab and pass system commands through parameters 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.
A file upload lets a user send a file to a website, which then stores it on its server. Here the site never checked what kind of file arrived, so the tester sent a program instead of a document. Because the server later ran that file when it was opened, the tester could make the server run commands of their choosing, which is called remote code execution.
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.