<?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 Abadullah Faridi on Medium]]></title>
        <description><![CDATA[Stories by Abadullah Faridi on Medium]]></description>
        <link>https://medium.com/@imafdi?source=rss-0f54bdfa9a66------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JlLebhTC9p0u4O-OBrRWtA.jpeg</url>
            <title>Stories by Abadullah Faridi on Medium</title>
            <link>https://medium.com/@imafdi?source=rss-0f54bdfa9a66------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 07:07:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@imafdi/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[Careless Whisper: How Delivery Receipts in WhatsApp and Signal Leak User Behavior]]></title>
            <link>https://medium.com/@imafdi/careless-whisper-how-delivery-receipts-in-whatsapp-and-signal-leak-user-behavior-0f81f91d83f0?source=rss-0f54bdfa9a66------2</link>
            <guid isPermaLink="false">https://medium.com/p/0f81f91d83f0</guid>
            <category><![CDATA[exploitation]]></category>
            <category><![CDATA[digital-privacy]]></category>
            <category><![CDATA[end-to-end-encryption]]></category>
            <category><![CDATA[cybersecurity-research]]></category>
            <category><![CDATA[messaging-app-privacy]]></category>
            <dc:creator><![CDATA[Abadullah Faridi]]></dc:creator>
            <pubDate>Wed, 17 Dec 2025 13:11:28 GMT</pubDate>
            <atom:updated>2025-12-17T18:43:12.482Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Image form seytonic YT" src="https://cdn-images-1.medium.com/max/1024/1*HHbpf1LeWsH_KxJFdadBNQ.png" /></figure><p>End-to-end encryption is widely (and correctly) praised for protecting message content. But what happens around those <strong>encrypted messages-delivery</strong> receipts, reactions, timing metadata, often gets far less scrutiny. <strong>Recent peer‑reviewed research </strong>shows that these “<strong>auxiliary</strong>” mechanisms can be quietly transformed into powerful surveillance tools.</p><p>This article summarizes and contextualizes the findings of the paper <strong>“Careless Whisper: Exploiting Silent Delivery Receipts to Monitor Users on Mobile Instant Messengers”</strong> by Gegenhuber et al. (SBA Research / University of Vienna), and incorporates details from the researchers’ public Defcon talk and subsequent coverage. The core result is stark:</p><blockquote>With nothing more than a phone number and the ability to send messages, an attacker can infer a user’s device state, network environment, multi‑device activity, and daily routine — without any malware, user interaction, or visible alerts.</blockquote><h3>Research background</h3><p>The authors focus on delivery receipts in<strong> WhatsApp and Signal — protocol‑level acknowledgments</strong> that confirm a message has reached a client device. Unlike read receipts, delivery receipts:</p><ul><li>Are mandatory for correct protocol operation.</li><li><strong>Cannot be disabled </strong>by the user.</li><li>Are generated even for <strong>unknown senders</strong> who are not in the contact list.</li></ul><p>The central research question:</p><blockquote>Can an attacker abuse the timing of delivery receipts as a side channel to monitor user behavior?</blockquote><p>Using controlled experiments and large‑scale measurements, the answer is <strong>yes</strong>. Crucially, this is not a break of end‑to‑end encryption. The content remains encrypted; the leak comes entirely from metadata, timings, and how clients and backends handle acknowledgments</p><h3><strong>How delivery receipts work (at a protocol level)</strong></h3><p>At a high level, both WhatsApp and Signal follow a similar sequence:</p><ol><li>The sender encrypts a message and uploads it to the service backend.</li><li>The backend forwards the <strong>ciphertext</strong> to all registered devices of the recipient.</li><li>Each recipient device, upon processing the message (or event), sends back a <strong>delivery receipt.</strong></li><li>The sender’s client displays a second check mark (WhatsApp) or equivalent confirmation when the receipt arrives.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XzeBozBFsRw8rj1QXzsoaQ.png" /></figure><p>The sender never sees message content, but <strong>the precise time between sending an event and receiving its delivery receipt is observable</strong>. The researchers show that this timing is not random noise:</p><ul><li>It systematically depends on the <strong>state of the recipient’s device.</strong></li><li>It differs across <strong>network types</strong> and device classes.</li><li>It can be collected at high frequency using <strong>silent reactions.</strong></li></ul><h3>Inferring device state from timing alone</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BYQMCX_EkK3bHMFPyF6C2w.png" /></figure><p>Through repeated probing of test devices,<strong> the authors demonstrate that delivery receipt latency strongly correlates</strong> with three main device states:</p><ul><li>Locked: Screen off, app in background. <strong>Delivery receipts are relatively slow and more variable.</strong></li><li>Unlocked (background): Screen on, but <strong>the app is not in the foreground. Latencies drop noticeably.</strong></li><li>App in foreground: The messaging app is actively open. D<strong>elivery receipts become almost instantaneous.</strong></li></ul><p>These timing differences arise from OS and app behavior:</p><ul><li>Background apps are subject to <strong>stricter scheduling and power‑saving policies.</strong></li><li>Foreground apps often have <strong>more immediate network access and wake locks.</strong></li><li>Push notification handling paths differ between background and foreground states.</li></ul><p>The critical point: the recipient never has to tap or respond. Merely having a phone in their pocket is enough; the attacker just watches how quickly delivery receipts come back over time.</p><h3>Silent probing using reactions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*NEPIo_RAof4hHITr8sJiGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ar2P_R7czCVMK2q2hek7OA.jpeg" /></figure><p>A key innovation in <em>Careless Whisper</em> is turning delivery receipts into an <strong>active measurement channel </strong>by using message reactions as probes.</p><p>The researchers found that:</p><ul><li><strong>Reactions generate delivery receipts</strong> just like normal messages.</li><li>Some reactions — especially reactions to the <strong>sender’s own messages </strong>— do not trigger user‑visible notifications.</li><li>Using modified or open‑source clients, it is possible to send <strong>reactions to messages that do not even exist </strong>on the victim’s device:</li></ul><blockquote>The victim’s client silently discards these events.</blockquote><blockquote>But it still processes them at the protocol level and emits delivery receipts.</blockquote><p>This combination creates a perfect probing mechanism:</p><ul><li>The victim gets no notification, no popup, no chat entry.</li><li>The attacker can send probes continuously, building a fine‑grained timing trace.</li><li>The entire process is invisible to the target.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*noyDs-2nSVBlchtA8OJHCg.png" /></figure><h3>Rate limiting and probe intensity</h3><p>The practical impact depends heavily on rate limiting:</p><p><strong>WhatsApp</strong></p><ul><li>At the time of the research, there was effectively <strong>no useful rate limiting</strong> for such reactions.</li><li>Researchers were able to send one reaction every <strong>50 ms — about 20 reactions per second.</strong></li><li>This enables <strong>high‑resolution timing measurements</strong>, and also leads to significant data and battery impact (see below).</li></ul><p><strong>Signal</strong></p><ul><li>Signal applied<strong> rate limiting</strong>, allowing only about <strong>1 reaction per second</strong>.</li><li>This still permits behavioral inference, but at coarser granularity, and with much lower resource abuse potential.</li></ul><p>Because delivery receipts <strong>cannot be disabled</strong> and are generated even for <strong>unknown numbers</strong>, any attacker who knows a target’s phone number can set up this kind of continuous probing — no malware, no exploits, and no social engineering required.</p><h3>Network and device fingerprinting</h3><p>Beyond simple “phone locked vs unlocked”, the researchers show that aggregated timing data can be used to:</p><h4>Detect network type</h4><p>The variance and jitter of delivery receipt timings differ markedly between:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a0xkkCk_dLV8gq1NwKLatg.png" /></figure><p><strong>Wi‑Fi</strong>:</p><ul><li>Low latency, relatively stable timings.</li><li>Narrow distributions around a small mean.</li></ul><p><strong>Cellular</strong>:</p><ul><li>Higher latency, greater jitter.</li><li>Characteristic spikes and bursts due to radio scheduling and handovers.</li></ul><p>In the Defcon demo and related visualizations, this distinction is clear: the timing plot for Wi‑Fi looks clean and compact, while cellular traces are noisy and irregular.</p><h4>Fingerprint device class and vendor</h4><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*XzeBozBFsRw8rj1QXzsoaQ.png" /></figure><p>The study also observes <strong>statistical timing differences</strong> across:</p><ul><li>iOS devices.</li><li>Various Android device families (e.g., Samsung, Xiaomi, etc.).</li></ul><p>These differences likely originate from distinct:</p><ul><li>Power management strategies.</li><li>Background execution policies.</li><li>Network stack implementations.</li></ul><p>While this is not enough to uniquely identify a specific device model, it <strong>shrinks the anonymity set</strong> and can be combined with other signals (e.g., phone number country code, OS‑specific quirks) to refine profiling.</p><h3>Multi-device presence and location inference</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OF-vK7lLaA7d5pqgFFHVeg.png" /></figure><p>Modern messengers like WhatsApp and Signal support <strong>multiple linked devices:</strong> phones, desktops, laptops. The paper shows that each linked device:</p><ul><li><strong>Independently generates delivery receipts</strong> for events it processes.</li><li>Has <strong>its own characteristic timing pattern,</strong> depending on hardware, OS, and network.</li></ul><p>By correlating these streams, an attacker can infer:</p><ul><li><strong>Which devices are currently online.</strong></li><li><strong>When particular devices come online or go offline.</strong></li><li><strong>Transitions between environments for example:</strong></li></ul><blockquote>Home PC becomes active in the morning → user is likely at home.</blockquote><blockquote>Work laptop comes online at 9 AM and goes offline at 5 PM → typical workday schedule.</blockquote><blockquote>Gaps in both might hint at commute periods or travel.</blockquote><p>The researchers’ visualizations make this very tangible: you can see, over the course of a day, exactly when a test subject’s:</p><ul><li>Home PC is on.</li><li>Work laptop is active.</li><li>Phone switches between Wi‑Fi at home and cellular on the move.</li></ul><p>This essentially yields a<strong> behavioral map of daily life,</strong> purely from delivery receipt timings — no content, no GPS, no explicit check‑ins.</p><h3>Resource exhaustion as a secondary effect</h3><p>The ability to send high‑frequency probes, especially on WhatsApp, has nasty side effects beyond privacy:</p><ul><li>At 20 reactions per second, the researchers measured:</li><li>Data consumption on the order of 13 GB per hour.</li><li>Battery drain of up to 18% per hour on the victim’s device.</li></ul><p>The victim never sees messages or notifications but pays the price in:</p><ul><li>Mobile data bills.</li><li>Battery life.</li><li>CPU wakeups and radio activity.</li></ul><p>On Signal, strict rate limiting caps this at roughly 1 reaction per second, corresponding to about 360 MB per hour in the researchers’ tests — still non‑trivial, but far less catastrophic.</p><p>This shows that rate limiting is not only an anti‑spam mechanism; it also functions as a privacy and resource‑protection control. Without it, subtle timing channels can be amplified at scale and turned into both surveillance and denial‑of‑service tools.</p><h3>Threat model and ease of exploitation</h3><p>A notable and worrying aspect of <em>Careless Whisper</em> is how low the bar is for an attacker:</p><p><strong>Requirements</strong>:</p><ul><li>Knowledge of the target’s phone number.</li><li>A client capable of sending reactions programmatically (can be built using open‑source libraries or modified clients).</li></ul><p><strong>No requirements:</strong></p><ul><li>No malware on the target device.</li><li>No physical access.</li><li>No interaction (the victim never has to open the chat).</li><li>No need to be in the victim’s contacts.</li></ul><p>As the video coverage points out, this makes the technique particularly attractive for:</p><ul><li>Stalkers.</li><li>Abusive partners.</li><li>Private investigators.</li><li>State‑level actors correlating behavior across large sets of phone numbers.</li></ul><p>The researchers also highlight that, combined with previous WhatsApp flaws (e.g., obtaining a phone number from a single image using other exploits or leaks), this can slot into larger surveillance workflows.</p><h3>Disclosure and vendor response</h3><p>The authors followed standard responsible disclosure:</p><ul><li>Both <strong>Meta (WhatsApp)</strong> and <strong>Signal </strong>were notified in <strong>September 2024.</strong></li><li>According to the paper and later reporting:</li></ul><blockquote>Meta initially sent a generic acknowledgment. About a year later, they indicated that the report had been forwarded to the “relevant team,” with no clear mitigation deployed at protocol level.</blockquote><blockquote>Signal reportedly did not respond to the researchers at all.</blockquote><p>At the time of publication:</p><ul><li>Delivery receipts remained <strong>mandatory </strong>and<strong> non‑configurable.</strong></li><li><strong>No protocol‑level defenses</strong> against timing inference were documented.</li><li>Rate limiting and abuse monitoring behavior varied significantly: *</li></ul><blockquote>Stronger on Signal, weaker or absent on WhatsApp for this specific vector.</blockquote><p>Since then, WhatsApp has introduced a <strong>new advanced privacy setting</strong> described publicly as blocking <strong>high volumes of messages from unknown accounts</strong>. It is not yet clear, from a research standpoint, whether:</p><ul><li>This setting fully mitigates reaction‑based silent probing.</li><li>It only throttles traditional messages.</li><li>It can be bypassed with crafted reaction patterns.</li></ul><p>Still, enabling it is a <strong>no‑regrets</strong> step for users.</p><p>On Signal, users can improve their situation marginally by:</p><ul><li>Adjusting <strong>phone number discoverability</strong> settings (e.g., preventing people from finding the account via phone number).</li><li>Restricting who can contact them.</li></ul><p>However, as the authors emphasize, end users have very limited ability to defend themselves against timing side channels that are baked into protocol semantics.</p><h3>Why this matters</h3><p><em>Careless Whisper</em> reinforces a long‑standing lesson in applied cryptography:</p><blockquote>Protecting message content is necessary but not sufficient.<br>Metadata — timings, headers, receipt patterns — can be just as revealing.</blockquote><p>In this case:</p><ul><li>Delivery receipts, originally designed as a simple reliability feature (“did the message arrive?”), become a <strong>rich sensor</strong> when queried often and analyzed statistically.</li><li>At scale, this enables:</li><li>Daily activity reconstruction.</li><li>Inference of social ties (e.g., two users consistently having the app open in lockstep).</li><li>Correlation of devices and locations across time.</li></ul><p>The implications go beyond WhatsApp and Signal. Any system that:</p><ul><li>Provides <strong>fine‑grained, observable acknowledgments</strong>, and</li><li>Allows <strong>untrusted entities</strong> to trigger them at high frequency,</li></ul><p>is potentially vulnerable to similar timing‑based side channels.</p><h3>Mitigation directions from the research</h3><p>The authors propose and discuss several technical and architectural countermeasures:</p><p><strong>Strong rate limiting</strong></p><ul><li>Especially for unknown or unauthenticated senders.</li><li>Throttle reaction events and other low‑visibility interactions.</li><li>Limit the maximum probe frequency to reduce both timing resolution and resource impact.</li></ul><p><strong>Timing obfuscation and batching</strong></p><ul><li>Introduce randomized delays or coarse‑grained batching when sending delivery receipts.</li><li>Trade a small amount of interactivity for significant privacy gains.</li><li>For example, send receipts in fixed‑interval batches rather than immediately.</li></ul><p><strong>Reduced granularity of acknowledgments</strong></p><ul><li>Avoid exposing ultra‑precise, per‑event timing where not strictly necessary.</li><li>Consider coalescing or aggregating receipts.</li></ul><p><strong>Treat receipt metadata as sensitive</strong></p><ul><li>Design protocols from the outset as if timing and acknowledgment patterns will be adversarially observed.</li><li>Apply similar threat‑modeling rigor to metadata as to message content.</li></ul><p>The researchers stress that <strong>these changes must occur at the protocol and implementation level</strong>. Users cannot realistically bolt privacy on top of timing side channels.</p><h3>Conclusion</h3><p>The <em>Careless Whisper</em> work demonstrates that even “boring” protocol features — delivery receipts and reactions — can harbor powerful privacy risks when examined carefully.</p><ul><li>A seemingly harmless second check mark in WhatsApp hides a <strong>side channel capable of revealing device state, network type, and daily routine.</strong></li><li>Silent reactions, especially when not rate‑limited, convert this side channel into a <strong>continuous monitoring interface </strong>open to anyone with your phone number.</li><li>Multi‑device support, while useful, amplifies the leakage by exposing where and when your different devices are active.</li></ul><p>As messaging platforms increasingly brand themselves as privacy‑first and <strong>end‑to‑end encrypted</strong>, this research is a reminder: encryption is only one layer. To offer real privacy, systems must address <strong>metadata and timing leakage</strong> with the same seriousness as cryptographic correctness.</p><h3>Core references</h3><p>The analysis and technical description of the attack draw from the peer‑reviewed paper:</p><ul><li><strong>Gegenhuber, Gabriel Karl,</strong> et al.<em>“Careless Whisper: Exploiting Stealthy End-to-End Leakage in Mobile Instant Messengers.”</em> SBA Research / University of Vienna, 2024. Available via arXiv (arXiv:2411.11194).​</li></ul><p><em>The timing plots and illustrative charts in this article are adapted from Seytonic’s video “Hacking ‘</em><strong>❤️</strong><em>’ to Track ANY WhatsApp or Signal User” on YouTube, used here for explanatory and educational purposes.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0f81f91d83f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Every Cybersecurity Student Must Try Building a Network Intrusion Detection System (NIDS): A…]]></title>
            <link>https://medium.com/@imafdi/why-every-cybersecurity-student-must-try-building-a-network-intrusion-detection-system-nids-a-5ced6107fc29?source=rss-0f54bdfa9a66------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ced6107fc29</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[ndis]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Abadullah Faridi]]></dc:creator>
            <pubDate>Fri, 08 Nov 2024 12:56:29 GMT</pubDate>
            <atom:updated>2024-11-08T13:03:56.748Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why Every Cybersecurity Student <em>Must</em> Try Building a Network Intrusion Detection System (NIDS): A Gloriously Hacked Together Adventure in Python</h3><p>Ah, the Network Intrusion Detection System (NIDS) — that beast lurking in the curriculum of any self-respecting cybersecurity program. Why did I embark on the ambitious journey to build my own NIDS in Python? Simple: it’s probably the fastest way to immerse yourself in the gritty world of network protocols, packet sniffing, anomaly detection, and troubleshooting. Grab a cup of coffee, sit back, and let me take you on the wild ride of building a NIDS, laced with sarcasm, gritty insights, and lessons learned the hard way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*rVZtpnXath_XQ9xiyZb3oQ.png" /></figure><h4>Setting the Scene: Why a NIDS?</h4><p>For cybersecurity students, the concept of an intrusion detection system sounds both thrilling and terrifying. You get to monitor network traffic and try to catch nefarious packets in action! Here’s why every student should build a NIDS: it’s an adventure that demands you understand network traffic, protocols, packet data, and a little machine learning — all while taming the chaos that is Python debugging.</p><p>So, armed with my Python IDE, libraries like <strong>Scapy</strong> and <strong>Nmap</strong>, and an overly optimistic view of my debugging skills, I set off on my mission.</p><h3>Part 1: Diving into the Code</h3><p>Building a NIDS isn’t just “writing code”; it’s wrangling with packet data. Here’s how my journey played out and a few code snippets to spare you from the same mistakes I made.</p><h4>Step 1: Understanding Network Protocols (A Crash Course in Chaos)</h4><p>The first task was getting comfortable with network protocols. But TCP/IP and UDP packets don’t exactly come with a user-friendly guide, and you’ll need to dig into RFCs and start parsing raw data. I leaned on <strong>Scapy</strong> for packet crafting and parsing. Here’s a basic example of capturing packets:</p><pre>from scapy.all import sniff<br># Define a packet handler function<br>def packet_handler(packet):<br>    if packet.haslayer(&quot;IP&quot;):<br>        print(f&quot;Source: {packet[&#39;IP&#39;].src} -&gt; Destination: {packet[&#39;IP&#39;].dst}&quot;)<br># Start sniffing packets (set count to 0 for continuous sniffing)<br>sniff(prn=packet_handler, count=10)  # Adjust count as needed</pre><p><em>What to avoid:</em> Don’t set count=0 right away; you’ll risk endless loops and memory issues if your code isn’t optimized. Start with small count values until you’re confident.</p><h4>Step 2: Anomaly Detection with Machine Learning (Insert Panic Here)</h4><p>When people talk about anomaly detection, they make it sound easy. In reality, detecting anomalous network traffic means you need to know what “normal” looks like first. I tried a few things:</p><ul><li><strong>Attempt 1: Simple Rules-Based Detection</strong></li></ul><pre># Very basic (and naive) rules-based detection<br>def detect_anomaly(packet):<br>    if packet.haslayer(&quot;TCP&quot;) and packet[&#39;TCP&#39;].flags == &quot;S&quot;:<br>        print(&quot;Potential SYN scan detected!&quot;)</pre><p><em>Why this didn’t work:</em> Almost every packet seemed suspicious. With no baseline, every TCP SYN packet looked like a hack attempt.</p><ul><li><strong>Attempt 2: Machine Learning Model for Anomaly Detection</strong></li></ul><p>Machine learning models need training data, which means you have to generate both “normal” and “abnormal” traffic patterns for a baseline.</p><pre>from sklearn.ensemble import IsolationForest<br>import numpy as np<br><br># Sample dataset (in real life, you&#39;d use more features)<br>data = np.array([[0.1], [0.2], [0.2], [1.0], [1.2], [1.1], [10]])  # Last element is an &quot;anomaly&quot;<br><br># Training isolation forest for anomaly detection<br>clf = IsolationForest(contamination=0.1)<br>clf.fit(data)<br><br># Predict if new traffic is anomalous (1=normal, -1=anomaly)<br>result = clf.predict([[1.5]])  # Adjust with real packet data<br>print(&quot;Anomaly detected&quot; if result[0] == -1 else &quot;Normal traffic&quot;)</pre><p><em>Lesson learned:</em> Keep models simple! Start with basic thresholds and only move to machine learning if you have real datasets.</p><h4><strong>Step 3: Actually Making Sense of Alerts</strong></h4><p>Once you’ve set up anomaly detection, interpreting alerts is the next hurdle. Packets don’t exactly scream “BINGO!”; instead, they display hexadecimals, IPs, and port numbers that need decoding.</p><pre>def interpret_alert(packet):<br>    if packet.haslayer(&quot;IP&quot;):<br>        print(f&quot;Suspicious traffic: {packet[&#39;IP&#39;].src} -&gt; {packet[&#39;IP&#39;].dst} on port {packet[&#39;IP&#39;].dport}&quot;)<br>        # Log this or take appropriate action</pre><h3>Challenges &amp; Bugs (Also Known As Character-Building Experiences)</h3><p>This is where the journey took a detour into bug territory.</p><ol><li><strong>Missing Packets:</strong> Sometimes, packets seemed to vanish, likely due to CPU limitations or packet loss. Solving this required tuning Scapy’s buffering and handling timeouts carefully.</li><li><strong>Memory Leaks with Scapy:</strong> Scapy is powerful, but sniffing too many packets can hog memory. I had to set up periodic memory clearing with gc.collect() to prevent crashes.</li><li><strong>The “nmap” Issue:</strong> Halfway through testing, I realized <strong>nmap</strong> wasn’t in my system PATH, leading to an hour-long goose chase.</li></ol><h3>Lessons Learned the Hard Way</h3><p>After all the drama, here’s what I took away:</p><ul><li><strong>Know Your Protocols</strong> — Network protocols are non-negotiable. If you don’t understand them, you’re lost. RFCs and Wireshark logs became my best friends.</li><li><strong>Simplify Machine Learning Models</strong> — Keep models basic at first. Complex models require large datasets and more computational power than you’d expect in a basic lab.</li><li><strong>Debugging is Key</strong> — For every line of code you write, expect to spend ten minutes debugging. Here’s a handy snippet for debugging packet layers:</li></ul><pre>def debug_packet(packet):   <br>    print(packet.show())</pre><h3>Why Every Cybersecurity Student Should Do This (Despite the Pain)</h3><p>Building a NIDS is like boot camp for cybersecurity. When you can sniff packets, detect unusual traffic patterns, and debug like a pro, you’re better prepared for real-world scenarios. This hands-on project will teach you network security principles by forcing you to live them.</p><h3>Final Takeaway: NIDS Is Not for the Faint of Heart</h3><p>So, should you try building a NIDS? Only if you’re ready to embrace the chaos, the bugs, and the constant stream of IP addresses. It’s challenging, but once you’re done, you’ll have a stronger skill set and a keener eye for network anomalies.</p><p>Ready to take the plunge? Just remember: every challenge is a lesson waiting to be hacked. Happy sniffing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ced6107fc29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Took Over a Website Using SQL Injection and SQLMap: A Real-World Vulnerability Story]]></title>
            <link>https://medium.com/@imafdi/how-i-took-over-a-website-using-sql-injection-and-sqlmap-a-real-world-vulnerability-story-f5b3d732ec76?source=rss-0f54bdfa9a66------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5b3d732ec76</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[vulnerability-assessment]]></category>
            <category><![CDATA[sqlmap]]></category>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[website]]></category>
            <dc:creator><![CDATA[Abadullah Faridi]]></dc:creator>
            <pubDate>Fri, 27 Sep 2024 17:42:48 GMT</pubDate>
            <atom:updated>2024-09-27T17:42:48.519Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of cybersecurity, staying ahead of threats is a constant battle. As a security professional, I recently conducted a vulnerability assessment for a web application belonging to a retail company, which I’ll refer to as “<em>ShopWell</em>” for privacy reasons. During the assessment, I discovered a serious security flaw in the website’s login mechanism —<strong>SQL Injection (SQLi)</strong>. Armed with SQLMap, a powerful open-source tool, I was able to demonstrate the full extent of this vulnerability, eventually gaining control over the website’s admin panel.</p><p>This blog post will walk you through how I identified and exploited this vulnerability using SQL Injection, shedding light on the critical need for strong web application security.</p><h3>Understanding SQL Injection (SQLi)</h3><h4>What is SQL Injection?</h4><p>SQL Injection (SQLi) is a code injection technique that allows attackers to manipulate or bypass a web application’s database queries by inserting malicious SQL code into input fields. When user inputs are not properly validated, attackers can exploit this by submitting SQL commands instead of expected data, potentially gaining unauthorized access to the database, exfiltrating data, or even taking control of the entire system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*zr7i6ZD7el1ERVVo.jpg" /><figcaption>SQL injection *Image taken from GeeksforGeeks*</figcaption></figure><p>SQLi vulnerabilities have been one of the most common and dangerous threats to web applications for years. Despite awareness, many sites are still vulnerable due to poor coding practices or lack of regular security assessments.</p><h4>Types of SQLi Attacks</h4><p>There are several types of SQL injection attacks, including:</p><ol><li><strong>Error-based SQLi</strong>: The attacker triggers error messages from the database that reveal valuable information.</li><li><strong>Union-based SQLi</strong>: This technique leverages the UNION SQL operator to combine the results of two or more SELECT queries, allowing attackers to extract data.</li><li><strong>Blind SQLi</strong>: In blind SQLi, no error messages are returned. Instead, the attacker observes behavioral changes in the web application to infer the structure of the database.</li><li><strong>Time-based Blind SQLi</strong>: This variant uses time delays to infer whether a query was successful or not, based on how long the server takes to respond</li></ol><h4>How SQLi Can Affect a Website</h4><p>When successfully exploited, SQLi can expose sensitive data like usernames, passwords, credit card information, and more. It can also give attackers complete control over the database, allowing them to modify or delete data, deface the website, or take it down entirely.</p><h4>The Importance of Web Vulnerability Assessments</h4><p>Before diving into the technical details, it’s important to understand why web vulnerability assessments are essential. In today’s digital landscape, websites are frequent targets of cyberattacks due to the sensitive data they often handle. A compromised website can expose everything from user credentials to financial and business data, resulting in significant damage to both the organization and its customers.</p><p>In the case of <em>ShopWell</em>, the site was not just an online storefront — it also managed customer data, including purchase histories and shipping details. If a malicious attacker had found and exploited the vulnerabilities I did, the consequences could have been severe. My role, as an ethical hacker, was to identify these flaws before they could be leveraged for malicious purposes.</p><h3>Identifying SQL Injection Vulnerabilities</h3><h4>Step 1: Initial Reconnaissance</h4><p>During the initial phase of the vulnerability assessment for <em>ShopWell</em>, I performed reconnaissance using tools like <strong>Burp Suite</strong> and <strong>Nmap</strong> to analyze the structure of the web application. I paid particular attention to the login form at shopwell.com/admin/login.php, as login pages are often prime targets for SQLi attacks.</p><p>The site responded unusually to certain input in the form fields, which suggested improper input sanitization — a telltale sign of a potential SQL injection flaw.</p><h4>Step 2: Manual Testing for SQLi</h4><p>Before diving into automated tools, I decided to perform some manual tests. Using a standard input like:</p><pre>&#39; OR 1=1 --</pre><p>This input is a classic SQL injection payload designed to trick the database into always returning a TRUE condition, effectively bypassing the login checks. To my surprise, the form processed the input and allowed me access to the next page—a strong indication that the website was indeed vulnerable.</p><h3>Exploiting the Vulnerability</h3><p>While manual testing confirmed the vulnerability, I needed a more structured way to explore its full extent. That’s where <strong>SQLMap</strong> came into play. SQLMap automates the process of exploiting SQL injection and retrieving data from vulnerable applications, making it an invaluable tool for penetration testers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*8iS5yrSH1zu9hiV2.png" /><figcaption>SqlMap</figcaption></figure><h4>Step 3: Using SQLMap for Deeper Analysis</h4><p>To begin my exploration, I ran SQLMap against the login form’s URL, focusing on the login parameters:</p><pre>sqlmap -u &quot;http://shopwell.com/admin/login.php&quot; --data=&quot;username=admin&amp;password=pass&quot; --dbs</pre><blockquote>In this command:</blockquote><blockquote>-u specifies the URL to test.</blockquote><blockquote>--data allows me to specify the POST request parameters for the login for<em>m.</em></blockquote><p>This command tests the vulnerability and retrieves a list of databases. After a few moments, SQLMap identified the backend database and displayed table names related to users, orders, and other sensitive information.</p><p>Here’s an example of how the output looked:</p><pre>[INFO] retrieved: shopwell_db<br>Database: shopwell_db<br>[2 tables]<br>+-------------------+<br>| users             |<br>| orders            |<br>+-------------------+</pre><p>I now had access to the users and orders tables. Next, I used SQLMap to dump the contents of the users table:</p><pre>sqlmap -u &quot;http://shopwell.com/admin/login.php&quot; --data=&quot;username=admin&amp;password=pass&quot; -D shopwell_db -T users --dump</pre><p>This command extracted sensitive user data from the users table, including usernames and passwords. Fortunately, I noted that the passwords were hashed, which was a relief. But the algorithm they were using to hash the passwords was MD5, which is easy to crack. As a hacker i could easily crack these hashes.</p><h4>Step 4: Logging into the Admin Panel</h4><p>With the credentials I obtained, I logged into the admin panel using the following SQL payload:</p><pre>admin&#39; OR &#39;1&#39;=&#39;1&#39; --</pre><p>This bypassed the login checks, giving me administrator-level access. From this point, I could modify content, delete records, or even shut down the site if I were a malicious actor.</p><h3>Mitigating and Preventing SQL Injection</h3><p>Once I confirmed the vulnerability, the priority shifted to protecting ShopWell from any real-world exploitation. Here’s how I handled it:</p><h4>1. Input Validation and Parameterized Queries</h4><p>I recommended immediately updating all database queries to use <strong>parameterized queries</strong> or <strong>prepared statements</strong>, which prevent SQL injection by separating SQL code from data. This simple change ensures that user inputs are never executed as part of the SQL command.</p><p><strong>Example of vulnerable code</strong>:</p><pre>$query = &quot;SELECT * FROM users WHERE username = &#39;$username&#39; AND password = &#39;$password&#39;&quot;;</pre><p><strong>Secure code using prepared statements</strong>:</p><pre>$stmt = $pdo-&gt;prepare(&quot;SELECT * FROM users WHERE username = ? AND password = ?&quot;);<br>$stmt-&gt;execute([$username, $password]);</pre><h4>2. Password Security</h4><p>During the SQLMap analysis, I found that although passwords were hashed, ShopWell was using an outdated algorithm. I advised switching to modern and secure hashing algorithms like <strong>bcrypt</strong> or <strong>Argon2</strong>, which are designed to be computationally expensive and resistant to brute-force attacks.</p><h4>3. Error Handling</h4><p>Another aspect I noticed was that the website leaked database error messages during testing. These error messages can provide valuable clues to attackers about the underlying database structure. I recommended implementing proper error handling that prevents detailed error messages from being displayed to the user.</p><h4>4. Regular Security Audits</h4><p>A key takeaway from this assessment is that SQLi vulnerabilities are preventable with proper security practices in place. I advised ShopWell to adopt regular security audits and vulnerability assessments as part of their ongoing cybersecurity strategy. These audits should include penetration testing, code reviews, and web application firewalls (WAFs) like (<em>Aws WAF or Cloudflare WAF)</em> to catch any potential issues before they become exploitable.</p><h3>Final Thoughts</h3><p>SQL Injection is one of the oldest and most dangerous vulnerabilities in web applications, yet many websites remain vulnerable due to lax security practices. The vulnerability I discovered on ShopWell could have been catastrophic if left unchecked — allowing attackers to steal sensitive data or compromise the entire website.</p><p>By identifying the flaw, reporting it responsibly, and implementing security fixes, I was able to safeguard the website and protect it from future attacks. This experience reinforces the importance of regular security assessments and the role of ethical hackers in keeping the web a safer place.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5b3d732ec76" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Logical Structure of a Disk — A Forensic Investigator’s Perspective]]></title>
            <link>https://medium.com/@imafdi/understanding-the-logical-structure-of-a-disk-a-forensic-investigators-perspective-e78502e9f67b?source=rss-0f54bdfa9a66------2</link>
            <guid isPermaLink="false">https://medium.com/p/e78502e9f67b</guid>
            <category><![CDATA[disk]]></category>
            <category><![CDATA[partition]]></category>
            <category><![CDATA[structure-of-disk]]></category>
            <category><![CDATA[investigation]]></category>
            <category><![CDATA[forensics]]></category>
            <dc:creator><![CDATA[Abadullah Faridi]]></dc:creator>
            <pubDate>Fri, 27 Sep 2024 11:43:37 GMT</pubDate>
            <atom:updated>2024-09-27T14:25:17.910Z</atom:updated>
            <content:encoded><![CDATA[<h3>Understanding the Logical Structure of a Disk — A Forensic Investigator’s Perspective</h3><h3>Introduction:</h3><p>As a forensic investigator, one of the most essential aspects of understanding a case involving digital devices is the logical structure of a disk. Through my experience and learning, especially from the coursework on <strong>computer forensics and incident response</strong>, I’ve gained profound insights into how data is structured, stored, and accessed within disks. The logical structure plays a pivotal role in every investigation and is often the key to recovering crucial evidence. Here’s an overview of what I’ve learned about the logical structure of disks and its significance in forensic analysis.</p><h3>The Logical Structure of a Disk:</h3><p>The data stored on a disk is organized in the form of files and directories in a hierarchical tree structure, dictated by the operating system (OS). Each OS uses different file systems and methods to control and access data on the disk, which influences how data is read and written.</p><p>Forensic investigations heavily rely on understanding these structures because when digital crimes are committed, traces often remain embedded in the disk’s structure. As a forensic investigator, the ability to navigate these structures allows me to uncover hidden, deleted, or fragmented data that can serve as critical evidence.</p><h3>Master Boot Record (MBR):</h3><p><strong>Master Boot Record (MBR)</strong> refers to a hard disk’s first sector or sector zero, which specifies the location of an OS for the system to load into the main storage. MBR is also called the partition sector or master partition table as it contains a table that locates partitioned disk data. A program in the record loads the rest of the OS into the RAM.</p><p><strong>The MBR is used for:</strong></p><ul><li>Holding a partition table which refers to the partitions of a hard disk</li><li>Bootstrapping an OS</li><li>Distinctively recognizing individual hard disk media with a 32-bit disk signature</li></ul><h4><strong>Structure of a Master Boot Record:</strong></h4><p>The structure of MBR consists of three parts:</p><ul><li><strong>Master Boot Code or Boot Strap:</strong> A small program responsible for initiating the boot process.</li><li><strong>Partition Table</strong>: This 64-byte data structure describes the disk partitions.</li><li><strong>Disk Signature</strong>: Unique to each disk, this is critical for BIOS during boot-up.</li></ul><p>Forensic tools can help recover MBRs even after attempts to overwrite or hide it. Any anomalies in the MBR can reveal tampering attempts, providing leads in an investigation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*45ZVsefa3EAs-W24eX25yg.png" /><figcaption>MBR Structure</figcaption></figure><h4>Disk Partitions:</h4><p>Partitioning refers to the creation of logical drives for effective memory management, and a partition is a logical drive for storing data. Hidden partitions created on a drive can hide data. The inter-partition gap is the space between the primary partition and the secondary partition.</p><p>If the inter-partition drive contains hidden data, disk-editor utilities such as Disk Editor can be used to change the information in the partition table. Doing so will remove all the references to the hidden partition, which have been hidden from the OS. Another method to hide data is to place the data, which may be digital evidence, at the end of the disk by declaring a smaller number of bytes than the actual size of the drive. Disk Editor allows an investigator to access these hidden or vacant areas of the disk.</p><p><strong>Partitions are of the following two types:</strong></p><ul><li><strong>Primary partition:</strong> It is a drive that holds the information regarding the OS, system area, and other information required for booting. In MS-DOS and earlier versions of Microsoft Windows systems, the first partition (C:) must be a “<em>primary partition</em>”.</li><li><strong>Extended partition:</strong> It is a logical drive that holds the information regarding stored data and files in the disk. A few disk-editor tools are <em>Disk Edit</em>, <em>WinHex, </em>and <em>Hex Workshop</em>. These tools enable users to view file headers and important information about files.</li></ul><h4>BIOS Parameter Block (BPB):</h4><p>The BIOS parameter block (BPB) is data structure situated at sector 1 in the volume boot record (VBR) of a hard disk and explains the physical layout of a disk volume. On partitioned devices such as hard disks, it describes the volume partition, whereas on unpartitioned devices, it describes the entire medium. Any partition that includes floppy disks can use BPB, which also describes the basic file-system architecture. The length of BPB varies across the listed file systems (i.e., FAT16, FAT32, and NTFS) because different file systems store different volumes of data and maintain different types of fields in the BPB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*Pc5e3X1O3w33hExkjilTvg.png" /><figcaption>Extended BPB for FAT32</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*ls77zNHsIh8szeG460P02A.png" /><figcaption>Extended BPB for NTFS</figcaption></figure><h3><strong>Clusters Space:</strong></h3><p>A cluster is the smallest logical storage unit on a hard disk. It is a set of sectors within a disk ranging from cluster number 2 to 32 or more, depending on the formatting scheme in use. The file system divides the storage on a disk volume into discreet chunks of data for efficient disk usage and performance. These chunks are called clusters, The process by which files are allocated to clusters is called allocation; therefore, clusters are also known as allocation units. In the File Allocation Table (FAT) file system, the clusters linked with a file keep track of file data in the hard disk’s file allocation table.</p><h4><strong>Cluster Size</strong></h4><p>Cluster sizing has a significant impact on the performance of an OS and disk utilization. Cluster size can be altered for optimum disk storage The size of a cluster depends on the size of the disk partition and type of file system installed on the partition. A large cluster size (greater than one sector) has the following effects:</p><ul><li>Minimizes the fragmentation problem</li><li>Increases the probability of unused space in the cluster</li><li>Reduces the disk storage area in which information can be saved Reduces the unused area on the disk</li></ul><h3>Lost Clusters: Hidden Fragments of Evidence</h3><ol><li>When the OS marks clusters as used but does not <em>allocate them to any file</em>, such clusters are known as lost clusters.</li><li>A lost cluster is a FAT file system error that results from the manner in which the FAT file system allocates space and chains files together.</li><li>It is mainly the result of a logical structure error and not a physical disk error.</li><li>They usually occur because of <em>interrupted file activities</em> caused when, for example, a file is not properly closed; thus, the clusters involved in such activity are never linked correctly to a file.</li><li><strong><em>CHKDSK</em></strong> is a system tool in Windows that authenticates the <em>file system reliability of a volume</em> and repairs <em>logical file system errors</em>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*P_RrXu1aGu4yMmspsv8gTA.png" /></figure><h3>Slack Space:</h3><p>Slack space is the storage area of a disk between the end of a file and the end of a cluster. If the file size is less than the cluster size, a full cluster is still assigned to that file. The remaining unused space is called slack space.</p><p><em>For example</em>, if the partition size is 4 GB, each cluster will be 32 KB in size. Even if a file requires only 10 KB, the entire 32 KB will be allocated to that file, resulting in 22 KB of slack space.</p><h4><strong>File Slack Types:</strong></h4><ul><li><strong>RAM slack:</strong> RAM slack is the data storage space that starts from the end of a file to the end of the last sector of the file.</li><li><strong>Drive slack:</strong> Drive slack is the data storage space that starts from the end of the last sector of a file to the end of the last cluster of the file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Glh5Iw0--IKEqHPDRhDJpA.png" /></figure><h3>Globally Unique Identifier (GUID):</h3><p>The Globally Unique Identifier (GUID) is a 128-bit unique reference number used as an identifier in computer software. In general, GUIDs are displayed as 32 hexadecimal digits with groups separated by hyphens.</p><h4><strong>Common Uses:</strong></h4><ul><li>In Windows Registry, GUIDs are used to identify COM (Component Object Model) DLLs (dynamic-link libraries).</li><li>In database tables, GUIDs are used as primary key values.</li><li>In some instances, a website may assign a GUID to a user’s browser to record and track the session.</li><li>Windows assigns a GUID to a username to identify user accounts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*5sGQRCULLzn7aMGI9yVZ6A.png" /></figure><h3>GUID Partition Table (GPT): The Modern Disk Layout</h3><p>The <strong>GUID Partition Table (GPT)</strong>, used in newer systems, supports larger drives (over 2TB) and more partitions than MBR. It also stores critical data in multiple locations, which enhances recovery capabilities in case of disk corruption. This is especially useful in forensic investigations, as GPT provides more opportunities to recover lost or tampered data.</p><p>GPT also offers better security than MBR, using <strong>Cyclic Redundancy Checks (CRCs)</strong> to ensure data integrity, which is invaluable when verifying the authenticity of data in a legal case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*tMB8pVDouEj7rcXMOB3nKQ.png" /></figure><h4>Advantages of GPT disk layout:</h4><ul><li>Supports up to 128 partitions and uses 64bit Logical Block Addresses (LBAs)</li><li>Supports a maximum partition size ranging from 2 Tebibytes (TiB) to 8 Zebibytes (ZiB)</li><li>Provides primary and backup partition tables for redundancy<br>Remaining</li></ul><h3>Conclusion: Why the Logical Structure of a Disk Matters in Forensics</h3><p>Understanding the <strong>logical structure of a disk</strong> is crucial for any forensic investigator. From navigating hidden partitions to analyzing slack space, the way data is structured and stored on a disk can reveal vital clues in an investigation. The knowledge I’ve gained in this field has equipped me to uncover data that would otherwise remain hidden, bringing critical evidence to light.</p><p>In the world of forensic investigation, the disk’s logical structure is a roadmap that, when understood properly, leads to answers and, often, justice.</p><h3>Visual Resources and Forensic Tools</h3><p>Throughout my learning computer investigations, I rely on several tools, including:</p><ul><li><strong>Disk Editors (e.g., WinHex)</strong> to view hidden partitions and slack space.</li><li><strong>chkdsk</strong> to scan for lost clusters and errors.</li><li><strong>Forensic software suites</strong> to recover deleted data and analyze disk structures.</li></ul><p>This understanding has been foundational to my knowledge, helping me become a more effective investigator.</p><h3>Sources of Information:</h3><p>The information presented in this blog is drawn from my coursework in <strong>computer forensics and incident response </strong>from EC-Council, specifically focusing on the <strong>logical structure of disks</strong>. It includes details on <strong>Master Boot Records (MBR)</strong>, <strong>GUID Partition Tables (GPT)</strong>, <strong>clusters</strong>, <strong>slack space</strong>, and various file systems like <strong>FAT</strong> and <strong>NTFS</strong>, all of which play critical roles in forensic analysis. The provided data and diagrams come from authoritative forensic resources, helping me gain a deeper understanding of how digital evidence is structured and how it can be retrieved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e78502e9f67b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simulating EternalBlue: A Hands-on Approach to Understanding Exploits]]></title>
            <link>https://medium.com/@imafdi/simulating-eternalblue-a-hands-on-approach-to-understanding-exploits-9419b68e5e0b?source=rss-0f54bdfa9a66------2</link>
            <guid isPermaLink="false">https://medium.com/p/9419b68e5e0b</guid>
            <category><![CDATA[cyberattack]]></category>
            <category><![CDATA[exploit]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Abadullah Faridi]]></dc:creator>
            <pubDate>Thu, 26 Sep 2024 08:45:23 GMT</pubDate>
            <atom:updated>2025-12-18T12:11:09.819Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction:</h3><p>In May 2017, the cybersecurity world stood still as a massive wave of ransomware, known as WannaCry, spread across the globe, leaving behind billions of dollars in damages. At the heart of this attack was a vulnerability in Microsoft’s SMB (Server Message Block) protocol — <em>EternalBlue</em> — originally discovered by the National Security Agency (NSA) and later leaked by the hacker group Shadow Brokers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*zQ_F0gAoMwXMBLfthxLyxg@2x.jpeg" /></figure><p>As the exploit ripped through unpatched systems, it highlighted a chilling reality: in our interconnected world, a single vulnerability could have devastating consequences.</p><p>But how does EternalBlue actually work? What made it so dangerous? To answer these questions, I embarked on a project to simulate this notorious exploit using Python. The goal of this blog is to share that journey, breaking down complex concepts into something tangible for cybersecurity enthusiasts and professionals alike. Whether you’re a student learning about vulnerabilities or an expert looking to dive deeper into EternalBlue, this simulation will offer you a closer look.</p><h3>Understanding EternalBlue: A Cybersecurity Milestone:</h3><p>EternalBlue targets a vulnerability in Microsoft’s implementation of the SMB protocol, specifically in how it handles requests. It exploits CVE-2017–0144, a flaw in how SMBv1 packets are processed, allowing attackers to execute arbitrary code on the affected machine.</p><p>At its core, EternalBlue sends specially crafted messages to an SMB server, which trigger a buffer overflow. This allows the attacker to inject malicious code and ultimately take control of the system. Once control is gained, attackers can do anything from stealing sensitive information to deploying ransomware — just as we saw with WannaCry.</p><p>Understanding the nuances of this exploit requires a deep dive into networking, operating system internals, and the mechanics of buffer overflows. But, instead of stopping at theory, I wanted to take things a step further by simulating the exploit — making these abstract concepts come to life.</p><h3>Why I Built the EternalBlue Simulation:</h3><p>Before diving into the technical aspects, I wanted to clarify my motivation. While the EternalBlue exploit has been thoroughly analyzed by experts worldwide, I found that hands-on, educational simulations of such real-world exploits were lacking. I decided to bridge that gap, creating a Python-based simulation that could serve as a teaching tool.</p><p>My GitHub project simulates the EternalBlue vulnerability in a controlled environment. The idea is not to provide a weaponized version of the exploit but to replicate its fundamental mechanics for educational purposes. By walking through this simulation, you’ll gain an understanding of how vulnerabilities can be exploited — and, more importantly, how they can be mitigated.</p><h3>Project Overview: Key Features of the Simulation:</h3><p>Here’s a breakdown of the core tools and libraries that make this project possible:</p><h4>1. SMB Protocol Emulation</h4><p>I leveraged Python libraries to mimic the SMB protocol, allowing for controlled manipulation of packet exchanges. This is crucial for replicating the conditions under which EternalBlue operates.</p><h4>2. Buffer Overflow Mechanism</h4><p>The heart of EternalBlue lies in its exploitation of a buffer overflow. In my simulation, I demonstrate how a specially crafted payload can overflow the SMB service’s buffer, leading to system compromise.</p><h4>3. Vulnerability Trigger</h4><p>The simulation highlights how EternalBlue triggers a vulnerability in SMB. By stepping through the process, you can understand how the attacker gains remote code execution.</p><h4>4. Real-World Impact and Mitigation</h4><p>One of the core objectives of this simulation is to emphasize the lessons learned from EternalBlue. The project includes insights into how these vulnerabilities can be patched, along with real-world strategies for mitigating similar risks in modern systems.</p><h3>Building the Simulation: Technical Walkthrough:</h3><p>Here’s a high-level overview of how the EternalBlue simulation works:</p><h4>1. Setting Up the Environment</h4><p>To replicate EternalBlue, I created a virtual environment using <strong>Python</strong> and some key libraries. Here’s a snippet from the project to help you set up the same:</p><pre># Install necessary dependencies<br>pip install pysmb scapy</pre><p>The <strong>pysmb</strong> library is used to handle the SMB packet generation, while <strong>scapy</strong> provides the ability to manipulate network packets, making it a perfect fit for simulating a network exploit like EternalBlue.</p><h4>2. Crafting the Exploit Payload</h4><p>At the core of this simulation is a payload designed to trigger the vulnerability. Here’s a breakdown of the code used to construct the exploit packet:</p><pre>from smb.SMBConnection import SMBConnection<br><br># Create an SMB connection<br>conn = SMBConnection(&#39;attacker&#39;, &#39;&#39;, &#39;victim&#39;, &#39;SMBServer&#39;)<br><br># Construct a specially crafted payload to simulate the buffer overflow<br>exploit_payload = b&#39;\x90&#39; * 1024  # NOP sled to simulate overflow<br><br># Send the payload<br>conn.sendSMB(exploit_payload)<br><br>def simulate_exploit(target_ip):<br>    try:<br>        # Simulate connecting to SMBv1 service<br>        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<br>        sock.connect((target_ip, 445))<br>        print(f&quot;Simulating EternalBlue exploit on {target_ip}...&quot;)<br>        <br>        # Simulate exploit logic (replace with actual exploit code for a real-world scenario)<br>        exploit_code = &quot;Exploit Code Payload&quot;<br>        sock.sendall(exploit_code.encode())<br>        print(&quot;Exploit code sent!&quot;)</pre><p>This simulates the conditions that lead to the buffer overflow and highlights the importance of patching vulnerable systems.</p><h3>Lessons Learned: The Ethics of Simulating Exploits:</h3><p>Building this project wasn’t without its challenges. One of the trickiest parts was configuring Nmap and ensuring the results were accurately parsed by the Python script. Additionally, simulating a real-world exploit in a safe and ethical manner required careful planning to avoid any misuse of the code.</p><p>Through this experience, I’ve deepened my understanding of network vulnerabilities and how they’re exploited, as well as honed my Python skills. It also highlighted the importance of secure coding practices and ethical hacking, which are essential in today’s cybersecurity landscape.</p><h3>Why This Project Matters:</h3><p>By simulating EternalBlue, I hope to provide a resource for other cybersecurity enthusiasts who want to learn more about how real-world exploits work — without the risks of engaging in illegal activities. Ethical hacking and vulnerability research are vital to securing our digital world, and this project serves as a stepping stone for anyone looking to delve deeper into network security.</p><h3>Conclusion:</h3><p>EternalBlue serves as a stark reminder of how critical cybersecurity is in today’s world. By simulating this exploit, I’ve gained invaluable insights into both the attack vector and the defenses that can prevent such vulnerabilities from being exploited in the future.</p><p>If you’re interested in seeing the full code or running the simulation yourself, check out the <a href="https://github.com/IMAFDI/EternalBlue_Simulation">GitHub repository</a>. Whether you’re looking to understand EternalBlue in-depth or want to explore how network exploits work, this project is a great starting point.</p><p>Together, let’s continue to build stronger, more resilient systems by learning from the vulnerabilities of the past.</p><p><strong>Ready to dive deeper?</strong></p><p>Explore the full EternalBlue simulation on my <a href="https://github.com/IMAFDI/EternalBlue_Simulation">GitHub</a> and start building your own understanding of this critical exploit. Let’s keep pushing the boundaries of cybersecurity — ethically and responsibly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9419b68e5e0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>