An advanced Python-based rootkit detection and analysis system designed to identify kernel-level threats and suspicious system behavior on Linux and Unix-like systems.
- Rootkit Signature Detection: Pattern-based detection of known rootkit families
- System Call Monitoring: Tracks anomalous system call patterns
- Kernel Module Analysis: Examines loaded kernel modules for suspicious behavior
- Process Inspection: Deep analysis of running processes and their system interactions
- File System Integrity: Monitors for unauthorized file modifications
- Network Connection Tracking: Detects suspicious network activities
- Real-time Alerts: Immediate notification of detected threats
- Detailed Reporting: Comprehensive analysis reports with remediation suggestions
- Python: 3.8 or higher
- OS: Linux or Unix-like system with root/sudo access
- Dependencies: See
requirements.txt
git clone https://github.com/M-Inc-lab/RootkitDetector.git
cd RootkitDetectorpython3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txt# For system-level monitoring, root/sudo access is required
sudo chmod +x rootkit_detector.pysudo python rootkit_detector.py --scan fullsudo python rootkit_detector.py --scan quicksudo python rootkit_detector.py --scan deep --verbosesudo python rootkit_detector.py --monitor --interval 5sudo python rootkit_detector.py --scan full --report /path/to/report.htmlsudo python rootkit_detector.py --check-process <PID>sudo python rootkit_detector.py --modulesRootkitDetector/
βββ rootkit_detector.py # Main entry point
βββ detector/
β βββ __init__.py
β βββ signature_engine.py # Signature-based detection
β βββ syscall_monitor.py # System call analysis
β βββ kernel_module_analyzer.py # Kernel module inspection
β βββ process_analyzer.py # Process analysis engine
β βββ filesystem_monitor.py # File system integrity
β βββ network_analyzer.py # Network connection tracking
βββ signatures/
β βββ rootkit_signatures.db # Known rootkit patterns
β βββ suspicious_syscalls.db # Suspicious system call patterns
β βββ malware_signatures.db # Malware indicators
βββ utils/
β βββ __init__.py
β βββ logger.py # Logging utilities
β βββ config.py # Configuration management
β βββ report_generator.py # Report generation
β βββ remediation.py # Remediation suggestions
βββ tests/
β βββ test_detector.py
β βββ test_signatures.py
β βββ test_analyzers.py
βββ requirements.txt # Python dependencies
βββ config.yaml # Configuration file
βββ README.md
detection:
enable_signatures: true
enable_syscall_monitoring: true
enable_kernel_analysis: true
enable_process_analysis: true
enable_filesystem_monitoring: true
enable_network_tracking: true
alerts:
alert_level: HIGH
send_notifications: true
log_to_file: true
log_path: /var/log/rootkit_detector.log
monitoring:
interval: 300 # seconds
sample_size: 100
retention_days: 30- Compares system artifacts against known rootkit signatures
- Database of known rootkit families and variants
- Regular signature updates
- Monitors anomalous system call patterns
- Analyzes process creation and termination
- Detects privilege escalation attempts
- Scans loaded kernel modules
- Detects hidden modules
- Analyzes module permissions and origins
- Deep inspection of process memory
- Checks for code injection
- Validates process integrity
- Monitors critical system directories
- Detects unauthorized modifications
- Maintains file integrity checksums
- Monitors suspicious network connections
- Detects command & control (C2) communications
- Identifies data exfiltration attempts
| Threat Type | Detection Rate | Method |
|---|---|---|
| Known Rootkits | ~95% | Signature + Behavior |
| Kernel-Level Malware | ~85% | Syscall + Module Analysis |
| Privilege Escalation | ~90% | Process Analysis |
| File Tampering | ~98% | Filesystem Integrity |
| Network Anomalies | ~80% | Network Analysis |
sudo python -m pytest tests/ -vsudo python -m pytest tests/test_detector.py -vsudo python -m pytest tests/ --cov=detector --cov-report=htmlββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RootkitDetector - Full System Scan β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
[*] Scanning system for rootkit indicators...
[+] Signature Detection: Checking against 2,543 signatures...
β No known rootkits detected
[+] Kernel Module Analysis: Scanning 156 loaded modules...
β WARNING: Suspicious module detected: 'netfilter_extra'
ββ Unsigned module
ββ Unusual memory location
ββ Requires investigation
[+] System Call Monitoring: Analyzing syscall patterns...
β Normal syscall behavior detected
[+] Process Analysis: Inspecting 324 running processes...
β WARNING: Process 'sshd' has unusual memory maps
ββ Possible code injection detected
[+] File System Integrity: Monitoring critical directories...
β No unauthorized modifications
[+] Network Analysis: Checking connections...
β WARNING: Unusual outbound connection detected
ββ Process: chrome (PID: 4521)
ββ Destination: 192.168.1.105:8080
ββ Status: Connection established
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
SUMMARY:
Threats Found: 3 (1 High, 2 Medium, 0 Low)
Clean: β 85%
Suspicious: β 15%
Detailed report saved to: /tmp/rootkit_scan_2024-06-16.html
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Requires Root Access: Most detection features require elevated privileges
- System Impact: Deep scans may temporarily increase CPU/disk usage
- False Positives: Some legitimate applications may trigger alerts
- Regular Updates: Keep signature database updated for best detection
- Backup First: Test in controlled environment before production use
- Run Regularly: Schedule scans via cron for continuous monitoring
- Keep Updated: Download latest signatures weekly
- Isolate Findings: Quarantine suspicious processes
- Review Logs: Analyze reports and logs regularly
- Verify Changes: Manually verify remediation actions
sudo python rootkit_detector.py --update-signaturesIf a rootkit is detected:
- Isolate System: Disconnect from network
- Preserve Evidence: Copy logs and reports
- Generate Report:
--reportflag for documentation - Professional Help: Contact security team
- Remediation: Follow suggested remediation steps
# Ensure running with sudo
sudo python rootkit_detector.py --scan full# Reinstall dependencies
pip install -r requirements.txt --force-reinstall# Adjust detection sensitivity
sudo python rootkit_detector.py --scan quick --sensitivity lowLogs are stored in:
- Console Output: Real-time feedback
- Log File:
/var/log/rootkit_detector.log - Report File: HTML reports in current directory
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
- Include test cases
- Additional rootkit signatures
- Improved detection algorithms
- New analysis modules
- Performance optimization
- Documentation improvements
This project is licensed under the MIT License - see LICENSE file for details.
For issues or questions:
- π§ Open a GitHub issue
- π Check Documentation
- π» Review existing issues
This tool is designed for authorized security research and system administration only. Users are responsible for:
- Obtaining proper authorization before scanning systems
- Complying with applicable laws and regulations
- Using the tool ethically and responsibly
- Respecting privacy and data protection
Built with inspiration from:
- Linux kernel security research
- SANS Institute rootkit analysis
- Open source security community
- Academic rootkit detection research
Protect your systems. Detect threats. Stay secure. π