Skip to content

About

An ATT&CK coverage report that counts a detection only when its log source is onboarded, every field it reads is populated, and it fires on an emulated sample of its technique.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

coverproof

CI

coverproof

coverproof computes MITRE ATT&CK coverage from evidence instead of from rule tags. It reads a directory of Sigma-style detection rules, a data-source registry, an asset inventory and JSONL telemetry samples, and counts a rule only when its log source is onboarded, every field it reads is populated, it fires on an emulated sample of its technique and it stays silent on a benign baseline. Scores are scaled by the worst field fill rate and host coverage the rule depends on. The output is a paper-versus-effective table per tactic, an ATT&CK Navigator layer and a gap report that says which OU or field to fix. All telemetry in this repository is synthetic.

The problem

A detection engineering team reports ATT&CK coverage to its CISO by counting rules tagged with each technique. A rule that reads CommandLine from process-creation events counts as coverage even when command-line auditing is switched off for a whole OU, when the log source was never onboarded, or when a misspelled field name means the rule has never matched anything. The heat map is green while the SOC is blind, and nobody finds out until an incident review.

How it works

flowchart LR
    R[Sigma-subset rules] --> M[Rule matcher<br/>fields read, negated-only fields]
    G[Data-source registry<br/>and asset inventory] --> P[Field profiler<br/>fill, host coverage, fill by OU]
    T[Telemetry samples<br/>JSONL per stream] --> P
    E[Emulation samples<br/>per technique] --> X[Run on emulation<br/>and benign baseline]
    B[Benign baseline sample] --> X
    R --> X
    M --> V[Per-rule verdicts<br/>blind, broken, unvalidated,<br/>noisy, degraded, validated]
    P --> V
    X --> V
    V --> S[Per-technique scores<br/>and sub-technique rollup]
    S --> L[Navigator layer]
    S --> Q[Tactic table]
    S --> H[Gap report]
Loading

Each rule gets exactly one verdict, decided in this order:

  1. blind: the log source is not onboarded, not in the registry, or its stream has no events.
  2. broken: a field read in a positive selection never occurs in the stream after aliasing.
  3. unvalidated: the rule does not fire on its technique's emulation sample.
  4. noisy: the rule fires on the benign baseline sample.
  5. degraded: the lowest field fill rate is below 0.9, or host coverage is below 0.8.
  6. validated: none of the above.

The effective score of a validated or degraded rule is 100 x min field fill x host coverage; any other verdict scores 0 and records its blocking reason. A technique's score is the maximum over its rules, and it is the score of the rule with the highest score. A parent technique with listed sub-techniques is partial when only some of them are covered, never covered, unless the parent carries a covered rule of its own (see Design decisions).

Quick start

Requires Python 3.12 or newer.

python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"

examples/demo.sh          # generate telemetry, profile, assess, write the layer, list gaps
pytest -q                 # run the tests

The commands behind the demo, with the bundled rules/, emulation/ and registry.yml as defaults:

python -m coverproof.synth --out out/data        # seeded synthetic telemetry (seed 11)
coverproof profile                               # fill rates, host coverage, fill by OU
coverproof assess                                # paper-versus-effective table (--json available)
coverproof layer --out out/layer.json            # ATT&CK Navigator layer, format 4.5
coverproof gaps                                  # blocking reason and fix for each technique

Rules use a documented Sigma subset: title, id, status, logsource, named selections (a map is AND, a list of maps is OR), the modifiers contains, startswith, endswith, re and all, and conditions with and, or, not, parentheses, 1 of sel* and all of them. Anything else (aggregations, timeframe, other modifiers, keyword lists, wildcards in plain values) raises an error that names the rule and the construct. Each rule carries exactly one attack.tNNNN or attack.tNNNN.NNN tag.

Example output

The synthetic estate has 120 hosts (100 Windows in four OUs, 20 Linux), five onboarded streams and about 20,000 events. 30 rules cover 18 techniques. Output of examples/demo.sh:

coverproof profile:

| Stream | Onboarded | Events | Hosts | Host coverage | Fields under 90% fill |
|---|---|---|---|---|---|
| dns | no | 0 | 0/120 | 0.00 | - |
| linux_auditd | yes | 1900 | 19/20 | 0.95 | - |
| web_proxy | yes | 4320 | 108/120 | 0.90 | - |
| win_powershell | yes | 2800 | 70/100 | 0.70 | - |
| win_process | yes | 6000 | 100/100 | 1.00 | process.command_line 55.0% (Stores 0.0%) |
| win_security | yes | 3000 | 100/100 | 1.00 | - |

coverproof assess, per tactic:

## By tactic

| Tactic | Techniques | Paper | Validated | Degraded | Unvalidated | Noisy | Broken | Blind | Paper % | Effective % |
|---|---|---|---|---|---|---|---|---|---|---|
| Initial Access | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0% | 0% |
| Execution | 4 | 3 | 2 | 0 | 0 | 0 | 1 | 0 | 75% | 48% |
| Persistence | 4 | 2 | 1 | 1 | 0 | 0 | 0 | 0 | 50% | 38% |
| Privilege Escalation | 2 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 50% | 48% |
| Defense Evasion | 3 | 3 | 1 | 1 | 1 | 0 | 0 | 0 | 100% | 55% |
| Credential Access | 3 | 2 | 1 | 1 | 0 | 0 | 0 | 0 | 67% | 52% |
| Discovery | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0% | 0% |
| Lateral Movement | 4 | 2 | 1 | 0 | 0 | 1 | 0 | 0 | 50% | 25% |
| Command and Control | 4 | 4 | 2 | 0 | 0 | 0 | 0 | 2 | 100% | 46% |
| Exfiltration | 2 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 50% | 45% |
| Total | 30 | 18 | 10 | 3 | 1 | 1 | 1 | 2 | 60% | 38% |

