The MCRIT IDA plugin has been moved to its own repository: mcrit-plugins
Features
- Query MCRIT for similar functions from the current IDA view
- Task matching jobs for entire binaries
- View and analyze matching results
- Batch import function labels from MCRIT
- Display colored control flow graphs for remote functions
- Query PicBlockHashes for basic blocks
- Filter results by block size and MinHash score
Installation
Prerequisites
- IDA Pro 7.x or later
- Python 3.x
- MCRIT server running and accessible
Setup
- Clone the MCRIT repository (or download the plugin files):
- Create your configuration file from the template:
- Edit the configuration to match your MCRIT deployment:
- Load the plugin in IDA Pro:
- In IDA, go to
File→Script file... - Navigate to
./plugins/ida/ida_mcrit.py - Click
Open
Configuration Options
Theconfig.py file supports the following options:
URL of your MCRIT server instance
API token for authenticated access to MCRIT
Username for tracking submissions and queries
Default MinHash similarity threshold (0.0 to 1.0)
PicHash size for matching (None for default)
Minimum number of band matches required for candidates
Maximum number of results to display
Whether to show matches from library code
Using the Plugin
Query Current Function
Query MCRIT for similar functions to the one currently viewed in IDA:- Navigate to a function in IDA
- Run the plugin or use the configured hotkey
- Select “Query Current Function”
- Wait for results to display
- Extract the current function’s features
- Send a query to MCRIT
- Display matching functions with similarity scores
Query Current Binary
Submit the entire binary for matching:- Run the plugin
- Select “Query Current Binary”
- Choose whether to store the binary in MCRIT or just query
- Wait for the matching job to complete
View Matching Results
Once results are available:- Function List: Browse matching functions sorted by similarity
- Similarity Scores: View MinHash and PicHash scores
- Sample Information: See which samples contain matching functions
- Filter Options: Filter by score threshold, block size, or library status
Import Function Labels
Batch import function names from MCRIT matches:- Query a function or binary
- Review the matching results
- Select “Import Labels”
- Choose import options:
- Threshold: Minimum similarity score
- Overwrite: Whether to overwrite existing names
- Prefix: Optional prefix for imported names
- Confirm import
View Remote Function CFG
Display the control flow graph of a matching function:- Select a match from the results
- Choose “View Remote CFG”
- The plugin displays a colored graph with:
- Basic blocks
- Control flow edges
- Block addresses and sizes
Query PicBlockHash
Query individual basic blocks:- Navigate to a basic block in IDA
- Run the plugin
- Select “Query PicBlockHash”
- View functions containing similar blocks
Advanced Features
Filter by Block Size
Filter matching functions by minimum basic block count:Filter by MinHash Score
Set a custom MinHash threshold for the current query:Task Matching Jobs
Submit a matching job and retrieve results later:- Query the current binary with “Submit Job”
- Note the job ID
- Continue working in IDA
- Later, select “Retrieve Job Results” and enter the job ID
Exclude Self Matches
When querying a binary already in MCRIT:Integration Workflow
Analyzing Unknown Malware
-
Initial Analysis:
- Load the sample in IDA
- Let IDA perform initial auto-analysis
-
Query Key Functions:
- Navigate to interesting functions (entry point, networking, crypto)
- Query each function in MCRIT
- Review matches to identify known code patterns
-
Import Labels:
- Import function names from high-confidence matches
- Use MCRIT labels to understand sample structure
-
Full Binary Match:
- Submit the entire binary for comprehensive matching
- Identify related samples and families
-
Refine Analysis:
- Use MCRIT results to guide deeper analysis
- Focus on unique code not matching known samples
Building a Reference Database
-
Submit Known Samples:
-
Submit Libraries:
-
Organize by Family:
- Use consistent naming conventions
- Include version information
- Tag variants appropriately
Finding Code Reuse
-
Query at Function Level:
- Identify shared functions across samples
- Track common utilities and libraries
-
Query at Block Level:
- Find code snippets and patterns
- Identify compiler artifacts
-
Cross-Reference Results:
- Link findings back to other samples
- Build attribution chains
Troubleshooting
Plugin Won't Load
Plugin Won't Load
Symptoms: Plugin script fails to execute in IDASolutions:
- Check Python version compatibility
- Ensure
config.pyexists and is valid - Verify MCRIT client library is installed
- Check IDA’s Python environment with
import mcrit
Connection Errors
Connection Errors
Symptoms: “Failed to connect to MCRIT server”Solutions:
- Verify MCRIT server is running
- Check
MCRIT_SERVERURL in config - Test connectivity:
curl http://localhost:8000/status - Verify firewall settings
- Check API token if authentication is enabled
No Results Returned
No Results Returned
Symptoms: Query completes but shows no matchesSolutions:
- Lower the
MINHASH_THRESHOLDin config - Check if MCRIT database has relevant samples
- Verify the function has sufficient code for matching
- Try querying a different function
Slow Query Performance
Slow Query Performance
Symptoms: Queries take a long time to completeSolutions:
- Reduce
MAX_RESULTSto limit data transfer - Use higher thresholds to reduce candidate matches
- Check MCRIT server performance and resources
- Consider querying smaller functions first
Label Import Issues
Label Import Issues
Symptoms: Labels not importing or incorrect namesSolutions:
- Check import threshold settings
- Verify function matches have labels in MCRIT
- Try importing with lower score threshold
- Use
with_label_only=Trueto filter results
Best Practices
Function Selection
Query distinctive functions first:
- Crypto/encoding functions
- Network protocol handlers
- Custom algorithms
- Main/entry functions
Threshold Tuning
Adjust thresholds based on goals:
- High (0.8-1.0): Exact/near-exact matches
- Medium (0.6-0.8): Similar implementations
- Low (0.4-0.6): Related code patterns
Label Management
Maintain clean labels:
- Review before bulk import
- Use prefixes to identify source
- Keep original IDA names when uncertain
- Document import decisions
Iterative Analysis
Build understanding incrementally:
- Start with high-confidence matches
- Import labels progressively
- Re-run queries as understanding grows
- Cross-reference multiple samples
Performance Tips
- Cache Results: The plugin caches recent query results
- Use Filters: Apply filters to reduce result processing time
- Batch Operations: Import labels in batches rather than individually
- Local Disassembly: Disassemble locally before querying to reduce server load
See Also
- Python Client Guide - Understanding the underlying API
- CLI Guide - Command-line data management
- Data Import/Export - Building reference databases