Skip to content
RCE Write-up Intermediate

Anatomy of a Full Compromise: From Information Disclosure to Remo

A download endpoint allowed arbitrary file reads, exposing source code and database credentials, and a photo upload feature accepted a PHP shell without validating file type. The attacker used these to run commands on the server and then accessed the database through a web database tool, reaching sensitive records and payment keys.

Viky Follow

Published on seek-er.medium.com

During a recent security assessment of an educational institution’s web application, I uncovered a chain of vulnerabilities that ultimately led to complete infrastructure compromise. What began as a simple configuration oversight escalated from local file inclusion to unrestricted file upload, and finally, full…

Viky, on seek-er.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 missing input validation on the download parameter and no file-type validation on uploads, combined with hard-coded database credentials in source code.

Impact

The attacker could read source code, execute commands on the server, and access over 70 database tables with more than 80,000 sensitive records including payment gateway keys and user credentials.

What the attacker needed

Access to the public website; no account needed

The fix

The text recommends disabling verbose errors, whitelisting download parameters, validating uploads and storing them outside the web root with execution disabled, and applying least privilege to database users.

How it was found

  1. Send a basic SQL injection payload to login pages and observe a SQL error revealing the backend file path.
  2. Use the download endpoint with a crafted filename to read PHP source files including config.php.
  3. Download fileupload.php via the same flaw and note it does not validate file type.
  4. Upload a PHP shell through the photo upload feature using a custom POST request.
  5. Visit the uploaded shell path to confirm execution and connect a reverse shell.
  6. Upload Adminer and log in with the harvested database credentials to access the database.

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 site had a file download feature that did not check which files could be requested, so the author could download the site's own code. That code contained the database password. Separately, a photo upload feature accepted a PHP script as if it were an image, letting the author 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.