4 - SeImpersonatePrivilege Exploitation

Topics

  1. Introduction to the Windows Shells

  2. Windows Permissions

  3. Reverse Shells in Windows

  4. SeImpersonatePrivilege Exploitation

  5. On Cross Compilation

  6. Windows Services

  7. Weak Service Permissions

  8. Unquoted Service Path

  9. DLL Hijacking

  10. Always Install Elevated

  11. Files with Sensitive Data

  12. Windows Hashes

  13. Stored Credentials and the Windows Vault

  14. Scheduled Task

  15. Critical Registry Paths

  16. Useful Tools

  17. AMSI Bypass

The SeImpersonatePrivilege, or "Impersonate a client after authentication," is a user right in Windows that allows programs running on behalf of a user to impersonate another client.

This privilege is primarily used in client-server scenarios, enabling a server process to impersonate the client process to perform tasks on its behalf.

Security Implications

If an attacker has the SeImpersonatePrivilege, they can:

  • Create a service to trick clients into connecting to it.

  • Impersonate the connected client’s privileges, potentially escalating their own access to SYSTEM. This makes SeImpersonatePrivilege a common target in privilege escalation attacks.


Checking for SeImpersonatePrivilege

To verify whether the current user has this privilege, run the following:

Sample Output

If the SeImpersonatePrivilege is enabled, the user can exploit it for privilege escalation using tools like PrintSpoofer or GodPotato.


Assigning SeImpersonatePrivilege

If you want to assign the SeImpersonatePrivilege to a user:

  1. Open the Local Group Policy Editor:

    • Navigate to: Computer Configuration > Windows Settings > Security Settings > Local Policies > User Rights Assignment.

    • Locate "Impersonate a client after authentication."

  2. Right-click and select Properties, then click Add User or Group.


Privilege Escalation with SeImpersonatePrivilege

Initial Setup

  1. Start a Listener on the Attacker Machine

  2. Download Netcat on the Victim Machine


Exploiting with PrintSpoofer

PrintSpoofer leverages misconfigured print spooler services to escalate privileges to SYSTEM.

  1. Download the Exploit

  2. Execute the Exploit Run the following command to establish a SYSTEM shell:


Exploiting with GodPotato

GodPotato is a tool that exploits COM and DCOM misconfigurations to achieve SYSTEM privileges.

  1. Identify .NET Framework Version Use the following command to determine the .NET version installed:

  2. Download the Appropriate GodPotato Version Depending on the .NET version:

    • .NET 2.0:

    • .NET 3.5:

    • .NET 4.0:

  3. Execute the Exploit Use the appropriate executable to escalate privileges and spawn a reverse shell:


Other Resources

Last updated