{GCC-13/09/23}

Introduction aux attaques sur le WEB

Drahoxx

2

Quelques failles : SQLi, LFI, XSS, idor

1

Les bases du web : Client/Serveur, Reverse-Proxy, Backend/Frontend, GET/POST, etc.

3

Intéractif :

Trouve la faille dans le code !

4

Les challenges de Mika !

Drahoxx

3

xanhacks - DOM Clobbering

Le principe du Client/Serveur

# LES BASES DU WEB

Drahoxx

Le principe du Client/Serveur

# LES BASES DU WEB

Drahoxx

FRONT - END

BACK - END

Le principe du Client/Serveur

# LES BASES DU WEB

Drahoxx

http://abc.lan/

Le "simple"

Le principe du Client/Serveur

# LES BASES DU WEB

Drahoxx

http://abc.lan/

Le proxifié

Le principe du Client/Serveur

# LES BASES DU WEB

Drahoxx

http://abc.lan/user

Le complet

Décodage

Requête SQL

Résultat SQL

Réencodage

Les requêtes GET et POST

# LES BASES DU WEB

Drahoxx

GET

"C'est la méthode la plus courante pour demander une ressource. Une requête GET est sans effet sur la ressource, il doit être possible de répéter la requête sans effet." ~ Wikipédia
# LES BASES DU WEB

Drahoxx

GET

https://www.google.com/search?channel=fs&client=ubuntu-sn&q=test

Protocol : HTTPS

Host : google.com

Endpoint : /search

Parameters :

-    channel=fs

-    client=ubuntu-sn

-    q=test

Les requêtes GET et POST

Les requêtes GET et POST

# LES BASES DU WEB

Drahoxx

POST

"Cette méthode est utilisée pour transmettre des données en vue d'un traitement à une ressource (le plus souvent depuis un formulaire HTML). " ~ Wikipédia
# LES BASES DU WEB

Drahoxx

POST

http://192.168.0.2/login

Protocol : HTTP

Host : 192.168.0.2

Endpoint : /login

Parameters :

-    username=abc

-    password=Sup3r...

Les requêtes GET et POST

-> username=abc
-> password=Sup3rP@sswd
# LES BASES DU WEB

Drahoxx

Les requêtes GET et POST

Quelques failles WEB...

# LES BASES DU WEB

Drahoxx

SQLi

http://abc.lan/user

Décodage

Requête SQL

Résultat SQL

Réencodage

Injection dans une requête SQL (SQLi = SQL injection)

 

Quelques failles WEB...

# LES BASES DU WEB

Drahoxx

SQLi

result = cur.execute(f"SELECT uid FROM users WHERE username='{rq_username}' and password='{rq_passwd}';").fetchone()

Quelques failles WEB...

# LES BASES DU WEB

Drahoxx

SQLi

"SELECT uid FROM users WHERE
username='{rq_username}' 
and 
password='{rq_passwd}';"
"SELECT uid FROM users WHERE
username='Toto' 
and 
password='Sup3rP@ssW0rd';"

Quelques failles WEB...

# LES BASES DU WEB

Drahoxx

SQLi

rq_username = "Toto"
rq_passwd = "Sup4rP@ssw0rd"
"SELECT uid FROM users WHERE
username='Toto' 
AND
password='Sup3rP@ssW0rd';"

Quelques failles WEB...

# LES BASES DU WEB

Drahoxx

SQLi

rq_username = "' OR 1=1-- -"
rq_passwd = "aaa"
"SELECT uid FROM users WHERE
username='' OR 1=1-- -' 
AND
password='aaa';"
"SELECT uid FROM users WHERE username='' OR 1=1-- -' AND password='aaa';"

Quelques failles WEB...

# LES BASES DU WEB

Drahoxx

iDOR

https://moodle.univ-ubs.fr/course/view.php?id=2550

 

Modification d'un paramètre numérique pour réaliser une actions.

 

https://gcc-ensibs.fr/users/reset_password/133
https://gcc-ensibs.fr/users/reset_password/1 <- reset admin

Quelques failles WEB...

# LES BASES DU WEB

Drahoxx

X   SS

Cross-site Scripting, envoyer du code executable en front-end à d'autres utilisateurs
- Redirection
- Vol de cookies
- Suppression compte

- ...

Quelques failles WEB...

# LES BASES DU WEB

Drahoxx

XSS

Code normal
Code injecté

Quelques failles WEB...

# LES BASES DU WEB

Drahoxx

FI

Local-File Inclusion, accéder à des fichiers arbitraires

Quelques failles WEB...

# LES BASES DU WEB

Drahoxx

LFI

https://cmde.cyber-range.lan/index.php?file=login.php
https://cmde.cyber-range.lan/index.php?file=../../../../etc/passwd
# LES BASES DU WEB

Drahoxx

Des questions ?

Place à xanhacks

Code

By Léo Chaigneau (Drahoxx)