Paper: 18 of 30 techniques in the subset have a tagged rule (12 have none). Effective: 10 validated, 3 degraded, 2 blind, 1 broken, 1 unvalidated, 1 noisy.

coverproof gaps excerpt for the command-line and DNS techniques:

## T1003.001 LSASS Memory (credential-access): degraded, effective score 55.0
- Rule `CP-020` Process memory dumped with comsvcs MiniDump
  - Reason: CommandLine (process.command_line) is populated on 55.0% of win_process events; below 90% in OU Stores 0.0%
    Fix: Enable collection of process.command_line on win_process hosts in OU Stores

...

## T1071.004 DNS (command-and-control): blind, effective score 0.0
- Rule `CP-025` DNS query with a very long machine-generated label
  - Reason: log source dns (category=dns) is declared but not onboarded, so CP-025 sees no events
    Fix: Onboard category=dns (rule reads QueryName)

All 18 techniques are tagged on paper. Counted from evidence, 10 are validated, 3 are degraded, 2 are blind, and one each is broken, unvalidated and noisy.

Design decisions

  • Evidence over tags. A rule must run, on real-shaped events, against both an emulation sample and a benign baseline. This costs the emulation samples (3 to 10 events per technique) but it is the only way to catch a selection that cannot match, such as endswith: '\powershell' without .exe.
  • Fields under not are tracked separately. A missing field never matches a selection, so an exclusion on an absent field excludes nothing. Such a rule is not marked broken, because its positive selection still works; the absence is recorded as a reason and shows up as noise on the baseline. The fix text points at the missing alias.
  • Score is a product, not an average. min fill x host coverage makes the weakest dependency decide, which matches how a detection actually fails: it needs every field on every host. The cost is that one sparse field caps a rule even when other fields are fine.
  • Sub-technique rollup is explicit. A parent is covered only when every sub-technique listed in the bundled subset is covered, so "partial" is a statement about that subset of about 40 techniques, not about the full ATT&CK matrix. The "Effective %" column is the mean score over the techniques in the subset that are leaves or carry their own rule.
  • A parent's own rule counts. A parent technique that carries a covered rule of its own rolls up as covered even when only some of its listed sub-techniques are covered; partial applies to parents without such a rule.
  • Fill rate is per stream. It is computed over every event in a stream, so a field that exists only on some event codes (for example win_security mixes 4624 and 4625) is scored against all of them.
  • contains|all on list fields. For a field whose value is a list, every pattern must match the same list element, not any element. The bundled data uses string values, so it is not affected.
  • The baseline shares the telemetry shape, not its gap. Benign process events in the baseline always carry command_line, including for hosts in OU Stores, so the baseline does not reproduce that planted gap.
  • A small Sigma subset with loud failures. Implementing a subset keeps the matcher easy to verify against truth tables, and rejecting everything else prevents a rule from silently meaning something different than its author intended. Rules written for a full Sigma backend need adapting.
  • Deterministic by construction. The generator uses only random.random() from a seeded generator and a synthetic clock, and every report sorts on a unique key, so the output is identical across Python versions and machines.

Testing

GITHUB_ACTIONS=true CI=true COLUMNS=80 pytest -q

124 tests pass. They cover the condition parser and evaluator against hand-written truth tables for 1 of sel* and not filter, all of them and nested parentheses on 12 crafted events, each modifier with positive and negative fixtures, exact field extraction for five rules, the profiler on hand-built samples and on the generated telemetry, every verdict in the precedence order with its boundary values, the technique rollup, a hand-derived table of per-technique status and score, the totals (18 on paper; 10 validated, 3 degraded, 2 blind, 1 broken, 1 unvalidated, 1 noisy), the CLI, and a byte-for-byte comparison of the Navigator layer with tests/golden/layer.json. Hypothesis properties check that the matcher agrees with Python string operations and boolean logic.

If a change to the rules, registry or generator moves the layer on purpose, regenerate it with python -m coverproof.synth --out out/data && coverproof layer --out tests/golden/layer.json.

Project layout

src/coverproof/
  rules.py       Sigma-subset loader, condition parser, field usage
  matcher.py     event evaluation, nearest-miss diagnostics
  registry.py    data-source registry and asset inventory
  telemetry.py   stream profiler: fill, host coverage, fill by OU
  verdict.py     per-rule verdicts and effective score
  attack.py      bundled ATT&CK subset, technique scores, rollup
  report.py      tactic table, Navigator layer, gap report
  pipeline.py    loads inputs and runs the assessment
  synth.py       seeded synthetic telemetry generator
  cli.py         profile, assess, layer, gaps
  data/attack.json
rules/           30 detection rules
emulation/       one JSONL sample per technique
registry.yml     log sources, streams and field aliases
examples/demo.sh
tests/

License

MIT. See LICENSE.

About

An ATT&CK coverage report that counts a detection only when its log source is onboarded, every field it reads is populated, and it fires on an emulated sample of its technique.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages