<?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 Nishant Shinde on Medium]]></title>
        <description><![CDATA[Stories by Nishant Shinde on Medium]]></description>
        <link>https://medium.com/@shindenishant0910?source=rss-2e234e9bae95------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*l7LeL1NJgkVBDrfi</url>
            <title>Stories by Nishant Shinde on Medium</title>
            <link>https://medium.com/@shindenishant0910?source=rss-2e234e9bae95------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 12:44:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shindenishant0910/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[Building Native-Layer Root & Tamper Detection for React Native on Android]]></title>
            <link>https://medium.com/@shindenishant0910/building-native-layer-root-tamper-detection-for-react-native-on-android-f56afc2790e4?source=rss-2e234e9bae95------2</link>
            <guid isPermaLink="false">https://medium.com/p/f56afc2790e4</guid>
            <category><![CDATA[root-detection]]></category>
            <category><![CDATA[ssl-pinning]]></category>
            <category><![CDATA[native-layer]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Nishant Shinde]]></dc:creator>
            <pubDate>Fri, 23 Oct 2026 17:11:49 GMT</pubDate>
            <atom:updated>2026-10-23T17:11:49.155Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>How I moved root detection and SSL pinning verification out of JavaScript and into a hidden C++ layer — and why it matters for any app handling sensitive data.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*myZFM2Y2nNEIBcl7scG1fg.png" /></figure><h3>The problem with JS-only security checks</h3><p>Most React Native apps that care about security reach for a JS library, check isRooted(), and call it a day. It&#39;s quick to ship — and it&#39;s also trivially easy to bypass. Anyone with Frida, a repackaged APK, or basic reverse-engineering skill can hook the JS bridge, patch the boolean the check returns, or simply strip the check out of the bundle. JavaScript running on the RN bridge is visible, hookable, and — because Hermes bytecode is reversible — not much of a barrier at all.</p><p>For an app handling business-sensitive data, that wasn’t good enough. I wanted checks that:</p><ul><li>Run in native code, where reverse engineers have to work much harder</li><li>Can crash or kill the process the moment tampering is detected — not just return false to JS</li><li>Run continuously in the background, not just once at launch</li><li>Tie root/tamper detection directly into certificate pinning, so a compromised device can’t MITM API traffic either</li></ul><p>So I built it as a native module in C++, loaded through JNI, sitting underneath the RN layer entirely.</p><h3>Architecture at a glance</h3><p>The core lives in a single native-lib.cpp, loaded via JNI_OnLoad. There&#39;s no Java/Kotlin entry point calling into it directly for the checks — the moment the native library loads, it runs a security check <em>before</em> anything else happens:</p><pre>JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {<br>    if (isCompromised()) {<br>        syscall(__NR_exit, 0); // Immediate exit if hooked at load time<br>    }<br>    ...<br>}</pre><p>If the environment looks compromised at load time, the process exits immediately via a raw exit syscall — not System.exit(), not an exception. This matters because higher-level exit calls can themselves be hooked or intercepted; a raw syscall is much harder to swallow.</p><p>From there, two things happen:</p><ol><li>A native method (verifyNative) is registered for certificate pin verification, called from the TLS layer</li><li>A background pthread is spawned that re-runs all the compromise checks on a randomized 10–30 second interval, for the lifetime of the process</li></ol><h3>The detection layers</h3><h4>1. Frida detection (maps, threads, and port)</h4><p>Frida is the most common dynamic instrumentation tool used to bypass mobile security checks, so it gets the most attention:</p><ul><li><strong>/proc/self/maps scanning</strong> — looks for loaded libraries with telltale names (frida, gum-js-loop, libxposed, libsubstrate, zygisk, lsposed, etc.)</li><li><strong>Thread name scanning</strong> — Frida spawns threads named gum-js-loop and gmain; I walk /proc/self/task/*/comm looking for them, which catches cases where the library itself is renamed but its threads aren&#39;t</li><li><strong>Port probing</strong> — frida-server defaults to port 27042; a non-blocking socket connect with a short timeout checks whether anything&#39;s listening there</li></ul><p>Using three independent signals means an attacker has to defeat all three simultaneously, not just rename one library.</p><h4>2. Anti-debugging via TracerPid</h4><p>Every process’s /proc/self/status exposes a TracerPid field — non-zero means something is attached as a debugger:</p><pre>if (line.find(OBF(&quot;TracerPid:&quot;)) != std::string::npos) {<br>    ...<br>    if (pid != 0) return true;<br>}</pre><p>I combine this with a ptrace(PTRACE_TRACEME, ...) call — if the process is already being traced, this call fails, which is a classic (if well-known) anti-debug trick.</p><h4>3. Root artifact detection</h4><p>Standard checks for su binaries across common paths (/system/bin/su, /system/xbin/su, /sbin/su, etc.) and Magisk-specific artifacts (/sbin/.magisk, /data/adb/magisk, /data/adb/modules). Nothing exotic here, but it&#39;s the baseline every root-detection scheme needs, and it&#39;s cheap to run.</p><h4>4. String obfuscation at compile time</h4><p>Every sensitive string literal — paths, class names, method signatures — is wrapped in a constexpr XOR obfuscator that runs at compile time:</p><pre>#define OBF(str) []() -&gt; std::string { \<br>    constexpr Obfuscator&lt;sizeof(str)&gt; obf(str); \<br>    ...<br>}()</pre><p>This means static analysis tools (like running strings on the .so file) don&#39;t immediately reveal what the library is looking for or what it&#39;s protecting. It&#39;s not unbreakable — anyone stepping through with a debugger can watch the deobfuscated string appear at runtime — but it meaningfully raises the bar for casual static analysis, and forces an attacker into dynamic analysis, which the Frida/ptrace checks above are actively trying to detect.</p><h4>5. Certificate pinning, verified natively</h4><p>This is the part I’m most pleased with. Rather than doing pin comparison in Java/Kotlin (where it can be bypassed with a single hooked method), the actual SHA-256 hash comparison happens in native code:</p><ul><li>A self-contained SHA-256 implementation (no OpenSSL dependency, smaller attack surface, nothing to hook via a well-known library)</li><li>Public keys are extracted from the certificate chain passed in from Java, hashed, base64-encoded, and compared against the pinned hashes</li><li>The method is registered via RegisterNatives() rather than the conventional JNIEXPORT naming convention — which means it doesn&#39;t show up under a predictable exported symbol name, making it harder to locate and hook directly</li></ul><p>Critically, verifyNativeInternal also runs isCompromised() before doing any pin comparison — so even if someone found a way to call the verification function directly, a hooked/rooted device gets an automatic native exit() rather than a bypassable false.</p><h3>Why a background thread matters</h3><p>A one-time check at launch is easy to work around — attach Frida <em>after</em> the app has already passed its checks. That’s why the monitor thread keeps running for the app’s entire lifetime, re-checking on an irregular interval so the timing itself isn’t predictable or easy to sit between checks.</p><pre>void* securityMonitorThread(void* arg) {<br>    while (true) {<br>        if (isCompromised()) {<br>            syscall(__NR_exit, 0);<br>        }<br>        sleep(10 + (rand() % 20));<br>    }<br>}</pre><h3>What this gave the team</h3><ul><li><strong>Defense in depth beyond JS</strong>: even a fully patched RN bundle can’t disable native-layer checks without also patching the compiled .so, which is a meaningfully higher bar</li><li><strong>Tamper detection tied to network security</strong>: a rooted/hooked device can’t just bypass pinning — the pinning check itself refuses to run cleanly in a compromised environment</li><li><strong>Continuous, not one-shot, protection</strong>: attaching instrumentation mid-session gets caught within 10–30 seconds, not just at cold start</li></ul><h3>Caveats — because no client-side check is bulletproof</h3><p>Worth being upfront about this for anyone reading who wants to raise “but couldn’t an attacker just — “: yes, and I want to name the honest limits here.</p><ul><li><strong>Client-side security can always be defeated by a sufficiently motivated, skilled attacker</strong> with enough time — this is detection and friction, not a hard guarantee</li><li><strong>String obfuscation is not encryption</strong> — it raises the cost of static analysis, it doesn’t prevent dynamic analysis</li><li><strong>Advanced Frida usage</strong> (e.g. running it without a gum-js-loop/gmain thread name, or using kernel-level tooling) can dodge some of these specific signatures — this is an arms race, not a solved problem</li><li>These checks are one layer of a broader security posture — server-side validation, session integrity checks, and business-logic-level abuse detection all still matter and shouldn’t be skipped just because native root detection exists</li></ul><h3>Closing thoughts</h3><p>Moving root/tamper detection and pin verification out of JS and into a native layer is a meaningful upgrade for any app where compromised devices are a real business risk, not just a checkbox. It’s more work to build and maintain than a JS library call — but the security properties are genuinely different in kind, not just degree.</p><p>If you’re building something similar, I’d start with the three cheapest wins first: TracerPid checking, su binary scanning, and native cert pin comparison. The Frida-specific checks and background monitoring thread are where the real hardening happens, but they&#39;re also where most of the complexity lives — so get the fundamentals solid first.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f56afc2790e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debugging Network Calls in React Native (Android) Using Chucker]]></title>
            <link>https://medium.com/@shindenishant0910/debugging-network-calls-in-react-native-android-using-chucker-b4e960639c3c?source=rss-2e234e9bae95------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4e960639c3c</guid>
            <dc:creator><![CDATA[Nishant Shinde]]></dc:creator>
            <pubDate>Thu, 01 Jan 2026 05:01:05 GMT</pubDate>
            <atom:updated>2026-01-03T18:01:49.524Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mzbpeUGuWk_Jw9g8mIr75g.png" /></figure><p>When working with React Native, debugging API calls especially on Android can be a challenge. Logs don’t always tell the full story, and tools like Flipper or Axios interceptors may miss low-level details. Also, using remote debugging can slow down the app and affect the actual behavior of the application during testing.</p><p>Recently, I integrated Chucker in a dummy React Native project, and it significantly improved how I inspected network traffic directly on the Android device. It gave me instant visibility into all HTTP requests/responses without relying on browser tools or remote debuggers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aTfTpSxE5pRQupq68MzeKA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DwxBjprR5JziNZXvplr6Bg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9XI-kvxPDMJMmWpQWeDoZA.jpeg" /><figcaption>Chucker showing network requests directly on the Android device</figcaption></figure><p>In this post, I’ll walk you through how I added Chucker into a React Native Android app, using the native Android layer.</p><h3>What is Chucker?</h3><p><a href="https://github.com/ChuckerTeam/chucker"><strong>Chucker</strong></a> is an open-source HTTP inspector for Android. It intercepts HTTP/S requests made with <strong>OkHttp</strong> and provides a UI inside the app where you can inspect:</p><ul><li>Endpoints and URLs</li><li>Request and response bodies (JSON, XML, plain text)</li><li>Headers and cookies</li><li>HTTP methods and status codes</li><li>Error stack traces (timeouts, 500 errors, etc.)</li></ul><p>It’s built by the <a href="https://github.com/ChuckerTeam">Chucker Team</a> and serves as a great alternative to tools like <strong>Charles Proxy</strong>, <strong>Wireshark</strong>, or even <strong>Flipper</strong> — but with less setup and no external connections required.</p><h3>How I Integrated Chucker in React Native (Android)</h3><p>Since Chucker works at the native Android level, the integration is done inside the android/ folder of your React Native project. No changes to JavaScript code are required.</p><h3>1. Add Chucker to Gradle Dependencies</h3><p>Open your app-level Gradle file: android/app/build.gradle, and add:</p><pre>debugImplementation &quot;com.github.chuckerteam.chucker:library:4.0.0&quot;<br>releaseImplementation &quot;com.github.chuckerteam.chucker:library:4.0.0&quot;</pre><blockquote><em>📌 </em><a href="https://mvnrepository.com/artifact/com.github.chuckerteam.chucker/library">Chucker releases on Maven</a><em> — always check here for the latest version.</em></blockquote><h3>2. Inject Chucker Using Custom OkHttp Client Builder</h3><p>If you’re working with the native networking stack used by React Native (based on OkHttp), you can inject the Chucker interceptor like this:</p><pre>NetworkingModule.setCustomClientBuilder { builder -&gt;<br>    builder.addInterceptor(<br>        ChuckerInterceptor.Builder(this).build()<br>    )<br>}</pre><p>This code is typically placed in MainApplication.kt or wherever you&#39;re initializing native modules. It overrides the default OkHttp client React Native uses and adds Chucker as an interceptor.</p><p>Once added, Chucker starts logging every API call from the JS side (fetch, axios, etc.) automatically.</p><h3>3. Sync and Rebuild the Project</h3><p>After adding the dependency and builder logic, sync and rebuild:</p><pre>cd android<br>./gradlew clean<br>cd ..<br>npx react-native run-android</pre><p>Now, every time your app makes a network call (via fetch, axios, etc.), Chucker will intercept it and show notifications. You can tap on those to inspect the full request/response.</p><h3>Why Chucker Works So Well with React Native</h3><p>React Native bridges the JS and native Android world and while tools like Axios interceptors give some visibility, they don’t cover:</p><ul><li>Native module requests</li><li>Background network calls</li><li>Auth/token header issues</li><li>Low-level HTTP errors</li></ul><p>Chucker solves all of this — <strong>without touching your JS code</strong>. It captures traffic at the <strong>OkHttp</strong> layer, giving full access to:</p><p>✔ End-to-end payloads<br>✔ Header mismatch issues<br>✔ Server-side errors<br>✔ Network delays and timeouts</p><h3>Final Thoughts</h3><p>Chucker is a simple and useful tool for checking network calls in React Native Android apps. It shows requests and responses clearly on the device and helps a lot while testing APIs.</p><p>If you’re working with APIs in your app, especially on Android, using Chucker can make debugging much easier.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4e960639c3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>