Rust Threat Detector
A memory-safe SIEM threat detection component for real-time security monitoring and threat analysis. Built with Rust to eliminate vulnerabilities in security monitoring systems.
Security-First Design
Eliminates memory safety vulnerabilities in security tools themselves. Aligns with 2024 CISA/FBI guidance for memory-safe security infrastructure.
Features
Core Detection Capabilities
- Memory Safety - No buffer overflows or memory corruption in threat detection
- Real-time Analysis - Fast pattern matching for log analysis
- Pre-configured Patterns - Built-in threat detection rules
- Custom Patterns - Add organization-specific detection rules
- Severity Classification - Info, Low, Medium, High, Critical
- Alert Management - Structured threat alerts with recommendations
Advanced Analytics
-
Behavioral Analytics (UEBA) - User and Entity Behavior Analytics for anomaly detection
- User behavior profiling and baseline establishment
- Anomalous activity detection (unusual hours, IPs, access patterns)
- Risk scoring and high-risk user identification
- Failed login tracking and brute force detection
-
Threat Intelligence - IOC (Indicators of Compromise) matching
- Support for IP addresses, domains, file hashes, URLs, emails, user agents
- Fast lookup using HashSets for real-time detection
- Confidence scoring for threat indicators
- Default threat intelligence feeds (Tor nodes, C2 servers, phishing domains)
- JSON import/export for custom threat feeds
-
Statistical Anomaly Detection - Machine learning-based anomaly detection
- Z-score detection (standard deviations from mean)
- Moving average with threshold analysis
- Exponential smoothing for trend analysis
- Inter-Quartile Range (IQR) outlier detection
- Time-series metric tracking and analysis
-
MITRE ATT&CK Framework - 10+ technique detection patterns
- Credential dumping, lateral movement, persistence detection
- Process injection, privilege escalation identification
- Data exfiltration and command & control detection
SIEM Integration
- Multiple Export Formats - Native support for all major SIEM platforms
- CEF (Common Event Format) - ArcSight, Micro Focus
- LEEF (Log Event Extended Format) - IBM QRadar
- JSON - Splunk, Elasticsearch, Datadog
- Syslog (RFC 5424) - Universal compatibility
- CSV - Reporting and analytics
Use Cases
- Financial transaction monitoring
- Network intrusion detection
- Application security monitoring
- Compliance log analysis
- Real-time threat intelligence
- Security operations center (SOC) automation
Installation
Add to your Cargo.toml:
[]
= "0.1.0"
Quick Start
Basic Threat Detection
use ;
use Utc;
use HashMap;
let mut detector = new;
let log = LogEntry ;
let alerts = detector.analyze;
for alert in alerts
Advanced Usage Examples
Behavioral Analytics (UEBA)
Detect anomalous user behavior patterns:
use ;
use Utc;
let mut analytics = new; // 50.0 = anomaly threshold
// Establish baseline with normal user activity
for _ in 0..10
// Detect anomaly - login from unusual IP
let suspicious_log = LogEntry ;
if let Some = analytics.analyze
Threat Intelligence
Match logs against known malicious indicators:
use ;
use Utc;
let mut intel = new;
// Add custom IOCs
intel.add_ioc;
// Check log for IOC matches
let log = LogEntry ;
let alerts = intel.check_log;
for alert in alerts
Statistical Anomaly Detection
Detect statistical anomalies in metrics:
use ;
use Utc;
let mut detector = new;
// Track baseline metrics
for i in 0..100
// Detect anomaly using Z-score method
if let Some = detector.detect
SIEM Export Formats
Export alerts to multiple SIEM formats:
use ;
let exporter = new_default;
// Export to CEF (ArcSight)
let cef = exporter.export;
send_to_arcsight;
// Export to LEEF (QRadar)
let leef = exporter.export;
send_to_qradar;
// Export to JSON (Splunk)
let json = exporter.export;
send_to_splunk;
// Batch export to CSV
let batch_exporter = new;
batch_exporter.export_to_file?;
MITRE ATT&CK Detection
Detect MITRE ATT&CK techniques:
use ;
let mut detector = new;
let log = LogEntry ;
let detections = detector.analyze;
for detection in detections
Built-in Threat Patterns
1. Brute Force Detection
Pattern: Failed login attempts
Severity: High
Indicators: Multiple authentication failures
2. Malware Detection
Pattern: Malware signatures
Severity: Critical
Indicators: Virus, trojan, ransomware keywords
3. Data Exfiltration
Pattern: Large data transfers
Severity: High
Indicators: Unusual download patterns
4. Privilege Escalation
Pattern: Unauthorized access attempts
Severity: Critical
Indicators: Sudo, admin access attempts
5. SQL Injection
Pattern: SQL injection attempts
Severity: Critical
Indicators: Union select, drop table, SQL keywords
6. Anomalous Activity
Pattern: Suspicious IP addresses
Severity: Medium
Indicators: Unusual source IPs
Custom Patterns
Add organization-specific patterns:
use ;
use Regex;
let mut detector = new;
detector.add_pattern;
Alert Management
Filter by Severity
let critical_alerts = detector.filter_by_severity;
for alert in critical_alerts
Export to SIEM
for alert in alerts
Threat Categories
- BruteForce - Authentication attacks
- MalwareDetection - Malicious software
- DataExfiltration - Data theft attempts
- UnauthorizedAccess - Privilege violations
- AnomalousActivity - Unusual patterns
- PolicyViolation - Policy breaches
- SystemCompromise - System integrity issues
Security Features
Memory Safety
Traditional C/C++ SIEM tools are vulnerable to:
- Buffer overflows in log parsing
- Use-after-free in pattern matching
- Memory leaks in long-running processes
This implementation eliminates these vulnerabilities through Rust's ownership system.
Performance
- Fast pattern matching - Regex compilation optimized
- Low memory overhead - Efficient string handling
- Scalable - Handles high log volumes
- Real-time - Sub-millisecond analysis
Examples
See the examples/ directory:
Testing
Integration with SIEM Platforms
The threat detector provides native support for all major SIEM platforms through multiple export formats:
ArcSight / Micro Focus (CEF)
use ;
let exporter = new_default;
let cef_output = exporter.export;
// Output: CEF:0|GuardsArm|RustThreatDetector|1.0|BruteForce|...
// Send to ArcSight SmartConnector via syslog
send_via_syslog;
IBM QRadar (LEEF)
let leef_output = exporter.export;
// Output: LEEF:2.0|GuardsArm|RustThreatDetector|1.0|BruteForce|...
// Send to QRadar Event Collector
send_to_qradar;
Splunk / Elastic (JSON)
let json_output = exporter.export;
// Send to Splunk HTTP Event Collector
post_to_splunk_hec;
// Or index in Elasticsearch
index_in_elasticsearch;
Universal Syslog (RFC 5424)
let syslog_output = exporter.export;
// Compatible with any syslog receiver
send_via_syslog;
Batch Export to CSV
use BatchExporter;
let batch_exporter = new;
batch_exporter.export_to_file?;
// Generate reports for analysis or compliance
Alignment with Standards
This detector implements requirements from:
- NIST SP 800-92 - Guide to Computer Security Log Management
- NIST Cybersecurity Framework - Detect function
- MITRE ATT&CK - Threat detection patterns
- CIS Controls - Security monitoring
- CISA/FBI Guidance (2024) - Memory-safe security tools
Use in Financial Systems
Designed for:
- Commercial Banks - Transaction fraud detection
- Payment Processors - Real-time monitoring
- Forex Brokers - Trading anomaly detection
- Fintech Platforms - Security operations
- Regulatory Compliance - Audit log analysis
Performance Benchmarks
Core Detection
- Log processing: 10,000+ logs/second
- Pattern matching: Sub-millisecond per log
- Memory usage: <50MB for typical workload
- Scalability: Horizontal scaling support
Advanced Features
- UEBA profiling: 5,000+ user profiles with <100MB memory
- IOC matching: O(1) lookup with HashSet implementation
- Anomaly detection: Real-time statistical analysis (<1ms per metric)
- SIEM export: 1,000+ alerts/second across all formats
Memory Safety Advantage
Traditional C/C++ SIEM components commonly suffer from:
- Buffer overflows in log parsing
- Use-after-free in pattern matching engines
- Memory leaks in long-running detection processes
This Rust implementation eliminates these vulnerability classes entirely through compile-time memory safety guarantees, while maintaining comparable or superior performance.
License
MIT License - See LICENSE file
Author
Tony Chuks Awunor
- M.S. Computer Science (CGPA: 4.52/5.00)
- EC-Council Certified Ethical Hacker v13 AI (CEH v13 AI)
- EC-Council Certified SOC Analyst (CSA)
- Specialization: Memory-safe cryptographic systems and financial security infrastructure
- Research interests: Rust security implementations, threat detection, and vulnerability assessment
- Published crates: rust-crypto-utils, rust-secure-logger, rust-threat-detector, rust-transaction-validator, rust-network-scanner, rust-memory-safety-examples
Contributing
Contributions welcome! Please open an issue or pull request with:
- New threat detection patterns
- Performance improvements
- SIEM integrations
Related Projects
- rust-secure-logger - Secure logging for audit trails
- rust-network-scanner - Network security scanning
- rust-crypto-utils - Cryptographic utilities
Citation
If you use this detector in research or production systems, please cite:
Awunor, T.C. (2024). Rust Threat Detector: Memory-Safe SIEM Threat Detection.
https://github.com/guardsarm/rust-threat-detector
Built for security operations. Designed for memory safety. Implemented in Rust.