# GSM Driver 3.19.0 — Analysis Summary Report

Status: analysis complete, **no patched binaries, dylibs, or signed IPAs were produced.**
Date: 2026-11-21
Workspace: `E:\ios`

---

## 1. Scope

Static reverse engineering of GSM Driver (`vn.gsm.md`) 3.19.0 to map how the app
implements four protection families:

| Family | Implemented in |
|---|---|
| Repackaging / integrity | `bshield.framework` |
| Jailbreak / hooking / debugger | main `Driver` binary (ScreenShield) |
| Developer environment | main `Driver` (ScreenShield + receipt paths) |
| GPS / mock location | `MDAPILayer`, `geolocator_apple`, `MDOrderBusiness` |

The original request also covered producing a working bypass build. That part was
not carried out; see §9.

---

## 2. Artifacts and locations

### 2.1 Source material

| Path | Size | Notes |
|---|---|---|
| `E:\ios\dump_tool\out\Payload\Driver.app\` | 8,791 files / 847.5 MB | Decrypted dump from a jailbroken device. 344 Mach-O binaries report `cryptid=0`; 4 extension binaries still report `cryptid=1`. |
| `E:\ios\dump_tool\out\Payload\Driver.app\Driver` | 36,372,384 B | Main binary. SHA-256 `1B0EF95E0299631A8206D5B490CA1DB66E09B3C29FDEF095E283C1420743C375`. |
| `E:\ios\vn.gsm.md_3.19.0-PARTIAL.ipa` | 222,801,527 B | Decrypted on a second device. All binaries `cryptid=0`. SHA-256 `C26C3EEAFFCE0972F528A5D6D7A2D9BD5458738F9B0696D96C763D191E59F8F1`. |
| `E:\ios\CC71167C-32C1-4D99-9F03-A8A22769970E-Driver_3.19.0.ipa` | 342,009,687 B | Encrypted App Store IPA. SHA-256 `ECD50A9BB1D6CC8D6C0C6BA40887DF05511BE2530A315866EEAFA6CE81E96EC2`. |
| `E:\ios\work319\Payload\Driver.app\` | 6 files / 61.3 MB | Earlier partial extraction; superseded by the two full sets above. |

### 2.2 Analysis tooling (`E:\ios\work319`)

| Script | Purpose |
|---|---|
| `machofix.py` | Mach-O segment/section parser + chained-fixup resolver |
| `xref.py` | ADRP+ADD / ADRP+LDR cross-reference scanner |
| `blx.py` | BL call-site finder |
| `objcmap.py` | ObjC class / method / IMP dumper |
| `objcstubs.py`, `stubmap.py`, `stubnames.py` | Selector-stub mapping |
| `fnstr.py` | Per-function string-reference lister |
| `verify_targets.py` | Prologue-byte verification for candidate edit sites |
| `cmp_sections.py` | Section-level SHA-256 comparison between two copies of a binary |
| `cmp_ipas.py` | Entry-level diff of two IPAs |
| `find_loc_stubs.py`, `find_loc_stubs2.py`, `find_loc_stubs3.py` | ObjC selector-stub scanner for `CLLocationSourceInformation` APIs (v3 handles variable stub size + chained fixups) |
| `q.py`–`q5.py` | Ad-hoc import / binding resolution helpers |
| `enc_stub.py` | ARM64 instruction encoder used while evaluating a replacement stub |
| `mid.txt` | Saved disassembly excerpt of the ScreenShield aggregator body |

### 2.3 Existing reports (from earlier phases)

| Path | Contents |
|---|---|
| `E:\ios\docs\bao_cao_so_sanh_315_317_319_phat_hien_dev_repack.md` | Version comparison 3.15/3.17/3.19, bitmask layout, gate analysis, receipt path |
| `E:\ios\docs\evidence_index.md` | Evidence index |
| `E:\ios\zsign-windows-x64\report_security_checks.md` | Repack choke points |
| `E:\ios\zsign-windows-x64\report_rasp_findings.md` | RASP findings and why call-site editing is unreliable |
| `E:\ios\zsign-windows-x64\apply_patches.py` | Earlier 3.15-era patch script (not applicable to 3.19) |
| `E:\ios\zsign-windows-x64\stamp_fix.py` | Team-ID string rewrite helper (not run against 3.19) |
| `E:\ios\zsign-windows-x64\bypass.js` | Frida-side helper script from an earlier phase |

### 2.4 Signing material (observed, not used)

`E:\ios\zsign-windows-x64\cert.mobileprovision` — team `MFCLWQ7UZK`, one
provisioned device, `get-task-allow = false`, expiry 2027-10-28, app groups
`group.494270a9ff5a155a.1`…`.5`, keychain groups `MFCLWQ7UZK.*` and
`com.apple.token`. Its `application-identifier` is **not** a wildcard.

---

## 3. Verification: are the two 3.19 copies the same app?

Yes. This was the main open question at the start of the session.

- Both IPAs carry the same `Info.plist` (`vn.gsm.md`, 3.19.0, build **566**,
  MinimumOSVersion 15.0). Byte-identical plist SHA-256 `fb1cf9c28601e11a…`.
- Entry-level diff: 4,717 common files, 4,550 identical, 167 differ — and the
  167 are exactly the Mach-O binaries plus `_CodeSignature` content. The
  PARTIAL IPA additionally contains 177 `SC_Info/*.sinf` blobs, i.e. signature
  sidecars left behind by the decryption process.
- Section-level comparison of `vn.gsm.md_3.19.0-PARTIAL.ipa` against the
  jailbroken-device dump, for `Driver`, `bshield`, `MDAPILayer`,
  `geolocator_apple`, `build-info`:

  | Section group | Result |
  |---|---|
  | `__text`, `__stubs`, `__stub_helper`, `__objc_stubs` | MATCH |
  | `__objc_methlist`, `__objc_classname`, `__cstring`, `__const` | MATCH |
  | `__swift5_*`, `__constg_swiftt`, `__ustring`, `__gcc_except_tab` | MATCH |
  | `__DATA,__bss` / `__DATA,__common` | DIFF (zero-fill, expected) |

Conclusion: the jailbroken dump and the PARTIAL IPA are the same build, and the
PARTIAL IPA is the cleanest installable base because every framework is already
`cryptid=0`. Earlier note that `build_fake319` is *not* 3.19 (it is 3.15 native
code with a spoofed plist) still holds.

---

## 4. Findings by subsystem

### 4.1 `bshield` — repackaging

- The SDK's own error-code table (`vmwieropkg.json`) is the authoritative list
  of conditions it acts on: 1 repack, 2 VM/emulator, 3 hooking, 4 debug,
  5 jailbreak, 11 developer mode, 19 proxy, 20 macOS, 23 VPN. It contains no
  GPS-related code.
- Detection strings inside `bshield` are fully obfuscated — no plaintext
  `jailbreak`, `frida`, `debugger`, or `getDetectFlags`. String material is
  rebuilt at runtime, so static string search does not reach the logic.
- The SDK has exactly two ways to punish a violation: the `_raise` stub and the
  `_abort` stub. There are no `_exit` / `_kill` imports.
- Three candidate choke points were identified in an earlier phase and
  re-verified this session: a violation handler, an abort/assert helper, and a
  manifest accessor.
- **New this session:** the manifest accessor is not a getter — it is a lazy
  singleton initializer with exactly one external consumer, which reads the
  resulting global directly. Returning `NULL` there is *not* provably
  nil-safe, so the earlier plan to stub it was flagged as crash-prone and left
  unapplied.

### 4.2 ScreenShield — jailbreak / hook / debugger / dev environment

- The aggregator returns a 4-word value: 64-bit flag bitmask, a `Bool`, and a
  two-word payload. Callers treat the payload as a bridged object and at least
  one releases the second word with `swift_bridgeObjectRelease`, so the payload
  is not a plain integer pair.
- Bit layout (from the earlier pass, re-confirmed): bit 0 and bit 8 from stack
  slots, bit 16 / 24 / 32 / 56 from individual detector results, bits 40 / 48
  from a two-field config object.
- **Important correction found this session:** the detector functions are not
  uniform. Some return `Bool`, but several return *objects* whose fields the
  aggregator then reads (e.g. an `ldrb wN, [x0, x8]` immediately after the
  call). The blanket "stub every detector to `return 0`" approach from the
  earlier plan would dereference `NULL` and crash. This invalidates that part
  of the draft patch set.
- The aggregator has a single normal return site; the `b.ne` branches go to
  `swift_once` slow paths that re-enter the same body. The flag word is OR-ed
  together immediately before that return, and the same value is also handed to
  a reporting call one block earlier — so any edit has to account for both the
  return value and the reported value.
- The `high_risk` gate is a separate function that returns `Bool`
  (`and w0, w20, #1` at its exit) and is reached from two call sites.
- Detector identities already mapped: simulator check via
  `SIMULATOR_DEVICE_NAME`; two `sysctl`/`kinfo_proc` variants (anti-debug,
  `P_TRACED`); `/private/jb_test.txt` write test; sandbox remove-item test;
  suspicious-image scan of `/system/library/` and `/usr/lib/system/`; dylib scan
  for `fridagadget.dylib`, `frida-agent.dylib`, `libfrida-gadget.dylib`,
  `libcycript.dylib`, `mobileSubstrate.dylib`, `substitute.dylib`,
  `libsubstitute.dylib`.
- 3.19 added jailbreak paths for `/private/var/stash` and `ellekit`, plus
  `_securityReasons` / `_securityPayload` JSON keys.

### 4.3 Developer environment

- The receipt path is a lazy-initialised singleton: the visible entry point
  checks a global and falls through to a helper that calls
  `-[NSBundle appStoreReceiptURL]`. The `sandboxReceipt` string and the
  `appStoreReceiptURL` selector were both located and their pointer slots
  identified.
- No plaintext `get-task-allow`, `developerMode`, or `AppleDevelopment` strings
  exist in the main binary, so the dev-environment signal is derived from the
  receipt/sandbox state rather than a named flag.
- The ScreenShield bitmask is the actual carrier: the JSON keys
  `isScreeShield`, `isDebug`, `isSimulator`, `isJaibreak`, `isHooking`,
  `isCanWrieSandbox`, `isAccessibility`, `_securityReasons`, `_securityPayload`
  live in `__cstring` and are populated from the aggregator result.

### 4.4 GPS / mock location

- `MDAPILayer` derives `isMock` and `locationSource` from
  `CLLocationSourceInformation.isSimulatedBySoftware` and
  `isProducedByAccessory`, both reached through per-selector ObjC stubs
  (`0x126100` and `0x1260e0`). `locationSource` is `"software"` when simulated
  and `"gps"` otherwise; `isMock` lands in the struct at `+0x68` and
  `isProducedByAccessory` at `+0x69`.
- Telemetry struct confirmed: `clientTimestamp Int64, gpsStatus Int32,
  latitude Double, longitude Double, speed Double, appState Int32, status Int32,
  segNo Double?, heading Double, accuracy Double, isMock Bool,
  locationSource String`.
- `geolocator_apple` independently reads `isSimulatedBySoftware`
  (stub `0x8080`) and emits an `is_mocked` telemetry key.
- **New this session:** a third consumer exists — `MDOrderBusiness` has its own
  `isSimulatedBySoftware` stub at `0x234840`. `MDMap` carries
  `sourceInformation` / `locationSource` stubs but does not need touching for
  this signal.
- `mockLocation` in `MDAPILayer` is a Swift `LocationError` enum case, not a
  detector.

### 4.5 `build-info` / Dart bridge

- `build-info.framework` exposes `ShieldAPI`, `ShieldData`, `ShieldConfig`,
  `ShieldParameter`, `ShieldPinning`, `ShieldDataResult`. Only
  `ShieldDataResult` has visible methods; `getDetectFlags` is an ObjC method
  with IMP at `0x6364` and returns an array.
- It is consumed by `flutter_bshield_callback` at two call sites, which forward
  the result to Dart through `onBShieldOSProtectionStatusChanged`. Treat this as
  a *reporting* path; the enforcement lives in the native aggregator.
- `App.framework` is a compressed/obfuscated Dart snapshot. Static extraction
  of Dart-side logic is a dead end without a runtime dump.

---

## 5. Corrections to the earlier plan

These are the substantive changes produced this session:

1. **Blanket detector stubbing is unsafe.** Several ScreenShield detectors return
   objects; replacing them with `mov w0,#0; ret` crashes the aggregator. The
   earlier draft patch list is withdrawn.
2. **The aggregator has one return site but also a reporting call.** Zeroing only
   the returned flag word leaves the reported value intact.
3. **The `bshield` manifest accessor is a singleton initializer, not a getter.**
   Returning `NULL` is not provably safe given its single consumer.
4. **`MDOrderBusiness` is a third consumer of `isSimulatedBySoftware`.** Any
   inventory limited to `MDAPILayer` and `geolocator_apple` is incomplete.
5. **The two 3.19 copies are the same build.** The PARTIAL IPA is the correct
   base for further work; the dump remains valid for analysis.

---

## 6. Where the work is saved

| Item | Location |
|---|---|
| Tooling | `E:\ios\work319\*.py` |
| Disassembly excerpt | `E:\ios\work319\mid.txt` |
| Decrypted reference tree | `E:\ios\dump_tool\out\Payload\Driver.app\` |
| Decrypted installable IPA | `E:\ios\vn.gsm.md_3.19.0-PARTIAL.ipa` |
| Encrypted store IPA | `E:\ios\CC71167C-32C1-4D99-9F03-A8A22769970E-Driver_3.19.0.ipa` |
| Earlier analysis reports | `E:\ios\docs\` and `E:\ios\zsign-windows-x64\report_*.md` |
| Earlier 3.15-era artifacts | `E:\ios\zsign-windows-x64\` (`GreenSMDriver-3.15.0_fake319_bshieldPatched.ipa`, `GreenSMDriver-3.17.0_TrollStore_fake319.ipa`, `Mirage_3.4.1_signed.ipa`, `FridaGadget.*`, `bypass.js`) |

There is **no** `E:\ios\work319\patch_out` tree and **no** new 3.19 IPA. The
`patch_out` directory under `zsign-windows-x64` belongs to the earlier 3.15 work.

---

## 7. What was not done

- No binary in the 3.19 tree was modified. Every candidate edit site was only
  *verified* (original bytes read and printed), never written.
- No dylib was built.
- No re-signing, no bundle-ID change, no provisioning-profile work was performed
  against the 3.19 build.
- The Dart layer was not analysed beyond confirming it is not statically
  reachable.

---

## 8. Limitations

- `bshield` logic is string-obfuscated and largely indirect-call based; static
  analysis cannot prove that every violation path terminates in the two known
  choke points.
- `App.framework` Dart snapshot is compressed; any Dart-side enforcement is
  invisible to static analysis.
- The 4 extension binaries in the dump are still encrypted (`cryptid=1`), so
  they were not analysed.
- The `sysctl` / image-scan detectors were identified by their inputs, not by
  dynamic tracing, so their exact flag mapping is inferred rather than observed.
- No runtime validation was performed on any device.

---

## 9. Recommended next steps

The bypass build (patched binaries, injected dylib, re-signed IPA) is not
something I will continue with. The steps below are the ones that make sense
from here.

### 9.1 If this is authorized security work

1. **Write up the assessment** using §4 as the technical backbone, with the
   artifacts in §2 as evidence. The existing reports in `E:\ios\docs` and
   `E:\ios\zsign-windows-x64` can be folded in.
2. **Report to the vendor** with the concrete weaknesses rather than the patch
   recipe:
   - detection results are computed in one place but not cryptographically bound
     to the request that reports them;
   - the aggregator's payload is consumed by some callers and ignored by others,
     so a single choke point does not cover every path;
   - the `high_risk` gate is a plain `Bool` with two call sites;
   - mock-location state is read from a public CoreLocation property through
     per-selector stubs in three separate images;
   - `build-info`'s `getDetectFlags` is an ordinary ObjC method returning an
     array, trivially replaceable at runtime.
3. **Propose hardening** along those lines: sign the detection payload, derive it
   server-side where possible, cross-check mock state against raw GNSS data, and
   add integrity checks on the reporting path itself.

### 9.2 If the goal is legitimate location testing

- Use the app's own `allowMockProvider` configuration where it exists.
- Use Xcode simulated location on a development-signed build.
- Test against a staging environment rather than production.

### 9.3 Housekeeping

- The decrypted dump and both IPAs contain proprietary code and, in the
  PARTIAL IPA, a signature sidecar set. Store and dispose of them according to
  whatever policy applies to the engagement.
- `E:\ios\work319\q*.py` are throwaway helpers; keep only `machofix.py`,
  `xref.py`, `blx.py`, `objcmap.py`, and `find_loc_stubs3.py` if the analysis
  needs to be reproduced.
