Cheatsheet

Topics

  1. Introduction to the Windows Shells

  2. Windows Permissions

  3. Reverse Shells in Windows

  4. SeImpersonatePrivilege Exploitation

  5. On Cross Compilation

  6. Windows Services

  7. Weak Service Permissions

  8. Unquoted Service Path

  9. DLL Hijacking

  10. Always Install Elevated

  11. Files with Sensitive Data

  12. Windows Hashes

  13. Stored Credentials and the Windows Vault

  14. Scheduled Task

  15. Critical Registry Paths

  16. Useful Tools

  17. 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

  1. Download ncat.exe on the Target Machine ncat.exe (a lightweight implementation of Netcat) is required for creating the reverse shell.

  2. Set Up a Listener on the Attacker Machine The attacker machine must have a listener ready to receive the reverse connection.

  3. 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.

  1. Download the Script on the Attacker Machine

  2. Configure the Script Add the line to specify the attacker's IP and port:

  3. Host the Script on an HTTP Server Use Python to serve the script for download:

  4. Start listening mode with Netcat on attacker machine

  5. 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

  1. Start a Listener on the Attacker Machine

  2. Download Netcat on the Victim Machine

PrintSpoofer

PrintSpoofer leverages misconfigured print spooler services to escalate privileges to SYSTEM.

  1. Download the Exploit

  2. Execute the Exploit Run the following command to establish a SYSTEM shell:

GodPotato

  1. Identify .NET Framework Version Use the following command to determine the .NET version installed:

  2. Download the Appropriate GodPotato Version Depending on the .NET version:

    • .NET 2.0:

    • .NET 3.5:

    • .NET 4.0:

  3. Execute the Exploit Use the appropriate executable to escalate privileges and spawn a reverse shell:

winPEAS

  1. Download the binary:

  1. Running winPEAS to Enumerate Services

    Use the servicesinfo option to gather information about services:


Kernel

UAC

Access Token

Windows Credential Dumping

System Logs

Cracking Windows Hashes

Crackmapexec

Last updated