Lesson 8 of 13 · 16m
A Rule Is a Hypothesis About Behavior
Keying detections on attack invariants — LSASS access masks, RC4 ticket requests, PsExec sequences — instead of expiring IOCs.
A detection rule is a hypothesis: when this technique executes, telemetry will contain this shape. Write it backwards — from the attack mechanism to the field that betrays it — and it survives contact. Write it forwards — from an IOC list to a string match — and it expires with the campaign.
Pyramid of Pain, applied
David Bianco's Pyramid of Pain ranks indicators by how much it costs an attacker to change them. Hashes are trivial — recompile, one byte different. IPs cost a redirect. Domains cost registration. TTPs cost a rewrite of tooling and tradecraft. A rule keyed on a SHA-256 is a rule with a TTL measured in days; a rule keyed on behavior — an unsigned binary opening LSASS with read access — outlives the malware family that motivated it.
Worked example: LSASS dumping
The mechanism: credential dumping requires reading LSASS's memory. OpenProcess/ReadProcessMemory on lsass.exe produces Sysmon event 10 (ProcessAccess) with TargetImage ending in lsass.exe and a GrantedAccess mask encoding the requested rights. Mimikatz requests 0x1010 — PROCESS_VM_READ (0x0010) | PROCESS_QUERY_LIMITED_INFORMATION (0x1000). 0x1410 and 0x1FFFFF show up too.
The rule shape: Sysmon 10, TargetImage ends with lsass.exe, GrantedAccess in the credential-access set, SourceImage not in a known-good list. That last clause is where the hypothesis meets reality: antivirus products, procdump64.exe in an admin's hands, and backup agents all legitimately touch LSASS. Exclusions keyed on full image path + signer, not process name — because an exclusion on procdump64.exe is a free pass the moment an attacker renames mimikatz.exe to procdump64.exe, and they do exactly that.
Worked example: Kerberoasting
The mechanism: request RC4-encrypted service tickets for accounts with SPNs, crack the ticket offline. The telemetry: Security 4769, TicketEncryptionType = 0x17, service name is a user SPN rather than a machine account or krbtgt. The distinguishing field isn't "a 4769 happened" — it's the encryption downgrade to RC4 combined with the account shape. A rule matching only EventID = 4769 fires on every legitimate ticket in the domain; the fields are the detection.
Worked example: PsExec
The mechanism: PsExec drops a service binary, installs it with SCM, talks over ADMIN$ and a named pipe. The telemetry it produces: 7045 (service installed) naming PSEXESVC, Sysmon 17/18 on \\.\pipe\psexesvc, a 4624 type-3 logon, and ADMIN$ in the share name of a 5140/5145 access event. Any single field is weak; the sequence is airtight — which is why the durable PsExec rule is a temporal correlation, not a string match on PSEXESVC (attackers rename the service and the pipe; -r lets them pick).
Enumerate before you write
The workflow: read the technique (ATT&CK entry, attacker's own writeup, a write-up of the incident that used it), list which telemetry sources can see it, identify the field-level difference between the technique and its benign lookalikes, then write the selection. If no field distinguishes the attack from benign behavior, the honest answer is a detection that fires on both plus triage logic — not a tighter string match.
The comsvcs test
rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump <pid> <path> full dumps a process using a Microsoft-signed DLL — no malware binary, no hash to match, a living-off-the-land binary doing the work. It produces exactly the Sysmon 10 signature above. A rule written to catch "mimikatz" misses it; a rule written to catch the memory-read on LSASS catches it regardless of which signed binary made the call. That is the difference between an IOC and a detection.
The fields the hypothesis needs
Before writing detection:, list the invariant — the thing the technique cannot skip doing. Dumping credentials requires reading LSASS memory; the attacker can change the tool, the path, the encoding, but not the read. Persistence via scheduled tasks requires task registration; the task name is theirs to choose, the 4698 isn't. Rules keyed on invariants decay slowly; rules keyed on choices decay with the campaign.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
Immich Had Fourteen Advisories and One Bug It Fixed Three Times
Immich's 2026 security record runs to fourteen advisories, and they cluster hard: the sharing features, the OAuth plumbing, and one login redirect parameter that took three separate fixes across eighty-three days. Plus the 3.0 migration traps still waiting for anyone who hasn't jumped yet.
Jellyfin's Threat Model Is Your Brother-in-Law
Four Jellyfin CVEs landed in 2026 and not one of them needs an admin account. One needs only the ability to name a file. Meanwhile Jellyfin 12 shipped in September, the version numbers stopped starting with 10, and every "am I patched" check you wrote is now wrong.
Node.js Fixed 16 Flaws in One Release. Most of Them Live in HTTP/2 and TLS.
The November 11 Node.js security releases fix 16 CVEs across the 26, 24 and 22 lines, seven of them rated high. Nearly all sit in HTTP/2 and TLS, where a remote client can crash a server, leak memory, or get past per-host client-certificate checks.
Next.js Shipped Seven Advisories and Six of Them Are the Cache
The November 2026 Next.js security release patches seven issues, and six live in the new Cache Components layer, the feature meant to make your app faster by remembering more. Three hit self-hosted next start specifically: the ones Vercel's own platform quietly absorbs.