✳ Field lesson DE2 / 14 min

Write a detection for a behavior

A detection has two halves: a rule, and the events that rule reads. Mapping the rule to an ATT&CK technique records what you meant to catch. If the events never reach the SIEM, the rule is blind, however good it is.

Helpful first: Threat intelligence that changes a decision · Logs, alerts, and evidence · Triage an identity alert

Thirty days to Halcyon · Case 13: The quiet rules · Episode 2 of 5

Wednesday afternoon. Nyx, the Threat Hunter, slept four hours and came back early. She has written a rule for the first KS-4 behavior: a scheduled task created from the command line.

She runs it over a week of events from the 38 ground-station hosts. It returns nothing.

Kael Cho, Staff Infrastructure Engineer, reads the empty result over her shoulder. "Nothing. That is good news, right?" Nyx does not look up. "Either nobody did it, or the rule cannot see. Which one?"

By the end you can

  • Write a detection as a log source, a condition, and an expected false positive
  • Map a detection to an ATT&CK technique and name the telemetry it needs
  • Explain why a mapped technique is not a covered technique until the data arrives

A rule says what it reads, matches, and expects

A detection rule is a saved search that raises an alert when events match it. Nyx's first rule is for the KS-4 behavior that leads the requirement: a scheduled task created so a program survives a restart.

The heart of the rule is the match. The program that runs is schtasks.exe, and its command line contains /create. A condition says when to fire. Here it fires on any single match. But the match only makes sense against the right events. So the rule also names its log source: process-creation events from Windows hosts, which record each program that starts and its command line.

Two more parts keep the rule honest. The false positives say which harmless activity also matches. Software installers and admin scripts create tasks too, so an analyst should expect some. The level says how urgent a match is. Nyx sets medium, because one new task is common. How often a rule's alerts turn out real is its precision, which Triage an identity alert covers.

The parts depend on each other. The fields in the match exist only in the events the rule reads. A rule is never only its logic.

Sigma writes a rule once for many SIEMs

Every SIEM has its own query language. Sigma is an open format for writing a detection rule once, in YAML, so that teams and tools can share it. The current Sigma specification is version 2.1.0, released in August 2025.

Sigma is a format, not an engine. Nothing runs a Sigma rule directly. A converter such as sigma-cli translates it into the query language of a chosen SIEM, and the SIEM runs that query.

The translation includes field names. Sigma rules use standard names for each log source, such as Image and CommandLine for process creation. A mapping turns those into the names a particular SIEM stores. If the mapping is wrong or missing, the query asks for a field that does not exist. It matches nothing, often without any error.

Nyx writes her rule in Sigma, so it would survive a change of SIEM. The specification lists the parts in a set order, and most rules in public collections follow it.

PUT IT IN ORDER

Nyx's Sigma rule has six parts. Put them in the order the Sigma template writes them, top to bottom.

  1. Title: Scheduled task created from the command line
  2. False positives: installers and admin scripts that create tasks
  3. Condition: fire when the selection matches
  4. Level: medium
  5. Selection: schtasks.exe with /create in the command line
  6. Log source: process creation on Windows

Show the answer
  1. Title: Scheduled task created from the command line
  2. Log source: process creation on Windows
  3. Selection: schtasks.exe with /create in the command line
  4. Condition: fire when the selection matches
  5. False positives: installers and admin scripts that create tasks
  6. Level: medium

The template order also follows the logic. The log source decides which field names exist. The selection uses those fields. The condition names the selection. The false positives and the level describe a rule that is already complete.

A mapping says what you meant to catch

Nyx tags the rule attack.t1053.005. That points to MITRE ATT&CK technique T1053.005, Scheduled Task, a sub-technique of Scheduled Task/Job (T1053). In ATT&CK v20.1 it sits under three tactics: Execution, Persistence, and Privilege Escalation.

Each technique page in current ATT&CK lists detection strategies. A strategy groups analytics, and each analytic describes what to look for on one platform. For T1053.005 the strategy is DET0441, Detection of Suspicious Scheduled Task Creation and Execution on Windows. It is worth reading before writing a rule.

