Target: Bale (messaging app with integrated payments/wallet) Package: ir.nasim (confirmed via static analysis, 2026-07-25 — matches the earlier inference exactly) Version tested: 10.18.32 (versionCode 165172, latest available build) — confirmed via dumpsys package ir.nasim post-install (versionName=10.18.32 (165172)). Full bypass chain also confirmed working on the earlier 10.15.25 (versionCode 162232) build, where the original findings in §§1-5 were discovered (verified via dex2oat compile log app-version-name:10.15.25 (162232) and the Sentry baggage header on live traffic, sentry-release=ir.nasim%4010.15.25...162232) Testing window: static re-verification 2026-07-25 · live dynamic testing (Frida 16.1.11 + Burp, rooted Android 14 emulator, sdk_gphone64_arm64) 2026-08-02 · cross-version verification against v10.18.32 (165172) same day Tester: Admiral


1. Root detection ⚠ (searched, not found — genuinely unconfirmed)

Confirmed present per your original testing (script header: “frida script to bypass root detection, emulator detecion and ssl pinning of bale app”), but static re-verification against the decoded APK could not locate Bale’s own implementation:

  • Searched isRooted — 2 matches, both false positives: io.appmetrica.analytics.coreutils.internal.system.RootChecker — this is the AppMetrica analytics SDK’s own generic root-checker (used to tag analytics events with device state), not Bale’s own security gate.
  • No RootBeer library (unlike Mehr).

Bale’s own code lives under the ir.* and bale.* package prefixes (53,273 and 199 smali files respectively per this decode) — the actual detection logic is in there somewhere, but isn’t findable by generic English keyword search, meaning it’s either obfuscated, named non-obviously, or implemented natively (18 .so files present, ~53MB total — large enough to plausibly contain real logic, unlike Gardeshgari’s much smaller native footprint). JADX search scoped to ir.nasim + xrefs from wherever MainActivity/ApplicationBale first runs its startup checks is the next concrete step, not another keyword guess.

2. Emulator detection ⚠ (searched, not found — genuinely unconfirmed)

Correction from the Medium draft stands, now with search evidence behind it: searched isEmulator — zero matches anywhere in 70,845 smali files. Searched Genymotion — 2 matches, both false positives: one in AndroidX CameraX’s own device-quirk detection (ImageCaptureRotationOptionQuirk, a stock Jetpack library file, not Bale’s code), one in the Sentry crash-reporting SDK (tags crash reports with emulator info, not a security control).

The “scored/aggregated fingerprinting across QEMU files, sensor lists, and telephony properties” narrative from the Medium draft was invented to fill a gap and still has zero evidence behind it after this pass. If Bale has real emulator detection, it’s not using any of the common public terminology for it — this needs either a targeted JADX read of the startup path or dynamic testing (run on an emulator, see what breaks) to actually locate.

3. SSL / TLS pinning ✅ (confirmed via live dynamic testing, 2026-08-02 — mechanism identified, not just bypassed)

This is a materially different design from both Mehr and Gardeshgari, and explains why static analysis never found an OkHttp CertificatePinner or a network_security_config.xml for this app: the pin set isn’t in the APK at all — it’s fetched at runtime.

Captured in Burp (decrypted, post-bypass) as the very first two requests the app makes on cold start, both over plain okhttp/4.12.0:

1. GET hash.bale.ai/hashes-android.json — returns a JSON array mapping every backend hostname to its expected IP and one or more SHA-256-looking hashes:

1
2
{"host": "rpc-ssl-c002.bale.ai", "known_ip": "2.189.68.117", "hashes": ["6d9ba5c5c665b0a7066682a05329f2a9c4c11aa08c9c548ebd33b9d06bf6e444"]}
{"host": "assets.bale.ai",       "known_ip": "185.166.104.30", "hashes": ["6d9ba5c5c665b0a7066682a05329f2a9c4c11aa08c9c548ebd33b9d06bf6e444"]}

Response carries a custom signBale header (app-specific response-signing, separate from TLS) and is served off Sotoon CDN (X-ZRK-* headers) — an Iranian CDN provider.

2. GET ep.bale.ai/ep/endpoints-android.json — returns the live RPC endpoint(s) to connect to, in a custom URI scheme that embeds the same hash from step 1 directly in the connection string:

tls@6d9ba5c5c665b0a7066682a05329f2a9c4c11aa08c9c548ebd33b9d06bf6e444://rpc-ssl-c002.bale.ai@2.189.68.117:443#1013
tcp@6d9ba5c5c665b0a7066682a05329f2a9c4c11aa08c9c548ebd33b9d06bf6e444://rpc-c002.bale.ai@2.189.68.106:443#1014

