Skip to content
SQL injection Write-up Beginner

Upload2Own: How SQL Injection and File Upload Flaws Lead to Remot

A login form on a subdomain was vulnerable to SQL injection, allowing unauthenticated access to the CMS. The CMS's image upload feature accepted a PHP file, which when accessed executed commands, giving remote code execution on a shared server that also hosted the main site.

Adarsh Kumar Follow

Published on adarshkrdubay.medium.com

I was poking around a public website of a company, running routine tests — parameter tampering, hidden directories, endpoint fuzzing — but nothing stood out. No low-hanging fruit, no juicy headers, no outdated tech stack.

Adarsh Kumar, on adarshkrdubay.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 login form concatenated user input into SQL queries without parameterisation, and the file upload feature did not validate file types or prevent execution of uploaded scripts.

Impact

An attacker could gain remote code execution on the CMS server and, because it was shared, also control another production website hosted on the same VPS.

What the attacker needed

Access to the public website; no account needed

How it was found

  1. Enumerate subdomains and find a login panel on a subdomain.
  2. Try a classic SQL injection payload in the login form and gain access.
  3. Use the testimonial feature to upload a PHP web shell as an image.
  4. Browse to the uploaded file and append a command parameter to execute commands.
  5. Explore the server and notice another public_html folder for a different domain on the same VPS.

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 could be tricked into letting anyone in without a password because it built database queries unsafely. Once inside, the site let the attacker upload a file that the server would run as a program, giving control over the server. That server also hosted another website, so both were affected.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.