githubEdit

DnsAdmins

DnsAdmins

DnsAdmins group have access to DNS information on the network

The Windows DNS service supports custom plugins and can call functions from them to resolve name queries that are not in the scope of any locally hosted DNS zones.

The DNS service runs as NT AUTHORITY\SYSTEM

DNS management is performed over RPC

image.png

Leveraging DnsAdmins Access

Generating Malicious DLL

Transfer reverse shell to target

Loading DLL as Non-Privileged User

try to se the dnscmd utility to load a custom DLL with a non-privileged user. we will notice failure

Loading DLL as Member of DnsAdmins

As expected, attempting to execute this command as a normal user isn't successful. Only members of the DnsAdmins group are permitted to do this.

Loading Custom DLL

Note: We must specify the full path to our custom DLL or the attack will not work properly.

Only the dnscmd utility can be used by members of the DnsAdmins group, as they do not directly have permission on the registry key.

After restarting the DNS service

Finding User's SID

First, we need our user's SID.

Checking Permissions on DNS Service

Once we have the user's SID, we can use the sc command to check permissions on the service.

can see that our user has RPWP permissions which translate to SERVICE_START and SERVICE_STOP, which our user can start or stop dns service.

Stopping and Starting the DNS Service

Confirming Group Membership

If all goes to plan, our account will be added to the Domain Admins group or receive a reverse shell if our custom DLL was made to give us a connection back.

Signing with pwned user