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 incognito

To list the tokens:

list_tokens -u

For impersonating a token:

impersonate_token "name"

For upgrading the privileges in meterpreter shell we have to migrate to other pid:

pgrep explorer
migrate 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:

Juicy Potato

We have to copy the .exe file to the machine:

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

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.

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