Both a tls@ and a plain tcp@ variant are offered per datacenter — consistent with a Telegram-MTProto-style multi-datacenter transport (Bale’s chat core is architecturally similar; this endpoint-negotiation-plus-embedded-hash pattern is the same shape as MTProto’s DC config with pinned public-key fingerprints).

Working theory (mechanism confirmed, exact enforcement point not fully isolated): the hash from hashes-android.json/endpoints-android.json is checked against the actual TLS certificate or public key at connection time for the RPC channel, replacing a static pin list with a server-issued, rotatable one. Confirmed bypassed regardless of the exact enforcement point — the existing generic hook (com.android.org.conscrypt.TrustManagerImpl.verifyChain forced to return the untrusted chain as trusted, plus SSLContext.init nulling the TrustManager array) sits underneath whatever performs this comparison and defeated it with no dedicated hook needed. Confirmed via clean Burp capture of full plaintext JSON/binary responses for every host in the hash table that was actually contacted: rpc-ssl-c002.bale.ai, assets.bale.ai, tooshle.bale.ai, hash.bale.ai, ep.bale.ai, and file-gw1/4/5/7.ble.ir.

Caveat for anyone extending this: signBale is a response-body signature, independent of TLS. Passive inspection (reading decrypted traffic, which is all that was done here) doesn’t touch it — the signature still validates because the bytes aren’t modified, only eavesdropped. Active MITM (rewriting responses) would need to also forge or strip this signature; not attempted, flagging as a gap for anyone who needs to go further than read-only interception.

Unrelated, don’t confuse with the above: tooshle.bale.ai/hashes.json (no -android suffix) is a different, non-security JSON — it’s a standard webpack/CRA-style static-asset cache manifest (filename → MD5) for a hosted mini-app/PWA platform Bale serves from that host (bill payment, currency exchange, and similar mini-programs — file paths reference Iranian telecom/payment brands). Purely a content-cache-busting manifest, no pinning relevance.

4. Anti-instrumentation / Frida detection ✅

This is the one with solid, specific evidence. The app inspects the call stack and flags frames outside its own known package prefixes — confirmed via this fragment from your notes:

1
2
3
4
5
if (frame.indexOf("ir.nasim") !== -1 ||
    frame.indexOf("mob.banking") !== -1 ||
    frame.indexOf(".app.") !== -1) {
    isA... // [fragment cuts off here in source notes]
}

The three prefixes checked — ir.nasim (the app’s own package), mob.banking (a banking/payment-specific module — consistent with Bale’s integrated wallet functionality), and a generic .app. catch-all — indicate the detector treats any stack frame outside these as evidence of instrumentation (Frida’s injected script context, Xposed, etc.). The bypass approach was to hook the stack-inspection point itself and filter results before the app’s own logic evaluates them, rather than patching the conclusion.

Note: the source fragment is truncated at isA... in current notes — the full conditional body (what isA assigns/checks) wasn’t captured. If you have the complete function, it’s worth pulling in here for completeness.

5. Kill-switches ✅✅ (two confirmed via live dynamic testing, 2026-08-02 — real class names, real bypass, both verified working end-to-end)

Static analysis never turned these up because both are buried in obfuscated Kotlin coroutine continuation classes with no findable string/keyword to grep for. Found by hooking Activity.finish()/System.exit()/Process.killProcess()/dialog-display classes generically first (to catch any kill attempt regardless of source), watching what fired, then pulling the exact smali for the classes that showed up in the stack.

5a. Pre-login: ir.nasim.auth.auth.IntroActivity$l$a$a.invokeSuspend

Runs during the splash/intro flow, before login. Structure (reconstructed from smali): evaluates a condition, compares the result against iW1$c.a via Rt3.d() (a Kotlin Intrinsics.areEqual-style structural-equality helper used throughout the app), and on mismatch: delays 5 seconds via Qe2.s(5, Te2.e) (a Duration.ofSeconds(5)-equivalent) passed into tT1.c() (coroutine delay()), then calls BaseActivity.finish(). Observed behavior before the bypass: app shows a “because of security issues you can’t use bale” message and closes ~5 seconds after launch.

Bypass (confirmed working): short-circuit the whole method rather than patch the comparison or the kill call — replace invokeSuspend so it immediately returns the Kotlin Unit singleton (ir.nasim.Hc8.a) without running any of its internal logic:

1
2
3
4
5
var Intro = Java.use('ir.nasim.auth.auth.IntroActivity$l$a$a');
var Unit = Java.use('ir.nasim.Hc8');
Intro.invokeSuspend.implementation = function (result) {
    return Unit.a.value;
};

