Writing suricata and snort rules

From meltedinhex/analyst-ai-pack · View interactive version

Writing suricata and snort rules is an AI agent skill from the GitHub repository meltedinhex/analyst-ai-pack. Writes and validates Suricata/Snort IDS rules for network-based malware detection, covering rule anatomy, content/pcre matching, flow and threshold options, and common mistakes that cause false positives or no matches. Activates for requests to write a Suricata rule, create Snort signatures, or buil

How to use this skill

Skill file

Writing Suricata and Snort Rules

When to Use

observed network indicators.

non-matching.

Do not use broad content matches on common substrings that will flood alerts — anchor with

flow direction, ports, offsets, and uniqueness. This skill builds and lints rules; deploy them

through your IDS change process.

Prerequisites

(Suricata or Snort).

Workflow

Step 1: Draft the rule

Choose action, protocol, addresses/ports, direction, and a unique msg, sid, and rev. Add

content/pcre matches anchored with http.uri, tls.sni, flow:established,to_server, and

offsets/depths.

Step 2: Lint the rule

python scripts/analyst.py lint rules.rules

Checks for required fields (msg, sid, rev, classtype), balanced quotes/parentheses,

non-anchored overly short content, and duplicate SIDs.

Step 3: Tune to reduce noise

Add threshold/detection_filter, flowbits, and specific buffers (http.host, dns.query)

to scope matches.

Step 4: Document and stage

Record what each rule detects and stage it for testing against a pcap before production.

Validation

Pitfalls

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.