Skip to content

Detections

Every detection here started as a finding from a purple-team operation, and every one has tests: attack events it must fire on and normal events it must stay quiet on. CI runs the tests on every change.

Browse the rules on GitHub

From a miss to a tested detection

In OP-002 and OP-003, three things got past the SOC. OP-004 turned each one into a deployed detection:

What happened Why nothing alerted The fix
D1 Attacker ran native discovery (whoami, net, nltest, systeminfo...) Each command is normal on its own; existing rules looked for attacker tools, not behavior Alert when 4+ different discovery tools run on one host within 10 minutes
D2 Attacker hopped from one workstation to another with valid credentials The lateral-movement rule only watched traffic from the attack network Alert on any network or RDP logon between two workstations
D3 A Run-key persistence alert fired on reg.exe The alert title said "script host", which pointed the analyst the wrong way Renamed the alert to "Run/RunOnce Key Modified", showing the actual writer

Each was validated both ways in the lab before being enabled:

  • D1 fired at 8 distinct tools on a replayed discovery burst; the busiest normal 10-minute window on any host had 1.
  • D2 caught the OP-003 hop, and only that: of 8,864 network/RDP logons over 7 days, 4,028 were loopback and 4,835 went to the domain controller, leaving exactly 1.

D1 firing: 8 distinct discovery categories

D1 fires on the replayed OP-002 discovery burst (8 categories, threshold 4).

D1 over a normal window: no results

The same search over a normal window: no results.

D2 firing on the OP-003 hop

D2 fires on the OP-003 hop: Windows10 ← 10.10.2.9 as labuser, type 3.

D2 selectivity: 8,864 logons sorted into loopback, domain controller and one workstation hop

Selectivity over 7 days: 8,864 logons, of which only 1 is workstation → workstation.

A blind re-run on 2026-09-30 then caught both D1 and D2 cold, in about 5 and 6 minutes. See Results.

Web attacks: from an IOC list to behavior (OP-005b)

OP-005 attacked a deliberately vulnerable web app (OWASP Juice Shop) behind a ModSecurity WAF running the OWASP Core Rule Set. Network signatures alerted on the scanning and the XSS, and an IOC-gated rule fired because the attacker's IP was on a known-bad list. But the WAF's own verdicts never raised an alert: the SQL injection that reached the database read only as a generic "server error". OP-005b built two detections to close that gap:

Detects How
W1 Any request the WAF scores as an attack Alert on CRS rule 949110 (Inbound Anomaly Score Exceeded): the WAF's own verdict that a request's anomaly score crossed the threshold. No signature per attack, no IP list
W5 Login brute force One failed login is normal; 8 failures from one IP within 2 minutes is the attack. Grouped per source, so a second attacker gets their own alert

The test that matters for W1: the same attack was run twice, once with the attacker's IP on the IOC list and once with it removed. On the list, both the old rule and W1 fired. Off the list, W1 fired and the IOC rule stayed silent: the behavior layer caught the attacker the IOC layer missed. And the SQL injection from OP-005, sent again with W1 live, now raises a level-10 alert where it used to be logged-only.

The same SQL injection, before and after W1: the WAF flags it as an attack (CRS 949110); the old generic rule 31122 only reports a level-5 server error; W1 (rule 510160) raises a level-10 web attack alert. Retested live on 2026-11-15.

Proving W1 is quiet, not just silent. A week without false alerts meant little: nobody had used the app. Replaying W1's logic over all of WEB01's history, and then using the app as a normal visitor, showed three of Juice Shop's own requests scoring as attacks: an HTTP PUT, Socket.IO's text/plain posts, and an API path named whoami (also a Unix command). The fix went into the WAF's policy, not the detection. Afterwards 66 normal requests raised nothing, and the attacks still raised W1.

W1 rule 510160 firing in wazuh-logtest

W1 (510160) fires on the attack event in wazuh-logtest: level 10, T1190.

W1 fires with the attacker off the IOC list

Attacker removed from the IOC list: W1 fires, the IOC-gated rule stays silent.

W5: one brute-force alert over nine failed-login events

W5: a 10-attempt burst gives one level-10 brute-force alert over the level-3 failed logins.

W5 stays quiet on three failures

