In a managed SOC the hard part is not one difficult alert. It is the same ten alerts, every day, on every client, each one needing the same five lookups before anyone can say "noise" or "escalate". This post is what I built over two weeks to take that repetition off the analysts on a Cortex XDR Pro tenant: correlation rules, a family of triage playbooks, automation rules to route alerts to them, an AI brief inside the playbooks, fleet health alerts, and a reporting pipeline. It ends with one real incident handled from the first alert to the ticket.
Rules I set before touching anything
A SOC tenant is production. A bad playbook can close a real intrusion, and a bad policy change can stop a client's services. So the work followed five rules:
- Audit read-only first. Licence, integrations, policies, rules, playbooks and the alert mix, written up before any change.
- Additive changes only. A new rule or playbook version sits next to the old one. Nothing is disabled or deleted without an explicit decision for that object, and prevention policies and profiles were left alone on purpose.
- No automatic closure. Playbooks enrich, write a note, set a verdict and assign. A human closes.
- Every change has a journal entry with what was created, what was tested, what was not tested, and the rollback in order.
- Tenants never mix. Nothing from one client appears in another client's rule, playbook, report or ticket.
Step 1: read the alert mix, not the alert list
The first useful query is not a hunt. It is a count of issues by name and detection source over the retention window, from the issues dataset. It tells you where the analyst hours go.
dataset = issues
| comp count() as issues, max(_time) as last_seen
by xdm.issue.name, xdm.issue.detection.method
| sort desc issues
| limit 30
On this tenant three families made up nearly all the work: firewall VPN events, a VPN correlation rule, and endpoint agent alerts (WildFire and local analysis verdicts, hash and signer restrictions, behaviour and exploit detections). The firewall family was already automated. The other two were handled by hand, one alert at a time.
Two field facts saved hours later:
- In the
issuesdataset,xdm.issue.case_idsis an array of numbers.arraystring()on it fails;arrayindex(xdm.issue.case_ids, 0)works and lets you pull every alert of a range of cases in one query. - The useful detail of an alert (host, user, file path, SHA-256, process, command line, remote address) lives in
xdm.issue.normalized_fields. Profile it before you write a playbook, instead of guessing field names.
Step 2: fix the correlation rule that was making noise
The VPN rule was meant to catch the classic brute-force success: many failed logins, then a successful session, for the same account or from the same address. Every case it produced said the success came "from NULL" for "no account". The rule was firing, but it could never be investigated.
The cause was the firewall's log format. On SSL-VPN events from this FortiGate, the fields you would expect (src, suser) are empty. The remote address is in dst and the account in duser. The rule grouped by the empty field, so every event in the window fell into one null group, and any day with failures and one legitimate login matched.
The fix was two new rules, created with "Save as new" so the old one stayed untouched until validated:
dataset = <firewall dataset>
| filter subtype = "vpn" and account != null
| alter failed = if(action = "ssl-login-fail", 1, 0),
opened = if(action = "tunnel-up", 1, 0)
| comp sum(failed) as failures, sum(opened) as sessions,
values(remote_ip) as addresses by account
| filter failures >= 5 and sessions >= 1
A second rule does the same per remote address with a higher threshold, for password spraying across many accounts. Lesson: profile the fields before you group by them. A comp count(), count(field) by event type shows in seconds which fields are really populated.
Step 3: a family of triage playbooks
Instead of one giant playbook, I wrote one per alert family, each with the same skeleton, and routed them with automation rules. Only the first matching automation rule runs, so the specific rules sit above a catch-all.
| Family | Matched on | What the playbook does |
|---|---|---|
| Hash and signer restrictions | Alert name | Reputation of the file, propagation and executions in XQL, backup or share path as a noise indicator, verdict |
| Malicious file | WildFire and local analysis alerts | Full investigation note, then a Slack message with response buttons (isolate, quarantine, block hash) that a human must press |
| Behaviour and exploit | Catch-all on agent and BIOC detections | Command line against a keyword list, temp or user path, system binary guard, verdict |
| IOC on an IP address | Detection method | AbuseIPDB, firewall events for the address, endpoints that contacted it, verdict |
| VPN brute force | Correlation rule name | Account overlap, address overlap, campaign size |
| Fleet health | Fleet correlation rules | Notification only |
Every triage playbook ends on one of four verdicts, written as a French note on the case and nothing more:
- ESCALATE: malicious reputation, a suspicious command line, or an internal host that talked to a bad address. Severity goes up.
- PROBABLE NOISE or PROBABLE COMMON SOFTWARE: no propagation, no suspicious command, benign reputation. Marked low priority, an exception still needs a human.
- MANUAL REVIEW: everything else, which is the default.
What the engine taught me
- Condition logic. Inside one condition block the items are OR. Between blocks they are AND. Two of my conditions were inverted until I checked this in the editor.
- The system binary trap.
powershell.exeorrundll32.exealways has a clean reputation and is present everywhere, so a naive playbook calls it "common software". A guard on the path (\Windows\System32,SysWOW64) sends those alerts to manual review instead. - Context is cumulative. Reputation and query results append across runs. A
DeleteContextbefore each lookup keeps old answers out of new verdicts. - Enrichment must not stop the playbook. Every lookup task continues on error through an explicit error path, and every consolidation is guarded by an "is not empty" check.
- The debugger can act for real. A run on a copy of a real alert once took a response branch and added a hash to the tenant block list. Since then, approval steps in tests are always answered "Reject", and response branches are treated as live.
Step 4: AI inside the playbook, on a short leash
Cortex lets a playbook call an AI prompt as a task. I added one at the end of each triage playbook: it receives the investigation note the playbook already wrote, and returns a short brief for the analyst: summary, evidence, risk, recommended action, and what to verify. For the malicious file playbook, the brief is appended to the Slack approval message.
The guard rails matter more than the prompt:
- It is optional and non-blocking. An input switches it off, and if the model call fails the playbook carries on.
- It never decides. It does not close, change severity or press a button. Its text is labelled "AI analysis, to verify".
- It only sees the note. No free access to the tenant, so it cannot invent context. An empty lookup must be written as "none" in the note, otherwise the model reads it as "unknown" and hedges.
- Pick the model for the job. The reasoning model failed above an 8,192 token output limit; a fast model was enough for a one-screen brief.
Step 5: alert on the fleet, not only on threats
An agent that stopped reporting a month ago is a blind spot that no detection will ever show. Three scheduled correlation rules on the endpoints dataset now raise it as an alert: agents offline for more than 30 days, agents not on the target version, and agents that are not fully protected.
dataset = endpoints
| filter endpoint_status != "CONNECTED"
| alter days_silent = timestamp_diff(current_time(), last_seen, "DAY")
| filter days_silent > 30
| fields endpoint_name, endpoint_type, agent_version, days_silent
| sort desc days_silent
Two traps: last_seen is a date in XQL (the API returns it in epoch milliseconds, so the obvious conversion fails), and a telemetry-based version of this query misses exactly the machines that matter, because a silent endpoint has no events at all.
Step 6: reports that cannot invent a number
Weekly and monthly client reports are where a SOC loses credibility: a count copied from the wrong export, a duplicate counted twice, a score quoted on the wrong scale. The pipeline I use treats the report as code:
- Export the cases of the period from the console.
- Recount everything deterministically: duplicates by ID removed, "Duplicate Incident" cases excluded, totals per severity, status, source, host and analyst.
- Consistency checks before any writing: the same alert name closed with different statuses, high scores closed as false positives, active cases with no owner, missing columns. Each one must be arbitrated in the report.
- Facts file: the only numbers the narrative is allowed to use.
- Narrative written from the facts, under ten written rules (no estimated figure, no requalification of the console status, correlation is not causation, no compliance claim that is not attested).
- Word document in the client's visual identity, with line charts per day, per family, cumulative and per hour, and a per-case technical annex (hosts, file paths, hashes, network peers) pulled from the alerts with one XQL query.
- Visual QA: conversion to PDF, every page rendered and checked, and a count of any "to complete" marker left.
The detail annex is what changed the reports most. Pulling the alerts of the week's cases showed things the case list hides: a single host behind one large case, network peers that repeat at the same minute every day, a correlation rule that cannot name an account. Those became recommendations instead of footnotes.
One incident, start to finish
To show the whole loop, here is a recent case with every identifying detail removed.
- Detectionanalytics
Two "recurring rare domain access from an uncommon unsigned process" alerts on one workstation, a day apart. The process was
T1036.005 masqueradingC:\Windows\Windows Driver Foundation (WDF).exe, contacting a Peer2Profit API domain. - ScopeXQL, 30 days
One machine only on the whole fleet, but under three different hostnames (the endpoint had been renamed twice). Active for at least a month, started at every logon by
userinit.exefor every account on the machine, and resolving names directly against public DNS servers instead of the internal ones. - Persistenceread-only script
A read-only command set through the Action Center found it: the Winlogon
T1547.004 Winlogon helperShellvalue had been changed fromexplorer.exetoexplorer.exe,Windows Driver Foundation (WDF).exe --minimized. - Evasionfile facts
The binary was unsigned, hidden with the system attribute, had a last-write date set back to 2008, and was padded to about 700 MB, too large for sandbox and reputation services, which returned "unknown".
T1564.001, T1070.006 - Responseabout 20 minutes
Registry key exported for rollback, process stopped,
Shellrestored toexplorer.exe, hash added to the tenant block list, binary moved to a local quarantine folder, then a verification run: default shell, no process left. - Trackingcase and ticket
Investigation note on the case, a ticket with the full timeline (each step with its time and owner, missing ones flagged), and a mail to the client's contact with what was done, the indicators, and what we needed from them: identify the user, find the origin, block the domain at the firewall, confirm the next logon is normal.
Proxyware sells the machine's bandwidth to strangers, so the client's public IP carries traffic nobody can vouch for. It usually arrives bundled with a cracked tool, which is why the origin question matters more than the file itself.
Hunting for the same thing elsewhere
dataset = xdr_data
| filter event_type = ENUM.REGISTRY
and action_registry_key_name contains "Winlogon"
and action_registry_value_name in ("Shell", "Userinit")
| alter data = lowercase(action_registry_data),
programs = array_length(regextract(lowercase(action_registry_data), "[^,]+[.]exe"))
| filter (action_registry_value_name = "Shell" and data != "explorer.exe")
or (action_registry_value_name = "Userinit" and programs > 1)
| fields _time, agent_hostname, actor_process_image_name,
action_registry_value_name, action_registry_data
dataset = xdr_data
| filter event_type = ENUM.PROCESS and actor_process_image_name = "userinit.exe"
| filter action_process_image_name not in ("explorer.exe")
| comp count() as starts, count_distinct(agent_id) as hosts,
values(action_process_signature_status) as signature
by action_process_image_path
| sort asc hosts
On a healthy fleet the second query returns almost nothing, so anything unsigned in the root of C:\Windows stands out immediately.
Two small lessons from the response: Get-Item does not see a hidden system file without -Force, so a "file not found" during triage is not proof of absence; and when the native quarantine is not offered for an artefact, a scripted move to a protected folder plus a block list entry gives the same safety and stays reversible.
What I would tell another analyst
- Start from the alert mix. The playbook that saves the most hours is rarely the most interesting one.
- Write the verdict, not the closure. A playbook that writes a good note and assigns the case is already most of the value, with none of the risk.
- Treat every rule as code. Generate playbook YAML with a script, check the graph before upload, test in the debugger, and log what was not tested.
- Keep the AI where it helps. Summaries and briefs, yes. Decisions, no.
- Make reports recount themselves. If a number cannot be traced to the export, it does not go to the client.
The two hunts above are generic: they need nothing from the client environment they came from, and they run on any Cortex XDR tenant that collects registry and process events.
Thanks for reading. Running a SOC on Cortex XDR or XSIAM and want to compare playbooks or correlation rules? I reply within a day.