Sigma Rules
Tamandua EDR uses Sigma rules for behavioral detection based on log and event analysis. Sigma is a generic signature format for log events, enabling cross-platform detection that works across Windows, Linux, and macOS endpoints.
Built-in Rule Sets
Tamandua ships with 100+ Sigma rules organized by MITRE ATT&CK tactic:
| Category | Description | Rules | Key Techniques |
|---|
execution/ | Suspicious process execution | 20+ | T1059, T1047, T1218 |
persistence/ | Persistence mechanisms | 25+ | T1547, T1053, T1543 |
credential_access/ | Credential theft | 15+ | T1003, T1555, T1558 |
lateral_movement/ | Network lateral movement | 15+ | T1021, T1550, T1570 |
defense_evasion/ | Evasion techniques | 20+ | T1070, T1562, T1036 |
discovery/ | System/network discovery | 10+ | T1087, T1082, T1016 |
collection/ | Data collection | 5+ | T1560, T1113, T1115 |
exfiltration/ | Data exfiltration | 5+ | T1048, T1567 |
command_and_control/ | C2 communication | 10+ | T1071, T1572, T1090 |
impact/ | System impact | 10+ | T1486, T1485, T1490 |
ai_runtime/ | AI/LLM threat detection | 5+ | Prompt injection, MCP abuse |
serverless/ | Cloud/serverless threats | 5+ | Crypto mining, reverse shells |
Example Rules
PowerShell Download Cradle
title: Suspicious PowerShell Download Cradle
id: a0c3d5e2-6789-0abc-def1-234567890123
status: experimental
description: Detects PowerShell download and execute patterns
author: Tamandua Security Team
date: 2024/01/15
references:
- https://attack.mitre.org/techniques/T1059/001/
logsource:
category: process_creation
product: windows
detection:
selection_powershell:
Image|endswith:
- '\powershell.exe'
- '\pwsh.exe'
selection_download:
CommandLine|contains:
- 'IEX'
- 'Invoke-Expression'
- 'DownloadString'
- 'DownloadFile'
- 'Net.WebClient'
- 'Invoke-WebRequest'
- 'Invoke-RestMethod'
- 'Start-BitsTransfer'
selection_flags:
CommandLine|contains:
- '-enc'
- '-encodedcommand'
- '-nop'
- '-noprofile'
- '-w hidden'
- '-windowstyle hidden'
- '-exec bypass'
- '-executionpolicy bypass'
condition: selection_powershell and (selection_download or selection_flags)
falsepositives:
- Legitimate administrative scripts
level: high
tags:
- attack.execution
- attack.t1059.001
LSASS Memory Access
title: LSASS Memory Access via Process
id: b1d4e6f3-789a-1bcd-ef01-345678901234
status: stable
description: Detects suspicious access to LSASS memory
author: Tamandua Security Team
logsource:
category: process_access
product: windows
detection:
selection:
TargetImage|endswith: '\lsass.exe'
GrantedAccess|contains:
- '0x1010' # PROCESS_QUERY_LIMITED_INFORMATION + PROCESS_VM_READ
- '0x1410' # PROCESS_QUERY_INFORMATION + PROCESS_VM_READ
- '0x1fffff' # PROCESS_ALL_ACCESS
filter_legitimate:
SourceImage|endswith:
- '\wmiprvse.exe'
- '\taskmgr.exe'
- '\procexp64.exe'
- '\MsMpEng.exe'
condition: selection and not filter_legitimate
level: critical
tags:
- attack.credential_access
- attack.t1003.001
Scheduled Task Persistence
title: Scheduled Task Creation for Persistence
id: c2e5f7a4-89ab-2cde-f012-456789012345
status: stable
description: Detects creation of scheduled tasks commonly used for persistence
author: Tamandua Security Team
logsource:
category: process_creation
product: windows
detection:
selection_schtasks:
Image|endswith: '\schtasks.exe'
CommandLine|contains: '/create'
selection_suspicious:
CommandLine|contains:
- '/sc onlogon'
- '/sc onstart'
- '/sc onidle'
- 'powershell'
- 'cmd.exe /c'
- 'mshta'
- 'wscript'
- 'cscript'
condition: selection_schtasks and selection_suspicious
level: high
tags:
- attack.persistence
- attack.t1053.005
Supported Modifiers
Tamandua's Sigma parser supports 15+ field modifiers:
String Modifiers
| Modifier | Description | Example |
|---|
contains | Substring match | CommandLine\|contains: 'cmd' |
startswith | Prefix match | Image\|startswith: 'C:\Temp' |
endswith | Suffix match | Image\|endswith: '.exe' |
re | Regular expression | CommandLine\|re: 'pass.*word' |
cidr | IP CIDR match | DestinationIp\|cidr: '10.0.0.0/8' |
Encoding Modifiers
| Modifier | Description | Example |
|---|
base64 | Base64 encoded | CommandLine\|base64contains: 'eval' |
base64offset | Base64 with offset | CommandLine\|base64offset\|contains: 'cmd' |
wide | UTF-16 encoding | CommandLine\|wide\|contains: 'password' |
utf16le | UTF-16LE encoding | Data\|utf16le\|contains: 'secret' |
utf16be | UTF-16BE encoding | Data\|utf16be\|contains: 'secret' |
Comparison Modifiers
| Modifier | Description | Example |
|---|
gt | Greater than | FileSize\|gt: 1000000 |
gte | Greater than or equal | EventID\|gte: 4624 |
lt | Less than | ProcessId\|lt: 100 |
lte | Less than or equal | Count\|lte: 5 |
Boolean Modifiers
| Modifier | Description | Example |
|---|
all | All values must match | Tags\|all: ['admin', 'sensitive'] |
exists | Field must exist | ParentImage\|exists: true |
Condition Syntax
Basic Operators
# AND
condition: selection1 and selection2
# OR
condition: selection1 or selection2
# NOT
condition: selection and not filter
# Parentheses
condition: (selection1 or selection2) and not filter
Quantifiers
# Any of (OR across selections)
condition: 1 of selection_*
# All of (AND across selections)
condition: all of selection_*
# N of them
condition: 2 of them
# N of specific
condition: 3 of (selection_a*, selection_b*)
Count Aggregations
detection:
selection:
EventType: login_failure
timeframe: 5m
condition: selection | count(SourceIP) > 10
# Supported aggregations:
# count(), count(field)
# sum(field), avg(field)
# min(field), max(field)
Logsource Categories
Windows
| Category | Description | Event IDs |
|---|
process_creation | Process start events | Sysmon 1, Security 4688 |
process_access | Process memory access | Sysmon 10 |
process_termination | Process end events | Sysmon 5 |
file_event | File operations | Sysmon 11 |
file_delete | File deletions | Sysmon 23, 26 |
registry_event | Registry modifications | Sysmon 12, 13, 14 |
network_connection | Network connections | Sysmon 3 |
dns_query | DNS lookups | Sysmon 22 |
image_load | DLL/module loads | Sysmon 7 |
driver_load | Driver loads | Sysmon 6 |
create_remote_thread | Remote thread creation | Sysmon 8 |
pipe_created | Named pipe creation | Sysmon 17 |
wmi_event | WMI activity | Sysmon 19, 20, 21 |
Linux
| Category | Description | Source |
|---|
process_creation | Process execution | auditd, execve |
file_event | File operations | auditd, fanotify |
network_connection | Socket operations | auditd, netfilter |
authentication | Login events | PAM, auth logs |
macOS
| Category | Description | Source |
|---|
process_creation | Process execution | ESF, audit |
file_event | File operations | ESF |
network_connection | Network activity | ESF |
Custom Rule Creation
Via API
# Create a custom Sigma rule
curl -X POST "https://api.tamandua.io/v1/rules/sigma" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/x-yaml" \
-d @custom_rule.yml
Response:
{
"id": "sigma_custom_12345",
"title": "Custom Detection Rule",
"status": "active",
"validation": {
"syntax_valid": true,
"logsource_supported": true,
"modifiers_valid": true
}
}
Via Dashboard
- Navigate to Detection > Rules > Sigma
- Click Add Custom Rule
- Enter rule in YAML format
- Click Validate to check syntax
- Click Test to run against sample events
- Click Deploy to activate
Via CLI
# Add custom rule
tamanduactl rules sigma add custom_rule.yml
# Validate rule syntax
tamanduactl rules sigma validate custom_rule.yml
# Test against events
tamanduactl rules sigma test custom_rule.yml --events events.json
Rule Conversion
SigmaHQ Integration
Tamandua supports importing rules from the SigmaHQ repository:
# Import from SigmaHQ
tamanduactl rules sigma import --source sigmahq \
--category windows/process_creation
# Sync with SigmaHQ
tamanduactl rules sigma sync-sigmahq
Conversion from Other Formats
# Convert from Splunk
tamanduactl rules sigma convert --from splunk \
--input splunk_query.spl \
--output sigma_rule.yml
# Convert from Elastic
tamanduactl rules sigma convert --from elastic \
--input elastic_rule.json \
--output sigma_rule.yml
Aggregations and Timeframes
Timeframe-based Detection
title: Brute Force Detection
detection:
selection:
EventID: 4625
LogonType: 2
timeframe: 10m
condition: selection | count(TargetUserName) > 5
level: high
tags:
- attack.credential_access
- attack.t1110
Supported Aggregations
| Aggregation | Description | Example |
|---|
count() | Count events | count() > 10 |
count(field) | Count unique values | count(SourceIP) > 5 |
sum(field) | Sum numeric field | sum(BytesTransferred) > 1000000 |
avg(field) | Average value | avg(Duration) > 300 |
min(field) | Minimum value | min(ProcessId) < 100 |
max(field) | Maximum value | max(FileSize) > 10000000 |
Timeframe Syntax
| Format | Description |
|---|
5s | 5 seconds |
10m | 10 minutes |
1h | 1 hour |
24h | 24 hours |
7d | 7 days |
Rule Management
Listing Rules
# List all Sigma rules
tamanduactl rules sigma list
# Filter by tactic
tamanduactl rules sigma list --tactic persistence
# Filter by severity
tamanduactl rules sigma list --level critical
Enabling/Disabling
# Disable a rule
tamanduactl rules sigma disable sigma_rule_id
# Enable a rule
tamanduactl rules sigma enable sigma_rule_id
# Disable by tactic
tamanduactl rules sigma disable --tactic discovery
Rule Updates
# Check for updates
tamanduactl rules sigma check-updates
# Update all rules
tamanduactl rules sigma update
# View changelog
tamanduactl rules sigma changelog
Performance Tuning
Rule Performance Levels
| Level | Description | Recommendation |
|---|
| Low | Simple field matches | Enable everywhere |
| Medium | Multiple conditions, modifiers | Enable on servers |
| High | Aggregations, timeframes | Enable selectively |
| Very High | Complex regex, large timeframes | Review necessity |
Optimization Tips
- Use specific logsources
# Good - specific
logsource:
category: process_creation
product: windows
# Bad - generic
logsource:
category: generic
- Avoid excessive wildcards
# Good
CommandLine|contains: 'powershell.exe -enc'
# Bad
CommandLine|re: '.*powershell.*'
- Use appropriate timeframes
# For brute force: 5-10 minutes
timeframe: 10m
# For data exfil: 1 hour
timeframe: 1h
API Reference
List Rules
GET /api/v1/rules/sigma
# Response
{
"rules": [
{
"id": "sigma_001",
"title": "PowerShell Download Cradle",
"level": "high",
"status": "stable",
"enabled": true
}
],
"total": 100
}
Get Rule Details
GET /api/v1/rules/sigma/{id}
# Response
{
"id": "sigma_001",
"title": "PowerShell Download Cradle",
"content": "title: Suspicious PowerShell...",
"stats": {
"total_matches": 250,
"last_match": "2025-01-15T14:30:00Z",
"false_positives": 5
}
}
Create Rule
POST /api/v1/rules/sigma
Content-Type: application/x-yaml
title: Custom Rule
...
# Response
{
"id": "sigma_custom_123",
"status": "active"
}
Test Rule
POST /api/v1/rules/sigma/test
Content-Type: application/json
{
"rule": "title: Test Rule...",
"events": [
{"Image": "powershell.exe", "CommandLine": "IEX..."}
]
}
# Response
{
"matches": [
{"event_index": 0, "matched_selections": ["selection_powershell", "selection_download"]}
]
}
Related Documentation