Skip to content

Search and Hunt with Chainsaw

02 / Ask one question at a time

Start with search to understand the evidence, then hunt for behaviour that needs review.

Search
Find a pattern or field condition
Hunt
Apply detection rules
Starting folder
C:\Tools\chainsaw with the sample repository; use your actual paths for casework

Find a known event

01Ask for one event type
.\chainsaw.exe search -t 'Event.System.EventID: =4732' .\EVTX-ATTACK-SAMPLES\

-t supplies a structured field condition. Before interpreting a hit as a group membership addition, check all three identifiers below. Microsoft documents the event and its fields.

Event ID
4732
Provider
Microsoft-Windows-Security-Auditing
Channel
Security
Search by contentA quick lead

A case-insensitive pattern can find account names or command fragments anywhere in the parsed record. Read the field in which it matched.

Search by fieldA more precise question

Combine event ID with the provider, computer or another field. Multiple -t conditions are ANDed unless you request --match-any.

02Compare a content search with a field search
# Text patterns use regular-expression syntax; -i ignores case.
.\chainsaw.exe search 'powershell' -i .\EVTX-ATTACK-SAMPLES\

# Two conditions must both match.
.\chainsaw.exe search -t 'Event.System.EventID: =4732' -t 'Event.EventData.TargetSid: S-1-5-32-544' .\EVTX-ATTACK-SAMPLES\

Read the field that matched

The second command asks about additions to the built-in Administrators group using its SID, avoiding a translated group name. A match still needs context and authorisation checks.

The CLI definitions document the pattern, -t, -i and output options.

Run the original sample hunt

Why a Sigma hunt needs a mapping
  1. 1 / RuleSigma describes the fields and values to match.
  2. 2 / MappingTranslate rule fields to the event's structure.
  3. 3 / RecordRead the actual EventID and target group SID.
  4. 4 / MatchKeep the detection and return to the source event.

The mapping connects portable rule logic to the fields in your evidence.

03Run the Sigma hunt into a fresh output folder

The original SUSA command hunts all supplied EVTX samples using Sigma and writes CSV results to results:

.\chainsaw.exe hunt EVTX-ATTACK-SAMPLES/ -s sigma/ --mapping mappings/sigma-event-logs-all.yml --csv --output results

Screenshot: Run a Chainsaw Sigma hunt against EVTX-Attack-Samples and export CSV results

Check the whole run

  • Input files loaded
  • Rules loaded
  • Processing completed
  • Output files present

Record warnings and errors as well as hit counts. Counts vary with sample, rule and tool revisions; the screenshot's counts are not a pass condition.

›Read the command from left to right
hunt EVTX-ATTACK-SAMPLES/
Input files to analyse recursively.
-s sigma/
Sigma detection logic. sigma/rules/windows/ is a more focused Windows subset.
--mapping mappings/sigma-event-logs-all.yml
Translates rule fields and log sources into the parsed event structure.
--csv --output results
Writes CSV tables into a result directory.

Narrow the time window and preserve full records

04Bound the hunt using the evidence's clock

Use the event's timestamp basis, not today's date. This example brackets the two Full Lab records from 22 September 2019. Keep a wider initial search so an incorrect time assumption does not hide relevant evidence.

.\chainsaw.exe hunt .\EVTX-ATTACK-SAMPLES\ -s .\sigma\rules\windows\ --mapping .\mappings\sigma-event-logs-all.yml --from '2019-09-22T11:20:00' --to '2019-09-22T11:25:00' --json --output '.\hunt-window.json'
TimestampKeep the basis explicit

Hunt uses the mapping's event timestamp. Retain UTC by default and record it. If using --local or --timezone, record those options.

Search filterName the time field

Search time filtering also requires --timestamp. It names the timestamp field against which the window is applied.

WindowLeave a margin

Bracket the event with time on either side. Avoid relying on exact endpoint inclusion or a narrow first search.

See the search implementation for how the selected timestamp field is filtered.

05Preserve the complete source records

To preserve complete matching source records, export a separate search as JSON. A hunt's detection JSON and a search's raw event JSON serve different purposes.

.\chainsaw.exe search -t 'Event.System.EventID: =4732' .\EVTX-ATTACK-SAMPLES\ --json --output '.\group-events.json'
Check coverage before interpreting the resultWhat if there are zero matches or warnings?

Zero matches is a result, not a clean bill of health. Follow these checks in order and retain the console output with your results.

01 / Evidence

Did the intended files load?

Check
Confirm the input path, loaded files and available channels. Check that you are analysing the intended working copies.
Record the gap
Missing or overwritten logs cannot be searched. State which sources were available.
02 / Time

Is the window hiding the event?

Check
Compare the filter with the source event's timestamp and timezone. Widen the search if the clock context is uncertain.
Record the change
Retain the first run and explain any revised time bounds.
03 / Detection

Do the rules cover these logs?

Check
Review loaded rules, mapping coverage and required log sources. A Sysmon process rule cannot find its events in a Security-only export.
Record the limit
Unsupported rules may fail to load. A rule that did not run provides no detection coverage.
04 / Processing

Were any records skipped?

Check
Read parse warnings and errors, then confirm processing completed and inspect the saved output files.
Record the effect
Keep the messages and identify the evidence affected before writing a finding.