Detection engineering
Detection-as-code pipeline
Built a Sigma pipeline that tests, validates, and converts detection rules to KQL for Sentinel and Defender before anything merges.
Five detections mapped to MITRE ATT&CK. Four are Sigma rules in the pipeline: password spray (T1110.003), brute force (T1110.001), malicious inbox rules (T1098.002, T1114.003), and OAuth consent grant abuse (T1528). The fifth, impossible travel (T1078), is a KQL query in the companion catalog.
The problem
Detection logic written as one-off SIEM queries is unreviewable and quietly rots. It needed to live in version control with the same gates as application code.
What I built and owned
Runs on every pull request that changes a rule, the pipeline, or the tests, and on every push to main.
Review. Validate. Convert.
Every pull request that touches a rule, the pipeline, or the tests, and every push to main, runs four gates in GitHub Actions: rule requirement tests in pytest, Sigma syntax validation, conversion to KQL through a pipeline that maps each log source to its Sentinel table, and an uploaded query artifact for review.
One detection, two forms
The same password-spray detection for T1110.003, written twice. The Sigma rule is the portable source that CI validates and converts; it matches the failed sign-ins and is still marked experimental. The catalog query is the Sentinel version: it adds the ten-account threshold, ships with its own validation steps, and is marked stable in the catalog.
title: Azure AD Password Spray From Single Source
id: 7f1c2e90-3b4a-4d77-9b21-2c6f5a8e1d44
status: experimental
description: >
Detects a single source address failing authentication across many
distinct accounts in a short window, the signature of a password spray.
references:
- https://attack.mitre.org/techniques/T1110/003/
author: Edward Griggs
date: 2026/06/23
logsource:
product: azure
service: signinlogs
detection:
selection:
ResultType:
- '50126' # invalid username or password
- '50053' # account locked
condition: selection
timeframe: 30m
fields:
- IPAddress
- UserPrincipalName
- ResultType
falsepositives:
- Shared corporate egress IP behind NAT
- Applications replaying stale credentials
level: high
tags:
- attack.credential-access
- attack.t1110.003
// T1110.003 - Password Spray Detection
// Surfaces a single source failing authentication across many distinct
// accounts inside a short window, the signature of a low-and-slow spray.
//
// Tactic: Credential Access
// Technique: T1110.003 (Password Spraying)
// Source: SigninLogs (Microsoft Entra ID)
let lookback = 1h;
let sprayWindow = 30m;
let accountThreshold = 10; // distinct accounts targeted from one source
SigninLogs
| where TimeGenerated > ago(lookback)
| where ResultType in (
"50126", // invalid username or password
"50053", // account locked from repeated failures
"50055" // expired password presented
)
| summarize
FailedAttempts = count(),
TargetedAccounts = dcount(UserPrincipalName),
AccountList = make_set(UserPrincipalName, 100),
ResultCodes = make_set(ResultType)
by IPAddress, bin(TimeGenerated, sprayWindow)
| where TargetedAccounts >= accountThreshold
| project TimeGenerated, IPAddress, TargetedAccounts, FailedAttempts, AccountList, ResultCodes
| order by TargetedAccounts desc
ATT&CK coverage
Five detections across the two repositories, four of them as Sigma rules. Status is the KQL catalog status from each detection’s metadata, so work still in tuning is labeled as such.
| Detection | Technique | Sigma | Catalog status |
|---|---|---|---|
| Password spray from a single source: Password spray from a single source detection on GitHub (opens in a new tab) | T1110.003 | YES | Stable |
| Brute force against a single account: Brute force against a single account detection on GitHub (opens in a new tab) | T1110.001 | YES | Stable |
| Suspicious inbox rule creation: Suspicious inbox rule creation detection on GitHub (opens in a new tab) | T1098.002 · T1114.003 | YES | In tuning |
| OAuth consent grant abuse: OAuth consent grant abuse detection on GitHub (opens in a new tab) | T1528 | YES | Experimental |
| Impossible travel: Impossible travel detection on GitHub (opens in a new tab) | T1078 | NOT YET | In tuning |