Overview
This guide walks you through analyzing a React Native application for vulnerable dependencies using Hedis. You’ll learn how to disassemble bytecode, extract fingerprints, and match them against a reference database.Get a Hermes bytecode file
You need a The bundle file is typically in
.hbc file from a React Native app. You can extract one from an iOS app archive (.ipa) or compile your own.Option 1: Extract from an IPA
If you have an.ipa file, extract it and locate the bundle file:Payload/MyApp.app/.Option 2: Compile your own
If you have a React Native project:Disassemble the bytecode
Use the This creates a text file containing:
disassemble command to convert the bytecode to human-readable output:- Header information (Hermes version, function count)
- Function definitions with bytecode instructions
- String literals and object references
Disassembly flags
| Flag | Description |
|---|---|
-i, --hbc | Input HBC file (required) |
-o, --output | Output file path |
-s, --strings | Include string table |
-f, --functions | Include functions (default: true) |
-j, --objects | Include object definitions |
-z, --function-objects | Include function objects |
-r, --function-objects-ir | Include function IR representations |
-n, --normalization | Normalization level (0=none, 1=IR1, 2=IR2) |
Set up the fingerprint database
Before analyzing apps, you need to build a reference database of package fingerprints.This processes each React Native environment in This runs a parallel pipeline that:Or download all advisories and their associated packages:
Generate React Native baselines
Baselines are fingerprints of empty React Native apps, used to filter out framework functions:pipeline/react-natives/ and stores framework fingerprints.Process npm packages
Index packages from the React Native directory:- Installs each package in all 11 RN environments
- Bundles with Metro and compiles with Hermes
- Extracts function fingerprints
- Stores hashes in MongoDB
Update security advisories
Download GitHub Security Advisories for known vulnerabilities:Analyze an app bundle
Now you can analyze an app to identify which packages it contains.This performs exact hash matching against the fingerprint database.The This generates a detailed comparison report showing:
Basic analysis
Analyze a single HBC file against the database:Fuzzy matching
Enable fuzzy matching to catch packages that have minor differences:-c flag sets the confidence threshold (0.0–1.0). Higher values require closer matches.Fuzzy matching uses Levenshtein distance with length-based pre-filtering. It’s slower but catches packages that have been minified or transformed.
Compare specific packages
Compare a specific package directly to an app bundle:- Exact hash matches (structural, IR1, IR2)
- Fuzzy matches with confidence scores
- Match percentages for each hash type
Analysis flags
| Flag | Description |
|---|---|
-b, --hbc-file | Input HBC file to analyze |
-f, --fuzzy-matching | Enable fuzzy matching |
-c, --confidence-threshold | Confidence threshold (default: 0.8) |
-s, --specific-analysis | Compare specific package to app |
-p, --specific-package | Package HBC file |
-a, --compare-to-app-bundle | App bundle HBC file |
-o, --output-file | Write results to file |
Interpret the results
Hedis matches functions using three hash types:
Hash types
-
Structural Hash — SHA256 of instruction bigrams (opcode sequences)
- Detects code structure patterns
- Resistant to variable renaming
-
Content IR1 Hash — SHA256 of non-identifier strings
- Matches string literals and constants
- Uses trigram shingling for fuzzy matching
-
Content IR2 Hash — SHA256 of identifiers and object references
- Matches variable and function names
- More sensitive to minification
Understanding match percentages
- High match (>70%) - Package is very likely present
- Medium match (30-70%) - Partial match, possibly a different version
- Low match (<30%) - Package may not be present, or heavily modified
Example workflow
Here’s a complete example analyzing a React Native app:Next steps
Commands reference
Explore all available commands and options
Architecture
Learn how Hedis works under the hood