Three failures: only the failed-login events, no brute-force alert.

Tuning W5 for production, not for the demo. The first version alerted twice per burst. Suppressing repeats with a global ignore would have also hidden a second attacker during the quiet period, so the threshold was raised instead (one alert per burst, still per source), and grouping alerts into one incident is left to the SOAR layer, where it belongs.

Inventory

Detection ATT&CK Formats Origin
Clustered native discovery (D1) T1033 · T1082 · T1016 · T1057 · T1087 · T1018 Splunk · Sigma correlation OP-002 → OP-004
Workstation-to-workstation logon (D2) T1021.002 · T1550.002 · T1078 Splunk · Sigma OP-003 → OP-004
Run/RunOnce key written by script host or LOLBin (D3) T1547.001 Splunk · Sigma OP-002 → OP-004
Run/RunOnce key written by a script host T1547.001 Wazuh 510150 PB-012 · OP-001
PowerShell with ExecutionPolicy Bypass T1059.001 Wazuh 510140 · Sigma PB-003
Defender Tamper Protection blocked a change T1562.001 Wazuh 510142 · Sigma PB-005 · OP-001
Rundll32 spawned by PowerShell T1218.011 Wazuh 510143 · Sigma PB-009
Connection to a controlled IOC IP (none on purpose) Wazuh 510144 PB-010 · PB-017 · PB-019
Brute force, password spray, lockout, success-after-brute-force T1110.001 · T1110.003 · T1078 Wazuh 510120–510122, 510130–510133 PB-001 · PB-002
WAF inbound anomaly score exceeded (W1) T1190 Wazuh 510160 · Sigma OP-005b
Web login brute force, per source IP (W5) T1110.001 Wazuh 510161–510162 · Sigma correlation OP-005b

Example: D2 in Sigma

detection:
  selection_logon:
    EventID: 4624
    LogonType: [3, 10]
  selection_target_workstation:
    Computer: ['Win10.soc.lab', 'WIN11-OPS01.soc.lab', 'WIN11-PB026.soc.lab']
  selection_source_workstation:
    IpAddress: ['10.10.2.4', '10.10.2.9', '10.10.2.8']
  filter_loopback:
    IpAddress: ['127.0.0.1', '::1', '-']
  condition: all of selection_* and not filter_loopback

And its tests: the OP-003 hop must fire; a workstation logging on to the domain controller, a loopback logon, a console logon and a failed logon must not.

How the testing works

  • Sigma rules are parsed by pySigma, converted to Splunk, and checked against their sample events by a small evaluator built on pySigma's own parser. The correlation rule is tested with a sliding 10-minute window, including a burst that crosses a clock boundary.
  • Wazuh rules are checked for unique IDs in the lab's range, a parent rule and an ATT&CK tag, and their field patterns are run against sample alerts.
  • To show the tests catch mistakes, I broke rules on purpose (dropped an exclusion, raised a threshold, changed a process name). Each change made a test fail.

Known issues I found in my own rules

Publishing the live Wazuh file meant reading it line by line, then testing each rule live. 510140 (ExecutionPolicy Bypass) turned out to be silently dead on the newest endpoint: another rule pack had taken over its parent event, so it was never evaluated. Four more rules had the same outcome for other reasons: 510130/510131 (brute force, spray) compared a source-IP field Wazuh never fills in on Windows events; 510122 (lockout) hung off the logon-success rule, which lockout events never reach; and 510132 ("successful login after brute force") never checked for a successful logon at all. All are fixed and re-validated live (2026-10-12), as is 510133, which was labeled "lateral movement" but only counted three failed logons; it is now an honest low-severity brute-force early warning. Each finding is written up with its fixes in the detections README.

Limits

D2 v2 (2026-10-13) reads its workstations from a lookup and caught two live WIN11-PB026 hops that v1 would have missed. Testing also found that WIN11-OPS01 had been cloned from PB026 without Sysprep (same machine SID), so logons between the two always failed; PB026 was Sysprepped and the hop now works. The Wazuh parent rule and decoder only run on a real Wazuh manager, and the Splunk searches were validated against live lab data rather than in CI. Sample events are representative events based on lab validation runs, not raw log exports.