Windows User Privileges
SeImpersonate
These privileges are required for an attack:
SeAssignPrimaryToken: Allows a process to assign the primary token for a process. This privilege is critical for creating processes with specific user security contexts.
SeCreateToken: The SeCreateToken privilege allows a process to create new security tokens, typically used for authentication and identity representation.
SeImpersonatePrivilege: The SeImpersonatePrivilege allows a process to impersonate other users' security tokens. This privilege is crucial for operations.
Incognito (Metasploit)
With a meterpreter shell and once we confirmed that we have these privileges, we can load incognito:
load incognitoTo list the tokens:
list_tokens -uFor impersonating a token:
impersonate_token "name"For upgrading the privileges in meterpreter shell we have to migrate to other pid:
pgrep explorermigrate id
PrintSpoofer (Only works on Windows 10 and Server 2019)
We have to upload the nc.exe and PrintSpoofer.exe files to the victim machine:
Open a Listener
Execute the exploit:
Juicy Potato
We have to copy the .exe file to the machine:
Wr have to choose a CLSID for testing, available here.
We have to get one depending of the OS version of the target system.
We have to start a Listener (the same port as our nishang shell)
SigmaPotato
SeBackup and SeRestore Privilege
This privilege allows a user to read any file on the system, even those they would not normally have access to, by accessing files in "backup mode."
You can potentially exploit this by creating copies of sensitive files (like the SAM database, registry hives, or password-protected files) and then extracting credentials offline. For instance:
Dumping Hashes
SeBackupPrivilege Privilege Escalation (diskshadow)
Script for PowerShell Environment
In our kali, create a file.dsh which is a Distributed Shell File.
Then use unix2dos to convert the encoding and spacing of the dsh file to a format that is compatible with the Windows machine, ensuring seamless execution.
And upload the file to the machine
Transferring and Executing the DSH File
When it is uploaded run the file.
Now, we can use the RoboCopy tool to copy the file from the Z Drive to the Temp Directory.
Finally send the system and ntds.dit file to our kali
Extract the Hashes
SeDebugPrivilege
We can use ProcDump from the SysInternals suite to leverage this privilege and dump process memory.
This is successful, and we can load this in Mimikatz using the sekurlsa::minidump command.
RCE
We can also leverage SeDebugPrivilege for RCE.
First, transfer this PoC script over to the target system.
Run the command tasklist and select the pid of a system process (for example winlogon.exe)
SeTakeOwnership
Find a intersting file and change the ownership for reading its content. We can use the takeownWindows binary to change ownership of the file.
For confirming the ownership we can run this command in powershell
We may still not be able to read the file and need to modify the file ACL using icacls to be able to read it.
Files of Interest
SeLoadDriverPrivilege
Enable a Privilege
Windows does not provide a built-in command or PowerShell cmdlet to enable privileges, so we need some scripting to help us out.
Last updated