Overview
Chronos-DFIR integrates a powerful Sigma detection engine that translates YAML-based Sigma rules into optimized Polars LazyFrame expressions for real-time threat detection during forensic analysis. The engine evaluates 86+ detection rules against ingested evidence, automatically flagging suspicious activity aligned with the MITRE ATT&CK framework.Sigma is an open-source generic signature format for SIEM systems and log analysis tools. Chronos-DFIR implements a custom Sigma-to-Polars compiler that enables offline, vectorized detection without external dependencies.
Engine Architecture
The Sigma engine (engine/sigma_engine.py) is a 575-line dynamic YAML-to-Polars compiler that provides:
Core Capabilities (v1.2)
- Field Modifiers:
contains,endswith,startswith,any,all,not,re(regex) - EventID Matching: Intelligent
is_inmatching with case-insensitive column lookup - Boolean Logic: AND/OR conditions between detection blocks with complex nesting
- Temporal Correlation:
timeframe+correlationblocks (event_count, group-by, threshold) - Custom Aggregation: Time window grouping with configurable thresholds
- Evidence Extraction: Returns
sample_evidence(150 rows),matched_columns,all_row_ids(500 IDs)
Field Resolution
The engine performs case-insensitive column matching with dot-notation fallback:Detection Workflow
Rule Categories and Coverage
Chronos-DFIR includes 86 Sigma rules organized into 5 categories:MITRE ATT&CK Tactics (51 rules)
MITRE ATT&CK Tactics (51 rules)
Covers all 12 MITRE tactics with technique-specific detections:
| Tactic | Code | Rules | Example Techniques |
|---|---|---|---|
| Initial Access | TA0001 | 2 | T1078 (Valid Accounts), T1190 (Exploit Public-Facing App) |
| Execution | TA0002 | 5 | T1059.001 (PowerShell), T1047 (WMI), T1204 (User Execution) |
| Persistence | TA0003 | 7 | T1547 (Boot/Logon), T1053 (Scheduled Task), T1543 (Service Creation) |
| Privilege Escalation | TA0004 | 4 | T1548.002 (Bypass UAC), T1068 (Exploit Vuln) |
| Defense Evasion | TA0005 | 8 | T1070.003 (Clear Logs), T1562 (Impair Defenses), T1027 (Obfuscation) |
| Credential Access | TA0006 | 4 | T1003 (Credential Dumping), T1552 (Unsecured Credentials) |
| Discovery | TA0007 | 5 | T1057 (Process Discovery), T1083 (File/Directory Discovery) |
| Lateral Movement | TA0008 | 3 | T1021.002 (SMB/Admin Shares), T1021.001 (RDP) |
| Collection | TA0009 | 2 | T1560 (Archive via Utility), T1074 (Data Staged) |
| Exfiltration | TA0010 | 3 | T1048 (Exfil via Alternative Protocol), T1567 (Cloud Storage) |
| Command & Control | TA0011 | 4 | T1071 (Application Layer Protocol), T1572 (Protocol Tunneling) |
| Impact | TA0040 | 4 | T1486 (Data Encrypted), T1490 (Inhibit System Recovery) |
Forensic Artifacts (12 rules)
Forensic Artifacts (12 rules)
Detection rules for Windows forensic artifact analysis:
- Prefetch: Suspicious execution evidence in
C:\Windows\Prefetch\*.pf - ShimCache: Application Compatibility Cache anomalies
- AmCache: Unauthorized program installation indicators
- UserAssist: GUID-encoded user activity forensics
- SRUM: System Resource Usage Monitor abuse (network, CPU spikes)
- LNK/JumpLists: Lateral movement via Jump List artifacts
- ShellBags: Folder access patterns indicating reconnaissance
- MRU: Most Recently Used registry keys with suspicious paths
- Recycle Bin: Anti-forensics (file deletion before encryption)
Linux Detection (10 rules)
Linux Detection (10 rules)
Coverage for Linux/Unix forensic artifacts:
- Reverse Shells: Bash/Python/Netcat C2 connections
- SSH Brute Force: auth.log failed authentication analysis
- Sudo Abuse: Privilege escalation via misconfigured sudoers
- Systemd Persistence: Malicious
.servicefiles - Cron Manipulation: Backdoors via scheduled tasks
- Auditd Events: Kernel-level security event anomalies
- Container Escape: Docker/K8s breakout indicators
macOS Detection (5 rules)
macOS Detection (5 rules)
macOS-specific threat hunting rules:
- TCC Bypass: Transparency, Consent, Control database manipulation
- Gatekeeper Bypass: Unsigned application execution
- XProtect Evasion: Anti-malware bypass techniques
- Authorization Plugins: Persistence via authorization database
- Unified Log Suspicious Shells: macOS Unified Log shell execution
Browser Forensics (8 rules)
Browser Forensics (8 rules)
Web browser artifact analysis:
- History Manipulation: Cleared or tampered browsing history
- Cookie Theft: Session hijacking indicators
- Cache Forensics: Unusual cached resources (malware downloads)
- Extension Abuse: Malicious browser extensions
Example Sigma Rules
Rule 1: Anomalous Windows Logon Patterns (T1078)
Detection Logic: Service accounts should NEVER authenticate interactively (Type 2/10). LogonType 8 sends passwords in cleartext—both patterns indicate credential compromise.
Rule 2: PowerShell Encoded Command (T1059.001)
Rule 3: Prefetch Execution Evidence
Rule Syntax and Structure
YAML Schema
Every Sigma rule follows this structure:Supported Field Modifiers
| Modifier | Description | Example | |
|---|---|---|---|
contains | Substring match | `CommandLine | contains: ‘mimikatz’` |
startswith | Prefix match | `Image | startswith: ‘C:\Temp\‘` |
endswith | Suffix match | `Image | endswith: ‘\powershell.exe’` |
re | Regex pattern | `CommandLine | re: ’.-Enc.-Nop.*‘` |
any | Match any value in list | `EventID | any: [‘4624’, ‘4625’]` |
all | Match all values in list | `Tags | all: [‘admin’, ‘suspicious’]` |
not | Negation | `User | not: ‘SYSTEM’` |
Condition Logic
Chronos supports complex boolean expressions:How Rules Are Evaluated
Step 1: Rule Loading
At startup,load_sigma_rules() walks rules/sigma/ recursively:
Rules are cached in memory after first load for performance. Force reload with
load_sigma_rules(force_reload=True).Step 2: Expression Building
Each detection block is compiled to a Polars expression:Step 3: DataFrame Filtering
The compiled expression filters the forensic DataFrame:Step 4: Evidence Extraction
For each hit, the engine extracts forensic context:Temporal Correlation
Chronos supports time-windowed aggregation for behavioral detections:Integration with Forensic Analysis
Sigma hits feed directly into Chronos-DFIR’s risk scoring and dashboard:1. Risk Score Calculation
2. Dashboard TTPs
Sigma tags are parsed for MITRE technique badges:3. Forensic Modal Evidence
Each Sigma hit is clickable in the Forensic Context modal:Performance Optimization
Vectorized Operations
All Sigma evaluations use Polars vectorized expressions—no Python loops:Lazy Evaluation
Rules are evaluated in a single pass per DataFrame load—results cached for exports.Column Pruning
Only detection-relevant columns are cast toUtf8 for string matching:
Forensic Integrity Guarantees
Non-Destructive Analysis: Sigma evaluation operates on read-only DataFrames. Original evidence metadata (timestamps, hex values, SIDs) is never mutated.
- Evidence Preservation:
sample_evidenceincludes_idcolumn for precise row linking - Audit Trail: All hits include
rule_pathfor reproducibility - Offline Operation: Zero external API calls—100% local YAML files
Creating Custom Sigma Rules
Template for New Rule
Testing New Rules
Related Detection Systems
YARA Rules
Binary pattern matching for malware/ransomware detection
MITRE ATT&CK
TTP mapping and kill chain visualization
Roadmap
Current (v1.2): 86 rules, basic temporal correlation, evidence extraction Upcoming (v2.0):- Full
timeframe+count > Nsupport for brute-force/beaconing detection nearoperator for proximity searches in command-line argumentsbase64offsetmodifier for encoded payload detectioncidrmodifier for IP range matching- Cross-file correlation (multi-artifact Sigma chains)
References
- Sigma Official Specification
- MITRE ATT&CK Framework
- Chainsaw (Sigma for DFIR)
- Engine Source:
engine/sigma_engine.py(575 lines)