# Overview

## Guides

* [Windows Privilege Escalation Guide](https://www.absolomb.com/2018-01-26-Windows-Privilege-Escalation-Guide/)
* [PayloadsAllTheThings/Windows - Privilege Escalation.md at master · swisskyrepo/PayloadsAllTheThings · GitHub](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Windows%20-%20Privilege%20Escalation.md)
* [GitHub - frizb/Windows-Privilege-Escalation: Windows Privilege Escalation Techniques and Scripts](https://github.com/frizb/Windows-Privilege-Escalation)
* [Windows elevation of privileges](https://guif.re/windowseop)
* [GitHub - SecWiki/windows-kernel-exploits: windows-kernel-exploits Windows平台提权漏洞集合](https://github.com/SecWiki/windows-kernel-exploits)
* [GitHub - WindowsExploits/Exploits: Windows Exploits](https://github.com/WindowsExploits/Exploits)

## Related

* [LOLBAS](https://lolbas-project.github.io)
* [GitHub - hfiref0x/UACME: Defeating Windows User Account Control](https://github.com/hfiref0x/UACME)
* [PowerSploit](https://d4rk1337.gitbook.io/the-pentesters-cheat-sheet/privilege-escalation/windows/03-power-sploit)
* [JAWS](https://d4rk1337.gitbook.io/the-pentesters-cheat-sheet/privilege-escalation/windows/05-jaws)
* [Juicy Potato, Rotten Potato (NG)](https://d4rk1337.gitbook.io/the-pentesters-cheat-sheet/privilege-escalation/windows/04-juicy-potato-rotten-potato)
* [Mimikatz](https://d4rk1337.gitbook.io/the-pentesters-cheat-sheet/privilege-escalation/windows/02-mimikatz)
* [SILENTTRINITY](https://d4rk1337.gitbook.io/the-pentesters-cheat-sheet/privilege-escalation/windows/07-silenttrinity)
* [Empire](https://d4rk1337.gitbook.io/the-pentesters-cheat-sheet/privilege-escalation/windows/06-empire)

## Manual

Current users privs

```
whoami /priv
```

Current user details (all)

```
whoami /all
```

List users

```
net user
```

User details

```
net user <username>
```

List other logged in users

```
qwinsta
query session
```

List user groups

```
net localgroup
```

Group details

```
net localgroup <groupname>
```

Add user (interactive, requires user interaction)

```
net user <username> <password> /add
```

Add user (non-interactive)

```
net user <username> /add
net user <username> <password>
```

Add user to group (e.g. administrators)

```
net localgroup administrators <username> /add
```

Change password

```
net user <username> <password>
```

System info

```
systeminfo
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
hostname
```

Patch level

```
wmic qfe get Caption,Description,HotFixID,InstalledOn
```

Network connections

```
netstat -ano
```

Scheduled tasks

```
schtasks
schtasks /query /fo LIST /v
```

Driver

```
driverquery
```

Installed software (slow)

```
wmic product get name,version,vendor
```

Alternative

```
wmic service list brief
```

Services

```
sc query
sc start <service>
sc stop <service>
sc config <service> <options>
```

Antivirus

```
sc query windefend
sc queryex type=service
```

Searching files

```
findstr /si <term> <ext>
findstr /si password *.txt
```

### DLL hijacking

Find a program with a missing dll, or make use for search path order, to execute your own dll.

### Unquoted service path

Finding unqoated service paths

```
wmic service get name,displayname,pathname,startmode
```

```
sc qc <service>
```

Check if we have write permission in a suitable path.

```
.\accesschk64.exe /accepteula -uwdq <path>
```

## PowerShell

### SMB

Mount smb share

```powershell
New-PSDrive -Name "<share-name>" -PSProvider "FileSystem" -Root "\\<ip>\<smb-share>"
```

Access with

```powershell
cd <share-name>:
```

## Automated

### Exploit Suggester

> This tool compares a targets patch levels against the Microsoft vulnerability database in order to detect potential missing patches on the target. It also notifies the user if there are public exploits and Metasploit modules available for the missing bulletins.\
> [GitHub - AonCyberLabs/Windows-Exploit-Suggester](https://github.com/AonCyberLabs/Windows-Exploit-Suggester) [Windows Exploit Suggester - Next Generation (WES-NG)](https://github.com/bitsadmin/wesng)

```bash
windows-exploit-suggester.py –update
windows-exploit-suggester.py --database 2021-09-21-mssb.xls --systeminfo sysinfo_output.txt
```

### winPEAS

[winPEAS](https://github.com/carlospolop/PEASS-ng/tree/master/winPEAS)

```
winpeas.exe > <output-file>
```

### PowerSploit

[PowerSploit](https://d4rk1337.gitbook.io/the-pentesters-cheat-sheet/privilege-escalation/windows/03-power-sploit)

### JAWS

[JAWS](https://d4rk1337.gitbook.io/the-pentesters-cheat-sheet/privilege-escalation/windows/05-jaws)

### Watson

> Enumerate missing KBs and suggest exploits for useful Privilege Escalation vulnerabilities\
> [GitHub - rasta-mouse/Watson](https://github.com/rasta-mouse/Watson)

```
Watson.exe
```

### Seatbelt

> Seatbelt is a C# project that performs a number of security oriented host-survey "safety checks" relevant from both offensive and defensive security perspectives.\
> [GitHub - GhostPack/Seatbelt](https://github.com/GhostPack/Seatbelt)

```
Seatbelt.exe -group=all -outputfile=<path>
```

### Sherlock

> Deprecated. Have a look at [Watson](https://github.com/rasta-mouse/Watson) instead.

> PowerShell script to quickly find missing software patches for local privilege escalation vulnerabilities.\
> [GitHub - rasta-mouse/Sherlock](https://github.com/rasta-mouse/Sherlock)

```
Sherlock.ps1
FindAllVulns
```

## Misc

### File inside a file

```
dir /r
powershell (Get-Content hm.txt -Stream root.txt)
```

### Run as

```
runas /netonly /user:<user> cmd
```

### Weak services

Replace files/programs running with SYSTEM permissions with exploited ones\
-> Check permissions `icacls <file>`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://d4rk1337.gitbook.io/the-pentesters-cheat-sheet/privilege-escalation/windows/01-overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
