Skip to content
RCE Write-up Intermediate

From Curiosity to Shell phpinfo()

The login page leaked valid usernames through response timing, and the API lacked CSRF checks and rate limiting, allowing credential brute force. After logging in, an unrestricted profile picture upload accepted a PHP file disguised as an image, leading to remote code execution.

medium.com

Published on medium.com

It was 2 a.m., and I was on my third cup of coffee, eyes straining in the glow of my monitor, watching the response from a server I’d poked just a little too gently over the past two hours. I wasn’t even sure what I was looking for anymore - just that itch, that gut feeling every ethical hacker knows.

Dhiren Kumar Pradhan, 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 application used timing differences to reveal valid usernames, omitted CSRF and rate limiting on the API, and saved uploaded files without validating their content or preventing execution.

Impact

An attacker could enumerate usernames, brute-force credentials through the API, and upload a malicious file to execute code on the server.

What the attacker needed

Access to the login page and API; a list of usernames; a valid username and password; ability to upload a profile picture

How it was found

  1. Observe that failed logins return slightly different response times for valid usernames.
  2. Automate login attempts with a fixed password and a list of usernames to confirm timing differences.
  3. Test the API and find it lacks CSRF checks and rate limiting.
  4. Brute-force credentials through the API to obtain a valid username and password.
  5. Upload a file with a .php extension (rejected), then rename to .jpg (accepted) and note it is served from /uploads/.
  6. Append PHP code inside a valid image header, upload, and visit the file to trigger phpinfo() and achieve remote code 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.

The login page responded slightly slower for real usernames, letting an attacker discover which accounts exist. The mobile API had no protection against repeated password guesses, so the attacker could try many passwords. The profile picture upload saved files without checking their contents, so a file that looked like an image but contained code could be run by 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.