LPE

Local Privilege Escalation

Windows

Local Enumeration

Disable PS history when enumerating around:

User Info

System Info

Products & Services

Network & Process

Registry & Filesystem

Users & Groups

Add user to the builtin local Administrators group on an any-language system:

AccessChk

Find weak file permissions:

Find weak directory permissions:

Find weak service permissions:

upnphost & SSDPSRV (Windows XP)

Weak Service Permissions

Check service permissions with a script:

Change ownership of the target binary to LocalSystem:

Set binPath to point to the target binary and trigger vulnerable service:

Unquoted Service Paths

CreateProcessA function parses an unquoted BINARY_PATH_NAME like follows:

It gives an attacker the ability to "inject" corresponding binary into path for it to be executed with vulnerable service permissions if she has enough privileges to write into one of these directories:

List services and their binary path:

Query VulnerableSvc:

Exploit VulnerableSvc:

Malious binary example:

Always Install Elevated

Check:

Exploit:

wuauserv

UPnP Device Host Service

CVE-2019-1405, CVE-2019-1322 - Windows 10, version 1803 < 1809

RpcEptMapper

CVE-2021-27091

Potentionally vulnerable Windows versions:

  • Windows 7

  • Windows Server 2008 R2

  • Windows 8

  • Windows Server 2012

Compile into Release and exploit:

HiveNightmare

CVE-2021–36934

PowerShell one-liner:

.NET Sandboxes

When an attacker can compile arbitrary code in privileged context but a Sandbox is in game (like in uMod) the following approaches can be leveraged to gain admin privs:

  • Registry keys manipulation.

  • Deserialization attacks.

Example #1 (Registry) - AlwaysInstallElevated:

Example #2 (Registry) - Service binary path:

Example #3 (Deserialization) - BinaryFormatter:

MSI Abuses

Tools

Windows-Exploit-Suggester

PowerUp

JAWS

winPEAS

Run from memory:

PrivescCheck

Seatbelt

Linux

Disable shell history when enumerating around:

Filesystem

Grep for sensitive keywords:

Find and list all files newer than 2020-03-16 and not newer than 2020-03-17:

Find SUID binaries:

Dirty COW

logrotate

motd

/etc/update-motd.d/:

PAM MOTD:

polkit/dbus-daemon

CVE-2021-3560

Calculate the approximate time for dbus-send to fail:

Divide it by 2 or by 3 and create a new user account (you might want to experiment with the number of milliseconds in the delay and repeat the process a couple of times if needed):

Then set a password for it, sudo into a privilege shell and you are root:

Tools

LinEnum

linux-smart-enumeration

linPEAS

linux-exploit-suggester

Locally on target:

On Attacker box providing uname output from Victim:

SUID3NUM

htbenum

pspy

A lightweight alternative with Bash:

Old Ubuntu Quick Deploy

Last updated