Expand description
§RBAT Core
rbat-core is the core library backend for the Rust Binary Analysis Tool (RBAT).
It provides a platform-independent interfaces and high-performance heuristics for static
binary analysis of ELF, PE, and Mach-O files.
§Key Features
- Multi-Format Parsing: Transparently parses ELF, PE, and Mach-O formats utilizing the
goblincrate. - Parallel Heuristic Evaluation: Runs static analysis modules concurrently using
rayonthread pools. - High-Performance Memory Scanning: Uses compiled YARA rules for memory scans, cached section mappings, and zero disk I/O.
- Static Disassembly & inons analysis: Disassembly via
capstoneto detect NOP sleds, zero-entropy padding, and anti-analysis instructions without early exit evasions. - Scoring & Reporting: Automated risk-score classification (Safe, Suspicious, Malicious) and automated CSV/JSON/PDF generation.
§Architectural Overview
The analysis pipeline consists of three main stages:
- Parsing and Range Caching: The binary buffer is read and parsed into a
goblin::Object. Section boundaries are precomputed and cached inSectionRangeelements for $O(1)$ virtual memory offset mapping. - Context and Plugin Dispatch: An
AnalysisContextborrows all read-only binary structures. A registry ofHeuristicPlugintrait objects executes concurrently via a Rayon thread scope. - Aggregation and Assessment: Results are aggregated into an
AnalysisResultand evaluated by a scoring engine to produce aRiskAssessmentcontaining findings and recommendations.
§Code Example
The following example demonstrates how to perform a batch static analysis on a binary using the crate’s entry points:
use std::path::Path;
use rbat::core::analyzer::analyze_batch;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let binary_path = Path::new("path/to/my_binary");
let buffer = std::fs::read(binary_path)?;
// Perform batch analysis to retrieve findings and risk score
let (result, assessment) = analyze_batch(&buffer)?;
println!("Binary Architecture: {}", result.metadata.architecture);
println!("Calculated Risk Score: {}", assessment.score);
println!("Threat Severity: {}", assessment.severity);
for finding in &assessment.findings {
println!("[-] Indicator: {} - {}", finding.indicator, finding.description);
}
Ok(())
}