WhoBuilt

H*ck yourself

Oct 14, 2021· 23 min· 700 views·Watch on YouTube

Speaker

Mateo Silguero, front-end chapter lead at Argentina-based Ankh and a mobile security enthusiast, presents on securing React Native apps at React Native EU 2021, hosted by Callstack.

Inspect the app for exposed secrets

Silguero recommends reviewing your app before attackers do, starting with its APK or IPA. He demonstrates inspecting Android manifests, resources, Smali code, and JavaScript bundles for hardcoded keys and other sensitive information. Hermes bundles can also be disassembled into instructions for inspection. He names APKnown, APKX, and MobSF as automated analysis tools.

Limit exposure of secrets and stored data

Silguero recommends avoiding secrets in client apps where possible, since they cannot be made completely safe there. He discusses Hermes with Obfuscator.io for making JavaScript harder to read, and ProGuard for Android, while noting that obfuscation rules can increase bundle size. He also warns that AsyncStorage data is stored as plain text in an SQLite database that can be retrieved from a rooted device or emulator.

Use encrypted storage where needed

As alternatives to AsyncStorage, Silguero mentions React Native Encrypted Storage and MMKV, a C++ library from Tencent with React Native wrappers. He says MMKV supports encryption and storing data types beyond strings. Without encryption, its data file is readable; with encryption, it requires the encryption key.

Test app behavior with Frida

Silguero describes Frida as a tool for hooking app code and changing behavior without modifying the original source. His examples include returning fixed location coordinates and logging AsyncStorage calls with frida-trace. He demonstrates patching an APK with Objection to add Frida Gadget, then hooking a device validation so it returns false, showing how runtime checks can be bypassed.

Build layered defenses and keep learning

Silguero says no security approach is bulletproof, but teams can reduce the chance of successful attacks. He suggests learning ethical hacking and practicing on company apps or dedicated testing labs. He also points to network traffic, proxies, public databases, and activities as topics for further investigation.

Takeaways

  • Treat shipped APKs and IPAs as inspectable; keep API keys and other secrets out of client bundles where possible.
  • Check manifests, resources, JavaScript bundles, and compiled Hermes code for sensitive values.
  • Use encrypted storage for sensitive local data, since AsyncStorage stores plain text in SQLite.
  • Test runtime checks against tools such as Frida, and combine integrity checks with other defenses.
  • Use obfuscation to raise the effort required to inspect code, while accounting for added bundle size.

Mentioned in this talk

Search inside this talk

What was claimed 11

  • role at
    Mateo Silguero is leader of the front-end chapter at Ankh
    “I work as the leader of the front-end chapter at Ankh”
    YouTube
    Unverified1 source· Talk
  • feature
    APKTool: Decompiles APK artifacts into source files
    “we can use APKTool to decompile the artifact into source files”
    YouTube
    Unverified1 source· Talk
  • feature
    Hermes Agent: Compiles JavaScript code to bytecode
    “if Hermes is enabled, the JavaScript code is compiled to bytecode”
    YouTube
    Unverified1 source· Talk
  • feature
    MobSF: Analyzes APKs and IPAs and can find URLs, Firebase URLs, emails, strings, and hardcoded secrets
    “MobSF is another tool, and it works with both APKs and IPAs”
    YouTube
    Unverified1 source· Talk
  • feature
    Obfuscator.io: Metro plugin that makes strings in the bundle harder to read
    “it's a Metro plugin, so the strings will be really hard to read in the bundle”
    YouTube
    Unverified1 source· Talk
  • feature
    AsyncStorage: Persists data in an SQLite database file as plain text
    “all that you save is persisted in an SQLite database file as plain text”
    YouTube
    Unverified1 source· Talk
  • built
    “MMKV is a C++ library developed by Tencent”
    YouTube
    Unverified1 source· Talk
  • feature
    React Native MMKV: Supports data encryption
    “it has an option for data encryption”
    YouTube
    Unverified1 source· Talk
Show all 11 facts

Related talks