This guide provides a comprehensive reference for developers creating correlation rules to detect security threats in UTMStack v11. Rules are YAML files used by the analysis plugin to generate alerts when specific conditions are met.Documentation Index
Fetch the complete documentation index at: https://docs.insecureweb.com/llms.txt
Use this file to discover all available pages before exploring further.
Developer Reference: This page is designed as a practical guide for implementing security detection logic through correlation rules.
What are Correlation Rules?
Correlation rules define how to analyze events to detect security threats. When an event matches a rule’s conditions, an alert is generated.Key Capabilities
- Real-time threat detection based on event patterns
- Multi-event correlation across time windows
- Complex conditional logic using CEL expressions
- Alert deduplication to prevent fatigue
- Threat intelligence integration
Rule Structure
A complete rule consists of several components:Rule Fields Reference
Basic Metadata
id
id
Type: Integer
Required: YesUnique identifier for the rule across the entire system.
Required: YesUnique identifier for the rule across the entire system.
dataTypes
dataTypes
Type: Array of strings
Required: YesSpecifies which event types this rule applies to. Rule only evaluates events with matching data types.Common data types:
Required: YesSpecifies which event types this rule applies to. Rule only evaluates events with matching data types.
windows,linux,macos- OS logsapache,nginx,iis- Web server logscisco,fortigate,paloalto- Network device logsaws,azure,gcp- Cloud provider logs
name
name
Type: String
Required: YesHuman-readable name for the rule. Displayed in alerts and UI.
Required: YesHuman-readable name for the rule. Displayed in alerts and UI.
description
description
Type: String
Required: YesDetailed description explaining what the rule detects and why it’s important.
Required: YesDetailed description explaining what the rule detects and why it’s important.
Threat Classification
impact
impact
Type: Object
Required: YesDefines the potential impact of the detected threat on CIA triad (0-5 scale).Scoring Guide:
Required: YesDefines the potential impact of the detected threat on CIA triad (0-5 scale).
- 0: No impact
- 1-2: Low impact
- 3: Medium impact
- 4: High impact
- 5: Critical impact
category
category
Type: String
Required: YesClassification category for the threat.Common categories:
Required: YesClassification category for the threat.
- Authentication, Authorization
- Network Attack, Web Attack
- Malware, Ransomware
- Data Exfiltration
- Insider Threat
- Policy Violation
technique
technique
Type: String
Required: YesSpecific technique used by the threat (often mapped to MITRE ATT&CK).
Required: YesSpecific technique used by the threat (often mapped to MITRE ATT&CK).
adversary
adversary
Type: String
Required: Yes
Values:
Required: Yes
Values:
origin or targetIdentifies which side is considered the adversary.references
references
Type: Array of strings
Required: NoExternal references for more information (MITRE ATT&CK, CVEs, articles).
Required: NoExternal references for more information (MITRE ATT&CK, CVEs, articles).
Conditional Logic: The where Field
The where field defines the main condition using Common Expression Language (CEL).
Basic Syntax
Supported Operators
- Comparison
- Logical
- String Operations
- Field Checks
Complex Expression Examples
Event Correlation: The afterEvents Field
The afterEvents field enables multi-event correlation by searching for additional events within specified time windows.
Basic Structure
Search Operators
filter_term
Exact match using term search (keyword fields)Best for: IPs, usernames, exact strings
filter_match
Full-text match using text searchBest for: Messages, descriptions, analyzed text
must_not_term
Not equal using term searchBest for: Excluding specific values
must_not_match
Not matching using text searchBest for: Excluding text patterns
Dynamic Values
Use{{field.path}} syntax to reference values from the triggering event:
Time Windows
Time windows use Elasticsearch date math syntax:Multiple Searches
Correlate across different indices:Nested OR Logic
Useor field for alternative correlation paths:
Count Limit: Maximum
count value is 50 to prevent performance issues.Alert Deduplication
UsededuplicateBy to prevent duplicate alerts for the same threat:
How It Works
- Alert is generated based on rule conditions
- System creates a hash from specified fields
- If hash matches recent alert (within deduplication window), new alert is suppressed
- Otherwise, alert is created
Best Practices
- Include fields that uniquely identify the threat
- Balance between deduplication and alert visibility
- Common fields: IPs, usernames, hostnames, attack types
- Avoid time-based fields that change frequently
Rule Evaluation Process
Real-World Examples
Example 1: Brute Force Detection
Example 2: Data Exfiltration
Example 3: Lateral Movement
Example 4: Suspicious Time Activity
Development Workflow
Identify Threat
Determine what security threat you want to detect
- Review security requirements
- Analyze threat intelligence
- Consider MITRE ATT&CK framework
Write Where Condition
Create CEL expression to identify suspicious events
- Start simple, refine iteratively
- Test expressions with sample data
- Handle missing fields with
safe()andhas()
Add Correlation Logic
Define
afterEvents if multi-event correlation needed- Choose appropriate index patterns
- Set reasonable time windows
- Use dynamic values for correlation
Test Rule
Deploy to development environment and test
- Use test events that should trigger
- Use test events that should NOT trigger
- Verify alert content and format
Refine and Optimize
Adjust based on testing results
- Tune thresholds
- Optimize performance
- Reduce false positives
Best Practices
Rule Design
Start Simple
- Begin with basic conditions
- Add complexity incrementally
- Test each addition
- Target specific data types
- Use precise field matches
- Avoid overly broad conditions
- Always use
has()orsafe()for optional fields - Provide sensible defaults
- Test with incomplete events
- Limit data type scope
- Use efficient operators
- Minimize afterEvents searches
- Set reasonable time windows
- Test with diverse datasets
- Include normal activity patterns
- Use whitelisting where appropriate
- Refine based on feedback
Documentation
- Write clear, detailed descriptions
- Include relevant references (MITRE ATT&CK, CVEs)
- Document expected event formats
- Explain complex logic
- Note any limitations or caveats
Testing
- Test with real production data samples
- Test edge cases and missing fields
- Verify deduplication works correctly
- Monitor performance impact
- Conduct regular reviews and updates
Troubleshooting
Common Issues
Rule Not Triggering
Rule Not Triggering
Possible Causes:
- Event doesn’t match
dataTypes wherecondition evaluates to falseafterEventscount not met- Field names don’t match event structure
- Verify event has correct
dataTypefield - Test
whereexpression with sample data - Check field names match exactly (case-sensitive)
- Review
afterEventssearch results - Check for typos in field names
Too Many False Positives
Too Many False Positives
Possible Causes:
- Condition too broad
- Normal activity matches pattern
- Missing exclusions
- Add more specific conditions
- Include whitelist of known-good patterns
- Increase thresholds (counts, time windows)
- Add additional correlation requirements
Performance Issues
Performance Issues
Possible Causes:
- Complex expressions
- Large time windows in
afterEvents - Too many correlation searches
- Simplify expressions
- Reduce time window durations
- Limit number of
afterEventssearches - Narrow
indexPatternscope - Add more specific
dataTypes
Missing Field Errors
Missing Field Errors
Possible Causes:
- Field doesn’t exist in all events
- Field name typo
- Data type mismatch
- Use
has()to check field existence - Use
safe()with defaults - Verify field names against events
- Check field types match expected