<?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 Hassan Mohsen on Medium]]></title>
        <description><![CDATA[Stories by Hassan Mohsen on Medium]]></description>
        <link>https://medium.com/@hassanmohsen13?source=rss-3f6d591501a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*OwLpJ2F4wfNdStEF.jpeg</url>
            <title>Stories by Hassan Mohsen on Medium</title>
            <link>https://medium.com/@hassanmohsen13?source=rss-3f6d591501a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 16:29:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hassanmohsen13/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[Breaking TLS in Flutter on iOS: How to Capture and Decrypt App Traffic]]></title>
            <link>https://medium.com/@hassanmohsen13/breaking-tls-in-flutter-on-ios-how-to-capture-and-decrypt-app-traffic-2e71326d2b49?source=rss-3f6d591501a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e71326d2b49</guid>
            <dc:creator><![CDATA[Hassan Mohsen]]></dc:creator>
            <pubDate>Wed, 24 Sep 2025 23:16:23 GMT</pubDate>
            <atom:updated>2025-09-24T23:16:23.466Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SeSCKpL7m6v-85aUjVuhXA.png" /></figure><p><strong>Prerequisites and scope</strong></p><p>Before you continue, make sure you’re familiar with the fundamentals covered in my <a href="https://medium.com/@hassanmohsen13/understanding-tls-and-certificate-pinning-in-flutter-why-traffic-interception-isnt-852d411f91b1">previous article</a>:</p><ul><li>How TLS works (handshake, certificates, trust chain).</li><li>The difference between TLS and SSL pinning.</li><li>How TLS and certificate pinning interact.</li></ul><p>This post focuses specifically on <strong>intercepting and bypassing TLS verification inside a Flutter iOS app</strong>.</p><p>To fix the problem we first need to understand it and also need to know why traffic interception is straightforward on Android but more complicated on iOS? Let’s answer that next.</p><h3>Why can we intercept requests directly in Android (using proxy, Frida script), but need custom setup for iOS?</h3><p>Short answer first: <strong>Because Android’s networking stack (and how the Flutter app is built on Android) usually </strong>respects<strong> the system/proxy path, while on iOS the same Flutter app often opens sockets or uses native transports that bypass the system HTTP proxy.</strong> So, on Android your Frida unpin + set Burp as proxy = works; on iOS the unpin helps TLS but the TCP/UDP stream never goes to Burp — hence you need VPN/transparent interception.</p><p><strong>A closer look (by cause):</strong></p><ul><li><strong>System proxy behavior differs by platform</strong> <br> Android (and many Android-flutter builds or emulators) commonly route HTTP traffic through the OS proxy, so setting a Wi-Fi proxy sends requests to Burp. iOS apps — or the native libraries used by Flutter plugins — often bypass the Wi-Fi proxy and talk directly over sockets.</li><li><strong>Different client stacks</strong> <br> On Android you frequently hit Java-based stacks (OkHttp, HttpURLConnection) that respect proxies. On iOS the app may use Dart native sockets / BoringSSL or CFNetwork/NSURLSession in ways that do not route through the device proxy, especially when native code or plugins are involved.</li><li><strong>Raw sockets vs. system HTTP clients</strong> <br> If the app opens a socket and performs TLS in-process (e.g., connect() + BoringSSL inside Flutter), that TCP connection goes straight to the remote IP and never to an HTTP proxy — Burp won’t see it. Android builds often route HTTP through a proxy-aware layer; some iOS builds do not.</li><li><strong>Emulator vs physical device</strong> <br> Android emulators typically make proxying easier; physical iPhones use a stricter networking model and behave differently when it comes to proxy routing.</li><li><strong>App / plugin differences</strong> <br> The same Dart code can result in different network behavior per platform because plugins or conditional compilation may use different native clients (for example, NSURLSession on iOS vs OkHttp on Android).</li></ul><h4><strong>What this means in practice</strong></h4><ul><li>App performs connect(server_ip:443) and handles TLS itself → Burp sees nothing (unless you have a proxy/transparent redirect).</li><li>App uses system HTTP client that respects proxy → Burp sees traffic when the device proxy is set.</li><li>App uses HTTP/3 / QUIC (UDP) or a custom transport → traditional HTTP proxies fail; VPN/gateway capture is required.</li></ul><p>Even when Flutter traffic is logically HTTP (Layer 7), a proxy only intercepts it if the app’s underlying TCP/UDP stream is routed to the proxy. If the app opens sockets directly, uses QUIC/UDP, or ignores proxy settings, Burp will miss it — but a VPN/TUN or transparent Layer 3/4 redirection will capture the stream.</p><p><strong>Result:</strong> Android is usually easier to intercept; iOS usually needs lower-layer capture. From this we derive two technical challenges to solve before you can inspect decrypted requests:</p><ol><li>Route iOS traffic through an intercept-capable gateway (capture at Layer 3/4).</li><li>Disable TLS verification inside the Flutter engine so the app accepts the interception certificate.</li></ol><p><em>Both must be solved. Next: solve the first challenge (routing/capture).</em></p><h3>Route iOS traffic through an intercept-capable gateway (capture at Layer 3/4).</h3><p>To intercept traffic that bypasses the system HTTP proxy you must capture it at a lower network layer (Layer 3). The practical way I use is to route the iPhone through an OpenVPN server running on my interception host, then redirect the VPN traffic to a local HTTP proxy (e.g., Burp).</p><p><strong><em>1. Install and generate an OpenVPN client config</em></strong></p><p>A quick <a href="https://raw.githubusercontent.com/Nyr/openvpn-install/master/openvpn-install.sh">install script will set up OpenVPN</a> and create a client .ovpn file:</p><pre>wget https://git.io/vpn -O openvpn-install.sh <br>chmod +x openvpn-install.sh <br>sudo ./openvpn-install.sh</pre><p>Follow the interactive prompts. Replace any example values with your environment:</p><ul><li><strong>Public IPv4 / Hostname:</strong> 192.168.1.10 (use your host IP or public hostname)</li><li><strong>Protocol:</strong> 1 (UDP)</li><li><strong>Port:</strong> 1194 (default)</li><li><strong>DNS server:</strong> choose 1.1.1.1 or another resolver</li><li><strong>Client name:</strong> e.g. openvpn_client</li></ul><p>The script will place the generated .ovpn file in your home directory (e.g., /home/kali <strong>or</strong> /root).</p><p>After setup, running ifconfig a should show a tun0 interface on the host.</p><p><strong><em>2. Transfer the client config to the iPhone</em></strong></p><p>A simple way to get the .ovpn file onto the iPhone is to serve it from the host and download it via Safari:</p><pre># from the directory that contains the .ovpn file (adjust path as needed) <br>sudo python3 -m http.server 8080 - directory /home/kali</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*affvz-FJS5k5XxR4M-LbjA.png" /></figure><p>On the iPhone, open <a href="http://%3Cyour-host-ip%3E:8080/">http://&lt;your-host-ip&gt;:8080</a> in Safari, download the .ovpn file and import it into the OpenVPN client app. Start the VPN on the phone; you should see the VPN icon in the status bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XKkkFwqqdpnamlLDNyHHgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w8bjpCaVbfq99f35p8ZSQg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rN_97z-MwVya5xGUlGAJMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u3mD5eyRHjc16N3K5PnYPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YH9zemrmRJwGYI1Fz55hcw.png" /></figure><p><strong><em>3. Start the OpenVPN service on the host</em></strong></p><pre>sudo service openvpn start</pre><p>Now the phone’s traffic flows through your host via tun0.</p><p><strong><em>4. Redirect VPN traffic to your local proxy (iptables)</em></strong></p><p>Next, redirect incoming VPN traffic to your proxy listener (example uses port 8080 for Burp). Replace interface names and subnets as appropriate.</p><blockquote>For local Wi-Fi clients:</blockquote><pre>sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp - dport 80 -j REDIRECT - to-port 8080 <br>sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp - dport 443 -j REDIRECT - to-port 8080 <br>sudo iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE</pre><blockquote>For OpenVPN clients (tun0):</blockquote><pre>sudo iptables -t nat -A PREROUTING -i tun0 -p tcp - dport 80 -j REDIRECT - to-port 8080 <br>sudo iptables -t nat -A PREROUTING -i tun0 -p tcp - dport 443 -j REDIRECT - to-port 8080 <br>sudo iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE</pre><ul><li>The first two rules redirect HTTP/HTTPS traffic to your local proxy (port 8080).</li><li>The POSTROUTING MASQUERADE rule allows clients to reach the internet with the host’s external IP.</li></ul><blockquote>Adjust the subnet (192.168.1.0/24) and proxy port if your environment differs.</blockquote><p><strong><em>5. Configure your proxy (Burp)</em></strong></p><ul><li>Set Burp to listen on the same port you redirected to (e.g., <strong>8080</strong>).</li><li>Bind to all interfaces so it accepts connections.</li><li>Enable <strong>Invisible proxy</strong> mode to support non-proxy-aware clients.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*byO1-TfA1Lxs_N1GozxEVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IQs5olQmhomNmxr0C3jRmA.png" /></figure><p>At this point you should begin seeing connections in Burp — but many will fail TLS verification because the app rejects the interception certificate.</p><p><strong><em>6. What’s left</em></strong></p><p>Routing via OpenVPN captures the traffic, but you still need to make the app accept your interception certificate. The next step is to disable TLS verification inside the Flutter runtime (for example, with an appropriate Frida hook). After that change, Burp will be able to decrypt and show the app’s requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TIDBM-7aQVgLwklFEkHaNg.png" /></figure><h3>Disable TLS verification inside the Flutter engine so the app accepts the interception certificate.</h3><p>This step is straightforward: we’ll use a Frida hook to disable TLS verification inside the Flutter runtime. There are many public Frida scripts available; some will work against a given app/version and some will not. I’ll show the scripts that worked for me — authoring a custom, version-specific Frida script is a deeper topic that deserves its own article.</p><p>You can try ready-made options such as:</p><pre># run a published script from Frida Codeshare (replace YOUR_BINARY) <br>frida - codeshare TheDauntless/disable-flutter-tls-v1 -f YOUR_BINARY</pre><p>Or download a script to your machine and run it against a device:</p><pre># run a local script against a USB-connected device (replace your.package.name) <br>frida -U -f your.package.name -l disable-flutter-tls.js</pre><p>Start the target app via Frida with the hook loaded; when the hook succeeds you should begin seeing decrypted requests in Burp (assuming network capture is configured).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mbmKAPl2hDIMNaewaxhX7A.png" /></figure><p><strong>Tip:</strong> when testing on a physical iPhone, keep the device connected to your host via USB while using Frida.</p><p><strong>Tip: </strong>If Burp can’t bind to port 8080, stop any running Python HTTP server first (find its PID and kill the process).</p><h4>What you try to do:</h4><p>Try using SSL-pinning bypass scripts to target certificate pinning (not TLS verification); in practice this often works.</p><p>I want to focus on a single topic — TLS — to highlight the difference between TLS and certificate (SSL) pinning.</p><p>Technically, the script you run targets the desired check and should bypass it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e71326d2b49" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding TLS and Certificate Pinning in Flutter: Why Traffic Interception Isn’t…]]></title>
            <link>https://medium.com/@hassanmohsen13/understanding-tls-and-certificate-pinning-in-flutter-why-traffic-interception-isnt-852d411f91b1?source=rss-3f6d591501a------2</link>
            <guid isPermaLink="false">https://medium.com/p/852d411f91b1</guid>
            <dc:creator><![CDATA[Hassan Mohsen]]></dc:creator>
            <pubDate>Wed, 17 Sep 2025 22:19:21 GMT</pubDate>
            <atom:updated>2025-09-17T22:19:21.012Z</atom:updated>
            <content:encoded><![CDATA[<h3>Understanding TLS and Certificate Pinning in Flutter: Why Traffic Interception Isn’t Straightforward</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BnsgOP_2YyB5zdkBxJ9kaQ.png" /></figure><p>In today’s mobile-first world, secure and reliable network communication forms the backbone of almost every application.</p><p>Whether you are building a simple weather app or a large-scale fintech platform, ensuring data moves safely between the app and backend servers is non-negotiable. Flutter, with its cross-platform capabilities, provides a robust set of APIs to handle networking. But when it comes to HTTPS, certificates, and advanced security measures like Transport Layer Security (TLS) and certificate pinning, developers often need to go beyond simple HTTP requests.</p><p>This article explores how Flutter manages network communication under the hood, the role of TLS in securing connections, and why intercepting Flutter traffic isn’t as straightforward as with native iOS or Android apps.</p><h3>SSL vs TLS vs Certificate Pinning</h3><p>Before diving deeper into Flutter’s internals, it’s important to clarify three commonly confused terms:</p><h3>1. SSL (Secure Sockets Layer)</h3><ul><li>An older cryptographic protocol once used to secure communications online.</li><li>Deprecated due to major vulnerabilities.</li><li>Today, when people say <em>“SSL,”</em> they usually mean TLS.</li><li>In Flutter/Dart, HTTPS requests (via http, dio, or HttpClient) actually use TLS, not SSL.</li></ul><h3>2. TLS (Transport Layer Security)</h3><ul><li>The modern, secure standard for HTTPS.</li><li>Provides encryption, integrity, and authenticity between client and server.</li><li>Used automatically whenever you make an https:// request in Flutter.</li></ul><p><strong>Example:</strong></p><pre>final response = await http.get(Uri.parse(&quot;https://example.com&quot;));</pre><p>This request is secured with TLS behind the scenes.</p><h3>3. Certificate Pinning (a.k.a. SSL Pinning)</h3><ul><li>An additional security layer on top of TLS.</li><li>Instead of trusting <em>any</em> valid certificate signed by a trusted CA, the app is configured to trust only a specific certificate or public key.</li><li>Protects against Man-in-the-Middle (MITM) attacks, even if a rogue CA issues a fake certificate.</li></ul><p>In Flutter, pinning can be implemented by:</p><ul><li>Using a custom SecurityContext with pinned certificates.</li><li>Leveraging packages like dio with http_certificate_pinning.</li></ul><p><strong>Summary in Flutter terms:</strong></p><ul><li><strong>SSL</strong> → obsolete, replaced by TLS.</li><li><strong>TLS</strong> → secures HTTPS automatically in Flutter.</li><li><strong>Certificate Pinning</strong> → an extra manual layer restricting which certificates are trusted.</li></ul><h3>How TLS and Certificate Pinning Work Together</h3><p>A common question is: <em>Does enabling certificate pinning disable TLS in Flutter?</em></p><p>The answer: <strong>No. TLS always runs first.</strong></p><h3>Normal TLS Request Flow</h3><ol><li>Flutter delegates networking to the underlying OS.</li><li>The OS performs the TLS handshake:</li></ol><ul><li>Server sends its certificate chain.</li><li>Client verifies certificate validity and CA trust.</li></ul><p>3. If valid, an encrypted TLS channel is established.</p><h3>With Certificate Pinning</h3><ol><li>The TLS handshake occurs as usual (as normal TLS Request Flow).</li><li>After OS validation, Flutter performs an additional check:</li></ol><ul><li>The server’s cert (or key fingerprint) is compared to the pinned version.</li><li>If they match → connection continues.</li><li>If they don’t → connection is rejected.</li></ul><p>🔑 <strong>Key takeaway:</strong></p><ul><li><strong>TLS = secure channel.</strong></li><li><strong>Pinning = stricter validation rule.</strong></li></ul><p>Think of TLS as checking a valid passport. Certification Pinning is like saying: <em>“It must also be this exact person I trust.”</em></p><h3>Why You Can’t Directly Intercept Flutter Traffic</h3><p>Unlike native iOS or Android apps, Flutter traffic isn’t easily intercepted due to architectural differences:</p><h3>1. Flutter Uses a Custom Engine</h3><ul><li>Native apps rely on OS networking libraries (NSURLSession on iOS, OkHttp on Android).</li><li>Flutter apps run Dart inside the Flutter engine (a C++ runtime).</li><li>Networking requests go through this Dart runtime before hitting OS APIs, making interception less transparent.</li></ul><h3>2. TLS and Certificate Handling</h3><ul><li>Flutter/Dart uses its own TLS logic (dart:io’s HttpClient), often bundling <strong>BoringSSL</strong>.</li><li>System-wide proxy certificates (e.g., Burp/Charles root CA) may not work out of the box.</li><li>Apps with Dart-level pinning further enforce trust, blocking interception attempts.</li></ul><h3>3. Compilation and Obfuscation</h3><ul><li>Dart code compiles Ahead-of-Time (AOT) into ARM machine code.</li><li>This makes Flutter harder to instrument with tools like Frida compared to Java/Obj-C.</li><li>Some libraries even enforce pinning inside Dart, bypassing OS-level hooks entirely.</li></ul><p><strong>In short:</strong><br> Flutter abstracts networking inside its engine and enforces TLS with optional pinning, making traffic interception far trickier than on pure native apps.</p><h3>Final Thoughts</h3><p>Flutter doesn’t use SSL anymore — it relies on TLS, like all modern platforms. TLS ensures secure communication, while certificate pinning gives developers tighter control by validating only the certificates they explicitly trust.</p><p>Together, they form a layered defense model. And because of Flutter’s architecture and security layers, intercepting traffic isn’t straightforward, which ultimately strengthens security for end users.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=852d411f91b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding SMB Protocol & Attack Vectors: A Theoretical Overview]]></title>
            <link>https://medium.com/@hassanmohsen13/understanding-smb-protocol-attack-vectors-a-theoretical-overview-1686921b052b?source=rss-3f6d591501a------2</link>
            <guid isPermaLink="false">https://medium.com/p/1686921b052b</guid>
            <category><![CDATA[smb-relay]]></category>
            <category><![CDATA[smbclient]]></category>
            <dc:creator><![CDATA[Hassan Mohsen]]></dc:creator>
            <pubDate>Fri, 28 Mar 2025 23:57:20 GMT</pubDate>
            <atom:updated>2025-03-31T22:16:46.705Z</atom:updated>
            <content:encoded><![CDATA[<h3>📘 Introduction to SMB</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l4Fk-eiF1M8uDgdZhvAy6w.png" /></figure><p>The <strong>Server Message Block (SMB)</strong> protocol is a network file sharing protocol that allows applications and users to read, write, and request services (like printer access) from files and other resources on remote servers. It’s widely used in Windows environments, especially within <strong>Active Directory</strong>, for:</p><ul><li>Authentication</li><li>Inter-Process Communication (IPC)</li><li>Remote Command Execution</li></ul><h3>🔑 Key Points:</h3><ul><li>Originally developed by <strong>IBM</strong>, later extended by <strong>Microsoft</strong>.</li><li>Heavily integrated into <strong>Windows environments</strong>.</li><li>Modern SMB operates primarily over <strong>TCP port 445</strong>.</li></ul><h3>🛡️ SMB Versions and Security</h3><p>There are several SMB versions, each with differing levels of security:</p><ul><li><strong>SMBv1</strong>: Obsolete and insecure. Vulnerable to attacks like <strong>WannaCry</strong>.</li><li><strong>SMBv2</strong>: Introduced in <strong>Windows Vista</strong>, offering better performance and security.</li><li><strong>SMBv3</strong>: Launched with <strong>Windows 8/Server 2012</strong>, providing <strong>encryption</strong>, improved <strong>reliability</strong>, and <strong>compression</strong> features.</li></ul><p>Understanding which version is in use is critical for identifying vulnerabilities.</p><h3>🧩 Understanding SMB Through Real Scenarios</h3><p>Before diving into attack techniques, it’s important to understand <strong>how SMB is used</strong>. This creates a mental map to help correlate SMB <strong>functions</strong> with the <strong>attack vectors</strong> that exploit them.</p><blockquote><em>“A penetration tester have to understand the system before attempting to breach it.”</em></blockquote><h3>🔁 1. File Sharing Between Windows Machines</h3><h4>Scenario:</h4><p>Employees access shared documents on a centralized Windows file server.</p><h4>How It Works:</h4><ul><li>User accesses \\FileServer\SharedDocs.</li><li>SMB authenticates via NTLM or Kerberos.</li><li>File access permissions are enforced.</li><li>Locking prevents simultaneous edits.</li></ul><h4>SMB Commands:</h4><ul><li>NT Create AndX – Open file/folder.</li><li>Read AndX – Read data.</li><li>Write AndX – Write data.</li><li>Close – Close file.</li></ul><h4>Why SMB is Used:</h4><p>✅ Efficient file access<br> ✅ Permission enforcement (ACLs)<br> ✅ File locking for concurrency</p><h3>🖨️ 2. Network Printer Sharing</h3><h4>Scenario:</h4><p>Employees print using a shared network printer via SMB.</p><h4>How It Works:</h4><ul><li>User selects \\PrintServer\OfficePrinter.</li><li>Print job is transferred over SMB to the printer.</li></ul><h4>SMB Commands:</h4><ul><li>Open Printer, Write Print Data, Close Printer</li></ul><h4>Why SMB is Used:</h4><p>✅ Centralized printing<br> ✅ Queue management<br> ✅ Access control</p><h3>🔐 3. Active Directory Authentication</h3><h4>Scenario:</h4><p>SMB handles user logins in a domain environment.</p><h4>How It Works:</h4><ul><li>User logs into a domain-joined machine.</li><li>SMB connects to Domain Controller (DC).</li><li>Authentication and session setup happen remotely.</li></ul><h4>SMB Commands:</h4><ul><li>Tree Connect AndX, Session Setup AndX, Logon Request</li></ul><h4>Why SMB is Used:</h4><p>✅ Seamless authentication<br> ✅ Remote profile access<br> ✅ Supports Single Sign-On (SSO)</p><h3>💻 4. Remote Administration (PsExec)</h3><h4>Scenario:</h4><p>Admins use PsExec to run remote commands via SMB.</p><h4>How It Works:</h4><pre>psexec \\192.168.1.10 -u Administrator -p Password cmd.exe</pre><ul><li>Admin connects to C$ share via SMB.</li><li>Remote command is executed and output returned.</li></ul><h4>SMB Commands:</h4><ul><li>Tree Connect AndX, Session Setup, Execute Command</li></ul><h4>Why SMB is Used:</h4><p>✅ Remote management<br> ✅ Central control<br> ✅ Software deployment</p><h3>💾 5. Backup &amp; Disaster Recovery</h3><h4>Scenario:</h4><p>Backups run nightly via SMB to centralize critical data.</p><h4>How It Works:</h4><ul><li>Backup connects to \\Workstation\C$.</li><li>Data is transferred securely to the backup server.</li></ul><h4>SMB Commands:</h4><ul><li>Tree Connect AndX, Read AndX, Write AndX</li></ul><h4>Why SMB is Used:</h4><p>✅ Automated backups<br> ✅ File integrity<br> ✅ Encrypted transfers</p><h3>🌐 6. Cross-Platform Sharing (Windows &amp; Linux via Samba)</h3><h4>Scenario:</h4><p>Linux server hosts SMB shares for Windows clients.</p><h4>How It Works:</h4><ul><li>Linux runs Samba service.</li><li>Windows users access \\SambaServer\SharedDocs.</li></ul><h4>SMB Commands:</h4><ul><li>Negotiate Protocol, Session Setup, NT Create AndX</li></ul><h4>Why SMB is Used:</h4><p>✅ Cross-platform support<br> ✅ Windows-style permissions on Linux<br> ✅ Seamless integration</p><h3>💣 SMB Attacks (Brief Overview)</h3><p>SMB’s powerful capabilities make it a prime target for various attacks. Each attack typically targets a specific SMB component such as authentication, file access, or remote execution.</p><p>and also i will mention attacks for SMB and also attacks that done through SMB</p><p>Below is a categorized list of <strong>common SMB attack techniques</strong> and the components they exploit:</p><h3>1️⃣ SMB Relay Attack</h3><ul><li><strong>Target</strong>: <strong>Active Directory authentication</strong> (NTLM authentication mechanism).</li><li><strong>Type</strong>: Man-in-the-Middle</li><li><strong>Description: </strong>Intercepts SMB authentication requests and relays them to another system, gaining unauthorized access.</li><li><strong>Exploited SMB Component:</strong> <strong>NTLM authentication (without signing)</strong>.</li><li><strong>Tools</strong>: ntlmrelayx.py, Responder, mitm6</li></ul><h3>2️⃣ Pass-the-Hash (PtH)</h3><ul><li><strong>Target</strong>: <strong>Windows authentication (Active Directory/Local Auth)</strong>.</li><li><strong>Type</strong>: Authentication bypass</li><li><strong>Description: </strong>Instead of cracking NTLM hashes, the attacker reuses them to authenticate to SMB shares, admin consoles, and remote systems.</li><li><strong>Exploited SMB Component:</strong> <strong>NTLMv1/v2 authentication</strong>.</li><li><strong>Tools</strong>: CrackMapExec, Mimikatz, smbexec.py</li></ul><h3>3️⃣ SMB Brute-Force</h3><ul><li><strong>Target</strong>: <strong>SMB login credentials</strong> (username/password authentication).</li><li><strong>Type</strong>: Credential guessing</li><li><strong>Description: </strong>Automated brute-force attempts on SMB login using weak/stolen credentials.</li><li><strong>Exploited SMB Component:</strong> <strong>Authentication mechanism (NTLM/Kerberos)</strong>.</li><li><strong>Tools</strong>: Hydra, Ncrack, Medusa</li></ul><h3>4️⃣ EternalBlue / EternalRomance (CVE-2017–0144/0145)</h3><ul><li><strong>Target</strong>: <strong>Remote code execution via SMBv1</strong></li><li><strong>Type</strong>: Exploit — Remote Code Execution (RCE)</li><li><strong>Description: </strong>A buffer overflow vulnerability in SMBv1 that allows an attacker to execute arbitrary code remotely without authentication.</li><li><strong>Exploited SMB Component:</strong> <strong>SMBv1 protocol (CVE-2017–0144)</strong>.</li><li><strong>Tools</strong>: Metasploit, MS17-010.py</li></ul><h3>5️⃣ SMBGhost (CVE-2020–0796)</h3><ul><li><strong>Target</strong>: <strong>Remote code execution via SMBv3</strong></li><li><strong>Type</strong>: Exploit — RCE via buffer overflow</li><li><strong>Description: </strong>Exploits a buffer overflow in SMBv3, allowing SYSTEM-level code execution.</li><li><strong>Exploited SMB Component:</strong> <strong>SMBv3 compression mechanism</strong>.</li><li><strong>Tools</strong>: CVE-2020–0796 PoC scripts, SMBGhost exploits</li></ul><h3>6️⃣ PetitPotam (NTLM Relay)</h3><ul><li><strong>Target</strong>: <strong>Active Directory Certificate Services (ADCS) &amp; NTLM authentication</strong></li><li><strong>Type</strong>: Coerced NTLM authentication</li><li><strong>Description: </strong>Forces an NTLM authentication request from a victim system, which can then be relayed to ADCS for <strong>domain privilege escalation</strong>.</li><li><strong>Exploited SMB Component:</strong> <strong>MS-EFSRPC (Encrypting File System Remote Protocol)</strong>.</li><li><strong>Tools</strong>: PetitPotam.py</li></ul><h3>7️⃣ PrintNightmare (CVE-2021–34527)</h3><ul><li><strong>Target</strong>: <strong>Windows Print Spooler (SMB &amp; RPC abuse)</strong>.</li><li><strong>Type</strong>: RCE &amp; privilege escalation</li><li><strong>Description: </strong>Allows attackers to execute arbitrary code remotely using SMB-based printer driver installations.</li><li><strong>Exploited SMB Component:</strong> <strong>SMB file-sharing for printer drivers</strong>.</li><li><strong>Tools</strong>: CVE-2021–1675 PoC, Mimikatz (to exploit PrintNightmare)</li></ul><h3>8️⃣ SMB Share Enumeration &amp; Data Exfiltration</h3><ul><li><strong>Target</strong>: <strong>File shares over SMB</strong></li><li><strong>Type</strong>: Information disclosure</li><li><strong>Description: </strong>Attackers scan SMB shares for misconfigured access rights, extracting sensitive data like passwords, configs, and database dumps.</li><li><strong>Exploited SMB Component:</strong> <strong>File sharing permissions</strong>.</li><li><strong>Tools</strong>: enum4linux, smbclient, CrackMapExec --shares</li></ul><h3>9️⃣ Lateral Movement (PsExec, Wmiexec)</h3><ul><li><strong>Target</strong>: <strong>Domain-joined systems via SMB Remote Execution</strong></li><li><strong>Type</strong>: Remote command execution — Lateral movement</li><li><strong>Description: </strong>Uses <strong>SMB authenticated sessions</strong> to execute commands remotely on a compromised machine.</li><li><strong>Exploited SMB Component:</strong> <strong>Remote command execution (ADMIN$ &amp; IPC$ shares)</strong>.</li><li><strong>Tools</strong>: psexec.py, wmiexec.py, smbexec.py</li></ul><h3>🔟 Kerberoasting (via SMB)</h3><ul><li><strong>Target</strong>: <strong>Service accounts (Active Directory)</strong>.</li><li><strong>Type</strong>: Credential harvesting</li><li><strong>Description: </strong>Requests Kerberos service tickets (TGS) over SMB and extracts <strong>crackable hashes</strong>.</li><li><strong>Exploited SMB Component:</strong> <strong>Kerberos authentication over SMB</strong>.</li><li><strong>Tools</strong>: GetUserSPNs.py, Rubeus</li></ul><h3>1️⃣1️⃣ RID Hijacking</h3><ul><li><strong>Target</strong>: <strong>Windows user authentication (privilege escalation)</strong>.</li><li><strong>Type</strong>: Persistence technique</li><li><strong>Description: </strong>Modifies <strong>Relative Identifier (RID)</strong> values to escalate a normal user to an <strong>Administrator</strong> via SMB.</li><li><strong>Exploited SMB Component:</strong> <strong>SAM database modification over SMB</strong>.</li><li><strong>Tools</strong>: Mimikatz, Set-RID.ps1</li></ul><h3>1️⃣2️⃣ SMB Session Hijacking</h3><ul><li><strong>Target</strong>: <strong>Active SMB sessions</strong> (hijacking authenticated sessions).</li><li><strong>Type</strong>: Session takeover</li><li><strong>Description: </strong>If an admin account logs into a compromised machine via SMB, an attacker can <strong>steal the session</strong> to perform privileged actions.</li><li><strong>Exploited SMB Component:</strong> <strong>Authenticated session reuse</strong>.</li><li><strong>Tools</strong>: Mimikatz, Metasploit</li></ul><h3>🧾 Summary: SMB Attack Techniques</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zz33inIBOBfmedxwjqzB_g.png" /></figure><h3>📌 Final Thoughts</h3><p>This article serves as a <strong>foundational overview</strong> of SMB and the <strong>attack surface</strong> surrounding it. The goal is to help you understand how SMB functions and where it can be <strong>exploited</strong>.</p><p>In upcoming articles, I will break down <strong>each attack</strong> in more technical detail — including <strong>demos</strong>, <strong>tools</strong>, and <strong>detection techniques</strong>.</p><p>Stay tuned 👨‍💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1686921b052b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Give chance for Zip() - in Swift ]]></title>
            <link>https://medium.com/@hassanmohsen13/give-chance-for-zip-in-swift-cde462663dd7?source=rss-3f6d591501a------2</link>
            <guid isPermaLink="false">https://medium.com/p/cde462663dd7</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[zip]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-development]]></category>
            <dc:creator><![CDATA[Hassan Mohsen]]></dc:creator>
            <pubDate>Sun, 30 Dec 2018 22:18:56 GMT</pubDate>
            <atom:updated>2018-12-31T09:15:05.687Z</atom:updated>
            <content:encoded><![CDATA[<h3>Give chance to Zip() - in Swift 😇</h3><p>Zip() can save your time , just give space for it in your code 🤩</p><h3>Zip(_:_:) :-</h3><blockquote>Creates a sequence of pairs built out of two underlying sequences.</blockquote><p>you may not understand what these words mean , that is what happen to me for first time i read it , but by practice and some search there is simple words to define it and show what it do .</p><blockquote>The zip(_:_:) function is designed to merge two sequences into a single sequence of tuples</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OVgSA8lppCUu7idWMgMMyw.png" /></figure><p>there is example to make things easier :</p><pre><strong>let</strong> sequence1 = [&quot;ali&quot; , &quot;ahmed&quot; , &quot;mohamed&quot;]<br><strong>let</strong> sequence2 = [1 ,2 ,3]<br><strong>let</strong> mergedSequence_zip = zip(sequence1, sequence2)<br>print(Array(mergedSequence_zip)) <br>//<strong>[(&quot;ali&quot;, 1), (&quot;ahmed&quot;, 2), (&quot;mohamed&quot;, 3)]</strong></pre><p>look to this simple example to know what happen .</p><p>zip() merge/join first item for sequence1 with first item for sequence2 and make those two item as tuple , that for first items , then make same step for second items and for third</p><p>there is note for zip , is zip() just work with Array? - No</p><blockquote>Zip() allow you to work with <strong>Arrays , Sets , Dictionaries</strong> or any type that conforms to <strong>sequenceType</strong> Protocol</blockquote><p>so , lets go to see example to what zip() do with <strong>Dictionary</strong> type :</p><pre><strong>let</strong> sequenceDic1 = [&quot;name&quot; : &quot;ahmed&quot; , &quot;address&quot; : &quot;London&quot;]<br><strong>let</strong> sequenceDic2 = [&quot;name&quot; : &quot;Mohamed&quot; , &quot;address&quot; : &quot;France&quot;]<br><strong>let</strong> zipDics = zip(sequenceDic1, sequenceDic2)<br>print(Array(zipDics))<br>// <strong>[((key: &quot;name&quot;, value: &quot;ahmed&quot;), (key: &quot;name&quot;, value: &quot;Mohamed&quot;)), ((key: &quot;address&quot;, value: &quot;London&quot;), (key: &quot;address&quot;, value: &quot;France&quot;))]</strong></pre><p>what happen for this time 🤔 , this is array with <strong>tuple type</strong> , to make it simple let us access first element .</p><pre>print(Array(zipDics).first!)<br>//<strong>((key: &quot;address&quot;, value: &quot;London&quot;), (key: &quot;address&quot;, value: &quot;France&quot;))</strong></pre><pre>print(Array(zipDics).first!.0)<br>//<strong>(key: &quot;name&quot;, value: &quot;ahmed&quot;)</strong></pre><pre>print(Array(zipDics).first!.0.key)<br>//<strong>address</strong></pre><pre>print(Array(zipDics).first!.0.value)<br>//<strong>London</strong></pre><p>we have 4 lines of code let me explain what is going on :</p><p>1- just we access first element in array of tuples that we done by zip().</p><p>2- we use <strong>(.0) </strong>to access first tuple in the main tuple that because we have nested tuple .</p><p>3- we access value of tuple , we get it by key.</p><p>4- we access value of tuple , we get it by value.</p><blockquote>tuples not our subject to talk now so lets go on</blockquote><p>after what we done , there is note and problem to discuss :</p><h4>Note that we have :</h4><blockquote>when you want to join any two sequences make sure values you want are matches there indexes “ index 0 will join with index 0 for second sequence”</blockquote><h4><strong>What about problem to discuss :</strong></h4><p>what happen if we join/merge two sequences that have different size ?</p><blockquote>Zip() will automatically choose the shorter of the two</blockquote><p>let see what happen by example :</p><pre><strong>let</strong> sequence4 = [&quot;ali&quot; , &quot;ahmed&quot; , &quot;mohamed&quot;]<br><strong>let</strong> sequence5 = [1 ,2]<br><strong>let</strong> mergedSequence_zip = zip(sequence4, sequence5)</pre><pre>print(Array(mergedSequence_zip))<br>//<strong>[(&quot;ali&quot;, 1), (&quot;ahmed&quot;, 2)]</strong></pre><p>Wow, what happen , where “mohamed” is ? — because two sequences have different size , Zip() choose shorter one , so “mohamed” is removed</p><p>Now , what ways is to access values in Zip() :</p><p>1- first we can use Array() :- (that way we use in this article)</p><pre><strong>let</strong> sequence1 = [&quot;ali&quot; , &quot;ahmed&quot; , &quot;mohamed&quot;]<br><strong>let</strong> sequence2 = [1 ,2 ,3]<br><strong>let</strong> mergedSequence_zip = zip(sequence1, sequence2)<br><strong>let</strong> zipValues = Array(mergedSequence_zip)<br>print(zipValues)<br>//<strong>[(&quot;ali&quot;, 1), (&quot;ahmed&quot;, 2), (&quot;mohamed&quot;, 3)]</strong></pre><p>2- second way , we can use <strong>map() </strong>for this :</p><pre><strong>let</strong> sequence1 = [&quot;ali&quot; , &quot;ahmed&quot; , &quot;mohamed&quot;]<br><strong>let</strong> sequence2 = [1 ,2 ,3]<br><strong>let</strong> mergedSequence_zip = zip(sequence1, sequence2)<br><strong>let</strong> zipValues = mergedSequence_zip.map({ ($0 , $1) })<br>print(zipValues)<br>//<strong>[(&quot;ali&quot;, 1), (&quot;ahmed&quot;, 2), (&quot;mohamed&quot;, 3)]</strong></pre><p>here we make tuple by ourselves — <strong>($0 , $1)</strong></p><p>3- third way , we can use <strong>foreach() , </strong>but<strong> </strong>this way we access every value separately.</p><pre><strong>let</strong> sequence1 = [&quot;ali&quot; , &quot;ahmed&quot; , &quot;mohamed&quot;]<br><strong>let</strong> sequence2 = [1 ,2 ,3]<br><strong>let</strong> mergedSequence_zip = zip(sequence1, sequence2)</pre><pre>mergedSequence_zip.forEach { (args) <strong>in<br>let</strong> (val1 , val2) = args<br>print(val1)<br>print(val2)<br>}</pre><pre><strong>//ali<br>//1<br>//ahmed<br>//2<br>//mohamed<br>//3</strong></pre><p>as we see , we access every value separately .</p><p>any of these ways can help separately , it depend on what you want to do , how way will help you in your logic or style of your code.</p><p>we can make any other operations like <strong>(reduce() , filter() ) </strong>this is line of code in project of mine that make zip() save my time and life<strong> (just to show how it may help you) .</strong></p><pre>mergedSequence_zip.map({$0.0 + $0.1}).reduce(0, +)</pre><p>you may not understand what this line done , but try to imagine it</p><p>Last thing in this Topic , how to unzip these sequences , may you have logic that want to return two sequences again.</p><p>we will use <a href="https://developer.apple.com/documentation/swift/array/2924692-reduce"><strong>reduce(into:_:)</strong></a><strong> </strong>may a lot didn&#39;t know what can you , and i’m too before write this article.</p><pre><strong>let</strong> sequence4 = [&quot;ali&quot; , &quot;ahmed&quot; , &quot;mohamed&quot;]<br><strong>let</strong> sequence5 = [1 ,2 , 3]<br><strong>let</strong> mergedSequence_zip = zip(sequence4, sequence5)</pre><pre><strong>let</strong> (unZipSeq2 , unZipSeq1) = mergedSequence_zip.reduce(into: ([String]() , [Int]())) { (result, tuple) <strong>in</strong></pre><pre>result.0.append(tuple.0)<br>result.1.append(tuple.1)<br>}</pre><pre>print(unZipSeq2)<br>//<strong>[&quot;ali&quot;, &quot;ahmed&quot;, &quot;mohamed&quot;]</strong></pre><pre>print(unZipSeq1)<br>//<strong>[1, 2, 3]</strong></pre><p>this is way to unzip merged sequences , explain it will get us to another subject we will discuss it later , but try to look to it you will get it 🤩😁</p><h4>Thank you for reading! If you liked this article, please clap so other people can read it too :)</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cde462663dd7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Testing VS  Debugging]]></title>
            <link>https://medium.com/@hassanmohsen13/testing-vs-debugging-3376af0abe48?source=rss-3f6d591501a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3376af0abe48</guid>
            <category><![CDATA[testing-vs-debugger]]></category>
            <category><![CDATA[ios-debugger]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[ios-testing]]></category>
            <dc:creator><![CDATA[Hassan Mohsen]]></dc:creator>
            <pubDate>Fri, 28 Dec 2018 10:20:56 GMT</pubDate>
            <atom:updated>2018-12-28T10:22:15.019Z</atom:updated>
            <content:encoded><![CDATA[<h3>Testing VS Debugging</h3><p>My friend tell some thing like if you use testing(unit test) , you don’t have to use debug .</p><p>I didn&#39;t feel well with that thing , so i do my searching to know difference between (Testing and Debugging). here we are , lets do it</p><h3>Testing :</h3><blockquote>we can identify it as , it is the process to identify the ( failure/ bug ) of the implementation code or system , <em>Testing involves identifying software defect </em><strong><em>without its correction</em></strong><em>.</em></blockquote><p>we used it to ensure that code works as expected ,it can be done using manual or automated way that start with known conditions with expected results</p><p>it done by tester or developer (unit test) , and can be outsourced to outside team as well.</p><h4>some tools for testing and unit test :</h4><blockquote>XCTest , OCMock , UI Automation , EarlGrey , Calabash , Quick</blockquote><h3>Debugger :</h3><blockquote>we can identify it as, it is process to identify the root cause of the bug</blockquote><p>it is deduction process , and performed based on the type of bug .</p><p>Once Development team received the report from the testing team, they will start debugging , but there is some thing , it can not be outsourced to outside team , it must be done inside development team.</p><p>can not be automated , it done manually .</p><blockquote><em>Debugging is deeper process than the </em>Testing<em>. Debugging involves identifying, isolating and fixing the bugs.</em></blockquote><p><strong>some tools for Debugging :</strong></p><blockquote>Arm DTT , LLDB , Microsoft Visual Studio Debugger , WinDB , …</blockquote><p>These are the main Differences between Testing and Debugging, the key difference is that debugging is performed by developers and they fix the issues filed by testers in debugging phase. The result of debugging is the issue got resolved and available for retesting. Testers do not fix the defects; rather they verify the defects fixed by the developers.</p><h4>Thank you for reading! If you liked this article, please clap so other people can read it too :)</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3376af0abe48" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>