Remote Code Execution via Misconfigured File Upload Using Encrypted Payload (AK47WebShell)
Two file upload endpoints accepted a PHP file without proper validation, and the server leaked the uploaded file's path in responses. An attacker could upload a web shell and execute arbitrary commands on the server.
Published on medium.com
While monitoring a production instance, we identified a critical oversight in the application’s file upload mechanisms—one that could have catastrophic consequences. File upload features are frequently under-secured, and this instance was no exception.
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 endpoints lacked proper file type and extension validation, and the server disclosed the uploaded file's path in responses.
Impact
An attacker could execute arbitrary system commands, exfiltrate sensitive data, install persistent backdoors, and potentially move laterally or escalate privileges.
What the attacker needed
Valid user account; access to upload features
The fix
The report recommends strict file validation, storing uploads outside the web root, not disclosing file paths, and disabling script execution in upload directories.
How it was found
- Log in and go to the News section upload feature.
- Upload a PHP file; the server renames it but discloses the path in the response.
- Access the disclosed path in a browser to execute the shell.
- Alternatively, go to Profile Settings and upload a PHP file as an avatar.
- The upload response does not show the path; update profile info and intercept the response to find the path.
- Access the leaked path to execute the shell.
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 users upload files but did not check what kind of file it was. The attacker uploaded a PHP script (a program that runs on the server) and then found its location because the server told them the path. By visiting that path, the script ran and gave the attacker control of the server.
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.