Files
AiSOC/scripts/detection_specs.py
T
Beenu Arora 98883d9229 fix(integrity): close the no-writer defects and consolidate the case tables (#1108)
* fix(integrity): the wave-0 defects where a writer never existed

Eight mechanisms that were complete, tested and unreachable because the
table or column they depended on had nothing writing to it. A unit test
cannot see any of this: the code was correct, and the data never arrived.

**SSO could not sign anyone in.** `aisoc_sso_connections` has existed
since migration 080, `sso_provisioning.resolve_connection` selects from
it on every SAML and OIDC callback, and no code path anywhere wrote a
row — so both handlers raised SsoProvisioningError and answered 403 on
every deployment. There is now a tenant-scoped CRUD surface for it. The
role mapping is held to `role_grants.authorize_role_grant` rather than a
local list, because a connection is a standing grant to everyone who can
authenticate against that issuer and must meet the same bar as creating
one user with that role.

**The OIDC id_token was never verified.** It was decoded with
`verify_signature: False` under a comment saying to use JWKS in
production, and the nonce was generated, sent, and never compared. An
unverified id_token is a base64 blob anyone can author, and its claims
were merged into the identity. It is now verified against the provider's
published JWKS with issuer, audience and expiry checked, and a token
that fails is discarded rather than downgraded. The state store moved to
Redis: as a process dict it broke roughly (n-1)/n of sign-ins on an
n-replica deployment, because the browser returns to whichever instance
the load balancer picks.

**MTTA was a fabricated zero.** `alerts.first_seen_at` had no writer, so
`/insights/soc` and `/metrics/soc` averaged over NULL and published a
confident `0.0` — which reads as instant acknowledgement. It is now
written when an analyst claims an alert, with COALESCE so a re-claim
after a release does not reset the clock to measure the last handoff.

The openapi-breaking gate then caught me making those means nullable,
which was right: `/metrics/soc` had already taken this decision and
documented it on `mttd_sample_count`, choosing a denominator alongside
the mean precisely because nullable is a breaking response change. So
`InsightTile` grows `sample_count` the same way, the console renders
"not measured" when it is zero, and a delta is withheld when either
window measured nothing. Zero breaking changes against the v15.1.0 spec.

**The evidence chain was always empty.** Three readers, no writer, so
`GET /cases/{id}/evidence` returned `[]` under a heading saying
"Evidence Chain" — which an auditor reads as "no evidence was handled".
Entries are now appended on alert links and status changes, hash-chained
so an edit or a removal is detectable. It is tamper *evidence*, not
tamper proofing — anyone who can write the column can rewrite every
link consistently, and a test asserts exactly that so nobody concludes
otherwise.

**SLA reporting had nothing to aggregate.** `alert_sla_events` had one
writer, a manual POST nothing calls, so 350 lines of correct MTTD/MTTR/
MTTC arithmetic ran over an empty table everywhere. `acknowledged` is
emitted on claim and `resolved` on disposition; `detected` is backfilled
from the alert's own `created_at` rather than emitted by fusion, so the
ingest hot path is not coupled to reporting and the pair is always
complete.

**The console's Approve button could not succeed.** `/decide` answers
412 without a `candidate_rule` verdict and `/evaluate-rule` is its only
writer, which had no web client. The deeper half: fixtures were never
persisted, so even calling it directly meant re-deriving fixtures the
drafter had already produced and discarded. Migration 082 stores them on
the proposal, the eval falls back to them, and the console runs the gate
before approving.

**Marketplace installs were lost on restart** and disagreed between
replicas. `marketplace_installs` has existed since migration 056 with
the right columns and a UNIQUE constraint, and had no reader or writer.

29 tests, 10 of them against real Postgres because reachability is not
observable from a double. The negative control is recorded: reverting
migration 082 fails exactly the two fixture tests and no others.

`AlertAssetCorrelation` is still unwired and is deliberately left for
wave 11, where linking alerts to assets is what lets criticality reach
prioritisation instead of a prompt string.

One correction to the survey this plan was built from: `python3-saml`
*is* declared in `services/api/pyproject.toml` and present in the
lockfile. That half of the SAML finding was already fixed.

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>

* fix(cases): one case table, and one status vocabulary

The product shipped with two case tables that never synchronised. The
console wrote `aisoc_cases`; `resolution_time` — which owns the single
shared MTTR definition — read `cases`, as did `metrics`, `insights`,
`executive_digest`, `mssp_portfolio` and the GraphQL layer.

So every case an analyst created was invisible to every case metric. A
tenant could close fifty cases in the console and watch MTTR stay null,
and `cases_opened_7d` and `cases_closed_7d` counted only KEV-exposure
sweeps, scheduled-hunt cases and demo seed rows. Nothing errored. Both
tables existed, both queries were valid, and the symptom was an empty
number with no explanation attached.

Migration 083 widens `aisoc_cases` with the fifteen columns the ORM
model needed, moves the rows across, repoints the child foreign keys and
renames the old table to `cases_pre_consolidation` rather than dropping
it — a consolidation that lost a row nobody noticed is worse than two
tables. `alert_ids` is unpacked element by element rather than cast,
because `cases` stored JSONB where `aisoc_cases` stores `uuid[]` and a
cast would fail the whole migration on one malformed entry.

The second half matters as much as the first. The readers filtered
`status == "open"` and `status == "in_progress"`, and the console's
machine is new → triaged → investigating → contained → resolved →
closed. Neither of those states can exist, so both counters were
structurally zero rather than merely empty. And `resolved` is not
terminal: a case moves resolved → closed, only that last transition
writes `closed_at`, so counting "closed this week" as `status =
'resolved'` counted cases still on a queue and missed every one that
finished — clocked off `updated_at`, which moves whenever anyone edits
the case. Both now read from `app.services.case_status`, which the cases
endpoint imports too, so there is one copy.

`scripts/check_one_case_table.py` asks both questions. Writing it was
worth it twice over: it found four more reads of the retired table and
fourteen impossible statuses in the demo seed that I had missed by
grepping. Its first draft was case-insensitive and flagged the English
"Create and update cases" in a permissions seed, so it now strips
comments and matches SQL keywords case-sensitively — a gate with false
positives is one people learn to skip.

Negative control recorded: reintroducing a single `FROM cases` fails it
with the file and line.

Repointing the ORM alone was not enough, and the way it failed is worth
keeping. `case_tasks` and `case_timeline_events` both declared
`REFERENCES cases(id)`, so SQLAlchemy could not resolve `Case.tasks` at
mapper-configuration time and 257 tests failed at once on models that
have nothing to do with cases.

7 live tests against real Postgres, because the defect was entirely in
which table a query named — every unit test passed throughout, each
testing its query against whichever table the test itself seeded.

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>

* feat(benchmark): a corpus that can actually grade an agent

An agent answering "true positive" to everything, without reading
anything, used to score **1.000** on this corpus. It now scores 0.727,
and that gap is the only reason any accuracy figure from it means
anything.

Three defects, and the second is the one nobody had named.

**The vocabulary did not match the scorer.** The corpus used
`malicious | suspicious | benign`; `replay` grades
`true_positive | benign_true_positive | false_positive | benign`. One
label of four in common, so the corpus was ungradeable by this package's
own scorer and nothing noticed.

**The benign class was fictitious.** `build_corpus._disposition` derived
it from `response_class == "monitor"`, and those eight incidents are
BloodHound domain enumeration tagged T1087.002 at medium severity. That
is a real attack with a monitoring response. Labelling it benign
conflates "low-severity threat" with "not a threat", which is the
distinction a triage agent exists to make. `response_class` says which
action to take and nothing about whether the finding was true.

So `corpus/benign_cases.py` authors one: fifteen shapes expanded to
seventy-five cases, split `benign` (the activity happened and was
authorised) from `false_positive` (the activity did not happen as
characterised) because those need different actions — an allowlist entry
versus a rule fix.

The cases deliberately look like attacks. PsExec at 02:00 inside a
change window, encoded PowerShell from a build agent, Nmap from the
scanner subnet, mimikatz on the detection-engineering lab. A benign
corpus of obviously boring events measures formatting, not judgement,
and the distinguishing evidence is in the content — a change ticket, a
known service account — which is what an analyst reads. They span
severities including critical, so the classes are not separable on
severity alone.

Four reference agents now land on four distinct scores: 0.727 for
always-malicious, 0.182 for always-benign, 1.000 for perfect, 0.473 for
a coin flip. If any two collapsed the corpus would not be measuring
anything.

**423 of 878 negative fixtures tested an impossible value.** They were
`f"not-{expected}"` — proving a rule ignores a string that cannot occur,
which is not what a false positive is. The fields carrying them are
enumerated (`event_type` 267, `event_name` 54, `syscall` 50), so the
generator now harvests each field's real vocabulary from the positive
fixtures and builds negatives from a different *real* value. 423 became
18, all 1,756 fixtures still replay correctly through the real engine,
and the fix is in the generator because the fixtures regenerate.

Also added: `false_negatives`, `false_negative_rate` and
`false_negative_verdicts` as named fields. All three are derivable from
the confusion matrix, and a reader should not have to compute the number
that matters most — a missed attack — from the one that reads best.
The verdict breakdown separates "it abstained on 40" from "it called 40
benign", which are different failures with different fixes.

**One finding worth separating out: the corpus shipped three real
routable address ranges**, 138 occurrences, including 185.220.101.0/24 —
a known Tor exit range — plus 45.142.122.x and 91.134.231.x. This corpus
is published and read by third-party agents through the benchmark
adapter, so an agent exercised on it could propose blocking an address
that belongs to somebody, and a reader could go and scan them. Replaced
with RFC 5737 documentation ranges at every generator, and a test now
refuses any address outside the documentation and private ranges.

The two injection-corpus digests moved as a result, which is the pinning
guard working: the injection corpus is built from
`synthetic_incidents.json`, and its docstring says a change to a base
incident must not land unnoticed. Both updated in this commit alongside
the diff that caused them, and `check_injection_eval --check` confirms
the guard rates are unchanged.

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>

* style(benchmark): wrap an over-long note in the benign corpus

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>

* fix(ci): keep `cases` readable for external SQL, and three smaller breaks

Four CI findings, and the first is a real design correction rather than
a test fix.

**The upgrade test was right to fail.** Migration 083 renamed `cases`,
and `upgrade-test.yml` seeds a case on the previous minor then reads it
back by that name. Renaming the table is correct for our own code and
wrong for everyone else's: a self-hoster with a Grafana panel, a
scheduled export or any SQL of their own would silently start erroring
on upgrade. `cases` now comes back as a **read-only view** over
`aisoc_cases`. External readers keep working; our own source does not,
because `check_one_case_table.py` still refuses `FROM cases` in tracked
code. The gate governs what we write, the view governs what we already
told other people to rely on. Verified end to end: seed on the
pre-083 schema, migrate, and the row reads back under both names.

Deliberately not updatable — a write through the view would bypass the
six-state machine, and failing on INSERT beats accepting a row nothing
can transition.

**The wave-0 SSO tests passed locally and failed in CI, and the reason
is worth keeping.** My local Postgres connected as the superuser, who
bypasses RLS entirely; CI connects as the DML-only `aisoc_app` role,
where `WITH CHECK (tenant_id = current_tenant_id())` refuses an unbound
insert. The local database was the more permissive test double — the
same shape as an over-capable mock, in infrastructure. The tests now
bind the tenant as a real request does, and were re-run against the
DML-only role rather than the superuser.

**Two TypeScript errors** from fields declared on the wrong interface:
`sample_count` landed on a neighbouring type instead of `InsightTile`,
and `candidate_rule` was read off the eval verdict without being
declared on it.

**A mypy baseline regression I caused by over-reaching.** `ruff format
packages/` reformatted fifteen files across three packages I had no
business touching, which moved a plugin-SDK tree from 3 findings to 5.
Reverted to `origin/main`; the only package changes left are the
benchmark ones this branch is actually about. The one new baseline entry
is `import-not-found` on the new test, matching its two siblings
exactly — mypy runs `--no-site-packages`, so the package is not
importable by design.

Also corrected a comment naming `services/sla.py`, which does not exist;
the module is `services/api/app/services/sla.py`.

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>

* fix(cases): ship the consolidation as the breaking change it is

The compatibility view was the wrong answer and the migration
idempotency check is what proved it.

A read-only `cases` view over `aisoc_cases` keeps external SQL working,
which is why I tried it. But every historical migration that does
`ALTER TABLE cases` or `CREATE INDEX ... ON cases` then fails on re-run
against a view — `001_init.sql`, `002_rls.sql` and
`046_detection_rules_cases_schema_drift_fix.sql` all did — and guarding
each of them scatters one decision through the entire migration history.
I guarded `002` and two more immediately surfaced, which is the signal
to stop.

So `cases` is renamed and gone, and that is recorded as a BREAKING
change rather than smoothed over. Erroring is the better outcome
anyway: external SQL now fails with "relation does not exist" instead of
quietly returning the pre-consolidation rows, and a query that silently
returned stale data would be worse than one that stops.

The rename is now idempotent, which it was not. On a second pass
`001_init.sql` recreates `cases` empty through CREATE TABLE IF NOT
EXISTS, so migration 083 ran again with nothing to move and an archive
that already existed, and the rename collided. The empty recreation is
dropped instead, leaving the original archive intact. Three full passes
over every migration are now clean.

The upgrade test follows the data to `aisoc_cases` and additionally
asserts the archive is still readable, so a consolidation that lost a
row stays detectable after the fact.

Two more findings, both from gates and both real:

**`check_tenant_query_predicates` caught a bug, not a style issue.** The
new SSO create handler pre-checked issuer uniqueness with a
cross-tenant SELECT, and under RLS as the DML-only role that query only
sees the caller's own rows — so it could not detect the case it existed
for, and the insert would then fail with a raw integrity error instead
of a 409. It is check-then-insert besides, which races. The unique index
now raises and the handler turns that into the 409.

**`check_python_route_state` is shrink-only and caught the allowlist
entry for `_installed` going stale.** Its own justification said the
in-memory store would get a table "where parity plan 5.4 makes install
write rows" — that is done, so the entry goes.

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>

* fix(cases): four test references the gate was blind to, and a stale digest

**The gate skipped `/tests/`, which is exactly where the misses were.**
Four live references to the retired table survived in
`test_resolution_time_parity.py` and `test_mssp_portfolio_isolation.py`,
and CI found them against real Postgres rather than the gate written to
find precisely that. A test that seeds `cases` is a test asserting the
consolidation did not happen, so the exclusion is removed: coverage goes
from 1,248 files to 1,818.

The benchmark page's injection block was stale because the two corpus
digests moved when `synthetic_incidents.json` was regenerated with
documentation addresses. Refreshed with `--write-benchmark`: only the
digests changed, and the guard rates — 98.1% tuned, 7.1% held out — are
identical.

On the remaining local failures: `tests/isolation/test_route_tenant_scope.py`
passes alone and fails in a whole-suite run. That is pre-existing test
pollution, not this branch — clean `origin/main` fails 22 in the same
invocation where this branch fails 9.

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>

* fix(cases): the reference the gate could not see, and the shape it now can

CI found a `DELETE FROM cases` after a literal search of every tracked
file came back clean, which is the interesting part. The table name was
not written out:

    for table in ("alerts", "cases", "connectors"):
        session.execute(text(f"DELETE FROM {table} WHERE tenant_id = ..."))

A string in a tuple, interpolated into SQL one line later. No grep for
`FROM cases` can see that, and neither could the gate written to catch
exactly this class.

So the gate now looks for the second shape too — and the way it was
narrowed matters as much as adding it. The first version flagged any
`"cases"` literal before a comma or bracket and produced 22 findings,
**every one a false positive**: the `/cases` route prefix, a saved-view
type, the `cases:write` permission resource, a UI label. A gate that
cries wolf is one people learn to suppress wholesale. It now requires
the same file to interpolate a name directly into a SQL verb, which is
what turns a string in a list into a table. That took 22 findings to
one, and the one was real — a table/column map in `seed_demo.py` that
re-anchors demo timestamps.

Both detection shapes are proven by injection: reintroducing a bare
`FROM cases` and reintroducing an interpolated `"cases"` each fail the
gate with the file and line, and the tree is clean with neither.

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>

* fix(gate): ask git for the repository root, not the directory tree

`check_gate_contract` refused the new gate for resolving its root from
`__file__` and never asking git. It is right to: two levels above the
script is whatever happens to be there — a worktree, a release tarball,
a container build context — and a gate that certifies the wrong tree is
worse than one that fails. Uses `gate_toolkit.repo_root()` like every
other gate here.

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>

* fix(codeql): drop an unused logger in the new installs module

CodeQL #984, `py/unused-global-variable` at note severity. The module
declared a logger and then used it nowhere — the log calls went when the
error handling moved to the caller, and the handle stayed behind.

Worth noting the gate caught this on the PR *merge* ref rather than on
the branch head, which is the ref a reviewer is actually merging.

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>

* chore(security): lower the semgrep ceiling to the count this tree produces

103/39, down from 104/40. A real reduction, not the ±1 the file's own
note warns about: `main` reported exactly 40/104 on three consecutive
runs while this branch reported 39/103, so the delta is the tree rather
than the scanner. The finding that went is the unused module-level
logger removed in the previous commit.

Lowering locks the improvement in, which is what a shrink-only ratchet
is for. Raising one to make a scan pass is the thing that is never
allowed.

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>

---------

Signed-off-by: Beenu Arora <beenu.a.arora@gmail.com>
2026-10-03 11:40:41 -07:00

1099 lines
65 KiB
Python

"""
AiSOC Detection Pack v1 - Rule Specifications
==============================================
Single source of truth for the 200-rule curated detection pack.
Schema for each rule entry:
(slug, name, severity, mitre[], log_source, condition, false_positives[], playbook?, positive_fixture, negative_fixture)
Where:
positive_fixture = dict that the rule's condition should match
negative_fixture = dict structurally similar but specifically tuned to NOT match
The generator script (`scripts/generate_detections.py`) walks this table to
emit YAML rules + fixtures. Validator (`scripts/validate_detections.py`)
runs fixture-replay against this same table to ensure positive matches and
negative doesn't.
Distribution per plan:
cloud: 40
identity: 40
endpoint: 40
network: 30
application: 30
data-exfil: 20
-------------------
Total: 200
"""
from __future__ import annotations
# fmt: off
# =============================================================================
# CLOUD (40)
# =============================================================================
CLOUD: list[dict] = [
# AWS (15)
{
"slug": "aws-root-account-login",
"name": "AWS Root Account Console Login",
"description": "Detects any console sign-in event using the AWS root account. Root account usage outside of initial setup or emergency break-glass scenarios should trigger immediate investigation. Best practice requires MFA on the root account.",
"severity": "critical",
"mitre": ["t1078.004"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name", "user_type", "error_code"},
"match_when": {"event_name": "ConsoleLogin", "user_type": "Root", "error_code": None},
"fp": ["Break-glass emergency access (must be documented)", "Initial account setup (one-time)"],
"playbook": "tpl-privilege-escalation",
"positive": {"event_name": "ConsoleLogin", "user_type": "Root", "error_code": None, "src_ip": "203.0.113.7"},
"negative": {"event_name": "ConsoleLogin", "user_type": "IAMUser", "error_code": None, "src_ip": "203.0.113.7"},
},
{
"slug": "aws-iam-enumeration",
"name": "AWS IAM Enumeration Burst",
"severity": "high",
"mitre": ["t1087.004", "t1069.003"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_source", "event_name_count", "time_window_minutes"},
"match_when": {"event_source": "iam.amazonaws.com", "event_name_count_gt": 25, "time_window_minutes_lt": 5},
"fp": ["Compliance scanners (AWS Config, Prowler, CloudCustodian)", "IaC tools running plan/apply"],
"playbook": "tpl-cloud-recon",
"positive": {"event_source": "iam.amazonaws.com", "event_name_count": 60, "time_window_minutes": 3, "user_arn": "arn:aws:iam::111:user/contractor"},
"negative": {"event_source": "iam.amazonaws.com", "event_name_count": 4, "time_window_minutes": 5, "user_arn": "arn:aws:iam::111:user/admin"},
},
{
"slug": "aws-s3-public-bucket",
"name": "AWS S3 Bucket Made Public",
"description": "Detects when an S3 bucket ACL or bucket policy is modified to allow public read or public read-write access, which can lead to data exposure or unauthorised data exfiltration.",
"severity": "high",
"mitre": ["t1530"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name", "request_acl", "request_policy"},
"match_when": {"event_name_in": ["PutBucketAcl", "PutBucketPolicy"], "public_grant": True},
"fp": ["Static website hosting bucket (must be tagged purpose=public)", "Open data publication"],
"playbook": "tpl-data-exposure",
"positive": {"event_name": "PutBucketAcl", "public_grant": True, "bucket": "customer-pii"},
"negative": {"event_name": "PutBucketAcl", "public_grant": False, "bucket": "customer-pii"},
},
{
"slug": "aws-s3-bucket-deletion",
"name": "AWS S3 Bucket Deletion",
"severity": "high",
"mitre": ["t1485"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name"},
"match_when": {"event_name": "DeleteBucket"},
"fp": ["Automated cleanup of ephemeral testing buckets", "Decommission via change-control ticket"],
"playbook": "tpl-data-destruction",
"positive": {"event_name": "DeleteBucket", "bucket": "prod-backups", "user_arn": "arn:aws:iam::111:user/contractor"},
"negative": {"event_name": "DeleteObject", "bucket": "prod-backups", "user_arn": "arn:aws:iam::111:user/admin"},
},
{
"slug": "aws-ec2-launch-foreign-region",
"name": "AWS EC2 Instance Launched in Unauthorized Region",
"severity": "medium",
"mitre": ["t1578.002"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name", "aws_region"},
"match_when": {"event_name": "RunInstances", "aws_region_not_in": ["us-east-1", "us-west-2", "eu-west-1"]},
"fp": ["DR/failover testing (announced)", "Approved expansion to new region (change ticket)"],
"playbook": "tpl-cloud-anomaly",
"positive": {"event_name": "RunInstances", "aws_region": "ap-northeast-3"},
"negative": {"event_name": "RunInstances", "aws_region": "us-east-1"},
},
{
"slug": "aws-security-group-open-world",
"name": "AWS Security Group Opened to 0.0.0.0/0",
"severity": "high",
"mitre": ["t1190", "t1133"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name", "ip_range", "port"},
"match_when": {"event_name": "AuthorizeSecurityGroupIngress", "ip_range": "0.0.0.0/0", "port_in": [22, 3389, 3306, 5432, 1433, 6379]},
"fp": ["Public load balancers (must be tagged role=public-lb)", "WAF-protected origins"],
"playbook": "tpl-cloud-misconfig",
"positive": {"event_name": "AuthorizeSecurityGroupIngress", "ip_range": "0.0.0.0/0", "port": 22, "sg_id": "sg-prod-db"},
"negative": {"event_name": "AuthorizeSecurityGroupIngress", "ip_range": "10.0.0.0/8", "port": 22, "sg_id": "sg-prod-db"},
},
{
"slug": "aws-iam-policy-permissive",
"name": "AWS IAM Policy with Wildcard Action",
"severity": "high",
"mitre": ["t1078.004", "t1098.001"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name", "policy_action", "policy_resource"},
"match_when": {"event_name_in": ["PutUserPolicy", "PutRolePolicy", "AttachUserPolicy"], "policy_action": "*", "policy_resource": "*"},
"fp": ["Bootstrap admin role (one-time, change ticketed)", "Break-glass policy"],
"playbook": "tpl-privilege-escalation",
"positive": {"event_name": "PutRolePolicy", "policy_action": "*", "policy_resource": "*", "role": "deploy-bot"},
"negative": {"event_name": "PutRolePolicy", "policy_action": "s3:GetObject", "policy_resource": "arn:aws:s3:::reports/*", "role": "deploy-bot"},
},
{
"slug": "aws-kms-key-disable",
"name": "AWS KMS Key Disabled or Scheduled for Deletion",
"severity": "critical",
"mitre": ["t1485", "t1486"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name"},
"match_when": {"event_name_in": ["DisableKey", "ScheduleKeyDeletion"]},
"fp": ["Decommission of expired key material (must reference change ticket)"],
"playbook": "tpl-data-destruction",
"positive": {"event_name": "ScheduleKeyDeletion", "key_id": "alias/prod-encrypt", "user_arn": "arn:aws:iam::111:user/intern"},
"negative": {"event_name": "EnableKey", "key_id": "alias/prod-encrypt", "user_arn": "arn:aws:iam::111:user/admin"},
},
{
"slug": "aws-cloudtrail-disabled",
"name": "AWS CloudTrail Logging Disabled",
"severity": "critical",
"mitre": ["t1562.008"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name"},
"match_when": {"event_name_in": ["StopLogging", "DeleteTrail", "UpdateTrail"]},
"fp": ["Log-trail consolidation during account merge (change ticketed)"],
"playbook": "tpl-defense-evasion",
"positive": {"event_name": "StopLogging", "trail_name": "org-default", "user_arn": "arn:aws:iam::111:user/contractor"},
"negative": {"event_name": "StartLogging", "trail_name": "org-default", "user_arn": "arn:aws:iam::111:user/admin"},
},
{
"slug": "aws-lambda-permissive-trigger",
"name": "AWS Lambda Function with Public Invoke Permission",
"severity": "medium",
"mitre": ["t1190"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name", "principal"},
"match_when": {"event_name": "AddPermission", "principal": "*"},
"fp": ["Public webhook endpoint (must have purpose=public-webhook tag)"],
"playbook": "tpl-cloud-misconfig",
"positive": {"event_name": "AddPermission", "principal": "*", "function": "process-customer-pii"},
"negative": {"event_name": "AddPermission", "principal": "arn:aws:iam::222:role/partner", "function": "process-customer-pii"},
},
{
"slug": "aws-vpc-flow-logs-disabled",
"name": "AWS VPC Flow Logs Disabled",
"severity": "high",
"mitre": ["t1562.008"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name"},
"match_when": {"event_name": "DeleteFlowLogs"},
"fp": ["VPC decommission (change ticketed, vpc-state=deleting tag)"],
"playbook": "tpl-defense-evasion",
"positive": {"event_name": "DeleteFlowLogs", "vpc_id": "vpc-prod"},
"negative": {"event_name": "CreateFlowLogs", "vpc_id": "vpc-prod"},
},
{
"slug": "aws-rds-publicly-accessible",
"name": "AWS RDS Instance Set Publicly Accessible",
"severity": "high",
"mitre": ["t1190", "t1530"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name", "publicly_accessible"},
"match_when": {"event_name_in": ["CreateDBInstance", "ModifyDBInstance"], "publicly_accessible": True},
"fp": ["Test/sandbox RDS bound to bastion subnet only (must not happen)"],
"playbook": "tpl-data-exposure",
"positive": {"event_name": "ModifyDBInstance", "publicly_accessible": True, "db_id": "prod-pii"},
"negative": {"event_name": "ModifyDBInstance", "publicly_accessible": False, "db_id": "prod-pii"},
},
{
"slug": "aws-ebs-snapshot-public",
"name": "AWS EBS Snapshot Made Public",
"severity": "critical",
"mitre": ["t1530"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name", "createvolumepermission"},
"match_when": {"event_name": "ModifySnapshotAttribute", "createvolumepermission": "all"},
"fp": ["Public AMI publication for community open-source projects (must be tagged purpose=public-ami)"],
"playbook": "tpl-data-exposure",
"positive": {"event_name": "ModifySnapshotAttribute", "createvolumepermission": "all", "snapshot_id": "snap-prod-pii"},
"negative": {"event_name": "ModifySnapshotAttribute", "createvolumepermission": "self", "snapshot_id": "snap-prod-pii"},
},
{
"slug": "aws-cross-account-assumerole",
"name": "AWS AssumeRole from Untrusted External Account",
"severity": "high",
"mitre": ["t1078.004", "t1199"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name", "user_arn"},
"match_when": {"event_name": "AssumeRole", "user_arn_external_account": True, "external_account_in_allowlist": False},
"fp": ["Trusted partner accounts (must be in allowlist)", "Org-internal cross-account scripts"],
"playbook": "tpl-cloud-anomaly",
"positive": {"event_name": "AssumeRole", "user_arn": "arn:aws:sts::999999999999:assumed-role/external", "user_arn_external_account": True, "external_account_in_allowlist": False},
"negative": {"event_name": "AssumeRole", "user_arn": "arn:aws:sts::111111111111:assumed-role/internal", "user_arn_external_account": False},
},
{
"slug": "aws-s3-mass-getobject",
"name": "AWS S3 GetObject Volume Anomaly per Principal",
"severity": "high",
"mitre": ["t1530"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name", "object_count_per_principal", "time_window_minutes"},
"match_when": {"event_name": "GetObject", "object_count_per_principal_gt": 5000, "time_window_minutes_lt": 30},
"fp": ["Bulk-export jobs (must use tagged batch role)", "Backup tooling"],
"playbook": "tpl-data-exfil",
"positive": {"event_name": "GetObject", "object_count_per_principal": 12000, "time_window_minutes": 12, "user_arn": "arn:aws:iam::111:user/intern"},
"negative": {"event_name": "GetObject", "object_count_per_principal": 35, "time_window_minutes": 30, "user_arn": "arn:aws:iam::111:user/intern"},
},
# Azure (10)
{
"slug": "azure-ad-role-owner-assignment",
"name": "Azure AD Owner/Global-Admin Role Assignment",
"severity": "critical",
"mitre": ["t1098.003"],
"log_source": {"product": "azure", "service": "azuread-audit"},
"fields": {"operation_name", "role_name"},
"match_when": {"operation_name": "AddMemberToRole", "role_name_in": ["Global Administrator", "Privileged Role Administrator", "Owner"]},
"fp": ["Initial tenant bootstrap (must be ticketed)", "Break-glass account assignment"],
"playbook": "tpl-privilege-escalation",
"positive": {"operation_name": "AddMemberToRole", "role_name": "Global Administrator", "target_user": "user@corp.com"},
"negative": {"operation_name": "AddMemberToRole", "role_name": "Reader", "target_user": "user@corp.com"},
},
{
"slug": "azure-ad-app-secret-added",
"name": "Azure AD Application Credential Added",
"severity": "high",
"mitre": ["t1098.001"],
"log_source": {"product": "azure", "service": "azuread-audit"},
"fields": {"operation_name"},
"match_when": {"operation_name": "Update application - Certificates and secrets management"},
"fp": ["Application owner rotating credentials (must be tagged change ticketed)"],
"playbook": "tpl-privilege-escalation",
"positive": {"operation_name": "Update application - Certificates and secrets management", "app_id": "graph-reader-app"},
"negative": {"operation_name": "Update application - Properties", "app_id": "graph-reader-app"},
},
{
"slug": "azure-conditional-access-disabled",
"name": "Azure AD Conditional Access Policy Disabled or Removed",
"severity": "critical",
"mitre": ["t1562.001"],
"log_source": {"product": "azure", "service": "azuread-audit"},
"fields": {"operation_name", "policy_state"},
"match_when": {"operation_name_in": ["Update conditional access policy", "Delete conditional access policy"], "policy_state": "disabled"},
"fp": ["Policy migration (must reference replacement policy)"],
"playbook": "tpl-defense-evasion",
"positive": {"operation_name": "Update conditional access policy", "policy_state": "disabled", "policy_name": "MFA-required"},
"negative": {"operation_name": "Update conditional access policy", "policy_state": "enabled", "policy_name": "MFA-required"},
},
{
"slug": "azure-keyvault-key-deleted",
"name": "Azure Key Vault Key Deleted",
"severity": "high",
"mitre": ["t1485"],
"log_source": {"product": "azure", "service": "keyvault"},
"fields": {"operation_name"},
"match_when": {"operation_name_in": ["KeyDelete", "VaultDelete"]},
"fp": ["Key rotation cleanup (paired with KeyCreate within 24h)"],
"playbook": "tpl-data-destruction",
"positive": {"operation_name": "KeyDelete", "key_name": "prod-encrypt", "principal": "user@corp.com"},
"negative": {"operation_name": "KeyGet", "key_name": "prod-encrypt", "principal": "user@corp.com"},
},
{
"slug": "azure-nsg-allow-all-inbound",
"name": "Azure NSG Rule Allowing 0.0.0.0/0 Inbound",
"severity": "high",
"mitre": ["t1190"],
"log_source": {"product": "azure", "service": "activity"},
"fields": {"operation_name", "rule_source", "rule_destination_port"},
"match_when": {"operation_name": "Microsoft.Network/networkSecurityGroups/securityRules/write", "rule_source": "*", "rule_destination_port_in": [22, 3389, 1433, 3306, 6379]},
"fp": ["Public load balancer subnet (tag = role:public-lb)"],
"playbook": "tpl-cloud-misconfig",
"positive": {"operation_name": "Microsoft.Network/networkSecurityGroups/securityRules/write", "rule_source": "*", "rule_destination_port": 3389, "nsg": "prod-db"},
"negative": {"operation_name": "Microsoft.Network/networkSecurityGroups/securityRules/write", "rule_source": "10.0.0.0/8", "rule_destination_port": 3389, "nsg": "prod-db"},
},
{
"slug": "azure-storage-public-blob",
"name": "Azure Storage Account Container Made Public",
"severity": "high",
"mitre": ["t1530"],
"log_source": {"product": "azure", "service": "activity"},
"fields": {"operation_name", "public_access"},
"match_when": {"operation_name": "Microsoft.Storage/storageAccounts/blobServices/containers/write", "public_access_in": ["blob", "container"]},
"fp": ["Static website hosting (purpose=public tag required)"],
"playbook": "tpl-data-exposure",
"positive": {"operation_name": "Microsoft.Storage/storageAccounts/blobServices/containers/write", "public_access": "container", "container": "customer-data"},
"negative": {"operation_name": "Microsoft.Storage/storageAccounts/blobServices/containers/write", "public_access": "none", "container": "customer-data"},
},
{
"slug": "azure-ad-mfa-disabled-for-user",
"name": "Azure AD MFA Disabled for User",
"severity": "high",
"mitre": ["t1556.006"],
"log_source": {"product": "azure", "service": "azuread-audit"},
"fields": {"operation_name"},
"match_when": {"operation_name": "Disable Strong Authentication"},
"fp": ["Account migration to passkey-only (purpose=passkey tag required)"],
"playbook": "tpl-defense-evasion",
"positive": {"operation_name": "Disable Strong Authentication", "target_user": "ceo@corp.com"},
"negative": {"operation_name": "Enable Strong Authentication", "target_user": "ceo@corp.com"},
},
{
"slug": "azure-app-registration-permissive-scope",
"name": "Azure AD App Registration Granted Broad Graph Scope",
"severity": "high",
"mitre": ["t1098.001"],
"log_source": {"product": "azure", "service": "azuread-audit"},
"fields": {"operation_name", "scope"},
"match_when": {"operation_name": "Add app role assignment to service principal", "scope_in": ["Mail.ReadWrite", "Files.ReadWrite.All", "Directory.ReadWrite.All", "User.ReadWrite.All"]},
"fp": ["IT service-account onboarding (must be ticketed)"],
"playbook": "tpl-privilege-escalation",
"positive": {"operation_name": "Add app role assignment to service principal", "scope": "Directory.ReadWrite.All", "app": "thirdparty-import"},
"negative": {"operation_name": "Add app role assignment to service principal", "scope": "User.Read", "app": "thirdparty-import"},
},
{
"slug": "azure-login-anonymous-ip",
"name": "Azure AD Login from Tor / Anonymous IP",
"severity": "high",
"mitre": ["t1078.004"],
"log_source": {"product": "azure", "service": "azuread-signin"},
"fields": {"risk_event_type"},
"match_when": {"risk_event_type": "anonymizedIPAddress"},
"fp": ["Researchers using Tor for testing (must be tagged research-account)"],
"playbook": "tpl-account-compromise",
"positive": {"risk_event_type": "anonymizedIPAddress", "user": "ceo@corp.com", "src_ip": "198.51.100.5"},
"negative": {"risk_event_type": "atypicalTravel", "user": "ceo@corp.com", "src_ip": "98.97.96.95"},
},
{
"slug": "azure-resource-mass-delete",
"name": "Azure Resource Mass Deletion",
"severity": "critical",
"mitre": ["t1485"],
"log_source": {"product": "azure", "service": "activity"},
"fields": {"operation_name", "delete_count_per_principal", "time_window_minutes"},
"match_when": {"operation_name_endswith": "/delete", "delete_count_per_principal_gt": 50, "time_window_minutes_lt": 15},
"fp": ["Sandbox cleanup (must originate from automation principal)"],
"playbook": "tpl-data-destruction",
"positive": {"operation_name": "Microsoft.Storage/storageAccounts/delete", "delete_count_per_principal": 120, "time_window_minutes": 5, "principal": "user@corp.com"},
"negative": {"operation_name": "Microsoft.Storage/storageAccounts/delete", "delete_count_per_principal": 2, "time_window_minutes": 60, "principal": "user@corp.com"},
},
# GCP (10)
{
"slug": "gcp-iam-primitive-role-grant",
"name": "GCP IAM Primitive Role (Owner/Editor) Granted",
"severity": "high",
"mitre": ["t1078.004"],
"log_source": {"product": "gcp", "service": "audit"},
"fields": {"method_name", "role"},
"match_when": {"method_name": "SetIamPolicy", "role_in": ["roles/owner", "roles/editor"]},
"fp": ["Initial bootstrap (one-time, ticketed)"],
"playbook": "tpl-privilege-escalation",
"positive": {"method_name": "SetIamPolicy", "role": "roles/owner", "principal": "user@corp.com", "project": "prod"},
"negative": {"method_name": "SetIamPolicy", "role": "roles/storage.objectViewer", "principal": "user@corp.com", "project": "prod"},
},
{
"slug": "gcp-service-account-key-created",
"name": "GCP Service Account Key Created",
"severity": "high",
"mitre": ["t1098.001"],
"log_source": {"product": "gcp", "service": "audit"},
"fields": {"method_name"},
"match_when": {"method_name": "google.iam.admin.v1.CreateServiceAccountKey"},
"fp": ["IaC tooling using key-pair auth (must be tagged purpose=iac)"],
"playbook": "tpl-privilege-escalation",
"positive": {"method_name": "google.iam.admin.v1.CreateServiceAccountKey", "sa_email": "deploy@prod.iam.gserviceaccount.com"},
"negative": {"method_name": "google.iam.admin.v1.UpdateServiceAccount", "sa_email": "deploy@prod.iam.gserviceaccount.com"},
},
{
"slug": "gcp-gcs-bucket-public",
"name": "GCP GCS Bucket Set to Public",
"severity": "high",
"mitre": ["t1530"],
"log_source": {"product": "gcp", "service": "audit"},
"fields": {"method_name", "iam_member"},
"match_when": {"method_name": "storage.setIamPermissions", "iam_member_in": ["allUsers", "allAuthenticatedUsers"]},
"fp": ["Public website hosting (must be tagged purpose=public)"],
"playbook": "tpl-data-exposure",
"positive": {"method_name": "storage.setIamPermissions", "iam_member": "allUsers", "bucket": "customer-data"},
"negative": {"method_name": "storage.setIamPermissions", "iam_member": "user:dev@corp.com", "bucket": "customer-data"},
},
{
"slug": "gcp-firewall-rule-allow-all",
"name": "GCP Firewall Rule Allowing 0.0.0.0/0 Inbound",
"severity": "high",
"mitre": ["t1190"],
"log_source": {"product": "gcp", "service": "audit"},
"fields": {"method_name", "source_range", "ports"},
"match_when": {"method_name": "compute.firewalls.insert", "source_range": "0.0.0.0/0", "port_in": [22, 3389, 5432, 3306, 6379]},
"fp": ["External load balancer subnet (tagged role=public-lb)"],
"playbook": "tpl-cloud-misconfig",
"positive": {"method_name": "compute.firewalls.insert", "source_range": "0.0.0.0/0", "port": 22, "fw": "prod-bastion"},
"negative": {"method_name": "compute.firewalls.insert", "source_range": "10.0.0.0/8", "port": 22, "fw": "prod-bastion"},
},
{
"slug": "gcp-project-deletion",
"name": "GCP Project Marked for Deletion",
"severity": "critical",
"mitre": ["t1485"],
"log_source": {"product": "gcp", "service": "audit"},
"fields": {"method_name"},
"match_when": {"method_name": "DeleteProject"},
"fp": ["Sandbox project cleanup (project name must contain -sbx or -test)"],
"playbook": "tpl-data-destruction",
"positive": {"method_name": "DeleteProject", "project": "prod-revenue", "principal": "user@corp.com"},
"negative": {"method_name": "UndeleteProject", "project": "prod-revenue", "principal": "user@corp.com"},
},
{
"slug": "gcp-audit-log-sink-disabled",
"name": "GCP Audit Log Sink Disabled or Deleted",
"severity": "critical",
"mitre": ["t1562.008"],
"log_source": {"product": "gcp", "service": "audit"},
"fields": {"method_name"},
"match_when": {"method_name_in": ["google.logging.v2.ConfigServiceV2.DeleteSink", "google.logging.v2.ConfigServiceV2.UpdateSink"]},
"fp": ["Sink migration (must reference replacement sink)"],
"playbook": "tpl-defense-evasion",
"positive": {"method_name": "google.logging.v2.ConfigServiceV2.DeleteSink", "sink": "org-default", "principal": "user@corp.com"},
"negative": {"method_name": "google.logging.v2.ConfigServiceV2.CreateSink", "sink": "org-default", "principal": "user@corp.com"},
},
{
"slug": "gcp-org-policy-modified",
"name": "GCP Organization Policy Modified",
"severity": "high",
"mitre": ["t1562.008"],
"log_source": {"product": "gcp", "service": "audit"},
"fields": {"method_name"},
"match_when": {"method_name_endswith": ".SetOrgPolicy"},
"fp": ["Approved policy change (must reference change ticket in metadata)"],
"playbook": "tpl-defense-evasion",
"positive": {"method_name": "google.cloud.orgpolicy.v2.OrgPolicy.SetOrgPolicy", "policy": "compute.requireOsLogin", "principal": "user@corp.com"},
"negative": {"method_name": "google.cloud.orgpolicy.v2.OrgPolicy.GetEffectivePolicy", "policy": "compute.requireOsLogin", "principal": "user@corp.com"},
},
{
"slug": "gcp-service-account-impersonation",
"name": "GCP Service Account Impersonation Outside Allowlist",
"severity": "high",
"mitre": ["t1078.004"],
"log_source": {"product": "gcp", "service": "audit"},
"fields": {"method_name", "impersonator", "target_sa"},
"match_when": {"method_name": "GenerateAccessToken", "impersonator_in_allowlist": False},
"fp": ["IT support break-glass (allowlisted impersonator only)"],
"playbook": "tpl-cloud-anomaly",
"positive": {"method_name": "GenerateAccessToken", "impersonator": "intern@corp.com", "target_sa": "deploy@prod.iam.gserviceaccount.com", "impersonator_in_allowlist": False},
"negative": {"method_name": "GenerateAccessToken", "impersonator": "deploy-bot@corp.com", "target_sa": "deploy@prod.iam.gserviceaccount.com", "impersonator_in_allowlist": True},
},
{
"slug": "gcp-secret-manager-mass-export",
"name": "GCP Secret Manager Mass AccessSecretVersion",
"severity": "critical",
"mitre": ["t1555.005", "t1530"],
"log_source": {"product": "gcp", "service": "audit"},
"fields": {"method_name", "secret_count_per_principal", "time_window_minutes"},
"match_when": {"method_name": "google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion", "secret_count_per_principal_gt": 25, "time_window_minutes_lt": 10},
"fp": ["Boot of large microservice fleet (must be a known service principal in allowlist)"],
"playbook": "tpl-data-exfil",
"positive": {"method_name": "google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion", "secret_count_per_principal": 80, "time_window_minutes": 4, "principal": "user@corp.com"},
"negative": {"method_name": "google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion", "secret_count_per_principal": 3, "time_window_minutes": 30, "principal": "deploy-bot@corp.com"},
},
{
"slug": "gcp-bigquery-dataset-public",
"name": "GCP BigQuery Dataset Made Public",
"severity": "high",
"mitre": ["t1530"],
"log_source": {"product": "gcp", "service": "audit"},
"fields": {"method_name", "iam_member"},
"match_when": {"method_name": "google.cloud.bigquery.v2.DatasetService.UpdateDataset", "iam_member_in": ["allUsers", "allAuthenticatedUsers"]},
"fp": ["Public datasets program (purpose=public tag required)"],
"playbook": "tpl-data-exposure",
"positive": {"method_name": "google.cloud.bigquery.v2.DatasetService.UpdateDataset", "iam_member": "allUsers", "dataset": "customer_metrics"},
"negative": {"method_name": "google.cloud.bigquery.v2.DatasetService.UpdateDataset", "iam_member": "user:analyst@corp.com", "dataset": "customer_metrics"},
},
# Multi-cloud (5)
{
"slug": "cloud-secrets-in-env",
"name": "Cloud Workload Spawned with Secrets in Environment Variables",
"severity": "high",
"mitre": ["t1552.001"],
"log_source": {"product": "cloud", "service": "workload"},
"fields": {"event_name", "env_has_secret"},
"match_when": {"event_name_in": ["RunInstances", "RunPods", "DeployContainer"], "env_has_secret": True},
"fp": ["Legacy workloads pre-migration to a secret-store (decommission ticket required)"],
"playbook": "tpl-cloud-misconfig",
"positive": {"event_name": "DeployContainer", "env_has_secret": True, "container": "billing-svc"},
"negative": {"event_name": "DeployContainer", "env_has_secret": False, "container": "billing-svc"},
},
{
"slug": "cloud-container-registry-public",
"name": "Container Registry Repository Made Public",
"severity": "medium",
"mitre": ["t1525"],
"log_source": {"product": "cloud", "service": "registry"},
"fields": {"event_name", "visibility"},
"match_when": {"event_name_in": ["UpdateRepositoryVisibility", "SetIamPolicy"], "visibility": "public"},
"fp": ["Public OSS image publishing (purpose=public-oss tag required)"],
"playbook": "tpl-data-exposure",
"positive": {"event_name": "UpdateRepositoryVisibility", "visibility": "public", "repo": "internal-tooling"},
"negative": {"event_name": "UpdateRepositoryVisibility", "visibility": "private", "repo": "internal-tooling"},
},
{
"slug": "cloud-tfstate-public",
"name": "Terraform State File Stored in Public Bucket",
"severity": "critical",
"mitre": ["t1530", "t1552.001"],
"log_source": {"product": "cloud", "service": "storage"},
"fields": {"object_path", "bucket_visibility"},
"match_when": {"object_path_endswith": ".tfstate", "bucket_visibility": "public"},
"fp": ["Demo/training repos (must be in dedicated demo project)"],
"playbook": "tpl-data-exposure",
"positive": {"object_path": "iac/prod/main.tfstate", "bucket_visibility": "public", "bucket": "ops-iac"},
"negative": {"object_path": "iac/prod/main.tfstate", "bucket_visibility": "private", "bucket": "ops-iac"},
},
{
"slug": "cloud-internet-load-balancer-no-waf",
"name": "Internet-Facing Load Balancer Without WAF",
"severity": "medium",
"mitre": ["t1190"],
"log_source": {"product": "cloud", "service": "lb"},
"fields": {"event_name", "scheme", "waf_attached"},
"match_when": {"event_name_in": ["CreateLoadBalancer", "ModifyLoadBalancerAttributes"], "scheme": "internet-facing", "waf_attached": False},
"fp": ["Health-check / status-page endpoints (must be tagged purpose=status)"],
"playbook": "tpl-cloud-misconfig",
"positive": {"event_name": "CreateLoadBalancer", "scheme": "internet-facing", "waf_attached": False, "lb": "prod-api"},
"negative": {"event_name": "CreateLoadBalancer", "scheme": "internet-facing", "waf_attached": True, "lb": "prod-api"},
},
{
"slug": "cloud-cross-account-trust-add",
"name": "Cross-Account Trust Added to Privileged Role",
"severity": "critical",
"mitre": ["t1199"],
"log_source": {"product": "cloud", "service": "iam"},
"fields": {"event_name", "trusted_principal_external_account", "external_account_in_allowlist"},
"match_when": {"event_name_in": ["UpdateAssumeRolePolicy", "PutRolePolicy"], "trusted_principal_external_account": True, "external_account_in_allowlist": False},
"fp": ["Approved partner SaaS integration (allowlist required)"],
"playbook": "tpl-cloud-anomaly",
"positive": {"event_name": "UpdateAssumeRolePolicy", "trusted_principal_external_account": True, "external_account_in_allowlist": False, "role": "prod-admin"},
"negative": {"event_name": "UpdateAssumeRolePolicy", "trusted_principal_external_account": False, "external_account_in_allowlist": True, "role": "prod-admin"},
},
]
# =============================================================================
# IDENTITY (40)
# =============================================================================
IDENTITY: list[dict] = [
# Authentication (15)
{
"slug": "brute-force-login",
"name": "Authentication Brute-Force Burst",
"description": "Detects high-frequency failed authentication attempts against a single account, which is a classic indicator of credential-stuffing or password-spraying attempts. Threshold is intentionally conservative to reduce noise.",
"severity": "high",
"mitre": ["t1110.001"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "outcome", "fail_count", "time_window_minutes"},
"match_when": {"event_type": "user.session.start", "outcome": "FAILURE", "fail_count_gt": 20, "time_window_minutes_lt": 10},
"fp": ["Misconfigured client looping forever (rare; tag known cases)"],
"playbook": "tpl-account-compromise",
"positive": {"event_type": "user.session.start", "outcome": "FAILURE", "fail_count": 80, "time_window_minutes": 5, "user": "ceo@corp.com"},
"negative": {"event_type": "user.session.start", "outcome": "FAILURE", "fail_count": 2, "time_window_minutes": 30, "user": "ceo@corp.com"},
},
{
"slug": "impossible-travel",
"name": "Impossible Travel Between Two Authentications",
"description": "Detects two successful authentication events for the same user from geographically distant locations within a time window that would require travel speeds exceeding 800 km/h. Strong indicator of compromised credentials being shared between attacker and legitimate user.",
"severity": "high",
"mitre": ["t1078"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "outcome", "travel_speed_kmh", "time_delta_minutes"},
"match_when": {"event_type": "user.session.start", "outcome": "SUCCESS", "travel_speed_kmh_gt": 800, "time_delta_minutes_lt": 120},
"fp": ["VPN usage that changes apparent geolocation", "Tor / proxy services"],
"playbook": "tpl-account-compromise",
"positive": {"event_type": "user.session.start", "outcome": "SUCCESS", "travel_speed_kmh": 1100, "time_delta_minutes": 30, "user": "vp@corp.com"},
"negative": {"event_type": "user.session.start", "outcome": "SUCCESS", "travel_speed_kmh": 12, "time_delta_minutes": 240, "user": "vp@corp.com"},
},
{
"slug": "password-spray",
"name": "Password Spray Across Many Users from Single IP",
"severity": "high",
"mitre": ["t1110.003"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "outcome", "distinct_users_per_ip", "time_window_minutes"},
"match_when": {"event_type": "user.session.start", "outcome": "FAILURE", "distinct_users_per_ip_gt": 30, "time_window_minutes_lt": 30},
"fp": ["Penetration tests (must be ticketed)"],
"playbook": "tpl-account-compromise",
"positive": {"event_type": "user.session.start", "outcome": "FAILURE", "distinct_users_per_ip": 60, "time_window_minutes": 12, "src_ip": "203.0.113.7"},
"negative": {"event_type": "user.session.start", "outcome": "FAILURE", "distinct_users_per_ip": 1, "time_window_minutes": 60, "src_ip": "10.0.0.5"},
},
{
"slug": "login-anonymous-ip",
"name": "Login from Tor / Anonymous Proxy",
"severity": "high",
"mitre": ["t1078"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "ip_anonymizer"},
"match_when": {"event_type": "user.session.start", "ip_anonymizer": True},
"fp": ["Researchers / red team (tagged research-account)"],
"playbook": "tpl-account-compromise",
"positive": {"event_type": "user.session.start", "ip_anonymizer": True, "user": "ceo@corp.com"},
"negative": {"event_type": "user.session.start", "ip_anonymizer": False, "user": "ceo@corp.com"},
},
{
"slug": "login-outside-business-hours",
"name": "Privileged Login Outside Business Hours",
"severity": "medium",
"mitre": ["t1078"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "outcome", "user_role", "hour_of_day_local"},
"match_when": {"event_type": "user.session.start", "outcome": "SUCCESS", "user_role_in": ["admin", "privileged"], "hour_of_day_local_not_in": list(range(7, 20))},
"fp": ["On-call rotation outside hours (must be on-call)", "Travel by privileged user (tag travel)"],
"playbook": "tpl-account-anomaly",
"positive": {"event_type": "user.session.start", "outcome": "SUCCESS", "user_role": "admin", "hour_of_day_local": 3, "user": "admin@corp.com"},
"negative": {"event_type": "user.session.start", "outcome": "SUCCESS", "user_role": "admin", "hour_of_day_local": 10, "user": "admin@corp.com"},
},
{
"slug": "login-from-foreign-country",
"name": "Login from Country Outside Allowed Geography",
"severity": "high",
"mitre": ["t1078"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "outcome", "src_country", "user_country_allowlist"},
"match_when": {"event_type": "user.session.start", "outcome": "SUCCESS", "src_country_not_in_allowlist": True},
"fp": ["Approved business travel (must be tagged)"],
"playbook": "tpl-account-compromise",
"positive": {"event_type": "user.session.start", "outcome": "SUCCESS", "src_country": "RU", "src_country_not_in_allowlist": True, "user": "user@corp.com"},
"negative": {"event_type": "user.session.start", "outcome": "SUCCESS", "src_country": "US", "src_country_not_in_allowlist": False, "user": "user@corp.com"},
},
{
"slug": "disabled-account-login-attempt",
"name": "Authentication Attempt Against Disabled Account",
"severity": "medium",
"mitre": ["t1078"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "user_state"},
"match_when": {"event_type": "user.session.start", "user_state_in": ["DISABLED", "DEPROVISIONED"]},
"fp": ["Lingering background jobs after offboarding (rare; transient)"],
"playbook": "tpl-account-anomaly",
"positive": {"event_type": "user.session.start", "user_state": "DISABLED", "user": "former-employee@corp.com"},
"negative": {"event_type": "user.session.start", "user_state": "ACTIVE", "user": "former-employee@corp.com"},
},
{
"slug": "mfa-fatigue",
"name": "MFA Push Bombing (MFA Fatigue)",
"severity": "high",
"mitre": ["t1621"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "mfa_push_count", "time_window_minutes"},
"match_when": {"event_type": "user.mfa.factor.push", "mfa_push_count_gt": 6, "time_window_minutes_lt": 5},
"fp": ["User retrying after a missed prompt (typically 2-3 retries)"],
"playbook": "tpl-account-compromise",
"positive": {"event_type": "user.mfa.factor.push", "mfa_push_count": 25, "time_window_minutes": 3, "user": "vp@corp.com"},
"negative": {"event_type": "user.mfa.factor.push", "mfa_push_count": 2, "time_window_minutes": 5, "user": "vp@corp.com"},
},
{
"slug": "mfa-bypass-policy-change",
"name": "MFA Requirement Removed from User Policy",
"severity": "critical",
"mitre": ["t1556.006"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "policy_change_field"},
"match_when": {"event_type": "policy.lifecycle.update", "policy_change_field": "mfa_required:false"},
"fp": ["Migration to passkey-only (must reference replacement policy)"],
"playbook": "tpl-defense-evasion",
"positive": {"event_type": "policy.lifecycle.update", "policy_change_field": "mfa_required:false", "policy_name": "all-employees"},
"negative": {"event_type": "policy.lifecycle.update", "policy_change_field": "session_timeout:8h", "policy_name": "all-employees"},
},
{
"slug": "expired-credential-reuse",
"name": "Authentication with Expired Credential",
"severity": "medium",
"mitre": ["t1110"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "credential_state"},
"match_when": {"event_type": "user.session.start", "credential_state": "EXPIRED"},
"fp": ["Cached credentials in legacy automation (rotation grace period)"],
"playbook": "tpl-account-anomaly",
"positive": {"event_type": "user.session.start", "credential_state": "EXPIRED", "user": "user@corp.com"},
"negative": {"event_type": "user.session.start", "credential_state": "VALID", "user": "user@corp.com"},
},
{
"slug": "service-account-interactive-login",
"name": "Service Account Used for Interactive Login",
"severity": "high",
"mitre": ["t1078.004"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "user_type", "session_type"},
"match_when": {"event_type": "user.session.start", "user_type": "service_account", "session_type": "interactive"},
"fp": ["Service account testing during onboarding (must be ticketed)"],
"playbook": "tpl-account-compromise",
"positive": {"event_type": "user.session.start", "user_type": "service_account", "session_type": "interactive", "user": "deploy-bot"},
"negative": {"event_type": "user.session.start", "user_type": "service_account", "session_type": "machine", "user": "deploy-bot"},
},
{
"slug": "root-ssh-login",
"name": "Root SSH Login on Production Host",
"severity": "high",
"mitre": ["t1078.001"],
"log_source": {"product": "linux", "service": "auth"},
"fields": {"event_type", "user", "host_role"},
"match_when": {"event_type": "ssh-accept", "user": "root", "host_role": "production"},
"fp": ["Disaster recovery break-glass (must be ticketed)"],
"playbook": "tpl-privilege-escalation",
"positive": {"event_type": "ssh-accept", "user": "root", "host_role": "production", "host": "db-prod-01"},
"negative": {"event_type": "ssh-accept", "user": "deploy", "host_role": "production", "host": "db-prod-01"},
},
{
"slug": "default-credential-login",
"name": "Login with Vendor Default Credentials",
"severity": "high",
"mitre": ["t1078.001"],
"log_source": {"product": "linux", "service": "auth"},
"fields": {"event_type", "user_in_default_list", "outcome"},
"match_when": {"event_type": "ssh-accept", "user_in_default_list": True, "outcome": "SUCCESS"},
"fp": ["Lab/sandbox hosts (must not be production-tagged)"],
"playbook": "tpl-account-compromise",
"positive": {"event_type": "ssh-accept", "user": "admin", "user_in_default_list": True, "outcome": "SUCCESS", "host": "appliance-01"},
"negative": {"event_type": "ssh-accept", "user": "real-employee", "user_in_default_list": False, "outcome": "SUCCESS", "host": "appliance-01"},
},
{
"slug": "shared-account-login-spike",
"name": "Shared Account Login Spike (Distinct IPs)",
"severity": "medium",
"mitre": ["t1078"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "distinct_ip_count_per_user", "time_window_minutes"},
"match_when": {"event_type": "user.session.start", "distinct_ip_count_per_user_gt": 5, "time_window_minutes_lt": 10},
"fp": ["Shared corporate workstation (multi-user)"],
"playbook": "tpl-account-anomaly",
"positive": {"event_type": "user.session.start", "distinct_ip_count_per_user": 12, "time_window_minutes": 6, "user": "shared-account@corp.com"},
"negative": {"event_type": "user.session.start", "distinct_ip_count_per_user": 1, "time_window_minutes": 60, "user": "user@corp.com"},
},
{
"slug": "login-during-incident",
"name": "Authentication During Active P0/P1 Incident Window",
"severity": "medium",
"mitre": ["t1078"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "outcome", "active_p0_or_p1_incident", "user_role"},
"match_when": {"event_type": "user.session.start", "outcome": "SUCCESS", "active_p0_or_p1_incident": True, "user_role_not_in": ["incident_responder", "admin"]},
"fp": ["IR team members not in the responder allowlist (rare; tag and continue)"],
"playbook": "tpl-incident-anomaly",
"positive": {"event_type": "user.session.start", "outcome": "SUCCESS", "active_p0_or_p1_incident": True, "user_role": "marketing", "user": "user@corp.com"},
"negative": {"event_type": "user.session.start", "outcome": "SUCCESS", "active_p0_or_p1_incident": False, "user_role": "marketing", "user": "user@corp.com"},
},
# Authorization (10)
{
"slug": "privileged-role-assignment",
"name": "Privileged Role Assignment",
"severity": "high",
"mitre": ["t1098"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "role_name"},
"match_when": {"event_type": "user.role.add", "role_name_in": ["admin", "owner", "global_admin"]},
"fp": ["Quarterly access review (ticketed)"],
"playbook": "tpl-privilege-escalation",
"positive": {"event_type": "user.role.add", "role_name": "admin", "target_user": "user@corp.com"},
"negative": {"event_type": "user.role.add", "role_name": "viewer", "target_user": "user@corp.com"},
},
{
"slug": "jit-elevation-abuse",
"name": "Just-In-Time Elevation Held Beyond Window",
"severity": "medium",
"mitre": ["t1078"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "elevation_duration_minutes"},
"match_when": {"event_type": "user.privilege.elevate", "elevation_duration_minutes_gt": 240},
"fp": ["Maintenance window approved beyond 4h (must be ticketed)"],
"playbook": "tpl-account-anomaly",
"positive": {"event_type": "user.privilege.elevate", "elevation_duration_minutes": 720, "user": "user@corp.com"},
"negative": {"event_type": "user.privilege.elevate", "elevation_duration_minutes": 60, "user": "user@corp.com"},
},
{
"slug": "sudo-no-mfa",
"name": "Sudo Used Without MFA",
"severity": "high",
"mitre": ["t1548.003"],
"log_source": {"product": "linux", "service": "sudo"},
"fields": {"event_type", "mfa_verified"},
"match_when": {"event_type": "sudo-use", "mfa_verified": False},
"fp": ["Hosts pending MFA rollout (host_role=legacy tag required)"],
"playbook": "tpl-privilege-escalation",
"positive": {"event_type": "sudo-use", "mfa_verified": False, "host": "db-prod-01", "user": "user"},
"negative": {"event_type": "sudo-use", "mfa_verified": True, "host": "db-prod-01", "user": "user"},
},
{
"slug": "group-policy-modification",
"name": "Active Directory Group Policy Modified",
"severity": "high",
"mitre": ["t1484.001"],
"log_source": {"product": "windows", "service": "security"},
"fields": {"event_id"},
"match_when": {"event_id_in": [5136, 5137, 5138, 5139]},
"fp": ["Change-management approved GPO updates (ticket reference required)"],
"playbook": "tpl-defense-evasion",
"positive": {"event_id": 5136, "object_class": "groupPolicyContainer", "user": "user@corp.com"},
"negative": {"event_id": 4624, "user": "user@corp.com"},
},
{
"slug": "rbac-cluster-admin-binding",
"name": "Kubernetes ClusterRoleBinding to cluster-admin",
"severity": "critical",
"mitre": ["t1078.004"],
"log_source": {"product": "kubernetes", "service": "audit"},
"fields": {"verb", "object_resource", "role_ref"},
"match_when": {"verb": "create", "object_resource": "clusterrolebindings", "role_ref": "cluster-admin"},
"fp": ["Initial cluster bootstrap (one-time)"],
"playbook": "tpl-privilege-escalation",
"positive": {"verb": "create", "object_resource": "clusterrolebindings", "role_ref": "cluster-admin", "subject": "user@corp.com"},
"negative": {"verb": "create", "object_resource": "clusterrolebindings", "role_ref": "view", "subject": "user@corp.com"},
},
{
"slug": "iam-policy-detach-defense",
"name": "Defensive IAM Policy Detached",
"severity": "critical",
"mitre": ["t1562.008"],
"log_source": {"product": "aws", "service": "cloudtrail"},
"fields": {"event_name", "policy_name"},
"match_when": {"event_name_in": ["DetachUserPolicy", "DetachRolePolicy"], "policy_name_contains_any": ["DefaultDeny", "GuardrailDeny", "OrgDeny"]},
"fp": ["Policy migration during Org SCP refactor (ticket required)"],
"playbook": "tpl-defense-evasion",
"positive": {"event_name": "DetachRolePolicy", "policy_name": "OrgDenyDeleteCloudTrail", "role": "deploy-bot"},
"negative": {"event_name": "DetachRolePolicy", "policy_name": "ReadOnlyAccess", "role": "deploy-bot"},
},
{
"slug": "domain-password-policy-weakened",
"name": "Domain Password Policy Weakened",
"severity": "high",
"mitre": ["t1556"],
"log_source": {"product": "windows", "service": "security"},
"fields": {"event_id", "policy_change"},
"match_when": {"event_id_in": [4739, 4738], "policy_change_in": ["min-length-decreased", "complexity-disabled", "lockout-disabled"]},
"fp": ["Approved policy refactor (ticketed, paired with rotation)"],
"playbook": "tpl-defense-evasion",
"positive": {"event_id": 4739, "policy_change": "complexity-disabled", "user": "user@corp.com"},
"negative": {"event_id": 4739, "policy_change": "min-length-increased", "user": "user@corp.com"},
},
{
"slug": "oauth-broad-scope-grant",
"name": "OAuth App Granted Broad Scopes by User",
"severity": "high",
"mitre": ["t1098.001"],
"log_source": {"product": "google-workspace", "service": "audit"},
"fields": {"event_type", "scope_set"},
"match_when": {"event_type": "oauth.token.grant", "scope_set_contains_any": ["mail.readwrite", "drive.full", "admin.directory"]},
"fp": ["IT-managed integrations (publisher in allowlist)"],
"playbook": "tpl-account-compromise",
"positive": {"event_type": "oauth.token.grant", "scope_set": ["drive.full"], "user": "user@corp.com", "app": "thirdparty-importer"},
"negative": {"event_type": "oauth.token.grant", "scope_set": ["calendar.read"], "user": "user@corp.com", "app": "thirdparty-importer"},
},
{
"slug": "app-token-broad-default",
"name": "GitHub App Installed with Repo Admin Permission",
"severity": "high",
"mitre": ["t1098.001"],
"log_source": {"product": "github", "service": "audit"},
"fields": {"action", "permission_administration"},
"match_when": {"action": "integration_installation.create", "permission_administration": "write"},
"fp": ["GitHub Apps from approved-publisher list"],
"playbook": "tpl-supply-chain",
"positive": {"action": "integration_installation.create", "permission_administration": "write", "app": "thirdparty-bot"},
"negative": {"action": "integration_installation.create", "permission_administration": "read", "app": "thirdparty-bot"},
},
{
"slug": "token-reuse-new-device",
"name": "Persistent Session Token Reused from New Device Fingerprint",
"severity": "high",
"mitre": ["t1550.004"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "device_fingerprint_seen_before", "session_age_hours"},
"match_when": {"event_type": "user.session.access_token", "device_fingerprint_seen_before": False, "session_age_hours_gt": 8},
"fp": ["Browser update changing fingerprint (must be paired with consistent IP)"],
"playbook": "tpl-account-compromise",
"positive": {"event_type": "user.session.access_token", "device_fingerprint_seen_before": False, "session_age_hours": 24, "user": "ceo@corp.com"},
"negative": {"event_type": "user.session.access_token", "device_fingerprint_seen_before": True, "session_age_hours": 24, "user": "ceo@corp.com"},
},
# Account lifecycle (10)
{
"slug": "account-creation-by-non-admin",
"name": "User Account Creation by Non-Admin Principal",
"severity": "high",
"mitre": ["t1136.001"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "actor_role"},
"match_when": {"event_type": "user.lifecycle.create", "actor_role_not_in": ["admin", "user_admin"]},
"fp": ["Self-service guest invite (must require sponsor)"],
"playbook": "tpl-privilege-escalation",
"positive": {"event_type": "user.lifecycle.create", "actor_role": "engineer", "actor": "user@corp.com"},
"negative": {"event_type": "user.lifecycle.create", "actor_role": "admin", "actor": "admin@corp.com"},
},
{
"slug": "admin-account-deletion",
"name": "Privileged Account Deleted",
"severity": "critical",
"mitre": ["t1531"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "target_user_role"},
"match_when": {"event_type": "user.lifecycle.deactivate", "target_user_role_in": ["admin", "owner"]},
"fp": ["Offboarding (must reference HR ticket)"],
"playbook": "tpl-account-compromise",
"positive": {"event_type": "user.lifecycle.deactivate", "target_user_role": "admin", "target_user": "ceo@corp.com"},
"negative": {"event_type": "user.lifecycle.deactivate", "target_user_role": "viewer", "target_user": "user@corp.com"},
},
{
"slug": "account-enable-after-disable",
"name": "Disabled Account Re-enabled",
"severity": "high",
"mitre": ["t1098"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "previous_state"},
"match_when": {"event_type": "user.lifecycle.activate", "previous_state": "DISABLED"},
"fp": ["Re-hire (must reference HR ticket)"],
"playbook": "tpl-account-anomaly",
"positive": {"event_type": "user.lifecycle.activate", "previous_state": "DISABLED", "user": "former-employee@corp.com"},
"negative": {"event_type": "user.lifecycle.activate", "previous_state": "STAGED", "user": "new-hire@corp.com"},
},
{
"slug": "self-password-reset-admin",
"name": "Admin Password Reset Initiated by Self via Self-Service",
"severity": "medium",
"mitre": ["t1098"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "reset_method", "user_role"},
"match_when": {"event_type": "user.account.reset_password", "reset_method": "self-service", "user_role": "admin"},
"fp": ["Forgotten-password flow with strong second factor (rare for admins)"],
"playbook": "tpl-account-anomaly",
"positive": {"event_type": "user.account.reset_password", "reset_method": "self-service", "user_role": "admin", "user": "admin@corp.com"},
"negative": {"event_type": "user.account.reset_password", "reset_method": "helpdesk-assisted", "user_role": "admin", "user": "admin@corp.com"},
},
{
"slug": "password-reset-out-of-hours",
"name": "Password Reset Out of Business Hours for Privileged Account",
"severity": "medium",
"mitre": ["t1098"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "user_role", "hour_of_day_local"},
"match_when": {"event_type": "user.account.reset_password", "user_role_in": ["admin", "privileged"], "hour_of_day_local_not_in": list(range(7, 20))},
"fp": ["On-call out-of-hours legitimate reset (must be on-call rotation)"],
"playbook": "tpl-account-anomaly",
"positive": {"event_type": "user.account.reset_password", "user_role": "admin", "hour_of_day_local": 2, "user": "admin@corp.com"},
"negative": {"event_type": "user.account.reset_password", "user_role": "admin", "hour_of_day_local": 11, "user": "admin@corp.com"},
},
{
"slug": "ad-replication-non-dc",
"name": "Active Directory Replication Request from Non-Domain-Controller",
"severity": "critical",
"mitre": ["t1003.006"],
"log_source": {"product": "windows", "service": "security"},
"fields": {"event_id", "source_role"},
"match_when": {"event_id": 4662, "operation_type_contains": "DS-Replication-Get-Changes", "source_role_not_in": ["domain_controller"]},
"fp": ["Approved replication agents (azure ad connect; explicit allowlist)"],
"playbook": "tpl-credential-theft",
"positive": {"event_id": 4662, "operation_type": "DS-Replication-Get-Changes-All", "source_role": "workstation", "user": "user@corp.com"},
"negative": {"event_id": 4662, "operation_type": "DS-Replication-Get-Changes-All", "source_role": "domain_controller", "user": "DC01$"},
},
{
"slug": "kerberoasting",
"name": "Kerberoasting (Service-Ticket Request for SPN)",
"severity": "high",
"mitre": ["t1558.003"],
"log_source": {"product": "windows", "service": "security"},
"fields": {"event_id", "ticket_encryption", "spn_count_per_user", "time_window_minutes"},
"match_when": {"event_id": 4769, "ticket_encryption_in": ["RC4-HMAC", "0x17"], "spn_count_per_user_gt": 5, "time_window_minutes_lt": 5},
"fp": ["Legacy services that still issue RC4 tickets (host_role=legacy tag)"],
"playbook": "tpl-credential-theft",
"positive": {"event_id": 4769, "ticket_encryption": "RC4-HMAC", "spn_count_per_user": 12, "time_window_minutes": 2, "user": "user@corp.com"},
"negative": {"event_id": 4769, "ticket_encryption": "AES256-CTS-HMAC-SHA1-96", "spn_count_per_user": 1, "time_window_minutes": 60, "user": "user@corp.com"},
},
{
"slug": "asreproasting",
"name": "AS-REP Roasting (Account with Pre-Auth Disabled)",
"severity": "high",
"mitre": ["t1558.004"],
"log_source": {"product": "windows", "service": "security"},
"fields": {"event_id", "preauth_required"},
"match_when": {"event_id": 4768, "preauth_required": False},
"fp": ["Legacy unix/krb5-style accounts with explicit allowlist"],
"playbook": "tpl-credential-theft",
"positive": {"event_id": 4768, "preauth_required": False, "user": "service-legacy"},
"negative": {"event_id": 4768, "preauth_required": True, "user": "user@corp.com"},
},
{
"slug": "golden-ticket",
"name": "Golden Ticket Indicator (Anomalous TGT Lifetime)",
"severity": "critical",
"mitre": ["t1558.001"],
"log_source": {"product": "windows", "service": "security"},
"fields": {"event_id", "ticket_lifetime_hours"},
"match_when": {"event_id": 4624, "logon_type": 3, "ticket_lifetime_hours_gt": 24},
"fp": ["Forest-trust kerberos tickets (rare; allowlist trust)"],
"playbook": "tpl-credential-theft",
"positive": {"event_id": 4624, "logon_type": 3, "ticket_lifetime_hours": 720, "user": "user@corp.com"},
"negative": {"event_id": 4624, "logon_type": 3, "ticket_lifetime_hours": 8, "user": "user@corp.com"},
},
{
"slug": "silver-ticket",
"name": "Silver Ticket Indicator (Service Ticket Without TGS Hit)",
"severity": "critical",
"mitre": ["t1558.002"],
"log_source": {"product": "windows", "service": "security"},
"fields": {"event_id", "tgs_event_seen"},
"match_when": {"event_id": 4624, "logon_type": 3, "tgs_event_seen": False},
"fp": ["Cached TGT reuse outside log retention window"],
"playbook": "tpl-credential-theft",
"positive": {"event_id": 4624, "logon_type": 3, "tgs_event_seen": False, "user": "service-account"},
"negative": {"event_id": 4624, "logon_type": 3, "tgs_event_seen": True, "user": "service-account"},
},
# SSO/Federation (5)
{
"slug": "saml-response-anomaly",
"name": "SAML Response with Mismatched Issuer or Future-Dated NotBefore",
"severity": "critical",
"mitre": ["t1606.002"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type", "issuer_valid", "notbefore_in_future"},
"match_when": {"event_type": "user.authentication.sso", "any_of": [{"issuer_valid": False}, {"notbefore_in_future": True}]},
"fp": ["Clock-skew between IDP and SP (rare; <2min)"],
"playbook": "tpl-credential-theft",
"positive": {"event_type": "user.authentication.sso", "issuer_valid": False, "notbefore_in_future": False, "user": "user@corp.com"},
"negative": {"event_type": "user.authentication.sso", "issuer_valid": True, "notbefore_in_future": False, "user": "user@corp.com"},
},
{
"slug": "federated-trust-modified",
"name": "Federation Trust Relationship Modified",
"severity": "critical",
"mitre": ["t1556.007"],
"log_source": {"product": "azure", "service": "azuread-audit"},
"fields": {"operation_name"},
"match_when": {"operation_name_in": ["Set domain authentication", "Set federation settings on domain"]},
"fp": ["Approved federation cutover (must reference change ticket)"],
"playbook": "tpl-defense-evasion",
"positive": {"operation_name": "Set domain authentication", "domain": "corp.com"},
"negative": {"operation_name": "Verify domain", "domain": "corp.com"},
},
{
"slug": "idp-metadata-changed",
"name": "IDP Metadata or Signing Cert Changed",
"severity": "critical",
"mitre": ["t1556"],
"log_source": {"product": "okta", "service": "system-log"},
"fields": {"event_type"},
"match_when": {"event_type_in": ["app.idp.update_signing_certificate", "app.idp.update_metadata"]},
"fp": ["Cert rotation (must be paired with rotation calendar)"],
"playbook": "tpl-defense-evasion",
"positive": {"event_type": "app.idp.update_signing_certificate", "app": "salesforce"},
"negative": {"event_type": "app.idp.lifecycle.activate", "app": "salesforce"},
},
{
"slug": "ca-policy-scope-broadened",
"name": "Conditional Access Policy Scope Broadened (Less Restrictive)",
"severity": "high",
"mitre": ["t1562.001"],
"log_source": {"product": "azure", "service": "azuread-audit"},
"fields": {"operation_name", "policy_change"},
"match_when": {"operation_name": "Update conditional access policy", "policy_change_in": ["scope-expanded", "exclusion-added"]},
"fp": ["Onboarding new application to existing policy (ticketed)"],
"playbook": "tpl-defense-evasion",
"positive": {"operation_name": "Update conditional access policy", "policy_change": "exclusion-added", "policy_name": "MFA-required"},
"negative": {"operation_name": "Update conditional access policy", "policy_change": "exclusion-removed", "policy_name": "MFA-required"},
},
{
"slug": "federation-cross-tenant-access",
"name": "Cross-Tenant Identity Access Granted",
"severity": "high",
"mitre": ["t1199"],
"log_source": {"product": "azure", "service": "azuread-audit"},
"fields": {"operation_name"},
"match_when": {"operation_name": "Add cross-tenant access policy"},
"fp": ["Approved B2B partnership (allowlisted partner-tenant)"],
"playbook": "tpl-cloud-anomaly",
"positive": {"operation_name": "Add cross-tenant access policy", "partner_tenant": "external-tenant-id"},
"negative": {"operation_name": "Update cross-tenant access policy", "partner_tenant": "allowlisted-partner-tenant"},
},
]
# fmt: on