Rule syntax
في هذه الصفحة
Every key of a rule, every modifier, and the rules of thumb that keep a detection precise.
The keys
Key | Required | Meaning |
|---|---|---|
| yes |
|
| yes | The module that runs it ( |
| yes |
|
| yes | One line. |
| yes | The evidence types it reads. |
| yes | What happened, why it matters, what to do next - about one match. |
| no | Different wording per evidence type: |
| yes | The selections combined with |
| yes | Named selections, each mapping fields to a matcher. |
| no | Fire only once this many events matched (default 1). |
| no | The entity type its signals are about, when not the record's own subject. |
| no | Fields whose values make one signal. |
| no | ATT&CK technique IDs. |
| no | For the rule's authors; not shown with signals. |
| yes | The fidelity contract. See Testing. |
| no |
|
Matchers and modifiers
{"field.name": {"modifier": "endswith", "values": ["\\a.exe", "\\b.exe"]}}
Modifier | Matches when the field |
|---|---|
| is exactly a value |
| contains, starts with, ends with a value |
| is a path whose folder ends with a value: |
| has a whole word, written as a switch ( |
| has a whole word that is exactly |
Matching ignores case. Booleans are matched as "true" / "false".
One signal, many matches
By default, a rule's matches with one subject are one signal.
Give
coalescewhen the subject is too broad: a shell's matches are different signals by command line -"coalesce": ["process.name", "process.command_line"].Give
entitywhen the record's subject is the wrong thing: an IFEO rule's signal is about the hijacked program, not the debugger -"entity": "program".Never coalesce on a time or a record number: every match would be its own signal.
Raw log records
security_event and system_event are raw records: "this record is in the Security (or System) log". One event ID means different things from different providers in one log - on one real host, 84 of 99 System events 104 came from a smart-card driver, and only 15 were log clears.
Write rules that cannot be fooled
Match a file name whole:
\\cmd.exe, notcmd.exe, whichmycmd.exealso ends with.Match what an attacker cannot choose. A name ending in
$is not proof of the computer's account - a hidden local account can end in$. The system's logon session0x3e7is.Anchor path exclusions at the drive:
:\program files\, never\program files\anywhere - an attacker chooses the path.Select what you mean. For unsigned code,
file.signature equals [unsigned, invalid, not found]- nevernot (equals valid), which also matches a file nobody could check.Match a service's program on
service.program(the path without arguments), never onservice.image_path, whose arguments can name any folder.Avoid localised words. Service start types and states may be written in the host's display language; built-in rules do not match them.
Naming attack tools in rules
A rule may name an attack tool or its syntax where the detection needs it. But a plain .json file that names a tool can be quarantined by an antivirus. Pack it:
signal rules -pack -rules C:\signal-rules
This writes a compressed .pack beside each .json; -rules reads either. Keep the .json as your source. Packing is not secrecy: signal rules prints the rules in full.