How to turn a security question into a repeatable detection, and what CTA does (and doesn't do) along the way.
Start with a hypothesis, not a keyword
Opening the event table and asking "what looks suspicious?" rarely gets you anywhere. A specific question does:
"Could an attacker be using Microsoft Word to launch PowerShell?"
That question is testable. In CTA's Threat Hunting panel it becomes:
process=powershell
parent=winword
last 7 days
You don't need the perfect query on the first try. Hunt in layers, adding one condition at a time and watching how the results change:
process=powershell
process=powershell
parent=winword
process=powershell
parent=winword
command="-enc"
last 7 days
Every clause is an AND: an event must satisfy all of them to appear. Clauses can go one per line or all on one line; both parse the same way.
A hunt asks "has this happened?"; a detection says "tell me when it happens"
Take this process-creation event:
NewProcessName=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe;
ParentProcessName=C:\Program Files\Microsoft Office\WINWORD.EXE;
CommandLine=powershell -enc AAAA
The hunt above finds it. If the results are activity you would genuinely investigate, you've found something worth turning into a standing detection. The full loop looks like this:
Hypothesis → Hunt → Review events → Validate → Create Sigma rule → Test → Tune → Monitor alerts
The query language in five minutes
CTA deliberately uses a small query language instead of imitating SQL or a full search engine.
| You type | What it does |
|---|---|
mimikatz | Free-text match across the event's channel, message, computer, user, severity, source and event ID |
net user | Two separate terms. Both must appear; it is not the exact phrase |
process=powershell | Field match (see the note on "contains" below) |
parent!=explorer | Field does not contain the value |
command="-nop -enc" | Quotes let a field value contain spaces |
risk>70, event_id=4625 | Numeric comparison (>, >=, <, <=, =, !=) |
last 24 hours | Relative time window: minutes, hours, days or weeks |
Fields: process, parent, command, computer, user, channel, severity, risk, event_id, client, agent.
Aliases: host= for computer=, parentimage= for parent=, cmd= / cmdline= / commandline= for command=, id= for event_id=, and a few more.
Two behaviors worth knowing
= means "contains", not "equals." For text fields, matching is a case-insensitive substring test. process=powershell also matches powershell_ise.exe, and parent!=explorer means "does not contain explorer." Only risk and event_id are compared numerically.
A bare word is not the same as a field. powershell searches the whole event, so it also catches events that merely mention PowerShell, such as script-block logs. process=powershell only looks at the process image. When you mean the process, say process=.
What happens when a query is a little wrong
The parser never throws. An unrecognized field name is treated as free text. A bad numeric value (risk>high) is skipped, and a warning appears above the results rather than silently changing what you searched for.
Hunting patterns that work
Risk as a triage filter. risk>70 with last 24 hours is a good start for a daily review: the highest-scored activity first, then pivot. Risk is a hunting filter. It is not something a Sigma rule can match on (more on that below).
Event IDs, with care. event_id=4625 (failed logons) and event_id=1102 (log cleared) are specific enough to be useful. event_id=4624 (successful logons) will return a mountain of normal activity. The question isn't "can I find Event 4624?" but "can I find a meaningful subset of it?"
Exclusions to cut noise. process=cmd.exe plus parent!=explorer focuses on command shells that weren't started by Explorer.
A trap with
!=: if an event has no parent field at all, "parent does not contain explorer" is true. Pair negations with a positive clause (likeprocess=) so you're only excluding from events that actually have the field.
A safe exclusion routine: run the broad hunt, work out what's producing the noise, add the exclusion, rerun, and confirm the interesting events are still there.
Time windows. process=powershell asks "show me PowerShell from whatever events are stored." process=powershell plus last 24 hours asks "what happened recently?" The second is almost always the better question, and CTA also applies the window when it loads candidate events, so it helps with the size limit described below.
Multi-client scoping
A universal analyst can narrow a hunt with client=acme or agent=CTA-AAA111:
process=powershell
client=acme
last 24 hours
Client-bound users are scoped to their own client's data (the Client column is hidden for them). Hunting follows the same tenant boundaries as the rest of the platform.
From result to investigation
The hunt is a starting point. The results table shows Time, Risk, Event ID, Severity, Channel, Computer, Client, Agent, User, Parent and Message, with a summary line such as "37 of 20,000 candidate events matched". Double-click a row for the full event. Right-click a process-creation event to open the process tree, which shows what launched what. After your first run, results refresh live as new events arrive.
Hunt result → Event detail → Process tree → Parent/child → Command line → Decision
From hunt to Sigma
When a hunt has produced activity you'd want to catch every time, click Create Sigma rule… (the button beside Hunt and Clear on the Threat Hunting panel). CTA builds a draft from the current query. For example:
process=powershell
command="-enc"
parent!=explorer
becomes (abridged):
title: 'Hunt - process: powershell, command: -enc'
logsource:
product: windows
detection:
selection:
NewProcessName|contains: powershell
CommandLine|contains: -enc
exclude1:
ParentProcessName|contains: explorer
condition: selection and not exclude1
level: medium
The real output also includes an id, status: experimental, a description recording the original hunt, an author, a date, and a placeholder falsepositives entry that tells you to tune after reviewing the first hits.
What survives the conversion
CTA translates the parts of a hunt that describe behavior. It does not copy query text into YAML.
| Hunt clause | In the Sigma rule |
|---|---|
process= / parent= / command= | NewProcessName / ParentProcessName / CommandLine with |contains |
Same fields with != | An excludeN filter, joined with and not |
| A bare word | A keywordN selection (multiple words are ANDed, like the hunt) |
event_id=N | EventID: N. Ranges like event_id>4000 are dropped, because Sigma matches an exact ID |
last N days | Dropped. A detection runs on every new event; the window was your investigation scope |
risk, severity | Dropped. They are outputs of detection, not inputs |
computer, user, channel, client, agent | Dropped. Scope is chosen when you save the rule |
Everything dropped is listed in orange above the YAML, so you can see exactly what didn't survive.
Compare the two:
Hunt: process=powershell parent=winword last 7 days computer=FINANCE-PC risk>70
Detection: PowerShell launched by Word
The hunt says "show me suspicious PowerShell from Word on this machine this week." The rule says "alert me whenever PowerShell is launched by Word."
Test before you save
The dialog dry-runs the draft against the 5,000 most recent stored events and reports something like:
Test: this rule would have matched 12 of the 5,000 most recent stored events (0.2%).
Above 5%, CTA adds a warning that the rule is probably too broad and will flood the alert queue. The generator also warns you directly when:
the rule is just
event_id=N(it will fire on every event with that ID);the rule is parent-only (it alerts on everything that parent starts);
the only keywords are very short;
you included several different
event_idclauses (they can't all be true at once, so the rule matches any of them).
The YAML in the dialog is editable. Regenerate rebuilds it from the title and level and discards manual edits. Test again re-runs the dry run.
The match count alone doesn't tell you whether a rule is good. Ask: would an analyst actually investigate these matches? process=powershell matches enormous amounts of harmless activity. process=powershell + parent=winword + command="-enc" is specific enough that a hit means something. The goal is maximum useful signal, not maximum volume.
Saving is deploying locally
Clicking Save rule… goes through the normal Sigma import path. You'll be asked for a client scope, and the rule is then enabled and evaluating immediately. Treat the dry run as your last chance to catch noise. Afterward you can disable or delete the rule in Sigma Rules, tune it, or send it out to endpoint agents with Publish & Deploy Selected….
Importing existing Sigma rules
Hunting isn't the only source of detections. In Sigma Rules you can import a YAML file or paste YAML directly, including a multi-rule ----separated export, then enable, disable, view or delete rules.
Imported rules aren't second-class. They're evaluated against events alongside the built-in set and flow through the same whitelisting, correlation, Detection Timeline, Rule Performance and MITRE ATT&CK coverage as native detections.
The supported subset
CTA implements a practical subset of Sigma, not the whole specification.
Supported: field modifiers
contains,startswith,endswith,re, andall(as inCommandLine|contains|all); conditions usingand,or,not, parentheses,1 of <pattern>,all of <pattern>andall of them. Lists of values are ORed, and multiple fields inside one selection are ANDed.Not supported: aggregation functions,
timeframe,near, and backend field-mapping pipelines. Rules relying on them aren't equivalent to per-event matching, and unsupported condition syntax fails the import with a specific error rather than silently evaluating wrong.Logsource: a rule with an unrecognized or missing logsource still runs, against every event, rather than being dropped.
A rule that is valid Sigma isn't automatically equivalent in every backend, so always test imported rules.
Where hunting fits among the other tools
Hunting searches stored event telemetry. It doesn't search live memory or scan files on disk. That's a different job:
| Capability | Main question |
|---|---|
| Threat Hunting | What happened? |
| Sigma | When this behavior happens, should I alert? |
| Process Tree | What launched what? |
| Timeline | What happened before and after? |
| MITRE ATT&CK | What technique does this represent? |
| YARA | Does this file or process contain a suspicious pattern? |
A real investigation chains them: a suspicious PowerShell event, a hunt, the process tree, the command line, a downloaded file, a YARA scan, an ATT&CK mapping, then a detection rule.
Detection quality is limited by telemetry quality
Process hunting depends on the events actually containing process, parent and command-line fields. If process-creation or command-line auditing isn't enabled, command="-enc" can return nothing even when the behavior occurred. An empty hunt isn't proof of absence. It may mean the telemetry was never collected.
Limits to keep in mind
No
ORand no wildcard or regex syntax in the hunt language. Clauses are ANDed.Process, parent and command fields are extracted from
Key=Valuetext inside event messages. Values stop at a semicolon, so a command line containing;is truncated in the extracted field.Only relative time windows (
last N …) are supported, not calendar dates.A hunt examines the 20,000 most recent events (within the time window if you give one). The summary line shows the candidate count, and if it equals 20,000 your results may be truncated, so tighten the time window.
The Create Sigma rule dry run uses the 5,000 most recent events, regardless of any
last Nwindow.Not every clause converts to Sigma, and a generated rule always needs review and tuning.
Try it yourself
PowerShell from Office:
process=powershell+parent=winword+last 7 days, then the same withparent=excel.Encoded PowerShell:
process=powershell+command="-enc"+last 7 days.Unexpected shells:
process=cmd.exe+parent!=explorer+last 24 hours. Check what's producing the noise before turning it into a rule.Failed authentication:
event_id=4625+last 24 hours.High-risk PowerShell:
process=powershell+risk>70+last 24 hours.
Don't turn every result into a rule. Hunt first, investigate second, detect third.
The takeaway
A hunt is an investigation. A detection is an operationalized hypothesis. Sigma is the portable language that carries one into the other.
A good hunter asks, "What could an attacker be doing here?" A good detection engineer then asks, "How can I recognize that reliably next time?" CTA connects the two: hunt, understand the evidence, build the rule, test it against real events, then let the platform watch for the next occurrence.
No comments:
Post a Comment