analyze command compares Hermes bytecode files against a database of known package fingerprints to identify vulnerable dependencies. It supports both exact hash matching and fuzzy similarity-based matching using Levenshtein distance.
Usage
Analysis Modes
The analyze command supports two primary modes:1. Database Analysis (Currently Disabled)
Direct IPA or HBC file analysis against the fingerprint database is currently disabled in the codebase. This functionality is commented out pending further development.Use the packages command with
-d flag for database-backed analysis, or use specific analysis mode (below) for direct comparison.2. Specific Analysis
Directly compare a package HBC file against an app bundle HBC file:Flags
Input Flags
Path to the IPA file to analyze. The command will extract and analyze HBC files from the IPA archive.Status: Currently disabled in the codebase.
Path to the HBC file to analyze directly.Status: Currently disabled in the codebase.
Specific Analysis Flags
Enable specific analysis mode. When enabled, compare a specific package HBC file against a specific app bundle HBC file.
Path to the package HBC file to analyze. Required when
-s is enabled.Path to the app bundle HBC file to compare against. Required when
-s is enabled.Path to the output file where match results will be written.
Fuzzy Matching Configuration
Enable fuzzy matching with confidence scores. Uses Levenshtein distance to find similar functions even when exact hashes don’t match.
Minimum confidence threshold for fuzzy matches. Valid range: 0.0-1.0.
1.0= exact match only0.8= 80% similarity required (recommended)0.6= 60% similarity (more lenient, may have false positives)
Maximum number of documents to check for fuzzy matching. Higher values increase accuracy but slow down analysis.
Length tolerance for fuzzy matching (0.2 = ±20%). Only compare IR strings with compatible lengths to improve performance.
Examples
Specific Package vs App Bundle Analysis
Compare a vulnerable package against an app bundle with default settings:High-Confidence Fuzzy Matching
Perform analysis with strict fuzzy matching (90% similarity required):Lenient Fuzzy Matching
Use lower confidence threshold for heavily obfuscated code:Performance-Tuned Analysis
Limit fuzzy matching documents for faster analysis:Output Format
The analysis generates a comprehensive report with exact and fuzzy match statistics:Match Types
The analysis compares three types of fingerprints:- Structural Hash: SHA256 of instruction bigrams (opcode sequences)
- Content IR1 Hash: SHA256 of non-identifier strings and literals
- Content IR2 Hash: SHA256 of identifiers and object references
Interpretation
- Exact matches: Functions with identical hashes (100% confidence)
- Fuzzy matches: Functions with similar IR strings above the confidence threshold
- Eligible for fuzzy: IR strings ≥30 characters that weren’t exact matches
- Overall percentage: Combined metric indicating likelihood the package is present
How It Works
Exact Matching
- Disassemble both HBC files and extract function objects
- Generate IR representations and compute SHA256 hashes
- Compare hashes for exact equality
Fuzzy Matching
- Filter IR strings by length compatibility (±20% by default)
- Calculate Levenshtein distance between IR strings
- Convert distance to similarity score (0.0-1.0)
- Include matches above confidence threshold
Performance Optimizations
- Length pre-filtering: Skip comparisons between incompatible lengths
- Minimum IR length: Only match strings ≥30 characters
- Parallel processing: Structural, IR1, and IR2 matching run concurrently
- Document limits: Cap fuzzy matching to prevent excessive runtime
Common Use Cases
Vulnerability Detection
Check if a known vulnerable package version is present in a production app:Supply Chain Auditing
Analyze multiple packages against an app bundle:Code Similarity Analysis
Compare two different versions of the same package:Notes
- Database analysis mode (
-i,-b) is currently disabled in the codebase - Specific analysis mode (
-s) is the primary working mode - Both package and app bundle files must be valid HBC files
- Results are most accurate when both bundles use the same Hermes version
- High match percentages (>40% combined) indicate strong likelihood of package presence
- Consider baseline React Native functions when interpreting results