windowsMaster checklist

Includes both Local and AD level privesc specific to OSCP

Local Privesc [Enumeration]

Files & Creds

.\winpeas.exe quiet windowscreds
.\winpeas.exe quiet filesinfo

Sometimes there is password hidden in files, so we need to enumerate all the files

Get-ChildItem -Path C:\ -Include *.kdbx -File -Recurse -ErrorAction SilentlyContinue
Get-ChildItem -Path C:\ -Include *.txt,*.ini -File -Recurse -ErrorAction SilentlyContinue
Get-ChildItem -Path C:\ -Include *.txt,*.pdf,*.xls,*.xlsx,*.doc,*.docx -File -Recurse -ErrorAction SilentlyContinue

OS version

Check OS version, then check for kernal exploit or any open exploit available

systeminfo
.\winpeas.exe quiet systeminfo

Internal Network

netstat -antp tcp

PowerShell History File


Local Privesc [Exploitation]

Most attacks need specific rights on the binary or folder which we are supposed to attack, so we need to know the permissions:

Mask
Permission on file

F

Full Access

M

Modify Access

RX

Read & Execute Access

R

Read Access

W

Write only Access

Service Binary Hijacking

1

Find binaries with writable permissions

Use winpeas.exe to check which binary we have rights to abuse.

2

Confirm rights on the binary

3

Enumerate the service name for the binary

4

Exploitation (replace binary)

5

Restart / Reboot

Restart the service or reboot the system.

ADD-User.EXE

compile the code using linux


Always Install Elevated

These registry keys tell windows that a user of any privilege can install .msi files as NT AUTHORITY\SYSTEM.

  1. Check via powerup.ps1 or winpeas.exe, winpeas output looks like:

  2. Manual Recon

  3. Create malicious .msi file using msfvenom

  4. Run exploit


DLL Hijacking

Download procmon.exe - https://download.sysinternals.com/files/ProcessMonitor.zip

  1. Enumerate installed apps (example: 32-bit uninstall keys)

  2. If anything gets listed using above command, besides from Microsoft ***, then proceed.

  3. Check permission on folder

  4. Use procmon.exe to filter (if possible)

  5. Create a malicious dll using msfvenom with reverse shell inside or use below TextShaping.dll and insert into the same folder

Build:

TextShaping.cpp


Scheduled Tasks

1

Enumerate scheduled tasks

2

Identify repeating tasks

Check the Repeat: Every: tag in the output to find tasks that run on a schedule.

3

Filter useful fields

4

Exploit by replacing task binary


Unquoted Service Path

In order to exploit, we need 2 things: Unquoted Service Path & White space between the folder name.

1

Enumerate potential unquoted paths

2

Manual recon for service paths

3

Identify whether you can Start/Stop the service

4

Check permissions on folder & sub-folders where service binary exists

5

Malicious binary naming rules

The malicious binary must be named after the name of folder/sub-folder which is writable (the word before whitespace only).

Examples:

6

Inject malicious binary depending on writable folder

  1. if "C:\Program Files\Enterprise Apps\Current Version\" is writable:

  1. if "C:\Program Files\Enterprise Apps\" is writable:

  1. if "C:\Program Files\" is writable:

After injecting the binary, start the service:


Se-Impersonate Privilege

Available tools: godpotato.exe | printspoofer.exe | sweetpotato.exe


Se-Restore Privilege

From Windows (evil-winrm) session

  • Rename utilman.exe to utilman.old and cmd.exe to utilman.exe

  • From Linux

This will open a new RDP window to target system. On the RDP session press the below key shortcut to get the shell as NT-Authority\SYSTEM:


Se-Backup Privilege

From Windows (evil-winrm) session

From Linux session, extract hash using pypykatz:


Se-Backup + Se-Restore [DC]

For standalone machines try standalone attack, but if we have both privileges on a domain controller, use this attack.

1

Create Distributed Shell (DSH) file on attacker

Create file.dsh (e.g., nano file.dsh) with contents:

2

Convert to DOS format

3

Upload to Windows session and run DiskShadow

4

Backup required files

5

Download and dump NTDS


AD [Environment Setup]

Execution policy Bypass


Internal Port Scan


Tunneling

To tunnel any specific port

Victim:

Attacker:

With Socks

Victim:

Attacker:


File Transfer

Inside Intranet

From Outside

other tools: certutil.exe | curl | wget


AD [Enumeration]

Manual Enumeration


BloodHound Enumeration


AD [Lateral Movement]

Enabling Remote Services

Enable RDP:

Enable PS-remoting:


LM Techniques


AD [Presistence]

Adding User

Add existing user OR create new user to Local Administrator group


Golden Ticket


AD [Exploitation & Attacks]

Credentials Dumping

  • Impacket

  • Mimikatz https://gist.github.com/insi2304/484a4e92941b437bad961fcacda82d49


AS-REP-roasting

  • No Username

  • With Username

  • With creds

Cracking hash:


Kerberoasting

Cracking hash:


Target Kerberoasting