HackBlue

Tools · Network IDS and detection as code · 24 / 24

sigma-cli: tags are not log fields

Tags on a Sigma rule are keywords the author attached. They are not columns in the log and not a search you ran. Write them as tags. Do not file hits of the tag string as the rule’s hits.

12 min read · practice only with authorization

A tag is a keyword on the file

The tags list is text in the YAML: labels the author chose, sometimes a tactic name, sometimes an internal word. Those strings are not fields the detection tests unless the detection section also names them, which you check separately.

Quoting a tag is quoting the file. It is not quoting a log row.

What to file

File the rule id and the tags as keywords. File a hit count only for the query you ran, and name that query. A tag that looks like a technique name is still a keyword until a cited log row shows the activity.

Worked case: a tag string searched as the rule

The lab rule’s tags include lab.inventory. The detection looks for a process path. A draft searches the lab index for the text lab.inventory, gets 9 events, and files them as the rule’s hits. The converted query was not run.

The note says lab.inventory is a tag on the file. The 9 events are a search for that string. The rule query was not run, so those 9 are not filed as the rule. The process-path test stays unread.

Snippet
rule tags: lab.inventory
detection tests: a process path
search actually run: the text lab.inventory, 9 events
rule query: not run
write: tag versus a keyword search
not: the rule returned 9

Diagram

Keep a tag off the hit count

  1. Tag

    A keyword on the YAML.

    File
    lab.inventory
  2. Detection

    The test the rule actually states.

    Rule
    a process path
  3. Keyword search

    A different question, if that is what you ran.

    Search
    9 events
  4. The rule’s hits

    Only from the rule’s query.

    Gap
    not run

Check yourself

1. A rule’s tags include lab.inventory. What is that string?

2. You searched the index for the tag text and did not run the converted query. What are the hits?

3. When can you say the rule matched?