Skip to content

Initial Enum

  • CHEAT SHEET - https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Windows%20-%20Privilege%20Escalation.md
  • https://www.bordergate.co.uk/windows-privilege-escalation/

  • Fully compromising the host may gain us access to sensitive files/file shares, grant us the ability to capture traffic to obtain more credentials, or obtain credentials that can help further our access or even escalate directly to Domain Admin in an Active Directory environment.
  • From a low user we can privesc to:
    • Domain Admin
    • NT AUTHORITY\SYSTEM
    • Domain User part of local admin group
    • Local Admin
    • Local User part of local admin group
  • Windows Command Reference
    • https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands

Key Data Points

  • OS Name - Windows Workstation, server
  • VERSION - 7, 10, 11 https://en.wikipedia.org/wiki/Comparison_of_Microsoft_Windows_versions
  • Running services - services running as NT_AUTHORITY\SYSTEM are good to note

System Information

Using cmd.exe normally and run as Admin will give different results
  • looking at the system gives us a better idea of the exact os version, hw, programs, security updates.
    • this will narrow down our CVE search

Tasklist - look at running processes

Display All Environment Variables

  • set
    • displays all env variables
  • look at PATH, check if we have write access to modify it
    • eg: place Python, JAVA in that path to allow execution of python or .jar files
  • If the folder placed in the PATH is writable by your user, it may be possible to perform DLL Injections against other applications. Remember, when running a program, Windows looks for that program in the CWD (Current Working Directory) first, then from the PATH going left to right. This means if the custom path is placed on the left (before C:\Windows\System32), it is much more dangerous than on the right.

View Detailed Configuration Information

  • systeminfo
    • shows if a box is patched recently and if it is a VM
  • if not patched, google the KBs (present in systeminfo output) installed under https://www.catalog.update.microsoft.com/Search.aspx?q=hotfix

Patches and Updates

  • if systeminfo does not display hotfixes
    • wmix qfe
    • Get-HostFix | ft -AutoSize

Installed Programs

  • wmix product get name
  • Get-WmiObject -Class Win32_Product | select Name, Version

Display Listening ports and Running Processes

  • netstat -ano
  • if port 8080 is open, note down the pid in the last column of netstats output
    • tasklist /svc | find <pid>

User & Group Information

Logged-in users

  • query user

Current User

  • echo %USERNAME%
  • whoami
  • Suppose we gain access as a service account (SYSTEM).
    • In that case, we may have privileges such as SeImpersonatePrivilege, which can often be easily abused to escalate privileges using a tool such as Juicy Potato.

Current User privileges

  • whoami /priv

Current User Group Info

  • whoami /groups
    • did our user inherit something interesting? are they privileged in the AD domain env?

Get Other Users

  • net user
  • if we rdp'd into a host using creds for bob and we see another bob_adm user, we can try credential re-use
  • Can we access the user profile directory for any important users? We may find valuable files such as scripts with passwords or SSH keys in a user's Desktop, Documents, or Downloads folder.

Get All Groups

  • net localgroup
    • looking for non-standard groups - their misconfigurations

Details about a group

  • net localgroup administrators
    • users belonging to the group
    • can find sensitive info in group's description

Get Password Policy & Other Account Information

  • net accounts