<?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 Rayhan Hanaputra on Medium]]></title>
        <description><![CDATA[Stories by Rayhan Hanaputra on Medium]]></description>
        <link>https://medium.com/@rayhanhanaputra?source=rss-8d331d5bef10------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nl0EGQoo6ST27eGdswownQ.jpeg</url>
            <title>Stories by Rayhan Hanaputra on Medium</title>
            <link>https://medium.com/@rayhanhanaputra?source=rss-8d331d5bef10------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:06:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rayhanhanaputra/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Got Paid $2,000 by Mozilla for “Just Prompting” an AI]]></title>
            <link>https://medium.com/@rayhanhanaputra/how-i-got-paid-2-000-by-mozilla-for-just-prompting-an-ai-439bf7fc5e05?source=rss-8d331d5bef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/439bf7fc5e05</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Rayhan Hanaputra]]></dc:creator>
            <pubDate>Tue, 28 Apr 2026 16:39:08 GMT</pubDate>
            <atom:updated>2026-04-28T16:39:08.264Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Yes, really. No, it’s not what you think.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k7gFerGzH3RCq285nfr4nw.png" /><figcaption><em>Two windows. One billion lines of code.</em></figcaption></figure><p>If you clicked this, you probably think I’m about to sell you some “AI side hustle” course for $499.</p><p>I’m not.</p><p>But I <em>did</em> recently receive a <strong>$2,000 bounty from Mozilla’s Firefox client-side bug bounty program</strong> for a security vulnerability in the Firefox browser itself — and a huge part of how I found it really was, technically, “just prompting.”</p><p>Before the AI purists sharpen their pitchforks and the AI hype-bros start screenshotting this for their threads — let me be clear:</p><p>&gt; <strong>The reality is more interesting.</strong></p><p>Let me walk you through how I actually do it.</p><p><strong>- — -</strong></p><h4><strong>The headline vs. the reality</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h-YM8ZTZE3j7jc8FP45qeg.png" /><figcaption><em>What people see vs. what’s actually underneath.</em></figcaption></figure><p>The headline version sounds magical:</p><p>&gt; <em>”Type words into AI. AI finds bug. Mozilla sends money. Profit.”</em></p><p>The real version looks more like:</p><p>&gt; <em>”Spend hours designing a research workflow. Let AI do the parts it’s good at. Manually verify everything it claims. Build a working proof-of-concept. Write a real report. Defend it against skeptical engineers. Get paid.”</em></p><p>Both are technically true.</p><p>One gets clicks.</p><p>The other pays the rent.</p><p>If you came here for the first one, congrats — you’ve been clickbaited. Stay anyway. The second one is the part that actually makes money.</p><p><strong>- — -</strong></p><p><strong>What I actually do: automated security research on open-source code</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YQn7cZzP9GKIOtCdCjUAaA.png" /><figcaption><em>Millions of lines of code. A handful of real bugs. Your job is finding them.</em></figcaption></figure><p>I do <strong>vulnerability research on open-source software.</strong></p><p>Specifically, I’ve been hunting bugs in the <strong>Firefox browser itself </strong>through Mozilla’s client-side bug bounty program.</p><p>For those who don’t know: Mozilla pays real money — sometimes a lot of it — to researchers who responsibly disclose security vulnerabilities in Firefox. Their public-facing source code is huge. Millions of lines of C++, Rust, JavaScript, build scripts, and decades of legacy decisions baked in.</p><p>That’s a lot of haystack. And somewhere in there are needles.</p><p>Traditionally, finding those needles meant:</p><p>- Reading code for hours</p><p>- Building a deep mental model of the security architecture</p><p>- Auditing every suspicious-looking branch by hand</p><p>- Hoping you’d notice something nobody else has noticed in 20 years</p><p>This still works. But it scales like a coffee shop with one barista.</p><p>So I built something else.</p><p><strong>- — -</strong></p><p><strong>My workflow: AI as a force multiplier, not an oracle</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QYeUINcpP9dxw9LIxTPY-w.png" /><figcaption><em>AI handles the volume. You handle the judgment.</em></figcaption></figure><p>Here’s the actual pipeline I use. None of this is magic. All of it is engineering.</p><p><strong>Phase 1 — Targeted exploration </strong><em>(AI-assisted)</em></p><p>I don’t dump “<em>find me a Firefox 0day”</em> into ChatGPT or Claude. That doesn’t work, and anyone who tells you otherwise is either lying or selling you a Discord membership.</p><p>What I <em>do</em> is point AI at <strong>specific subsystems</strong> I want to understand — security-relevant areas where the logic is dense, the spec is complicated, and the consequences of a small mistake are huge. Things like content security, sandboxing boundaries, parsers, URL handling, permission checks.</p><p>I have the AI read code with me. Summarize logic. Trace control flow. Compare what the code does to what the spec says it should do. Flag suspicious branches, weird comments, inconsistent enforcement, and places where developers themselves left <em>”I’m not sure about this”</em> notes.</p><p>That last one is gold.</p><p>&gt; <strong>Code reviewers’ uncertainty is a free vulnerability lead.</strong></p><p><strong>Phase 2 — Hypothesis generation </strong><em>(AI-assisted)</em></p><p>Once I’ve identified a suspicious area, I ask the AI to generate hypotheses:</p><p>- <em>”What would have to be true for this check to be bypassable?”</em></p><p>- <em>”What request types would skip this branch?”</em></p><p>- <em>”If the spec says X is forbidden, where in the codebase do we still allow X?”</em></p><p>This is where AI shines. It’s a tireless brainstorming partner that can hold a 5,000-line file in working memory while you can’t.</p><p>But — and this is critical — <strong>AI hallucinates.</strong> Constantly.</p><p>It will confidently invent function names, misread control flow, hallucinate spec language, and produce beautifully written nonsense. I treat every single AI-generated hypothesis as a <em>suspect</em>, not a <em>witness</em>.</p><p><strong>Phase 3 — Manual verification </strong><em>(THE most important step)</em></p><p>This is the phase nobody talks about. And it’s the one that actually pays.</p><p>Once I have a hypothesis, I switch off “vibes mode” and do the unglamorous work:</p><p>- Read the actual code paths myself, line by line</p><p>- Confirm function names, types, and conditions exist as the AI claims</p><p>- Walk through call graphs by hand</p><p>- Re-read the relevant W3C / IETF / WHATWG spec sections</p><p>- Cross-reference past CVEs in the same area to understand prior art</p><p>- Ask: <em>”would a real attacker actually be able to trigger this?”</em></p><p>A meaningful percentage of AI-suggested “vulnerabilities” die in this phase. They were hallucinations. Or they were technically true but practically unreachable. Or someone already fixed them in a different file. Or the threat model already accounts for them.</p><p><strong>Phase 4 — Proof of Concept </strong><em>(AI-assisted, manually validated)</em></p><p>Once I’m convinced a real bug exists, I build a minimal, reproducible proof of concept.</p><p>This is where AI is, again, extremely useful — generating boilerplate test servers, sample payloads, HTML/XML scaffolding, automation scripts. What used to take me an afternoon takes thirty minutes.</p><p>But I run it. I run it on a real Firefox build. I confirm the result with my own eyeballs. I produce a clean expected-vs-actual comparison so the engineer reading the report can reproduce it in under five minutes.</p><p>&gt; <strong>No PoC, no payout. That rule is older than AI.</strong></p><p><strong>Phase 5 — Reporting and defense</strong></p><p>I ask AI to write the report. When the Mozilla engineer pushed back on my submission — questioning whether the fix was even appropriate — I responded with reasoning grounded in cross-browser behavior, prior CVEs in the same class, and spec interpretation.</p><p>Eventually the patch landed. Uplift to beta. Uplift to ESR. CVE-class fix shipped to millions of users. Bounty awarded. Wire transfer. Done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*auqBPd64egA44RwFWkicgg.png" /><figcaption>Email from mozilla’s team.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ro4-XH7POncLYogqhlKH1A.png" /><figcaption>Bounty in bugzilla.</figcaption></figure><p><strong>- — -</strong></p><p><strong>So… did you “just prompt”?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2SxHYpJdUfE5fKa_dc0STw.png" /><figcaption><em>The keyboard isn’t the work. The thinking is the work.</em></figcaption></figure><p>Honestly? Kind of. I do a lot of prompting. AI is genuinely embedded in my workflow at every stage.</p><p>But “just prompting” is doing the same heavy lift that “just typing” did for novelists in the 1800s. The keyboard isn’t the work. The <strong>thinking</strong> is the work.</p><p>What AI changes is the <strong>ratio</strong>.</p><p>It used to be 95% reading code and 5% finding bugs.</p><p>Now it’s something like 60% reading code (with AI sherpa-ing me through it), 20% verifying AI claims, 10% writing PoCs, and 10% writing reports.</p><p>I cover more ground. I get more shots on goal. I find more bugs. I get paid more often.</p><p>That’s not magic. That’s a power tool.</p><p><strong>- — -</strong></p><p><strong>What this means for you</strong></p><p>If you’re reading this thinking <em>”oh I should fire up Claude and find Firefox bugs and get rich”</em> — please slow down.</p><p>Mozilla, Google, and every major project’s security team are currently being <strong>buried</strong> in low-effort AI-generated slop reports. They are tired. They are skeptical. They will reject you on sight if your report looks like ChatGPT vomit.</p><p>The opportunity isn’t <em>”AI now finds bugs for free.”</em></p><p>The opportunity is:</p><p>&gt; <strong>AI removes the bottleneck on the boring 80% of vulnerability research, so humans who actually understand security can do 5× more of the interesting 20%.</strong></p><p>If you have real security knowledge — read specs, understand threat models, can write a clean PoC, can argue your case with an engineer — then yes, AI is a genuine multiplier and the bounty programs are very real.</p><p>If you don’t have that foundation yet, build it.</p><p>Read CVEs. Read other people’s writeups. Audit small open-source projects for fun. Learn what a real bug looks like before you ask AI to find one.</p><p>The shortcut isn’t a shortcut. It’s a force multiplier on whatever you already are.</p><p><strong>- — -</strong></p><p><em>If this was useful, hit follow — I’ll be writing more about how I structure my AI-assisted security research workflow, including the prompts, tooling, and habits I use to keep the AI honest.</em></p><p><em>And no, I’m not selling a course.</em></p><p><em>Yet.</em></p><p><strong>- — -</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=439bf7fc5e05" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Your Own Open-Source Next-Gen Firewall (NGFW): A Step-by-Step Guide]]></title>
            <link>https://medium.com/@rayhanhanaputra/build-your-own-open-source-next-gen-firewall-ngfw-a-step-by-step-guide-d308bc64cb95?source=rss-8d331d5bef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/d308bc64cb95</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[guides-and-tutorials]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[firewall]]></category>
            <dc:creator><![CDATA[Rayhan Hanaputra]]></dc:creator>
            <pubDate>Thu, 21 Aug 2025 08:58:18 GMT</pubDate>
            <atom:updated>2025-08-21T08:58:18.002Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WOJS1SRvsfAqf7a-BjtOGA.png" /></figure><h3>Introduction</h3><p>Cyber threats are no longer confined to large enterprises. Home networks, with multiple connected devices and applications, are increasingly vulnerable to malicious traffic, bandwidth abuse, and privacy risks. Commercial firewalls provide advanced protection, but their high cost makes them out of reach for most households.</p><p>Fortunately, with <strong>OPNsense</strong>, an open-source firewall platform, you can build a <strong>mini Next-Generation Firewall (NGFW)</strong> at home. With modular plugins and straightforward setup, OPNsense brings enterprise-grade features — such as application control and intrusion prevention — into your living room.</p><h3>Why OPNsense for a Home NGFW?</h3><p>Traditional firewalls filter traffic based on ports and IP addresses. While useful, they cannot address the complexity of today’s applications or evolving attack patterns. A Next-Generation Firewall adds intelligence by inspecting traffic deeply, recognizing applications, and blocking threats in real time.</p><p>Using OPNsense and Zenarmor as the foundation, you gain:</p><ul><li><strong>Application Control:</strong> Block or restrict apps such as gaming services.</li><li><strong>Intrusion Detection and Prevention (IDS/IPS):</strong> Detect and stop known threats before they reach your devices.</li></ul><p>With these capabilities, you can secure a home network with the same principles applied in corporate environments.</p><h3>Lab Architecture</h3><p>The following design mirrors a simplified enterprise network but is built for a home setup:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*AysUeunq4kFuzQ5s5XuBlw.png" /><figcaption>Simple architecture</figcaption></figure><ul><li><strong>WAN:</strong> Connects to the internet (via your ISP router or bridged connection).</li><li><strong>OPNSense + Zenarmor:</strong> as the Mini Home-NGFW</li><li><strong>VMs:</strong> End-user devices or test virtual machines connected to LAN.</li></ul><h3>Deployment Steps</h3><h3>Step 1 — Install OPNsense</h3><ol><li>Create a virtual machine with at least 2 CPUs, 4 GB RAM, and 40 GB disk. In this article, I will use VMware to show the demonstration.</li></ol><p>2. Configure two network interfaces:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*W0ipIMXrUxdhSI50qXI6YQ.png" /><figcaption>Configuration for network interfaces</figcaption></figure><ul><li><strong>WAN</strong> (Bridged or NAT to provide internet).</li><li><strong>LAN</strong> (Host-only, subnet 192.168.10.0/24).</li></ul><p>2. Boot from the OPNsense ISO and install it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*TCZDnbrOmOJsYFERYaSuvw.png" /><figcaption>Download OPNsense ISO from the official website</figcaption></figure><p>3. Assign WAN/LAN interfaces and confirm that LAN clients receive IPs through OPNsense DHCP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*Q_CxOMOhu2ktkteNo8f0Wg.png" /><figcaption>Assign both interfaces to OPNsense VM</figcaption></figure><h3>Step 2 — Add Essential Plugins</h3><p>Go to <strong>System &gt; Firmware &gt; Plugins</strong> and install:</p><ul><li><strong>os-sunnyvalley</strong> (dependency for Zenarmor).</li><li><strong>os-sensei (Zenarmor)</strong> for application control and analytics.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*oMy4OdVBHl8WaTuMKnoi_A.png" /><figcaption>Install the plugins in OPNsense to install the essential plugins</figcaption></figure><h3>Step 3 — Application Control with Zenarmor</h3><p>Zenarmor enables you to manage applications at a granular level. You can block categories such as social media, gambling, or video streaming . This allows you to enforce productivity, conserve bandwidth, or simply manage network usage more effectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*yc15OmPIOEeZAa5WXgYC1w.png" /><figcaption>Setup database for Zenarmor</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*wa6FrlS9gDk--896DAOR1A.png" /><figcaption>Configure Zenarmor interface</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*M-xsM2iUAYY71V1JhMP5RQ.png" /><figcaption>App controls settings in Zenarmor</figcaption></figure><h3>Step 4 — Threat Detection with Suricata IDS/IPS</h3><p>Enable Suricata from <strong>Services &gt; Intrusion Detection</strong>:</p><ul><li>Activate <strong>Inline IPS Mode</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*aT19fiGzF3i71ChOnh0mmQ.png" /><figcaption>Activating IPS Mode</figcaption></figure><ul><li>Download and apply the <strong>Emerging Threats Open</strong> rule set.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*L69rqabDCH-i-S4xrl0WuA.png" /><figcaption>Download rulesets</figcaption></figure><ul><li>Configure Suricata to monitor the <strong>WAN interface</strong>. This ensures inbound threats from the internet are blocked while Zenarmor manages application visibility inside the LAN.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*AJxO3x7wnB5St379uo3vHw.png" /><figcaption>Enabling several action alert for related activity</figcaption></figure><h3>Outcome</h3><p>By following these steps, you transform an ordinary PC or virtual machine into a <strong>mini home-NGFW</strong> capable of:</p><ul><li>Blocking or limiting unwanted applications.</li><li>Detecting and preventing attacks in real time.</li><li>Providing reports and analytics to monitor your home network.</li></ul><p>This setup not only enhances your home security but also provides a valuable learning platform for understanding NGFW concepts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*YcRPyTyNfgqq_dg7mqmA2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*6bpRRKCrGvC1Hi9rRJ15MA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*VXmuGEuKgLO5Y9o9w4dMEA.png" /><figcaption>Dashboard monitoring logs and event</figcaption></figure><h3>Conclusion</h3><p>With OPNsense and its modular features, it is possible to replicate many enterprise-class firewall functions at home. By combining <strong>Zenarmor for application control</strong> and <strong>Suricata for intrusion prevention</strong>, you can build a resilient network defense system without investing in expensive hardware or licenses.</p><p>Building a <strong>home mini NGFW</strong> is more than a technical exercise — it is a proactive step toward securing personal data, ensuring safe browsing, and creating a controlled network environment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d308bc64cb95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bypass Root Detection — Flutter Jailbreak Detection]]></title>
            <link>https://medium.com/@rayhanhanaputra/bypass-root-detection-flutter-jailbreak-detection-65f1dbb9cbf3?source=rss-8d331d5bef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/65f1dbb9cbf3</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile-pentesting]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[root-detection]]></category>
            <dc:creator><![CDATA[Rayhan Hanaputra]]></dc:creator>
            <pubDate>Fri, 27 Jun 2025 00:54:55 GMT</pubDate>
            <atom:updated>2025-06-27T07:17:19.000Z</atom:updated>
            <content:encoded><![CDATA[<h3>Bypass Root Detection — Flutter Jailbreak Detection</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*nfXeWu2NLAo5odrnp2C_kA.png" /></figure><p>During a recent mobile pentest, I encountered a mobile banking app created with Flutter that had multiple layers of protection. It included root detection, making dynamic analysis challenging. It was such a pain in the ass.</p><p>Flutter applications are increasingly using community plugins for added security. One such plugin is flutter_jailbreak_detection, which wraps platform-specific libraries to detect rooted or jailbroken devices.</p><p>So, for those of you who are currently pentesting a flutter application, here’s how you can bypass the root detection mechanism.</p><h3>Bypass Root Detection</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*1lPZmaXrG5CmajLQ1wCCCA.png" /><figcaption>Plugin github page</figcaption></figure><p>This Flutter plugin uses:</p><ul><li><strong>RootBeer</strong> on Android</li><li><strong>IOSSecuritySuite</strong> on iOS</li></ul><p>This means most of the detection logic happens at the native level. To bypass it, we’ll either hook into those libraries or modify the binary directly.</p><h3>iOS</h3><p>To bypass root detection in iOS apps using this plugin:</p><ol><li>Clone the following Frida script: <a href="https://github.com/CyberCX-STA/flutter-jailbreak-root-detection-bypass.git">https://github.com/CyberCX-STA/flutter-jailbreak-root-detection-bypass.git</a></li><li>Run the target Flutter app on a jailbroken device.</li><li>Attach Frida to the running app: frida -U -f &lt;com.package.example&gt; -l jailbreak_bypass.js</li><li>The script will intercept checks from IOSSecuritySuite and return 0 for checking isJailbroken.</li></ol><p>This method does not require binary modification and is effective for most apps using the plugin. You can also use environment-hiding tools like <strong>Dopamine’s built-in jailbreak hiding</strong> to bypass root detection without using Frida; these tools hide jailbreak indicators like Cydia, SSH, and tweak injection from targeted apps, making them believe the device is not jailbroken.</p><h3>Android</h3><h4>Option 1:</h4><p>If the Flutter app is using flutter_jailbreak_detection version <strong>1.0.0 </strong>(haven’t tested it yet with the latest version), you can use this Frida script: <a href="https://github.com/lpilorz/flutter-app/blob/master/frida-flutter-jailbreak-detection-bypass.js">https://github.com/lpilorz/flutter-app/blob/master/frida-flutter-jailbreak-detection-bypass.js</a></p><p>But… if the app has been obfuscated or includes more advanced security techniques — such as anti-Frida hooks, runtime checks, or native-level detection — you will likely need a more advanced or manual bypass approach.</p><h4>Option 2:</h4><p>I initially attempted to bypass the root detection by writing a custom Frida script. I tried tampering with the plugin’s checkRoot function by hooking into individual checks—such as blocking commands from being executed (e.g., which su) and intercepting file existence checks for the su binary or dangerous packages.</p><p>However, the newer versions of the plugin integrate more tightly with native code, which makes dynamic hooking less reliable. Some apps also implement anti-Frida techniques, making script injection more difficult.</p><p>When Frida becomes ineffective or unstable, manual patching becomes the most dependable method.</p><p><strong>Steps:</strong></p><ol><li>Install the application</li><li>Navigate to the app directory. You can check the directory by simply running<strong> </strong>pm path &lt;com.example.packages&gt;</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tYi_q_HgtUpAKAC1arE5FQ.png" /><figcaption>Directory of the target app</figcaption></figure><p>3. Identify the directory of the target app. Now, navigate to that directory and check for the libtoolChecker.so file.</p><p>4. Pull the file to your local machine using the following command: adb pull /data/app/&lt;random-string-package-name&gt;/lib/arm64/libtoolChecker.so</p><p>5. Open the file in Ghidra or any other decompiler. Decompile the checkForRoot function and try to analyze it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/1*hN8DpbmrW9WmNpFy28WyTA.png" /><figcaption>Functions inside libtoolChecker.so</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*D8HoNVb5DArNqBwftWFLQQ.png" /><figcaption>CheckForRoot function</figcaption></figure><p>From the given piece of code, you can see that it returns 1 if the root binary exists.</p><p>6. Patch the instruction to always return 0, regardless of whether it detects root or not</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*G_-xJypVcoJM2jL_17MGPA.png" /><figcaption>Patch the instruction</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*depk3kgA68GNsKULiF6tLQ.png" /><figcaption>Modifying the value to always return 0</figcaption></figure><p>7. Now patch the file by going to <strong>File &gt; Export Program</strong>. Keep the format as <strong>Original File</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*OJ8iv_C_XNO2xdqiOUAh4w.png" /><figcaption>Export to the original file</figcaption></figure><p>8. Push the modified .so binary back to: /data/app/&lt;random-string-package-name&gt;/lib/arm64/libtoolChecker.so</p><p>By simply modifying the .so binary, we can bypass the root detection mechanism. This binary patching technique isn’t limited to bypassing root detection — it can also be used to neutralize other native-level security checks, such as <strong>Frida detection</strong>, <strong>anti-debugging</strong>, or <strong>emulator detection</strong>, provided these checks are implemented inside the native .so libraries. By reversing and modifying the corresponding functions, you can force them to return false results or disable them entirely, thus effectively bypassing the security logic.</p><p><strong>Note:</strong> This won’t always work, as some applications implement additional detection methods inside the APK itself. You will need to manually bypass those checks using your own-crafted “magic” scripts.</p><p>Anyway, happy hacking, everyone!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65f1dbb9cbf3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Cryptography in 3 Days — Day 3: Asymmetric Cryptography]]></title>
            <link>https://medium.com/@rayhanhanaputra/learning-cryptography-in-3-days-day-3-asymmetric-cryptography-4823fd5ff980?source=rss-8d331d5bef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/4823fd5ff980</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[asymmetric-encryption]]></category>
            <dc:creator><![CDATA[Rayhan Hanaputra]]></dc:creator>
            <pubDate>Wed, 25 Jun 2025 15:00:59 GMT</pubDate>
            <atom:updated>2025-06-25T15:00:59.222Z</atom:updated>
            <content:encoded><![CDATA[<h3>Learning Cryptography in 3 Days — Day 3: Asymmetric Cryptography</h3><blockquote>Hello everyone, and welcome to the final part of “Learning Cryptography in 3 Days”! Recently, I’ve been brushing up on my cryptography knowledge and exploring how to implement it directly into a code. Here’s how I’ve been approaching each step of the learning process.</blockquote><h3>What is Asymmetric Cryptography?</h3><p>Asymmetric cryptography, also called <strong>public‑key cryptography</strong>, is built upon the concept of a <strong>keypair</strong>:</p><ul><li><strong>Public Key</strong>: Shared openly with the world.</li><li><strong>Private Key</strong>: Kept secret and protected.</li></ul><p>With this approach:<br> a. Anyone can encrypt a message using the public key.<br> b. Only the holder of the private key can decrypt it.</p><p>This is what allows two people to communicate securely <strong>without ever sharing a secret key beforehand</strong>. Unlike <strong>symmetric cryptography</strong> (such as stream and block ciphers), which require both parties to have the same secret key, asymmetric cryptography makes it possible to establish trust and confidentiality using key pairs.</p><h3>Why Asymmetric Cryptography is Important</h3><p>Before the invention of asymmetric cryptography, encryption relied exclusively on <strong>symmetric keys</strong> — a single key used for both encryption and decryption. This posed a critical challenge:</p><blockquote><strong><em>How do you securely share the key?</em></strong></blockquote><p>Asymmetric cryptography solved this problem elegantly. By introducing a <strong>public key</strong> (shared openly) and a <strong>private key</strong> (kept secret), it allows two parties to establish a secure channel <strong>even if an attacker is listening in</strong>.</p><p>One of the best-known asymmetric encryption schemes is <strong>RSA</strong>, named after its inventors — Rivest, Shamir, and Adleman. Here’s an overview of how it works:</p><h3>1. Key Generation</h3><p>We pick:</p><ul><li>Two large prime numbers (p and q).</li><li>Compute n = p * q.</li><li>Compute φ = (p-1)*(q-1) (Euler’s totient).</li><li>Choose a public exponent e (often 65537).</li><li>Find the private exponent d, such that (e * d) % φ = 1.</li></ul><p><strong>Result</strong>:</p><ul><li>Public key = (e, n)</li><li>Private key = (d, n)</li></ul><h4>Demo in Python</h4><pre>from sympy import randprime<br>from math import gcd<br><br># 1. Choose two primes<br>p = randprime(100, 200)<br>q = randprime(100, 200)<br>n = p * q<br>phi = (p-1)*(q-1)<br><br># 2. Choose public exponent e<br>e = 65537<br>while gcd(e, phi) != 1:<br>    e = randprime(3, phi)<br><br># 3. Find private exponent d<br>d = pow(e, -1, phi)<br>print(f&quot;Public Key: (e={e}, n={n})&quot;)<br>print(f&quot;Private Key: (d={d}, n={n})&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hwtsYI1N-Ajt7zmP_rGQ5A.png" /></figure><h3>2. Encryption</h3><p>To encrypt a message:</p><pre>def encrypt(message, e, n):<br>    &quot;&quot;&quot;Encrypt using the public key&quot;&quot;&quot;<br>    return pow(message, e, n)<br><br># Example:<br>message = 123<br>ciphertext = encrypt(message, e, n)<br>print(f&quot;Original Message: {message}&quot;)<br>print(f&quot;Encrypted Ciphertext: {ciphertext}&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aO4qzKJW2RyDjdNCnzSENQ.png" /></figure><h3>3. Decryption</h3><p>To recover the original message:</p><pre>def decrypt(ciphertext, d, n):<br>    &quot;&quot;&quot;Decrypt using the private key&quot;&quot;&quot;<br>    return pow(ciphertext, d, n)<br><br>decrypted_message = decrypt(ciphertext, d, n)<br>print(f&quot;Decrypted Message: {decrypted_message}&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zW8LwxELjCa3zHIp_mQb3w.png" /></figure><h3>Real‑World Applications</h3><p>Asymmetric cryptography is more than just theory — it’s the foundation of modern digital security. Here are some of its <strong>key applications</strong> in the real world:</p><h4>1. Secure Web Connections (SSL/TLS)</h4><p>Every time you visit an <strong>https://</strong> website, asymmetric cryptography is working behind the scenes.<br> a. When your browser connects to a site, it uses the site’s <strong>public key</strong> (from its SSL certificate) to securely exchange a secret key.<br> b. This allows both your browser and the server to establish an <strong>encrypted channel</strong>, ensuring that no one can eavesdrop on your communication.</p><h4>2. Digital Signatures</h4><p>Digital signatures use a person’s <strong>private key</strong> to sign a message, making it possible to:<br> a. <strong>Verify Identity</strong> — Confirm that the message came from the person or organization it claims to be from.<br> b. <strong>Ensure Integrity</strong> — Detect any tampering with the message.<br> Commonly used in software distribution, emails, and document signing.</p><h4>3. Key Exchange (Diffie-Hellman/RSA)</h4><p>Asymmetric cryptography allows two parties to securely <strong>agree on a secret key</strong> over an insecure channel.<br> a. Enables protocols like <strong>Diffie‑Hellman</strong> or the RSA key exchange mechanism.<br> b. Enables secure symmetric encryption by letting both parties establish a shared secret <strong>without ever transmitting it openly</strong>.</p><h3>Why Asymmetric Cryptography Matters</h3><p>Asymmetric cryptography is the backbone of trust and security in today’s digital world. Without it:</p><ol><li><strong>We wouldn’t have online banking.</strong><br> Transactions would be exposed to hackers and eavesdroppers, making it impossible to securely send money online.</li><li><strong>We wouldn’t have encrypted internet traffic.</strong><br> Every website you visit, every password you enter, every piece of data you send would be readable by anyone listening.</li><li><strong>We wouldn’t be able to send or receive information securely across the globe.</strong><br> From private emails and medical records to government documents and digital payments, asymmetric cryptography ensures that sensitive information can travel safely across borders and through countless networks.</li></ol><h3>Final Thoughts</h3><p>With this final piece, you now have a solid foundation in modern cryptography:</p><ol><li><strong>Day 1: Block Cipher</strong> — Understanding fixed‑size encryption and its role in data security.</li><li><strong>Day 2: Stream Cipher</strong> — Exploring bit‑by‑bit encryption and the importance of keystream generation.</li><li><strong>Day 3: Asymmetric Encryption</strong> — Discovering the power of public‑key cryptography for secure communication and trust.</li></ol><p>These three building blocks form the <strong>core of digital security</strong> — from online banking and e‑commerce to secure messaging and data transfer.</p><h3>What’s Next?</h3><p>If you’re eager to continue exploring the fascinating world of cryptography, here are a few exciting areas to dive into:</p><ol><li><strong>Elliptic Curve Cryptography (ECC):</strong> A modern approach that provides strong security with smaller key sizes, making it ideal for mobile devices and IoT.</li><li><strong>Post‑Quantum Cryptography:</strong> The next frontier — exploring new algorithms designed to resist the power of quantum computers.</li><li><strong>Real‑World Cryptographic Attacks:</strong> Understanding how cryptosystems can be broken in practice, and how to design and implement more resilient protocols.</li></ol><p>Thank you for reading my three‑day journey through the essentials of cryptography. I hope you learned something new, gained a deeper understanding, and felt inspired to keep exploring in this challenging field.</p><p>As always, <strong>stay curious and keep learning!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4823fd5ff980" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Cryptography in 3 Days — Day 2: Stream Cipher]]></title>
            <link>https://medium.com/@rayhanhanaputra/learning-cryptography-in-3-days-day-2-stream-cipher-5e511b8eaca9?source=rss-8d331d5bef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e511b8eaca9</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[stream-cipher]]></category>
            <category><![CDATA[cryptography]]></category>
            <dc:creator><![CDATA[Rayhan Hanaputra]]></dc:creator>
            <pubDate>Tue, 24 Jun 2025 11:07:47 GMT</pubDate>
            <atom:updated>2025-06-24T11:07:47.360Z</atom:updated>
            <content:encoded><![CDATA[<h3>Learning Cryptography in 3 Days — Day 2: Stream Cipher</h3><blockquote>Hello everyone, and welcome to the second part of “Learning Cryptography in 3 Days”! Recently, I’ve been brushing up on my cryptography knowledge and exploring how to implement it directly into a code. Here’s how I’ve been approaching each step of the learning process.</blockquote><h3>What is a Stream Cipher?</h3><p>A stream cipher encrypts data one bit or one byte at a time using a keystream — a sequence of random or pseudorandom bits. The basic operation is an XOR because XOR has a unique property that makes it perfect for reversible operations: applying the same keystream again during decryption restores the original data (since A ⊕ B ⊕ B = A). This simplicity and reversibility make XOR efficient for both encryption and decryption.</p><pre>ciphertext_bit = plaintext_bit ⊕ keystream_bit<br>plaintext_bit  = ciphertext_bit ⊕ keystream_bit<br><br># Example<br># 1 ⊕ 0 = 1<br># 0 ⊕ 0 = 0<br># 1 ⊕ 1 = 0<br># 0 ⊕ 1 = 1</pre><h3>Stream Cipher vs Block Cipher</h3><p>Stream ciphers operate on data one bit or one byte at a time, making them ideal for situations where data arrives in a stream. They use a <strong>keystream</strong> — a sequence of random or pseudorandom bits — and combine it with the plaintext via <strong>bitwise XOR</strong> to produce ciphertext. In contrast, block ciphers work on fixed-sized blocks of data, such as 64 or 128 bits. Instead of a continuous keystream, block ciphers use a <strong>master key</strong> to generate a set of subkeys for multiple encryption rounds, relying on a combination of <strong>confusion</strong> and <strong>diffusion</strong> to secure the data</p><blockquote><strong><em>Note:</em></strong><em> I have already discussed about block cipher — exploring how they operate on fixed-sized blocks, generate subkeys, and utilize rounds of confusion and diffusion for security in day 1 series.</em></blockquote><h3>KeyStream Generators</h3><p>In a stream cipher, the <strong>keystream</strong> — a stream of random or pseudorandom bits — is generated by a <strong>keystream generator</strong>. This component produces a sequence of key bits that is <strong>equal in length to the plaintext or ciphertext</strong>, ensuring every bit or byte of the message can be securely combined (using XOR) with its corresponding key.</p><ol><li><strong>LFSR</strong> (Linear Feedback Shift Register) — Simple, fast, and have a maximum generated key = 2^n-1.</li><li><strong>NLFSR</strong> (Nonlinear Feedback Shift Register) — Similar to an LFSR but incorporates AND/OR logic for stronger randomness and improved security.</li><li><strong>RC4</strong> — Created by Ron Rivest, this classic stream cipher generates keystream bytes and was used in early WiFi and SSL implementations.</li></ol><h3>LFSR Example</h3><p>Let’s walk through an example of how an <strong>LFSR</strong> (Linear Feedback Shift Register) works in a stream cipher.</p><p>Suppose we have an 8‑bit LFSR defined by the primitive polynomial:</p><blockquote><strong><em>x⁸ + x⁴ + x² + 1</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/0*TyFi2GzgFJ_4lBo0" /><figcaption>Polynomial example</figcaption></figure><p>This polynomial means that the feedback (new bit) will be calculated from taps at positions 7, 3, and 1 (counting from 0). These taps determine how the register evolves over time and are crucial for generating a long, pseudorandom keystream.</p><p><strong>Pseudo-Code for LFSR:</strong></p><pre># Initial state (seed): an 8-bit register<br>state = [1, 1, 0, 1, 1, 0, 1, 1]<br><br>keystream = []<br>for _ in range(16):  # We want to output 16 keystream bits<br>    # New bit is the XOR of selected taps<br>    new_bit = state[7] ^ state[3] ^ state[1]<br><br>    # Output the oldest bit<br>    keystream.append(state.pop())<br><br>    # Append the new calculated bit<br>    state = [new_bit] + state<br><br># Final keystream<br>print(&quot;Keystream:&quot;, keystream)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*aZXWV89Ht6lgi5M4nB2jhw.png" /><figcaption>Generated keystream</figcaption></figure><p><strong>Resulting Keystream Example:</strong><br> 1101 1011 1000 0011</p><p><strong>Each clock cycle:</strong></p><ul><li>The oldest bit of the state is <strong>shifted out</strong> as the next <strong>keystream</strong> bit.</li><li>A new bit is calculated using XOR from the taps and added to the first of the register.</li><li>The state shifts, making room for this new bit.</li></ul><p>With a well‑chosen primitive polynomial, the LFSR can produce a long, pseudorandom stream — ideal for stream cipher encryption.</p><h3>The Importance of Keystream</h3><p>In a stream cipher, the security doesn’t just come from the algorithm itself — it rests <strong>entirely on the quality of its keystream</strong>.</p><ul><li>A <strong>truly random or well‑designed pseudorandom keystream</strong> guarantees strong encryption, making it nearly impossible for an attacker to guess the output.</li><li>But if the keystream is <strong>all 0s</strong>, then the ciphertext is identical to the plaintext — making the encryption completely meaningless.</li><li>Similarly, if the keystream is <strong>all 1s</strong>, the ciphertext becomes a simple bitwise NOT of the plaintext, which is just as insecure.</li><li>Even if the keystream contains a repeating pattern, an attacker can easily discover the repeating segment and break the encryption.</li></ul><p>In short, the strength of a stream cipher is defined by the <strong>randomness, uniqueness, and length</strong> of its keystream. A strong keystream means strong encryption; a predictable or repeating one means disaster.</p><h3>What’s Next?</h3><p>That’s it for Day 2— you’ve learned about Stream Ciphers, their inner workings, and why randomness is vital for security.</p><blockquote><em>In </em><strong><em>Day 3</em></strong><em>, we’ll shift focus to </em><strong><em>Asymmetric Cryptography</em></strong><em>. Stay tuned!</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e511b8eaca9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Cryptography in 3 Days — Day 1: Block Cipher]]></title>
            <link>https://medium.com/@rayhanhanaputra/learning-cryptography-in-3-days-day-1-block-cipher-6d43a23a7ae1?source=rss-8d331d5bef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d43a23a7ae1</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[block-cipher]]></category>
            <dc:creator><![CDATA[Rayhan Hanaputra]]></dc:creator>
            <pubDate>Mon, 23 Jun 2025 06:58:56 GMT</pubDate>
            <atom:updated>2025-06-23T06:58:56.260Z</atom:updated>
            <content:encoded><![CDATA[<h3>Learning Cryptography in 3 Days — Day 1: Block Cipher</h3><blockquote>Hello everyone, and welcome to the first part of “Learning Cryptography in 3 Days”! Recently, I’ve been brushing up on my cryptography knowledge and exploring how to implement it directly into a code. Here’s how I’ve been approaching each step of the learning process.</blockquote><h3>What is a Block Cipher?</h3><p><strong>A block cipher</strong> encrypts data in fixed-sized blocks (for example, 64 or 128 bits), using a secret key. Unlike stream ciphers, which operate on one bit or byte at a time, block ciphers work on an entire chunk of data.</p><p>Each block goes through a series of well-defined steps:</p><ul><li><strong>XOR:</strong> The block is combined with the key using the XOR operation.</li><li><strong>Substitution (S‑Box):</strong> Small sections of the block are replaced with other values based on a lookup table, introducing <strong>confusion</strong> — making the link between the key and the output less obvious.</li><li><strong>Permutation:</strong> The positions of the bits within the block are shuffled, spreading the data out and creating <strong>diffusion</strong> — making the output highly sensitive to small changes in the input.</li><li><strong>Matrix Multiplication:</strong> In many block cipher designs, such as AES, the block’s data is treated as a matrix and multiplied with another matrix in a special <strong>Galois Field</strong>, further mixing the input and making it harder for an attacker to trace.</li></ul><p>Each block goes through several <strong>rounds</strong> of these steps, making it extremely challenging for an attacker to reverse‑engineer the original message without knowing the secret key. The result is a <strong>ciphertext</strong> block that appears completely random, providing strong security even if an attacker can observe many encrypted messages.</p><h3>Example: XOR with Key</h3><p>One of the simplest yet fundamental operations in block cipher design is the <strong>XOR</strong> operation. At its core, this is how a block cipher adds the key to the plaintext before applying more complex transformations.</p><h4>The Concept</h4><p>If you have:</p><ul><li>A <strong>64‑bit block of plaintext</strong>, and</li><li>A <strong>64‑bit key</strong>,</li></ul><p>You can encrypt the block by applying the XOR operation between the two values. XOR (exclusive OR) is ideal for this because:<br> a. It’s a <strong>reversible</strong> operation — applying the same XOR with the same key restores the original plaintext.<br> b. It’s very <strong>fast</strong> and operates bit‑by‑bit.</p><pre>plain = 0x1234ABCDEF567890<br>key = 0x123456789ABCDEF0<br>cipher = plain ^ key<br>print(f&quot;Resulting Ciphertext: {hex(cipher)}&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cuVO062ZMCWNAOW-F7tPGQ.png" /><figcaption>Xoring plaintext and key to achieve ciphertext</figcaption></figure><h3>Adding Complexity: The S-Box</h3><p>To make a block cipher strong, we must do more than just XOR the data with the key. We introduce <strong>non‑linearity</strong> through an <strong>S‑Box</strong> (Substitution Box). An S‑Box is essentially a lookup table that takes a small chunk of data — typically 4 bits, called a <strong>nibble</strong> — and replaces it with a different 4‑bit value.</p><h4>Why an S‑Box?</h4><p>XOR alone is too simple and linear. An attacker can easily observe patterns and recover the key. An S‑Box adds confusion, making the relationship between the plaintext, the key, and the ciphertext highly <strong>non‑linear</strong> and harder to decipher.</p><h4>How it Works:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FFI_roF_eC-0NQ3WTd7jlQ.png" /><figcaption>For each 4-bit segment of block goes into an S-Box</figcaption></figure><p>Each 4‑bit segment of the block is used as an index into the S‑Box, which returns a new, substituted value.</p><p><strong>Example of S-Box Table:</strong></p><pre>Input : Output<br>0 -&gt; E    1 -&gt; 4    2 -&gt; D    3 -&gt; 1<br>4 -&gt; 2    5 -&gt; F    6 -&gt; B    7 -&gt; 8<br>8 -&gt; 3    9 -&gt; A    A -&gt; 6    B -&gt; C<br>C -&gt; 5    D -&gt; 9    E -&gt; 0    F -&gt; 7</pre><p><strong>Example Usage in Python:</strong></p><pre>SBOX = [0xE, 0x4, 0xD, 0x1, 0x2, 0xF, 0xB, 0x8,<br>        0x3, 0xA, 0x6, 0xC, 0x5, 0x9, 0x0, 0x7]<br><br>def apply_sbox(data):<br>    result = 0<br>    for i in range(16):  # assuming 64-bit block<br>        nibble = (data &gt;&gt; (i * 4)) &amp; 0xF<br>        result |= SBOX[nibble] &lt;&lt; (i * 4)<br>    return result<br>cipher_after_sbox = apply_sbox(0x000FDB57FFDB57F0)<br>print(f&quot;After S-Box: {hex(cipher_after_sbox)}&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*orxNA-0w4_lGTKXzb0JbOA.png" /><figcaption>Substitutes the value each byte inside a block</figcaption></figure><h3>Permutations</h3><p>After applying the S‑Box, we move on to the <strong>Permutation</strong> step. A permutation doesn’t change the actual data values — it simply <strong>shuffles their positions</strong> within the block. This step is critical because it spreads the data out, making it much harder for an attacker to recognize patterns or find a direct link between the input and the output.</p><h4>Why is this important?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/0*0sq6HTOEz2Mi6Xx-.png" /><figcaption>Permutation example from <a href="https://www.geeksforgeeks.org/">https://www.geeksforgeeks.org/</a></figcaption></figure><p>Even if certain patterns appear in the plaintext or the S‑Box output, a well‑chosen permutation will <strong>disperse</strong> these patterns across the block, making them harder to spot. This adds another layer of security and strengthens the cipher.</p><p><em>(For demonstration, we can implement any fixed permutation that you want. Here’s an example that swaps halves.)</em></p><pre>def simple_permutation(data, block_size=64):<br>    half = block_size // 2<br>    left = data &gt;&gt; half<br>    right = data &amp; ((1 &lt;&lt; half) - 1)<br>    return (right &lt;&lt; half) | left<br><br>perm_result = simple_permutation(cipher_after_sbox)<br>print(f&quot;After Permutation: {hex(perm_result)}&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S-PLsP7H8ahGweswk1Poaw.png" /><figcaption>Simple permutation example</figcaption></figure><h3>Matrix Multiplication</h3><p>Block ciphers like AES (and others) use a special mixing step called <strong>matrix multiplication</strong>. This operation treats a group of input values (bytes or nibbles) as a vector, and then <strong>multiplies</strong> it by a fixed matrix. This ensures that every output is influenced by every input value — making the cipher highly <strong>diffusive</strong>.</p><p><strong>Diffusion</strong> is vital for security. Even a tiny change in one input (e.g., a single byte) propagates to many outputs. This makes it much harder for an attacker to trace how an output relates to its input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*JcjdXf4PY5j6S3OTkYycHw.png" /><figcaption>Matrix multiplication</figcaption></figure><h4>In GF(2⁴): Multiplication and Polynomials Example</h4><p>Here we operate in the finite field GF(2⁴), defined by the polynomial:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*VqBvR_H0wxmgk0VwqEZRsg.png" /><figcaption>Polynomial for finite field GF(2⁴)</figcaption></figure><p>Each value is treated as a polynomial of degree ≤ 3, and multiplication is performed <strong>modulo</strong> this polynomial. This allows results to “wrap around” and remain within 4‑bit boundaries.</p><h4>Why GF(2⁴) for MixColumns (and Similar Operations)</h4><p>In block ciphers like AES, the <strong>MixColumns</strong> step is essentially a <strong>matrix multiplication</strong> performed in a finite field (such as GF(2⁸) for AES or GF(2⁴) in this example). This is done because:</p><ul><li>Finite fields guarantee well‑defined and reversible (invertible) operations.</li><li>Multiplication in GF(2^k) allows for highly <strong>diffusive</strong> and structured mixing across the block.</li><li>A small change in one input propagates throughout the block due to the linear algebra over the field.</li></ul><pre># Multiplication in GF(2^4) using the primitive polynomial x^4 + x + 1 (0x13)<br><br>def gf4_mul(a, b):<br>    &quot;&quot;&quot;Multiply two 4-bit values in GF(2^4) using the primitive polynomial x^4 + x + 1.&quot;&quot;&quot;<br>    p = 0<br>    for i in range(4):  # multiply<br>        if b &amp; (1 &lt;&lt; i):<br>            p ^= a &lt;&lt; i<br>    for i in range(7, 3, -1):  # reduce<br>        if p &amp; (1 &lt;&lt; i):  <br>            p ^= 0x13 &lt;&lt; (i - 4)  # 0x13 = primitive polynomial<br>    return p &amp; 0xF<br><br>def x2(a): return gf4_mul(a, 2)  # multiply by x<br>def x3(a): return gf4_mul(a, 3)  # multiply by x + 1<br><br>def multiply_matrix(a0, a1, a2, a3):<br>    &quot;&quot;&quot;Perform matrix multiplication for one block (4 elements) in GF(2^4).&quot;&quot;&quot;<br>    b0 = x2(a0) ^ x3(a1) ^ a2 ^ a3<br>    b1 = a0 ^ x2(a1) ^ x3(a2) ^ a3<br>    b2 = a0 ^ a1 ^ x2(a2) ^ x3(a3)<br>    b3 = x3(a0) ^ a1 ^ a2 ^ x2(a3)<br>    return [b0, b1, b2, b3]<br><br># Demo Usage<br>a0, a1, a2, a3 = 0x1, 0x2, 0x3, 0x4<br>mix_result = multiply_matrix(a0, a1, a2, a3)<br>print(f&quot;After Matrix Multiplication: {[hex(b) for b in mix_result]}&quot;)</pre><p>With this approach:</p><ul><li>We operate in GF(2⁴).</li><li>Multiplication respects the primitive polynomial x⁴ + x + 1</li><li>The output of this matrix multiply depends highly on every input, providing strong diffusion.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fEp00AeQRmhuy3Di3LN4gw.png" /><figcaption>Matrix multiplication result in GF(²⁴)</figcaption></figure><h3>Putting It All Together</h3><p>With these steps combined, a block cipher can transform a plain block of data into highly secure ciphertext. Here’s how it all connects:</p><h4>The Complete Process</h4><ol><li><strong>XOR with Key</strong> — The input block is combined with the secret key, making the data dependent on the key right from the start.</li><li><strong>S‑Box Substitution</strong> — The data is split into smaller units (nibbles or bytes), and each is replaced using an S‑Box, introducing <strong>non‑linearity</strong>.</li><li><strong>Permutation</strong> — The positions of the data bits or bytes are shuffled, spreading information across the block (achieving <strong>diffusion</strong>).</li><li><strong>Matrix Multiplication</strong> — The block’s data is combined using a fixed matrix over a special math space (GF(2⁸) for AES), further diffusing the information across the block.</li></ol><h4>The Result</h4><p>After applying these steps — sometimes repeating the process for multiple rounds — the output block is completely transformed:</p><ul><li>Its structure is highly unpredictable.</li><li>Every bit of the ciphertext depends on every bit of the plaintext and every bit of the key.</li><li>Even a tiny change in the input results in a completely different output.</li></ul><p>That’s it for <strong>Day 1</strong> — you’ve learned the foundations of block cipher! In <strong>Day 2</strong>, we’ll move forward to the concept of <strong>Stream Cipher</strong>, exploring how to encrypt data one bit at a time using keystream generation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d43a23a7ae1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CAPT Exam Review - The Underrated Android Pentest Certification by MobileHackingLab]]></title>
            <link>https://medium.com/@rayhanhanaputra/capt-exam-review-the-underrated-android-pentest-certification-by-mobilehackinglab-0f79db8a1206?source=rss-8d331d5bef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/0f79db8a1206</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Rayhan Hanaputra]]></dc:creator>
            <pubDate>Sun, 25 May 2025 23:37:45 GMT</pubDate>
            <atom:updated>2025-05-25T23:43:27.514Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ywT4FtGEsPuut1la_7CKYg.png" /><figcaption>Certified Android Penetration Tester by MobileHackingLab</figcaption></figure><p>If you’re looking to break into android pentesting or to prove your skills with a hands-on certification, the Certified Android Penetration Tester (CAPT) exam by Mobile Hacking Lab might have caught your attention. I recently completed the course and took the exam. And in this article, I’ll walk you through my experience, from the training modules to the certification test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ASbr6eMy2DzblreYxh6F6A.png" /><figcaption>Android Application Security Course by MobileHackingLab</figcaption></figure><p>The CAPT journey begins with Mobile Hacking Lab’s self-paced course. The curriculum is designed to equip you with the real-world skills needed to assess Android applications for security vulnerabilities.</p><h3>What’s Inside the Training?</h3><p>The course starts with the fundamentals:</p><ul><li>Android architecture and security model</li><li>App components (Activities, Services, Content Providers, Broadcast Receivers)</li><li>Static and dynamic analysis</li></ul><p>Then it gradually progresses to advanced topics:</p><ul><li>Reverse engineering APKs using tools like JADX, apktool, and Frida</li><li>Runtime manipulation and hooking</li><li>Bypassing root detection and SSL pinning</li><li>Exploiting insecure data storage, WebViews, exposed components, and more</li><li>Android pentest attack surface</li></ul><p>One of the highlights of the course is its lab-based approach. You don’t just watch — you get your hands dirty right away. For each concept, there’s a corresponding lab environment, making it easier to reinforce your learning. Another thing I really liked is that each video is accompanied by a script on the next slide, so I can follow along with clear and direct instructions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fVq82ZjD3gs45pmWJJwwOA.png" /><figcaption>Script on the next slide after a video</figcaption></figure><h3>Practice Labs</h3><p>Before taking the exam, you’re encouraged to complete a set of vulnerable applications intentionally designed for practice. These include:</p><ul><li>Custom apps created by Mobile Hacking Lab</li><li>Public vulnerable apps like InsecureBank, DIVA, AndroGoat, and others</li></ul><p>The labs simulate real-world conditions, including different levels of obfuscation, encryption, and anti-analysis techniques. These are key to passing the exam, so I highly recommend spending time here.</p><p>What’s great is that you can set up the entire environment on your own using Android Studio + Genymotion/AVD, or follow their guide to use physical devices and ADB for more realism.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m2o2AM5zfWh6giqCpdBykQ.png" /><figcaption>MobileHackingLab’s Free Practice Labs</figcaption></figure><h3>The Exam</h3><ul><li><strong>Duration</strong>: 72 hours for exploitation + 24 hours for reporting</li><li><strong>Environment</strong>: Given an Android app to analyze</li><li><strong>Goal</strong>: Identify and exploit vulnerabilities, then submit a professional penetration test report</li></ul><p>This is not a multiple-choice test — it’s a full-blown practical exam. You’ll need to:</p><ul><li>Decompile the app(s)</li><li>Perform both static and dynamic analysis</li><li>Discover security flaws</li><li>Exploit them with proof-of-concepts</li><li>Document everything in a detailed report</li></ul><p>You can use your preferred tools (Burp Suite, MobSF, Frida, objection, etc.) and are expected to think like a real-world pentester.</p><h3>Reporting Phase</h3><p>The reporting phase is critical. You need to submit a report that includes executive summary, vulnerability details (title, severity, description), and screenshots. Your report will be reviewed manually by the MobileHackingLab team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OOhXoLRvAdB9e-VDIpjB9g.png" /><figcaption>My exam report</figcaption></figure><h3>The Certification</h3><p>Upon passing, you’re awarded the Certified Android Penetration Tester (CAPT) certificate. It’s a vendor-neutral, skill-based certification that you can proudly add to your resume or LinkedIn profile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dB-YX6-TFjoe4AaYm1IKSQ.png" /></figure><h3>Is CAPT Worth It?</h3><p>Absolutely — if you’re new to mobile pentesting and wanted to learn more about Android security.</p><p>What sets the CAPT apart is its focus on practical, hands-on experience. It’s not about memorizing definitions; it’s about demonstrating real skills.</p><p><strong>Pros</strong>:</p><ul><li>Real-world, exam-like environment</li><li>In-depth training with guided labs</li><li>Great value for the price</li></ul><p><strong>Cons</strong>:</p><ul><li>Some prior experience with Android development or penetration testing is recommended</li><li>Setting up the environment can be tricky for beginners</li></ul><p>If you’re looking to push your skills beyond theory and into real-world mobile app exploitation, CAPT is one of the best certifications out there right now.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0f79db8a1206" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[This is how I got 16 CVEs in 2 months]]></title>
            <link>https://medium.com/@rayhanhanaputra/this-is-how-i-got-16-cves-in-2-months-491be07793b0?source=rss-8d331d5bef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/491be07793b0</guid>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Rayhan Hanaputra]]></dc:creator>
            <pubDate>Thu, 22 May 2025 02:45:40 GMT</pubDate>
            <atom:updated>2025-05-23T06:55:53.703Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kM5Z_029xQaRhsXb.png" /><figcaption>Wordpress bug bounty</figcaption></figure><p>2024 was a year for me. I used to play a lot of CTF with my team called “Hantu Siber” (<a href="https://ctftime.org/team/203878/">https://ctftime.org/team/203878/</a>). We also won some of them (even if they can be counted on fingers). But the thing that I want to share here is, I got bored. Study &gt; Play CTF &gt; Losing. I did ask myself back then, what is it that I actually want to achieve here?</p><p>I came across a LinkedIn post that told a story about “How I got my first CVE” and so on. This interested me. After playing CTFs for years, studying cybersecurity, and what now?</p><p>WordPress was the easiest one to start researching for vulnerabilities, especially the plugins. We know that there are A LOT of WordPress plugins out there. They are made by the public and used by the public. It is the biggest attack vector for WordPress vulnerabilities. In Indonesia, many government websites were targeted with online gambling web defacements, where some of them were using WordPress as their CMS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KlaHtCB4JoQ4ssbHwggAiQ.png" /><figcaption>List of wordpress plugins</figcaption></figure><p>There are two ways of finding vulnerabilities in WordPress plugins. First, you can do white-box analysis (yes, WordPress plugin source code is available online), which you can find here: <a href="https://plugins.svn.wordpress.org/">https://plugins.svn.wordpress.org/</a>.</p><p>Find some interesting plugins there, and analyze the source code. Find patterns of some vulnerable functions in the plugins here: <a href="https://wpdirectory.net/">https://wpdirectory.net/</a>,</p><p>and voila, you’ll get your first CVE. Sounds easy, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*4Rrl1pPsxVwZAcRy4cKfyw.png" /><figcaption>I love adding meme in my articles xD</figcaption></figure><p>Whoops… not so easy, brother. Analyzing source code requires a deep understanding of a programming language (in this case, PHP), and you also need to analyze tons of available plugins on there (there are 59,000+ plugins…).</p><p>So if you’re not a nerdy guy who loves source code analysis, you can go with my second method, which is the “black-box” method. I personally love this method because I can skip reading the code xD (I love reverse engineering, to be honest).</p><p>I set up my own WordPress machine using this OVA from Bitnami: <a href="https://bitnami.com/stack/wordpress/virtual-machine">https://bitnami.com/stack/wordpress/virtual-machine</a>. Fire it up on your own VBox or VMware — whatever you prefer. Then access the WordPress.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9m-ehLMdxFFL48f7IJuHZA.png" /><figcaption>Bitnami package for wordpress</figcaption></figure><p>The first easiest thing to do is to have your main vulnerability as the target scope in WordPress plugins. I targeted Cross-Site Scripting (XSS) as it was the easiest one for me to find, since there are so many plugins that offer displaying “things” that WordPress doesn’t have.</p><p>I found a plugin that supports media upload for SVG. I had the idea to utilize this SVG for XSS. So I installed the plugin and created the POC. And luckily, it worked — I had my first XSS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*_CwlrXg7wnZErtwt-QTsiQ.png" /><figcaption>XSS triggered via direct SVG access</figcaption></figure><p>Now, to report this vulnerability, we can send the PoC to <a href="https://patchstack.com/database/report">https://patchstack.com/database/report</a>. Patchstack offers a bug bounty program for WordPress, and researchers can submit their findings and get rewarded (XPs and $$$). The more critical it is, the higher the reward you’ll get from them. Also, they will automatically assign a CVE ID to your finding if it is accepted.</p><p>After you fill out the report form, you will receive a confirmation report in your email like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*WVUE_XCtMCT8DiUuxXxB1A.png" /><figcaption>Confirmation of received report from patchstack</figcaption></figure><p>Sadly, Patchstack doesn’t accept vulnerabilities involving direct access to files like SVG files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*L6o9jf10rhdhtQv4NOaYKQ.png" /><figcaption>Rejection email from patchstack, so sad…</figcaption></figure><p>So here comes the second option: WPScan. They also accept vulnerability submissions here: <a href="https://wpscan.com/submit/">https://wpscan.com/submit/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NJDxyTorto44fWrNBabRoA.png" /><figcaption>WPScan vulnerability submission</figcaption></figure><p>I submitted my rejected finding to WPScan, waited day after day, week after week, and finally…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*YUHVAn62VzyiJJ0ufzPR-Q.png" /><figcaption>Update of priority set in my submission from WPScan</figcaption></figure><p>And here is the email — the love letter — when they finally disclosed the CVE!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*PXUKxAvsEXk_VIAoLdGwgw.png" /><figcaption>My sample of disclosed CVE</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dw4wt3u1NTlIacHdw65zPA.png" /><figcaption>One of my finding in SVG XSS vulnerability</figcaption></figure><p>Anyway, I kept grinding to find the perfect and suitable plugins with the same vulnerability for two weeks, submit them to WPScan or Patchstack (while waiting for the submission to be processed), and got all of them disclosed within two months 👀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*y2g8bM2zkG38eFpEsAP5ZQ.png" /><figcaption>Example of patchstack accepted submission</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s6pjPxXAXvjtKRcdUwb_tA.png" /><figcaption>My patchstack profile</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hNcf6twgreeUhqahFax_AA.png" /><figcaption>My wordfence’s profile</figcaption></figure><p>It was fun playing with WordPress plugins — you’ll get a CVE if you’re lucky. Sadly, I don’t have time right now to play with those things again, since I’m busy with my pentesting job and researching other things. I hope this article helps you a lot in getting your first CVE. Feel free to connect with me on LinkedIn (<a href="https://www.linkedin.com/in/rayhanhanaputra/">https://www.linkedin.com/in/rayhanhanaputra/</a>) to ask anything you want 😄</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=491be07793b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>