
Suricata supports integration of external IOC lists for threat detection using datasets. IOCs like IPs, domains, and URLs must be properly formatted and referenced in rules. This enables real-time traffic analysis and alerting based on custom threat intelligence.
- Suricata Version: Ensure you are using Suricata version 7.0 or later, as the dataset feature was introduced in this version.
- Operating System: A Unix-like operating system (e.g., Linux) is recommended for optimal compatibility and performance.
- Dependencies: Install necessary tools such as jq for JSON parsing and base64 for encoding, which are commonly used in processing IOC feeds.
- Supported IOC Types: Suricata can handle various IOCs, including:
1.IP addresses (IPv4 and IPv6)
2.Domain names
3.URLs
4.File hashes (e.g., SHA256)
- Data Formatting:
1.String-based IOCs (e.g., domains) should be base64-encoded.
2.Hash-based IOCs should be in hexadecimal format.
- Rule Files: Custom Suricata rules must be created to utilize the datasets for matching against network traffic.
-
- Obtain your external IOC list in a structured format (e.g., JSON). We can still you .txt format but must ensure the content matches Suricata’s expected dataset structure
- Extract relevant IOCs using tools like jq. For example, to extract domains:
cat iocs_list.json | jq -c -r '.data[] | select(.ioc_type == "domain") | .ioc' >
domains.txt
-
- For string-based IOCs, encode each entry in base64:
while IFS= read -r line; do echo -n "$line" | base64; done < domains.txt >>
domains_iocs.list
-
- Move the encoded IOC list to Suricata's rules directory:
sudo cp domains_iocs.list /etc/suricata/rules/
sudo chown suricata:suricata /etc/suricata/rules/domains_iocs.list
-
- Write a custom rule to alert on matches from the dataset. For example:
alert http any any -> any any (msg:"Malicious Domain Detected"; http.host;
dataset:isset,malicious_domains; sid:1000001; rev:1;)
- This rule checks if the http.host field matches any entry in the malicious_domains dataset.
-
- Ensure the new rule file is included in suricata.yaml under the rule-files section:
rule-files: - custom.rules
-
datasets:
- name: malicious_domains
type: string
format: base64
file: /etc/suricata/rules/domains_iocs.list
-
- Apply the changes by restarting the Suricata service:
sudo systemctl restart suricata
-
Manual Updates: Suricata does not automatically fetch and update external IOC lists; this process must be managed manually or through custom automation scripts.
-
Performance Considerations: Large datasets may impact performance; it's essential to monitor resource usage and optimize rules and datasets accordingly.
-
Encoding Requirements: Incorrect encoding of IOCs can lead to ineffective detection; ensure proper formatting as per Suricata's requirements.