Windows
Copy info from here: https://tryhackme.com/room/windowsprivesc20
Gathering Info
whoami /privnet usersysteminfosysteminfo | 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,startnamewmic service get name,pathname,startname | findstr "Program Files"Find text in file
type C:\Windows\path\to\file\$FILE | findstr $STRINGFind passwords
reg query HKLM /f password /t REG_SZ /sWhoami /priv
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

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
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
Victim(cmd)

Kali
Victim(Powershell)
Kali
Victim(cmd)

Insecure Service Permissions
Examples
Victim(cmd)

Kali
Victim(Powershell)
Kali
Victim(Powershell)

Abusing dangerous privileges
Examples

Kali
Victim(Browser)

Bypassing UAC
Examples:
Bypassing Applocker
Examples:
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
WinPeas
Windows Exploit Suggester
SharpHound
Powerview
Juicy Potato
Examples
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
Setup
Kali
Victim(cmd)
OR
Victim(powershell)
Windows Exploit Suggester
Examples
Setup
Run command then paste output back to Kali in a file called systeminfo.txt
Victim
Kali
WinPeas
Examples
Setup
Kali
Victim
SharpHound
Examples
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
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