Suricata and Snort Rule Validator
Paste a local.rules file to find syntax errors, duplicate sids, impossible content modifiers and slow rules, read every rule in plain English, and fix sids and revisions in bulk.
Работи във вашия браузър. Файловете ви никога не напускат устройството. Вижте как да го проверите
…
Как се прави
- 1Choose the engine
Pick Suricata, Snort 3 or Snort 2.9 in the engine selector.
- 2Paste the rules
Paste a rules file or open a .rules file; continued lines are joined.
- 3Read the lint results
Filter by errors or warnings and read each issue under its rule.
- 4Explain a rule
Press Explain to read what the rule does in plain words.
- 5Fix in bulk
Add rev:1 where missing, renumber sids, raise a revision or disable a rule.
- 6Save
Save the edited file as .rules and export the lint report as CSV.
За този инструмент
Suricata and Snort rules pack a lot into one line: an action, a protocol, source and destination addresses and ports, a direction, then a parenthesised list of options where order matters. A missing semicolon, an unbalanced hex block in content, a depth shorter than the content it limits, or two rules sharing a sid can stop the engine from loading the file or leave a rule that never fires. This validator reads a whole rules file, joins lines continued with a backslash, and checks each rule for the selected engine: Suricata 7 and 8, Snort 3 or Snort 2.9. It validates the header parts, splits options correctly around quoted text and escapes, checks msg, sid, rev and classtype, content syntax and hex, content modifiers and their order, legacy HTTP modifiers versus sticky buffers, pcre syntax, flow keywords and contradictions, and performance problems such as rules with no content. Each rule can be explained in plain language, and bulk actions add missing revisions, renumber sids or disable a rule.
Header checks
The header must have seven parts: action, protocol, source address, source port, direction, destination address and destination port. Actions are checked per engine, for example rejectboth exists in Suricata and block in Snort 3. Protocols include the layer 4 names and, for Suricata and Snort 3, application-layer names such as http, tls, dns and smb; Snort 2 accepts only tcp, udp, icmp and ip. Addresses and ports may be any, a variable such as $HOME_NET, a negation, a list in brackets, a CIDR block or a port range. The direction must be -> or <>, and Suricata 8's transactional => is accepted for Suricata only.
Option checks
Options are split on semicolons that are not inside quotes or escaped. msg must be quoted, sid must be a positive integer and unique within the file (with gid), and rev should be present. content must be quoted, hex blocks between pipes must contain pairs of hexadecimal digits, and semicolons or quotes inside content must be escaped. nocase, depth, offset, distance, within, fast_pattern, startswith and endswith must follow a content, and a depth shorter than the content is reported as impossible. Suricata accepts the old http_uri style modifiers but prefers sticky buffers such as http.uri placed before the content, so those get a notice. flow options are checked against the allowed list and for contradictions such as to_server with to_client.
Performance and quality hints
A rule without a content or another cheap pre-filter is inspected against every packet in scope, so it gets a warning, as does a pcre without content. TCP and application-layer rules with content but no flow keyword get a notice, because adding flow:established,to_server stops the engine from inspecting the wrong side of sessions. Sids below one million are reserved for published rule sets, so local rules should use 1000000 and above.
Limits
This is a static check. It does not load your suricata.yaml or snort.lua, so it cannot confirm that variables are defined, that a keyword exists in your exact engine build, or that a rule matches real traffic. Run suricata -T or snort -T with your configuration and replay a test pcap before deploying.
Решен пример
A local.rules file has six rules, one of them commented out. Rule 1, a Log4j JNDI check on the HTTP User-Agent with flow:established,to_server and a hex-encoded content, passes. Rule 2 alerts on SMB to the internet with no content and gets a performance warning. Rules 3 and 4 both use sid 1000003, so both get a duplicate error. Rule 4 also has content:"/admin" (6 bytes) with depth:3, which can never match, and no rev. Rule 5 has the hex block |4G 00|, which is not valid hexadecimal, and flow:to_server,to_client, which is a contradiction. Explaining rule 1 gives: raise an alert for HTTP traffic from outside networks to your network, only on established traffic to the server, which must contain the JNDI string in the user agent buffer, ignoring case.
Накратко
- Категория: Сигурност
- Работи в браузъра, без регистрация, без качване.
- Въведената от вас информация остава на устройството ви.
- Налично на английски.
- Съдържанието е прегледано последно:
- Официален източник: Suricata rules documentation and Snort 3 rule writing guide
Често задавани въпроси
Which engines are supported?
Suricata 7 and 8, Snort 3 and Snort 2.9. The engine selector changes which actions, protocols and keywords are accepted.
Why is http_uri a notice in Suricata?
Suricata still accepts the legacy content modifiers, but its documentation recommends sticky buffers such as http.uri placed before the content. Both work; the sticky form is easier to read and to combine.
What sid range should local rules use?
Published rule sets use their own ranges, so local rules normally start at 1000000. The renumber action rewrites sids in order from any number you choose.
Does the tool check that my variables exist?
It lists every variable the rules use, such as $HOME_NET and $HTTP_PORTS, so you can compare with your configuration. It cannot read the configuration itself.
Can it test rules against a pcap?
No. It is a static linter and explainer. Use the engine's own test mode and a pcap replay for traffic tests.
Are the rules sent anywhere?
No. Everything runs in the browser, and the draft is kept in local storage only.
