Skip to content
RCE Write-up Intermediate

Picture Perfect Exploit: How Image Uploads Turned Into Shell Access

An unauthenticated image upload endpoint accepted a PHP file disguised as a JPEG, and a misconfigured backend served it as PHP when accessed with a semicolon in the filename. This allowed the attacker to execute arbitrary commands on the server.

infosecwriteups.com

Published on infosecwriteups.com

Free link 🎈

Iski, on infosecwriteups.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 endpoint only checked the file extension superficially and the backend server was misconfigured to execute files with certain extensions (like .php) even when they had extra characters like a semicolon.

What the attacker needed

No authentication required; upload endpoint accessible

How it was found

  1. Upload a file named shell.php.jpg containing PHP code in its metadata.
  2. The file is stored on an S3 bucket and accessible via a CDN URL.
  3. Fuzz alternative access paths to find one that executes the file as PHP.
  4. Access the file with a semicolon in the filename (shell.php;.jpg) and a cmd parameter to run commands.

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.

The website let anyone upload a picture, but it didn't properly check what kind of file it was. The attacker uploaded a file that looked like a picture but actually contained code. When the server later treated that file as a program instead of a picture, the attacker could run commands on the server.

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.