A mapping records what the rule is meant to catch. It does not show that the rule can catch it. Nyx's rule sees tasks created with schtasks.exe. A task created through PowerShell or the Task Scheduler interface starts no schtasks.exe process, so this rule misses it. Windows event 4698 records every new task, but only when the audit policy Audit Other Object Access Events is on.

So a silent rule has three possible causes. Its logic may not match how the behavior happened. Its events may never arrive. Or it may ask for a field name the SIEM does not use.

SORT IT OUT

Five rules at other sites stayed silent during a test. What is the most likely cause of each silence?

  1. The rule matches schtasks.exe, but the test created its task with a PowerShell command.

  2. The host's forwarder has sent nothing for six days.

  3. The rule asks for a field called CommandLine, and the SIEM stores it as process.command_line.

  4. Event 4698 never appears, because Audit Other Object Access Events is turned off.

  5. The rule fires only when ten tasks are created within a minute, and the test created one.

Show the answers
  1. Rule logic. The events arrived. The rule only looks for one of several ways to create a task.
  2. Missing data. No rule can match events that never reach the SIEM.
  3. Wrong field name. The data is there under another name. The query asks for a field that does not exist.
  4. Missing data. Windows never wrote the event, so there was nothing to forward or match.
  5. Rule logic. The condition asks for more than the behavior needs. One quiet task never reaches ten.

Coverage is a rule plus the data it reads

Nyx's rule found nothing in a week. So she asks a second question: which hosts send the events this rule reads? She counts the ground-station hosts with at least one process-creation event in the SIEM this week. The answer is 0 of 38.

The hosts were recording. Sysmon, a Microsoft Sysinternals tool, writes a process-creation record, event ID 1, to each host's own event log. Each host's forwarder sends only the channels on its list, and the Sysmon channel was not on it. The records never left the hosts.

Nyx's rule in the SIEM could match the task and still saw nothing. The task creation was recorded on the host and stopped at the forwarder, so the rule had no event to match.

So the rule was blind, however well it was written. Coverage of a behavior needs both halves. One is a rule that matches the behavior. The other is the events that rule reads, arriving from every host that matters.

The fix is not in the rule. It is one line in the forwarder list, on 38 hosts, and Kael wants it done today.

WORKED EXAMPLE

Find out why the rule is silent

  1. Write the rule. Log source: process creation on Windows. Match: schtasks.exe with /create. Level: medium. Tag: attack.t1053.005.
  2. Run it. A week of events from the 38 ground-station hosts. 0 matches.
  3. Ask the other question. Which of those hosts sent at least one process-creation event to the SIEM this week?
  4. Read the answer. 0 of 38. The forwarders send sign-in and system events, but not the Sysmon channel.

Result: Zero matches meant zero events, not zero tasks. The rule had never had a chance to fire.

SPOT THE PROBLEM

Nyx reads six lines from the coverage report for Meridian's office hosts, which Kael's change did not touch. Flag the lines where a rule cannot fire, however good its logic.

Show the answers
  • ops-ws-11 | process events forwarded: no The host records process events but never sends them. Every process rule is blind here.
  • rule task-registered | reads event 4698 | Audit Other Object Access Events: off Windows writes event 4698 only when that audit subcategory is on. The rule waits for an event that is never written.
  • ops-ws-08 | forwarder last heard 6 days ago A forwarder that stopped six days ago sends nothing. The host is out of coverage until it reports again.

CHECK YOUR JUDGMENT

A report to the launch board says T1053.005 is covered at Meridian. The rule exists, it carries the right tag, and the heat map cell is green. Which fact would you check first before believing it?

CASE FILE · CASE 13 · ENTRY 2 OF 5

Answer the closing question correctly to add this entry to your case file.

A rule needs its data

Nyx's scheduled-task rule found nothing because 0 of 38 ground-station hosts forwarded process events, so a mapped technique is not covered until its data arrives.

Next episode: The rule exists and the data flows. Has it ever fired on anything?

Open the case file ↗

Review sheet: exam notes and quick reference

Find your next idea.

Tip: press / to open search. Escape closes this window.