Skip to content
RCE Write-up Beginner

$1000 Bounty: Command Injection Vulnerability

The application accepted an uploaded file with a modified filename and content, allowing a PHP backdoor to be placed in an upload directory. An attacker could then execute arbitrary system commands on the server, achieving remote command execution.

medium.com

Published on medium.com

🔓Free Article Link: Click Here

Abhijeet kumawat, on 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

Root cause

Likely the upload feature did not properly validate file extensions or content, and stored uploaded files in a location where they could be executed as PHP.

Impact

An attacker could execute arbitrary system commands on the server, leading to remote command execution and potential deeper access.

What the attacker needed

Access to a file upload feature; ability to intercept and modify requests

The fix

The upload feature should validate file extensions and MIME types, check the entire file content, store uploaded files outside the web root, and prevent execution of uploaded files.

How it was found

  1. Select an image file and capture the upload request in Burp Suite.
  2. Send the request to Burp Repeater and change the filename to a PHP file and inject a PHP backdoor payload inside the file.
  3. Forward the modified request; the server accepts the file.
  4. Access the uploaded PHP file with a command parameter to execute system commands such as whoami.
  5. Run further commands such as reading the system password file to gather more information.

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 someone upload a file that the server would later run as a program. Because the server did not check the file properly, the attacker could make the server run commands of their choice, like listing users or reading system files.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.