Windows

Copy info from here: https://tryhackme.com/room/windowsprivesc20arrow-up-right

Gathering Info

whoami /priv
net user
systeminfo
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type"
dir c:\
dir "c:\program files"
dir "c:\program files (x86)"
wmic service get name,startname
wmic service get name,pathname,startname | findstr "Program Files"

Find text in file

type C:\Windows\path\to\file\$FILE | findstr $STRING

Find passwords

reg query HKLM /f password /t REG_SZ /s

Whoami /priv

Finding
Comment
Examples

SeImpersonatePrivilege

Printspoofer - works on Windows 10 and Server 2016/2019

SeImpersonatePrivilege

Using EfsPotato

Harvesting Passwords from Usual Spots

Might be able to find interesting files by looking at what was recently accessed. Start -> run -> recent.

Powershell history

Examples

Harvesting Passwords from Usual Spots

Victim(cmd)

Examples

Harvesting Passwords from Usual Spots

Need GUI to see other command prompt that will be spawned

Victim(cmd)

Examples

Harvesting Passwords from Usual Spots

Retrieve the saved password stored in the saved PuTTY session under your profile.

Victim(cmd)

See hidden files

Examples

Anthem

System and Sam

Download system and sam

Examples

Tampering With Unprivileged Accounts

Kali(WinRM)

Dump hashes

Examples

Tampering With Unprivileged Accounts

Kali

Add User & Assign Group Memberships

Victim

Enable RDP

Victim

Add user to RDP Group

Examples

Assign Group Memberships

Add user to group that allows them to RDP

Victim(cmd)

Scheduled Tasks

Examples

Windows Privilege EscalationAbusing Scheduled Tasks

Looking into scheduled tasks on the target system, you may see a scheduled task that either lost its binary or it's using a binary you can modify.

Scheduled tasks can be listed from the command line using the schtasks command without any options. To retrieve detailed information about any of the services, you can use a command like the following one:

Victim(cmd)

Victim(cmd)

Victim(cmd)

Kali

Victim

Abusing Service Misconfigurations

Examples

Abusing Service Misconfigurations

Insecure Permissions on Service Executable

Get the flag on svcusr1's desktop

Victim(cmd)

Victim(cmd)

Kali

Victim(Powershell)

Once the payload is in the Windows server, we proceed to replace the service executable with our payload. Since we need another user to execute our payload, we'll want to grant full permissions to the Everyone group as well.

Victim(Powershell)

Kali

Note: PowerShell has sc as an alias to Set-Content, therefore you need to use sc.exe in order to control services with PowerShell this way.

As a result, you'll get a reverse shell with svcusr1 privileges:

Victim(cmd)

OR

Victim(Powershell)

Unquoted Service Paths

Examples

Unquoted Service Paths

Victim(cmd)

Kali

Victim(Powershell)

Kali

Victim(cmd)

Insecure Service Permissions

Examples

Insecure Service Permissions

Victim(cmd)

Kali

Victim(Powershell)

Kali

Victim(Powershell)

Abusing dangerous privileges

Examples

Abusing dangerous privileges

Kali

Victim(Browser)

Bypassing UAC

Examples:

Bypassing UAC

Bypassing Applocker

Examples:

Bypassing Applocker

Load PowerUp.ps1 into memory.

Kali

Add the following line at the bottom to PowerUp.ps1 so it Invokes all checks automatically once downloaded

PowerUp.ps1

Victim(powershell)

Kali

Kali

Privilege Escalation

Automated Enumeration Tools

Juicy Potato

Examples

Retro

  • Download Juicy Potato to your attack machine

  • Upload Juicy Potato to the target (ex: via FTP, SMB, HTTP, etc.)

  • Create a reverse shell and upload it to the target (ex: via FTP, SMB, HTTP, etc.) use Juicy Potato to execute your reverse shell

PowerUp.ps1

Examples

Privilege EscalationRetro

Setup

Kali

Victim(cmd)

OR

Victim(powershell)

Windows Exploit Suggester

Examples

HackPark

Setup

Run command then paste output back to Kali in a file called systeminfo.txt

Victim

Kali

WinPeas

Examples

HackPark

Setup

Kali

Victim

SharpHound

Examples

Post-Exploitation Basics

Add this line to SharpHound.ps1 before transferring so I could run the command right away

Victim

Kali

Find all Domain Admins

List all Kerberostable accounts

Powerview

Examples

Post-Exploitation Basics

Victim

Run below to be able to run PowerView commands.

Enumerate the domain users.

Enumerate the domain groups.

Find Shared folders.

Get Operating systems on the network.

Last updated