5b. Post-login: ir.nasim.features.root.RootActivity$d.invokeSuspend

Runs every time RootActivity (the app’s post-login main/nav-root activity — not a root-detection screen despite the package name, confirmed by its size and contents: banking module, payments, contacts, marketing tools all live in it) resumes. Same Rt3.d(result, iW1$c.a) equality check as 5a — same sealed-class type (iW1), same “pass” sentinel (iW1$c.a) — strongly suggesting both kill-switches evaluate the same underlying signal via a shared check, just at two different points in the app lifecycle (pre- and post-login). On mismatch this one does two things, not one:

  1. Launches RootActivity$d$a as a coroutine — the same 5-second-delay-then-BaseActivity.finish() shape as 5a.
  2. Separately and immediately (not delayed) builds and shows a modal AlertDialog: title = string resource no_browser_founded_title (a reused/generic title string, not written for this purpose), message = string resource error_tamper — this is the actual resource key, i.e. this is confirmed to be Bale’s anti-tamper user-facing message — with a single OK button wired to ir.nasim.features.root.b’s click handler.

Methodology note worth keeping: the first bypass attempt hooked Process.killProcess/System.exit/Activity.finish generically and swallowed them (works fine for 5a). Against 5b this caused a genuine ANR (WindowManager: ANR ... Input dispatching timed out ... Waited 5001ms) — because the modal dialog still gets built and shown (nothing hooked touches that code path), and its only interactive element (OK) now does nothing since the finish() it used to trigger is silently swallowed. App became a soft-locked dead end rather than closing. Lesson: hooking the kill consequence is not equivalent to hooking the decision — if the decision path has side effects beyond the kill (a displayed dialog, a state flag, an analytics event), swallowing only the kill leaves those side effects stranded. Fixed by short-circuiting RootActivity$d.invokeSuspend itself, same technique as 5a — skips the check, the coroutine launch, and the dialog construction, all in one hook:

1
2
3
4
5
var RootD = Java.use('ir.nasim.features.root.RootActivity$d');
var Unit = Java.use('ir.nasim.Hc8');
RootD.invokeSuspend.implementation = function (result) {
    return Unit.a.value;
};

Open item: what Rt3.d(result, iW1$c.a) is actually evaluating (root state? signature/tamper flag? Play Integrity–style attestation result? some combination) was not identified — only the mechanism (compare → dialog/delay → kill) and a working bypass were confirmed. Tracing what populates result (the iW1 instance) back to its source would need a further JADX/xref pass and wasn’t in scope for this round.

Operational note also confirmed necessary: the kill can happen to a process that already has Frida attached, and the OS/app then relaunches a fresh, unhooked process — Frida’s spawn-gating (device.enable_spawn_gating() + re-attach on every spawn-added event matching the package) is required to keep coverage across relaunches; a one-shot spawn()+attach() only protects the first process instance.

6. Cross-version compatibility ✅

Full bypass chain verified end-to-end on the latest available build, 10.18.32 (versionCode 165172). The same chain is also confirmed working on the earlier 10.15.25 (162232) build referenced throughout §§1-5 — same package (ir.nasim), same minSdk/targetSdk across both.

Obfuscated class names held; a field name under one of them didn’t. Both ir.nasim.auth.auth.IntroActivity$l$a$a and ir.nasim.features.root.RootActivity$d resolved unchanged via Java.use() — genuinely didn’t expect that across a real version bump, but confirmed. ir.nasim.Hc8 (the renamed Kotlin Unit singleton class used in both §5 short-circuits) also still resolves as a class name — but its static instance field, named a on 10.15.25, no longer exists under that name. The hardcoded Hc8.a.value reference from the original bypass script threw TypeError: cannot read property 'value' of undefined the first time either short-circuit actually fired at runtime, even though both Java.use() calls had already succeeded at script-load time. Lesson: class-name stability across a rebuild does not imply field-name stability. R8’s short synthetic names are allocated per-symbol-kind and can shift independently — confirming a class resolves is not confirmation that everything hanging off it still matches the previous build.

Fix and re-verification: rather than hardcoding a new guessed field name, reflected on Hc8’s declared fields at hook-install time (getDeclaredFields(), filtered for static + self-typed) to find the real singleton field automatically. On this build the heuristic came back empty — zero self-typed static fields — most likely because the Hc8 label now points to a different class than it did on 10.15.25 (R8’s short-name pool gets reassigned across the whole app on any rebuild, not just for classes that meaningfully changed), rather than the original Unit-analog class having structurally changed. Fell back to returning null instead of a resolved value. Confirmed via live test, both stages: with the null fallback, IntroActivity$l$a$a.invokeSuspend fired cleanly on cold start (app proceeded straight into MainActivity, no security-block message, confirmed via logcat with no FATAL/AndroidRuntime entries), and RootActivity$d.invokeSuspend fired cleanly on a real post-login session (client confirmed normal app usage — no ANR, no soft-locked dialog; the exact failure mode from the original methodology mistake in §5 did not recur). For these two call sites specifically, a plain null return turned out to be functionally equivalent to the real Unit reference — the coroutine caller only appears to care that the value isn’t the COROUTINE_SUSPENDED sentinel, not what it specifically is.

