Cheatsheet
Topics
Introduction to the Windows Shells
Windows Permissions
Reverse Shells in Windows
SeImpersonatePrivilege Exploitation
On Cross Compilation
Windows Services
Weak Service Permissions
Unquoted Service Path
DLL Hijacking
Always Install Elevated
Files with Sensitive Data
Windows Hashes
Stored Credentials and the Windows Vault
Scheduled Task
Critical Registry Paths
Useful Tools
AMSI Bypass
Win Enumeration
System Information Commands
Operating System and Version:
Hardware Information:
Environment Variables:
File System and Directory Management
Navigation and Directory Structure:
File Operations:
Directory Operations:
3. Networking Commands
Network Information:
Testing and Troubleshooting:
Permissions and User Management
User Information:
Permissions and Policies:
Process and Service Management
Process Management:
Service Management:
Windows System Utilities
Administrative Tools:
Performance and Disk Management:
PowerShell - System, User, Process and Service
PowerShell Commands for Local Accounts:
System File Management:
Registry and Configuration Management:
List Environment Variables
Search Files Recursively
List Running Processes
List Installed Applications (32-bit)
List Installed Applications (64-bit)
Retrieve Service Information
File Transfer and Reverse Shell
Generate a reverse shell payload
Using certutil
Certutil is a Windows tool that can download files:
Using PowerShell PowerShell (iwr) can download files via HTTP:
Using FTP Windows supports FTP commands:
Using SMB Shares Files can be transferred using network shares:
Netcat Set up a listener on the attacker machine:
Send the file from the target:
Python Simple HTTP Server On the attacker machine:
On the target machine:
Spawning a Reverse Shell
cmd.exe
The cmd.exe reverse shell relies on utilities like ncat.exe to establish a connection. The process involves downloading the necessary binary, setting up a listener on the attacker machine, and initiating the reverse connection from the victim machine.
Steps
Download
ncat.exeon the Target Machinencat.exe(a lightweight implementation of Netcat) is required for creating the reverse shell.Set Up a Listener on the Attacker Machine The attacker machine must have a listener ready to receive the reverse connection.
Initiate the Reverse Shell from the Target Machine On the victim machine, execute the following command to connect back to the attacker and spawn a shell:
Powershell
Using Invoke-PowerShellTcp.ps1 Script
Invoke-PowerShellTcp.ps1 is a PowerShell script designed for reverse shells.
Download the Script on the Attacker Machine
Configure the Script Add the line to specify the attacker's IP and port:
Host the Script on an HTTP Server Use Python to serve the script for download:
Start listening mode with Netcat on attacker machine
Execute the Script from the Target Machine
From CMD:
From PowerShell:
Win Priv Esc
SeImpersonatePrivilege
Checking for SeImpersonatePrivilege
To verify whether the current user has this privilege, run the following:
Sample Output
If the SeImpersonatePrivilege is enabled, the user can exploit it for privilege escalation using tools like PrintSpoofer or GodPotato.
SeImpersonatePrivilege Privilege Escalation
Initial Setup
Start a Listener on the Attacker Machine
Download Netcat on the Victim Machine
PrintSpoofer
PrintSpoofer leverages misconfigured print spooler services to escalate privileges to SYSTEM.
Download the Exploit
Execute the Exploit Run the following command to establish a SYSTEM shell:
GodPotato
Identify .NET Framework Version Use the following command to determine the .NET version installed:
Download the Appropriate GodPotato Version Depending on the .NET version:
.NET 2.0:
.NET 3.5:
.NET 4.0:
Execute the Exploit Use the appropriate executable to escalate privileges and spawn a reverse shell:
winPEAS
Download the binary:
Running winPEAS to Enumerate Services
Use the
servicesinfooption to gather information about services:
Kernel
UAC
Access Token
Windows Credential Dumping
System Logs
Cracking Windows Hashes
Crackmapexec
Cmd.exe official documentation
PowerShell official documentation
Last updated