RunAs - Executing Commands with Different Privileges
Basic Syntax and Usage
runas /user:<domain\username> "<command>"Common Parameters
Parameter
Description
Basic Examples
# Run Command Prompt as Administrator
runas /user:Administrator cmd.exe
# Run Command Prompt as a domain user
runas /user:DOMAIN\admin cmd.exe
# Open notepad to edit a protected file
runas /user:Administrator "notepad.exe C:\Windows\System32\drivers\etc\hosts"
# Run PowerShell with elevated privileges
runas /user:Administrator "powershell.exe -ExecutionPolicy Bypass"Privilege Escalation with RunAs
1. Creating a New Admin User
2. Opening a Backdoor Connection
3. Accessing Protected Files
Limitations of RunAs
Bypassing Password Prompt Limitation
1. Using PowerShell Start-Process
2. Using the SaveCred Option
3. Using Alternative Tools
Finding Saved RunAs Credentials
Real-World Example: Accessing Protected Service Manager
Detection and Prevention
OSCP Exam Notes
Last updated