Skip to content
File upload Write-up Beginner

BPP [$750]Arbitrary File Upload Vulnerability To Remote Code Execution (RCE) Outside the Platform.

The application's profile photo upload endpoint did not validate file extensions, allowing an attacker to upload a PHP file. The attacker could then execute arbitrary commands on the server by accessing the uploaded file with a query parameter.

aryasec Follow

Published on aryasec.medium.com

Hello everyone, introducing my name Tengku Arya Saputra (Follow my LinkedIn). On this occasion I will tell you how I found a security hole with a very critical vulnerability level.

Tengku Arya Saputra, on aryasec.medium.com

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

This vulnerability allows an attacker to execute commands directly on the server, potentially reading sensitive files, exposing system configurations, and using the server as a pivot to attack other systems.

What the attacker needed

A user account with profile photo upload feature; ability to intercept and modify HTTP requests

The fix

The application should validate file extensions and restrict uploads to safe image types, and store uploaded files outside the web root or disable script execution in upload directories.

How it was found

  1. Observe the profile photo upload request to the endpoint /mobile/update-photo.
  2. Rename a file to have a .php extension and add PHP code to execute commands.
  3. Upload the file via a multipart/form-data request.
  4. Receive a 'Success' response confirming the upload.
  5. Locate the uploaded file at a URL under /assets/images/profile/.
  6. Access the file with a ?cmd= parameter to execute commands on the server.

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 any file type, including a script that runs on the server. When the attacker later opened that file in a browser, the server executed the script, giving the attacker control over the server. This is dangerous because it can lead to full server compromise.

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.

More by aryasec

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.