Identifying Boolean-based

Scenario

Target: Aunt Maria's Donuts - Business website Scope: External attacker simulation (no credentials)


Reconnaissance

Registration Page Discovery

Navigate to signup page and observe behavior:

http://<TARGET>/signup.php

When entering username, notice:

"The username 'moody' is available"

This suggests database query to check username existence.


Investigating Username Check

Source Code Analysis

Step 1: View page source

The onfocusout event triggers checkUsername() when user leaves field.

Step 2: Find JavaScript reference

Step 3: Analyze signup.js

Key Findings

Element
Value

Endpoint

/api/check-username.php?u=<username>

Method

GET

Response

{"status": "available"} or {"status": "taken"}


Testing for SQLi

Initial Probing

Username
Response

admin

status: taken

maria

status: taken

'

500 Internal Server Error ⚠️

Single quote causes error = potential SQLi!

Backend Query (Assumed)

With ' input:


Confirming Boolean-based SQLi

Injection Test

Payload: ' or '1'='1

Resulting Query:

Since '1'='1' is always true β†’ query returns rows β†’ status: taken

Burp Suite Test

Response:

Confirmation Matrix

Payload
Expected
Reason

' or '1'='1

taken

Always true

' and '1'='2

available

Always false

' or '1'='2

available

False condition

' and '1'='1

Depends on base

True but empty base


What We Know

Vulnerability Confirmed

βœ… Boolean-based Blind SQL Injection

Oracle Responses

Response
Meaning

status: taken

Query returned rows (TRUE)

status: available

Query returned nothing (FALSE)

Limitations

  • ❌ No direct data output

  • ❌ No error messages with data

  • βœ… Can ask "Yes/No" questions

  • βœ… Can infer data bit by bit


Attack Strategy

Example Extraction Logic


Next Steps


Quick Reference

Common Boolean Payloads

URL Encoding

Character
Encoded

'

%27

(space)

%20

=

%3D

--

%2D%2D

Last updated