TLS/dynamic-pin bypass: unchanged, confirmed working as-is. TrustManagerImpl.verifyChain and the nulled TrustManager array on SSLContext.init are platform API, not app-obfuscated code — fired identically on the new build with no modification needed (rpc-ssl-c002.bale.ai, assets.bale.ai both forced trusted on first cold start).

Takeaway for future engagements against this app: the underlying bypass techniques (short-circuit the decision, force the platform TLS verifier to pass) are robust across an app update even when the exact hardcoded obfuscated identifiers aren’t. Budget for one round of “which of these names moved” triage after any version bump — using reflection to re-discover shifted internals is faster than re-deriving everything from a fresh static-analysis pass, and only fall back to static analysis (JADX/apktool on the new build) if the reflective approach itself comes back ambiguous.


Summary of confirmed findings

Package confirmed (ir.nasim); bypass chain confirmed on the latest available build, 10.18.32 / 165172, and also on the earlier 10.15.25 / 162232 build where the original findings were made. Live dynamic testing (2026-08-02) confirmed and fully bypassed the app’s complete client-side defense chain: two kill-switches (pre-login IntroActivity$l$a$a and post-login RootActivity$d, both gating on the same iW1$c.a comparison, both neutralized by short-circuiting the check rather than the consequence) and a dynamic, server-issued certificate/key hash-pinning scheme (hash.bale.ai/hashes-android.json + ep.bale.ai/ep/endpoints-android.json) that explains why no static OkHttp/network_security_config pinning was ever found — the pin set was never in the APK. Anti-instrumentation stack-frame detection remains confirmed from static analysis with real evidence. Root detection and emulator detection specifically (as distinct from the tamper/integrity check found in §5) are still not conclusively located — the keyword matches found for each were confirmed false positives from third-party SDKs (AppMetrica, CameraX, Sentry), and the exact signal behind the §5 kill-switches (iW1$c.a) was not traced back to its source. §6 additionally confirmed the entire chain survives a real app update (10.15.25 → 10.18.32) with only a minor reflective adjustment, not a rewrite — meaning obfuscation churn between builds is not, on its own, a meaningful defense against any of this. Given the wallet/payment functionality, all of the above should be treated as higher severity than a pure messaging app would warrant — the attack surface extends to financial transactions, not just chat content.

  1. Server-side: the dynamic hash-pinning design (§3) is genuinely stronger than a hardcoded pin (rotatable, not extractable by static APK analysis alone) — but it’s still enforced entirely client-side once fetched, and a passive-MITM-capable attacker who defeats the enforcement point (as done here, one generic TrustManagerImpl hook) gets full traffic visibility regardless of how the pin set is delivered. Consider binding pin verification to attested/Integrity-API-backed state rather than a client-side comparison alone.
  2. Both kill-switches gate on the same underlying check and both are defeated by the same class of bypass (short-circuit the check) — consolidating to one check is not a fix; the fix is moving the trust decision server-side (reject/degrade the session server-side on failed attestation, don’t rely on the client to enforce its own kill).
  3. The post-login dialog (§5b, error_tamper) has an exploitable usability failure mode independent of the security bypass: an attacker (or bug) that prevents finish()/killProcess() from completing — which doesn’t require Frida, any crash or exception handler swallowing the call would do it — leaves the dialog on screen with no working exit, i.e. a self-inflicted denial-of-service on the main screen. Worth fixing regardless of the security question.
  4. Stack-trace-based instrumentation detection is a reasonable idea defeated by a well-known class of bypass (filtering the evidence at its source) — pairing it with integrity attestation at the server would raise the bar meaningfully.
  5. Confirm and replace the root/emulator-detection write-up with what’s actually implemented, if anything distinct from §5 exists — still the largest unresolved gap in this report.
  6. §6 is a reminder, not a new issue: relying on routine app updates (and the obfuscation churn that comes with them) to break existing bypasses is not a control. The same rebuild that reshuffled internal symbol names left every actual security decision (the kill-switch comparisons, the TLS trust decision) exactly as exploitable as before. The fixes in items 1-4 are the only things that change that.