Windows Privilege Escalation

Enumeration

  • OS Info Enumeration

    • systeminfo

    • hostname

    • echo %username%

    • wmic qfe -> check patches

    • wmic logicaldisk -> get other disk information

  • User Enumeration

    • whoami

    • whoami /priv -> check user privilleges

    • whoami /groups -> check user groups

    • net user -> list all users

    • net user <username> -> check groups associated with a user

    • net localgroup -> Check all the local groups available

    • net localgroup <group name> -> List the members of the given localgroup

  • Task | Service | Process Enumeration

    • sc queryex type= service (Lists all the service)

    • tasklist /SVC

    • tasklist

    • net start

    • DRIVERQUERY

    • wmic product get name, version, vendor

  • Permission Enumeration

    • C:\Program Files : icacls program_name

    • icacls root.txt /grant <username>:F (to grant permission to access file)

    • Check the PowerShell history file type C:\Users\sql_svc\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt

    • Check stored usernames and passwords

      • cmdkey /list

  • Network based

    • ipconfig

    • ipconfig /all

    • arp -a

    • router print

    • netstat -ano

  • Password Hunting

    • findstr /si password *.txt *.ini *.config (try searching in different directories)
      dir /s *pass* == *cred* == *vnc* == *.config*
      dir /S /B *pass*.txt == *pass*.xml == *pass*.ini == *cred* == *vnc* == *.config*
      where /R C:\ user.txt
      where /R C:\ *.ini
  • AV / Firewall check / Service Enumeration

  • Scheduled Tasks

  • Mount Information

    • mountvol

Escalation Techniques

Service Account Priv Esc (Token Impersonation)

  • whoami /priv

Run As :

Use the cmdkey to list the stored credentials on the machine.

Using runas with a provided set of credential.

Access check :

  • accesschk.exe -ucqv [service_name] /accepteula

  • accesschk.exe -uwcqv "Authenticated Users" * (won't yield anything on Win 8)

  • Find all weak folder permissions per drive.

    • accesschk.exe /accepteula -uwdqs Users c:\

    • accesschk.exe /accepteula -uwdqs "Authenticated Users" c:\

  • Find all weak file permissions per drive.

    • accesschk.exe /accepteula -uwsv "Everyone" "C:\Program Files"

    • accesschk.exe /accepteula -uwqs Users c:\*.*

    • accesschk.exe /accepteula -uwqs "Authenticated Users" c:\*.*

  • Powershell:

Unquoted Service Path Privilege Escalation

PATH directories with weak permissions

Always Install Elevated :

Kernel Exploits :

or for 32 bit

Automated Enumeration Tools

Powershell:

EXE : (https://book.hacktricks.xyz/windows/windows-local-privilege-escalation#exe)

Other : Windows Exploit Suggester (https://github.com/AonCyberLabs/Windows-Exploit-Suggester)

Metasploit :

  • getsystem

  • run post/multi/recon/local_exploit_suggester

Resources :

Last updated

Was this helpful?