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.
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.
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
- Enumerate subdomains and find a login panel on a subdomain.
- Try a classic SQL injection payload in the login form and gain access.
- Use the testimonial feature to upload a PHP web shell as an image.
- Browse to the uploaded file and append a command parameter to execute commands.
- 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.