githubEdit

Windows Privilege Escalation

Privilege Escalation (PrivEsc) in Windows is a process that get the Administrator credential and login.

Automation

We might be able to find vulnerabilities on target Windows machine with automation tools as below:

LOLBAS (Living Off the Land Binaries, Scripts and Libraries)

LOLBASarrow-up-right provides misuses tools and executables already in the Windows system. So check the website.

In addition, I've created the LOLGENarrow-up-right that generates Living Off The Land payload.

OS Information

hostname
systeminfo
systeminfo | findstr "OS"
ver
[System.Environment]::OSVersion.Version

# Datetime
Get-Date

Find OS Vulnerabilities

After investigating the OS information, find the vulnerabilities of OS version.

Interesting Information

Find Vulnerable Privileges

When executing whoami /priv command and if current user has the following privileges, there is likely a privilege escalation vulnerability.

Recent Files

  1. Right-click on the Windows icon.

  2. Click Run.

  3. Type recentin the search form.

Running Services

Override Service Executable

At first, check the service status and get the executable for the service.

Now check if we have write access under the folder where the executable exists.

If we could write arbitrary file under the service folder, we may be able to replace the executable file as below:

For example, if we want to do reverse shell, we need to prepare a net listener on our local machine:

Now restart the service on target machine:

When the service restarts, our 'evil' executable is executed in stead of the original executable. After few seconds, we might be able to get the shell on local machine.

Running Processes

Histories

Command History in PowerShell Console

Web Browser Hidsotries

We might be able to find interesting information about users by checking histories of web browsers such as Chrome, Microsoft Edge, Internet Explorer, etc.

VSS (Volume Shadow Copy Service)

VSS coordinates the actions that are required to create a consistent a shadow copy (also known as a snapshot or a point-in-time copy) of the data that is to be backed up.

Registry Keys

We may be able to retrieve sensitive information in registry hives. See also: Windows PrivEsc with Registry Keysarrow-up-right

Sensitive Information

Find Interesting Files

Find Interesting Information in Files

Collect Emails

Reference: Atomic Rea Teamarrow-up-right

We can collect the information about emails such as Outlook on the following directories.

Open Ports

If we found the listening ports, we need to port forwarding to access the port in local machine. For example, assume the port 8000 is listening. We can access to the target port 8000 by accessing to http://localhost:8000 in local by executing the following command.

Please refer to this pagearrow-up-right to check how to use Chisel for port forwarding.

Getting All Local Users/Groups

We can find all local users in Computer Management utility. To open, enter "computer management" in search form at the bottom of the windows screen.

In Computer Management, click "Local Users and Groups".

Enumerate Users

  1. Click "Users".

  2. Double-click each user to get details e.g. "Member Of".

Enumerate Groups

  1. Click "Groups".

  2. Double-click each group.

  3. Attempt to add new user in the group because we might be able to do that even if we are not an administrator.

Set New Password for Existing User

Using PowerView, we may be able to set new password for existing user.

Change Another User Password

If current user has GenericAll permission to another user, we can change the user password as below:

Then if the another user belongs to the Remote Management Users group or the Administrators group, we can login as the user with evil-winrm command.

Change File Permission

From Command-Line

Check the current permission:

And change permission:

From GUI

  1. Right-click on the file.

  2. Select the Properties.

  3. Click the Security tab.

  4. Click “Advanced”.

  5. In the Permissions tab, click the “Add”.

  6. Click “Select a principal”.

  7. Enter the username in the text field.

  8. Click OK and Apply.

Take Ownership of a File (Administrators Group Required)

All Privs for Local Service, Network Service Account

If we’re Local Service or Network Service account, it maybe possible to grant all privileges to the account.

FullPowersarrow-up-right is a powerful tool for doing that.

PowerView

We can use Python version of PowerView (https://github.com/aniqfakhrul/powerview.py).

After logged in, we can leverages its power as below:

Sysinternals

Tools that offer technical resources and utilities to manage, diagnose, troubleshoot, and monitor a Microsoft Windows environment.

Dump Sensitive Data from Recall

*I'm interested with that, but I've not test yet.

Tool: TotalRecallarrow-up-right

We can extract sensitive information with https://github.com/xaitax/TotalRecall.

References

Last updated