Sigma detection rules that are checked on public logs before they are merged. A rule must fire on the attack logs listed in its test cases and stay silent on normal activity. Each rule comes with a detection card that covers its blind spots, false positives and triage steps.
- Repository layout
- How a rule is checked
- Detection cards
- Quick start
- Converting rules for a SIEM
- Adding a rule
- Sources
- License
| Path | Contents |
|---|---|
detections/ |
Rules grouped by platform, one folder per rule |
tests/ |
pytest checks for rules, test cases and cards |
tools/ |
Log readers, SQLite replay, card parser, goodlog script, pinned ATT&CK release |
.github/workflows/ |
CI and the weekly ATT&CK release check |
Every rule folder has the same three files:
detections/<platform>/<name>/
├── <rule>.yml Sigma rule, file named as in SigmaHQ
├── tests.yml test cases: log URL, sha256, what the rule must find
└── README.md detection card
| Check | What it does | Runs in |
|---|---|---|
tools/sigma_check.py |
Runs sigma check: syntax, rule IDs and ATT&CK tags against the release pinned in tools/attack.py |
pre-commit, CI |
tests/test_detections.py |
One rule and one tests.yml per folder, at least one case the rule must fire on and one it must stay silent on |
pre-commit, CI |
tests/test_logs.py |
Runs the rule over the logs from tests.yml. pySigma converts the rule to SQL and SQLite runs it over the parsed events |
pre-commit, CI |
tests/test_cards.py |
The card follows the ADS section order, its title, ATT&CK tags, level and links match the rule, its example event exists in the test logs | pre-commit, CI |
tools/goodlog.sh |
Runs all rules over clean Windows logs from evtx-baseline with evtx-sigma-checker. A hit fails the run unless it is listed in tools/goodlog-known-fps.csv |
CI, five baselines |
tools/attack_update.sh |
Opens an issue when MITRE has an ATT&CK release newer than the one pinned in tools/attack.py |
CI, weekly |
Test logs and the ATT&CK release are downloaded into .cache/ and checked against their
sha256. They are not stored in the repo.
When MITRE publishes a new ATT&CK release, the weekly check opens an issue. Set VERSION and
SHA256 in tools/attack.py to the new release and run the checks.
The README.md next to each rule follows the
Palantir Alerting and Detection Strategy framework:
Goal, Categorization, Strategy Abstract, Technical Context, Blind Spots and Assumptions,
False Positives, Validation, Priority, Response, Additional Resources.
Validation names an Atomic Red Team test that makes the rule fire and lists the results on the
test logs. Example: LSASS memory access.
You need Python 3.12 and uv. goodlog also needs bash, curl, tar and Linux on x86-64, since it runs a Linux binary. On Windows use WSL.
git clone https://github.com/Dubwaay/detection-as-code.git
cd detection-as-code
uv sync --locked
uv run pytest
uv run python -m tools.sigma_check -i $(find detections -name '*.yml' ! -name tests.yml)Run the rules over a clean baseline. The baseline and the checker are downloaded once into
.cache/goodlog/:
tools/goodlog.sh win10-clientBaselines: win10-client, win2022-ad, win11-client, win2022-0-20348-azure, win2022-evtx.
Run the same checks on every commit:
uv tool install pre-commit
pre-commit installUse sigma-cli with the backend for your SIEM. For Splunk:
uvx --from sigma-cli==3.1.0 --with pysigma-backend-splunk==2.1.0 --with pysigma-pipeline-sysmon==2.0.0 \
sigma convert -t splunk -p sysmon detections/windows/lsass_memory_access/proc_access_win_lsass_memory_access.ymlThe sysmon pipeline turns the Sigma log source into Sysmon event IDs. Add the index or
source of your Sysmon data to the search. Backends for other SIEMs are listed in the
pySigma docs.
- Create
detections/<platform>/<name>/and put the Sigma rule there. Name the file as SigmaHQ does, for exampleproc_creation_win_<name>.yml. - Add
tests.ymlwith at least one log the rule must fire on (min_results) and one it must stay silent on (max_results: 0). The format is defined intools/cases.py. Logs are read bysourcetype.tools/logs.pyhas readers forXmlWinEventLog, the Windows event logs in splunk/attack_data, andlinux_audit, a raw Linux audit.log. A log can be one file inside a zip archive: setmemberto its path. - Add
README.mdwith the detection card. An existing card shows the expected sections. - Run
uv run pytest, andtools/goodlog.shfor Windows rules. - Open a pull request. CI runs the same checks.
- Sigma specification, pySigma and sigma-cli.
- splunk/attack_data (Apache-2.0): attack logs for the test cases.
- CAM-LDS (CC BY 4.0): Linux audit logs of attack scenarios for the test cases. M. Landauer et al., CAM-LDS: Cyber Attack Manifestations for Automatic Interpretation of System Logs and Security Alerts, International Journal of Information Security, 2026.
- NextronSystems/evtx-baseline (Apache-2.0): clean Windows logs and evtx-sigma-checker for goodlog.
- SigmaHQ/sigma:
tests/thor.yml, the mapping of Sigma log sources to Windows channels used by goodlog. - Atomic Red Team (MIT): tests named in the cards to make a rule fire.
- Splunk BOTS v1, v2 and v3 (CC0): extra checks in Splunk, results are in the cards.
- Palantir ADS framework (MIT): the card format.
- MITRE ATT&CK, STIX data from attack-stix-data.
MIT, see LICENSE. Downloaded data keeps the license of its source.