Skip to content
SQL injection Disclosed report Intermediate

[https://reviews.zomato.com] Time Based SQL Injection

Two cookies sent by the reviews site were passed into SQL queries without proper handling, so an attacker could inject SQL and make the database pause on demand. By timing those pauses, the attacker could confirm the injection and read the database version.

samengmg Follow

Originally disclosed on HackerOne

Bounty$1,000 Critical View original
  • Fixed in 3 days
  • Paid in 17 days
  • Disclosed after 41 days

Summary by the program

@samengmg found an cookie based SQL injection on https://reviews.zomato.com.

Summary by the researcher

I noticed that two cookies were submitted during a request during the login page of https://reviews.zomato.com

orange
squeeze

Due to the oddly named cookies, I decided to fuzz them. Eventually, I discovered both are vulnerable to SQL injection with different techniques.

For orange cookie Initial payload to determine issue

1'=sleep(10)='1 

Not only the server slept for 10 seconds but the HTTP response code was 200 (the normal response is a 302 redirect)

This led me to craft out the following payloads: Payloads used to determine database version:

'=IF(MID(VERSION(),1,1)=1,SLEEP(10),0)='1
'=IF(MID(VERSION(),1,1)=5,SLEEP(10),0)='1

For squeeze cookie: Initial payload to determine issue

1 ' or true# 
1 ' or false#

From here it was pretty straightforward.

Thank you Zomato team for the highest bounty stated in the policy.

The original report as published on HackerOne, by samengmg. 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 built SQL queries by concatenating raw cookie values instead of using parameterised queries.

Impact

An attacker could extract data from the database, including its version, through time-based blind injection.

What the attacker needed

Ability to set the two cookies; access to the login page

How it was found

  1. Notice the two oddly named cookies sent during a request on the login page.
  2. Fuzz both cookies to look for injection behaviour.
  3. For the first cookie, send a payload that causes a delay and observe the server sleeping and returning a 200 instead of the usual 302.
  4. Use conditional time-based payloads to test characters of the database version.
  5. For the second cookie, send true and false conditions to confirm injection.

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 cookie is a small piece of data a website stores in your browser and sends back on each request. Here the site put cookie values straight into database commands, so a modified cookie could change what the database does. The attacker used delays in the response to tell whether their guesses about the database were right.

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 samengmg

View all

1 more disclosed report, best first.

More from Eternal

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.