Skip to content
SQL injection Write-up Intermediate

From SQL Injection to Remote Code Execution: A Bug Bounty Hunter’s Unexpected Journey

The author claims a login form's email field was vulnerable to SQL injection, which let them dump the database and find plaintext admin credentials. Logging in as admin, they bypassed a file-type check on an image upload and uploaded a PHP web shell, gaining remote code execution.

gouravrathod8788 Follow

Published on medium.com

It all started as just another day in my bug bounty hunting routine. I had been scanning web applications for hours, looking for low-hanging fruit—basic misconfigurations, XSS, or maybe a juicy SQL injection.

Gourav Singh Rajput, 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 login query built SQL from unsanitised input, admin passwords were stored in plaintext, and the upload check trusted only the declared file type.

What the attacker needed

Access to the login page; no account needed initially

How it was found

  1. Send a quote-based payload in the email field and observe a SQL error
  2. Confirm with a UNION-based payload that returns different output
  3. Use SQLMap to dump database names and the user list
  4. Read the admin_logs table and find plaintext admin credentials
  5. Log in to the admin panel and upload a PHP shell disguised as an image
  6. Change the Content-Type to image/jpeg and request the uploaded file with a command

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.

A login form sent what you typed straight into a database command, so special characters could change that command. That let the author read the whole user table, including an admin password stored in plain text. With admin access they uploaded a small program disguised as a picture, and the server ran it, giving them control of the machine.

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.