Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

fix(api): four interactions the merged suites exposed, and the resynced corpus

beenuar303b275d3e10
diff --git a/services/api/app/data/detections/detection_ruleset.json b/services/api/app/data/detections/detection_ruleset.json
index 817b2b8d1..c9159bad4 100644
--- a/services/api/app/data/detections/detection_ruleset.json
+++ b/services/api/app/data/detections/detection_ruleset.json
@@ -1,5 +1,5 @@
{
- "count": 741,
+ "count": 765,
"rules": [
{
"category": "application",
@@ -13296,6 +13296,430 @@
"service": "stp",
"severity": "medium",
"slug": "net-stp-topology-change-from-edge"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-001",
+ "match_when": {
+ "baseline_client_family_rarity_gte": 0.95,
+ "eventName": "CreateAccessKey"
+ },
+ "mitre": [
+ "T1098.001",
+ "T1078.004"
+ ],
+ "name": "AWS Access Key Created From a Client This Principal Has Never Used",
+ "product": "aws",
+ "service": "iam",
+ "severity": "high",
+ "slug": "ta-aws-access-key-created-from-rare-client"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-002",
+ "match_when": {
+ "baseline_action_rarity_gte": 0.95,
+ "eventName_in": [
+ "AttachUserPolicy",
+ "AttachRolePolicy",
+ "AttachGroupPolicy"
+ ]
+ },
+ "mitre": [
+ "T1098.003"
+ ],
+ "name": "AWS Policy Attached by a Principal Who Does Not Normally Attach Policies",
+ "product": "aws",
+ "service": "iam",
+ "severity": "high",
+ "slug": "ta-aws-policy-attached-by-rare-actor-action"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-003",
+ "match_when": {
+ "baseline_location_rarity_gte": 0.95,
+ "eventSource": "iam.amazonaws.com"
+ },
+ "mitre": [
+ "T1078.004"
+ ],
+ "name": "AWS Control-Plane Call From a Country This Principal Has Never Used",
+ "product": "aws",
+ "service": "cloudtrail",
+ "severity": "medium",
+ "slug": "ta-aws-api-call-from-rare-country"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-004",
+ "match_when": {
+ "baseline_principal_volume_z_gte": 3.0,
+ "eventSource": "s3.amazonaws.com"
+ },
+ "mitre": [
+ "T1530"
+ ],
+ "name": "AWS S3 Read Volume Far Above This Principal's Normal",
+ "product": "aws",
+ "service": "s3",
+ "severity": "high",
+ "slug": "ta-aws-volume-spike-on-s3-reads"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-005",
+ "match_when": {
+ "baseline_resource_rarity_gte": 0.95,
+ "eventName_startswith_any": [
+ "Delete",
+ "Put",
+ "Modify"
+ ]
+ },
+ "mitre": [
+ "T1580"
+ ],
+ "name": "AWS Resource This Principal Has Never Touched",
+ "product": "aws",
+ "service": "cloudtrail",
+ "severity": "medium",
+ "slug": "ta-aws-rare-resource-touched-by-principal"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-006",
+ "match_when": {
+ "baseline_peer_deviation_gte": 3.0,
+ "eventSource": "iam.amazonaws.com"
+ },
+ "mitre": [
+ "T1078.004"
+ ],
+ "name": "AWS Privileged Call Volume Far Above This Principal's Peer Group",
+ "product": "aws",
+ "service": "iam",
+ "severity": "medium",
+ "slug": "ta-aws-peer-deviation-on-privileged-call"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-007",
+ "match_when": {
+ "baseline_location_rarity_gte": 0.95,
+ "event_type_in": [
+ "user.mfa.factor.reset_all",
+ "user.mfa.factor.deactivate"
+ ]
+ },
+ "mitre": [
+ "T1556.006",
+ "T1098.005"
+ ],
+ "name": "MFA Factor Reset From a Country This Principal Has Never Used",
+ "product": "okta",
+ "service": "identity",
+ "severity": "critical",
+ "slug": "ta-okta-mfa-reset-from-rare-country"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-008",
+ "match_when": {
+ "baseline_action_rarity_gte": 0.95,
+ "event_type_in": [
+ "user.account.privilege.grant",
+ "group.privilege.grant"
+ ]
+ },
+ "mitre": [
+ "T1098.003"
+ ],
+ "name": "Admin Role Granted by a Principal Who Does Not Normally Grant Roles",
+ "product": "okta",
+ "service": "identity",
+ "severity": "critical",
+ "slug": "ta-okta-admin-role-granted-rare-action"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-009",
+ "match_when": {
+ "baseline_client_family_rarity_gte": 0.95,
+ "event_type": "user.session.start"
+ },
+ "mitre": [
+ "T1078.004",
+ "T1550"
+ ],
+ "name": "Sign-In From a Client Family This Principal Has Never Used",
+ "product": "okta",
+ "service": "identity",
+ "severity": "medium",
+ "slug": "ta-okta-login-from-rare-client-family"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-010",
+ "match_when": {
+ "baseline_action_rarity_gte": 0.95,
+ "event_type_startswith": "system.idp"
+ },
+ "mitre": [
+ "T1556.007"
+ ],
+ "name": "Identity-Provider Change by a Principal Who Does Not Normally Make Them",
+ "product": "okta",
+ "service": "identity",
+ "severity": "critical",
+ "slug": "ta-okta-rare-action-on-identity-provider"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-011",
+ "match_when": {
+ "baseline_action_rarity_gte": 0.95,
+ "operation_contains": "conditional access policy"
+ },
+ "mitre": [
+ "T1556.009",
+ "T1484.002"
+ ],
+ "name": "Conditional Access Policy Changed by a Rare Actor",
+ "product": "azure",
+ "service": "entra",
+ "severity": "critical",
+ "slug": "ta-entra-conditional-access-change-rare-action"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-012",
+ "match_when": {
+ "baseline_principal_volume_z_gte": 3.0,
+ "event_type": "signin"
+ },
+ "mitre": [
+ "T1110.003"
+ ],
+ "name": "Entra Sign-In Volume Far Above This Principal's Normal",
+ "product": "azure",
+ "service": "entra",
+ "severity": "high",
+ "slug": "ta-entra-signin-volume-spike"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-013",
+ "match_when": {
+ "baseline_peer_deviation_gte": 3.0,
+ "event_type_contains": "group.user_membership"
+ },
+ "mitre": [
+ "T1098"
+ ],
+ "name": "Group Membership Changes Far Above the Principal's Peer Group",
+ "product": "identity",
+ "service": "directory",
+ "severity": "medium",
+ "slug": "ta-identity-peer-deviation-on-group-change"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-014",
+ "match_when": {
+ "baseline_oauth_app_volume_z_gte": 3.0,
+ "event_type": "oauth_token_event"
+ },
+ "mitre": [
+ "T1550.001",
+ "T1530"
+ ],
+ "name": "OAuth Application Activity Far Above Its Own Normal",
+ "product": "google-workspace",
+ "service": "oauth",
+ "severity": "high",
+ "slug": "ta-saas-oauth-app-volume-spike"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-015",
+ "match_when": {
+ "baseline_action_rarity_gte": 0.95,
+ "event_type": "admin"
+ },
+ "mitre": [
+ "T1098"
+ ],
+ "name": "Workspace Admin Action This Principal Has Never Performed",
+ "product": "google-workspace",
+ "service": "admin",
+ "severity": "high",
+ "slug": "ta-workspace-rare-admin-action"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-016",
+ "match_when": {
+ "baseline_principal_volume_z_gte": 3.0,
+ "event_type": "drive"
+ },
+ "mitre": [
+ "T1530"
+ ],
+ "name": "Drive Download Volume Far Above This Principal's Normal",
+ "product": "google-workspace",
+ "service": "drive",
+ "severity": "high",
+ "slug": "ta-workspace-drive-download-volume-spike"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-017",
+ "match_when": {
+ "baseline_client_family_rarity_gte": 0.95,
+ "operation_in": [
+ "New-InboxRule",
+ "Set-InboxRule"
+ ]
+ },
+ "mitre": [
+ "T1114.003",
+ "T1564.008"
+ ],
+ "name": "Mailbox Rule Created From a Client This Principal Has Never Used",
+ "product": "m365",
+ "service": "exchange",
+ "severity": "high",
+ "slug": "ta-m365-mailbox-rule-from-rare-client"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-018",
+ "match_when": {
+ "action_startswith_any": [
+ "workspace_",
+ "organization_",
+ "app_"
+ ],
+ "baseline_action_rarity_gte": 0.95
+ },
+ "mitre": [
+ "T1098"
+ ],
+ "name": "Slack Workspace Admin Action This Principal Has Never Performed",
+ "product": "slack",
+ "service": "audit",
+ "severity": "medium",
+ "slug": "ta-slack-rare-admin-action"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-019",
+ "match_when": {
+ "baseline_principal_volume_z_gte": 3.0,
+ "event_type_in": [
+ "ReportExport",
+ "BulkApi"
+ ]
+ },
+ "mitre": [
+ "T1530"
+ ],
+ "name": "Salesforce Export Volume Far Above This Principal's Normal",
+ "product": "salesforce",
+ "service": "audit",
+ "severity": "high",
+ "slug": "ta-salesforce-report-export-volume-spike"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-020",
+ "match_when": {
+ "action_startswith": "org.",
+ "baseline_action_rarity_gte": 0.95
+ },
+ "mitre": [
+ "T1098",
+ "T1195.001"
+ ],
+ "name": "GitHub Organisation Setting Changed by a Rare Actor",
+ "product": "github",
+ "service": "audit",
+ "severity": "high",
+ "slug": "ta-github-rare-action-on-org-settings"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-021",
+ "match_when": {
+ "action_in": [
+ "git.clone",
+ "repo.download_zip"
+ ],
+ "baseline_principal_volume_z_gte": 3.0
+ },
+ "mitre": [
+ "T1213.003"
+ ],
+ "name": "Repository Clone Volume Far Above This Principal's Normal",
+ "product": "github",
+ "service": "audit",
+ "severity": "high",
+ "slug": "ta-github-clone-volume-spike"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-022",
+ "match_when": {
+ "baseline_location_rarity_gte": 0.95,
+ "event_type_contains": "token"
+ },
+ "mitre": [
+ "T1098.001"
+ ],
+ "name": "GitLab Token Action From a Country This Principal Has Never Used",
+ "product": "gitlab",
+ "service": "audit",
+ "severity": "high",
+ "slug": "ta-gitlab-token-action-from-rare-country"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-023",
+ "match_when": {
+ "action_in": [
+ "create",
+ "delete",
+ "patch"
+ ],
+ "baseline_action_rarity_gte": 0.95,
+ "resource_contains": "clusterrolebinding"
+ },
+ "mitre": [
+ "T1609",
+ "T1078.003"
+ ],
+ "name": "Kubernetes Verb This Service Account Has Never Used",
+ "product": "kubernetes",
+ "service": "audit",
+ "severity": "high",
+ "slug": "ta-k8s-rare-verb-by-service-account"
+ },
+ {
+ "category": "threat-anomaly",
+ "id": "det-threat-anomaly-024",
+ "match_when": {
+ "baseline_principal_volume_z_gte": 3.0,
+ "resource_contains": "pods/exec"
+ },
+ "mitre": [
+ "T1609"
+ ],
+ "name": "Pod Exec Volume Far Above This Principal's Normal",
+ "product": "kubernetes",
+ "service": "audit",
+ "severity": "medium",
+ "slug": "ta-k8s-exec-volume-spike"
}
],
"version": 1
diff --git a/services/api/app/data/detections/windowed_ruleset.json b/services/api/app/data/detections/windowed_ruleset.json
index 98c4c49d9..355b8cea7 100644
--- a/services/api/app/data/detections/windowed_ruleset.json
+++ b/services/api/app/data/detections/windowed_ruleset.json
@@ -1,5 +1,5 @@
{
- "count": 72,
+ "count": 76,
"rules": [
{
"category": "application",
@@ -290,6 +290,77 @@
"threshold": 100,
"window_seconds": 120
},
+ {
+ "category": "identity",
+ "distinct_by": "src_asn",
+ "group_by": "session_id",
+ "id": "wd-aitm-session-replayed-from-new-asn",
+ "match_when": {
+ "session_id_neq": null
+ },
+ "mitre": [
+ "T1539",
+ "T1557"
+ ],
+ "name": "One session used from two different networks",
+ "severity": "high",
+ "threshold": 2,
+ "window_seconds": 3600
+ },
+ {
+ "category": "identity",
+ "distinct_by": "client_browser",
+ "group_by": "session_id",
+ "id": "wd-aitm-session-replayed-from-new-client",
+ "match_when": {
+ "session_id_neq": null
+ },
+ "mitre": [
+ "T1539",
+ "T1550.004"
+ ],
+ "name": "One session used from two different client families",
+ "severity": "high",
+ "threshold": 2,
+ "window_seconds": 3600
+ },
+ {
+ "category": "identity",
+ "distinct_by": "src_country",
+ "group_by": "session_id",
+ "id": "wd-aitm-session-left-the-country-it-started-in",
+ "match_when": {
+ "session_id_neq": null
+ },
+ "mitre": [
+ "T1539"
+ ],
+ "name": "One session used from two different countries",
+ "severity": "high",
+ "threshold": 2,
+ "window_seconds": 3600
+ },
+ {
+ "category": "identity",
+ "group_by": "session_id",
+ "id": "wd-aitm-mfa-then-session-from-new-asn",
+ "mitre": [
+ "T1557",
+ "T1539"
+ ],
+ "name": "An MFA-satisfied sign-in, then the same session used from another network",
+ "ordered": true,
+ "sequence": [
+ {
+ "mfa_satisfied": true
+ },
+ {
+ "session_id_neq": null
+ }
+ ],
+ "severity": "critical",
+ "window_seconds": 1800
+ },
{
"category": "application",
"group_by": "src_ip",
diff --git a/services/api/tests/test_builtin_rule_catalogue.py b/services/api/tests/test_builtin_rule_catalogue.py
index 7fa7ac357..320cb3d0e 100644
--- a/services/api/tests/test_builtin_rule_catalogue.py
+++ b/services/api/tests/test_builtin_rule_catalogue.py
@@ -66,9 +66,9 @@ PACKAGED = REPO / "services" / "api" / "app" / "data" / "detections"
#: regeneration that silently empties one is a failure here rather than a
#: quieter comparison of two numbers that moved together.
ARTEFACTS: dict[str, int] = {
- "detection_ruleset.json": 741,
+ "detection_ruleset.json": 765,
"detection_ruleset_imported.json": 1770,
- "windowed_ruleset.json": 72,
+ "windowed_ruleset.json": 76,
}
#: Windowed rules declared in fusion's Python rather than in any artefact.
@@ -76,11 +76,13 @@ ARTEFACTS: dict[str, int] = {
#: why the loaded windowed count is 73 against a file holding 72.
PYTHON_RESIDENT_WINDOWED = 3
-#: 741 + 1770 stateless, 73 windowed (70 of the 72 file entries plus the three
-#: above), 2 sequence (the other two file entries). Measured, not assumed —
+#: 765 + 1770 stateless, 76 windowed (73 of the 76 file entries plus the three
+#: above), 3 sequence (the other three file entries). Measured, not assumed —
#: `test_catalogue_matches_what_fusion_actually_loads` re-derives it by running
-#: fusion's loaders.
-FUSION_LOADED_TOTAL = 2586
+#: fusion's loaders. The 2026-10-12 merge train moved it 2586 -> 2614: +24
+#: native rules (depth 3.4's enrichment inputs) and +4 windowed (depth 7.3's
+#: AitM family).
+FUSION_LOADED_TOTAL = 2614
TENANT = uuid.UUID("aaaaaaaa-0000-0000-0000-00000000a173")
ACTOR = uuid.UUID("bbbbbbbb-0000-0000-0000-00000000b173")
diff --git a/services/api/tests/test_compliance_phishing_kb_tenant_isolation.py b/services/api/tests/test_compliance_phishing_kb_tenant_isolation.py
index 35819b2bf..4aebc1827 100644
--- a/services/api/tests/test_compliance_phishing_kb_tenant_isolation.py
+++ b/services/api/tests/test_compliance_phishing_kb_tenant_isolation.py
@@ -152,6 +152,16 @@ def _phishing_row(tenant_id: uuid.UUID, **overrides: Any) -> MagicMock:
"submitted_at": now,
"triaged_at": now,
"raw_content": "Click here to verify",
+ # Depth 7.1 columns. A bare MagicMock answers any attribute with a
+ # truthy mock, so retriage's `getattr(row, "intake_source", "manual")`
+ # read a mock instead of its default and ReportedMessage refused it —
+ # the double must say what a real row says, which for a pre-7.1
+ # submission is these values.
+ "intake_source": "manual",
+ "internet_message_id": "",
+ "recipients": [],
+ "reported_by": "",
+ "headers": {},
}
defaults.update(overrides)
row = MagicMock()
diff --git a/services/api/tests/test_retention_worker.py b/services/api/tests/test_retention_worker.py
index 0a64945dc..ea1b600f7 100644
--- a/services/api/tests/test_retention_worker.py
+++ b/services/api/tests/test_retention_worker.py
@@ -90,6 +90,13 @@ class FakeSession:
return FakeScalarResult(self._policies)
if sql.strip().upper().startswith("SELECT COUNT(*) FROM ALERTS"):
return FakeScalarResult(self._alert_counts.get(str((params or {}).get("tenant_id")), 0))
+ if "FROM audit_log" in sql:
+ # Depth 8.1 gave the worker an audit leg (`_purge_audit` counts and
+ # then calls `audit_retention_truncate`). Zero rows past the window
+ # keeps the leg quiet here — these cases pin the lake and alert
+ # stores' behaviour, and a double that cannot answer this query
+ # reads as an audit-store failure in every pinned error list.
+ return FakeScalarResult(0)
return FakeScalarResult(None)
async def commit(self) -> None:
diff --git a/services/api/tests/test_route_shadowing.py b/services/api/tests/test_route_shadowing.py
index 0240d64d5..87fce98d8 100644
--- a/services/api/tests/test_route_shadowing.py
+++ b/services/api/tests/test_route_shadowing.py
@@ -75,17 +75,24 @@ def _shape(path: str) -> tuple[str, ...]:
return tuple("{}" if s.startswith("{") and s.endswith("}") else s for s in path.split("/") if s)
-def _probe_url(path: str) -> str:
+def _probe_url(path: str, *, uuid_filler: bool = False) -> str:
"""A concrete URL for a published path, with parameters filled in.
- The filler is alphanumeric, which satisfies every path convertor in this
- tree including the one guarding ``{action}``.
+ Two fillers, because the published path cannot say which convertor guards
+ a parameter — OpenAPI strips the ``:uuid`` off ``{submission_id:uuid}``.
+ The alphanumeric filler satisfies the literal-excluding convertors such as
+ the one guarding ``{action}``; the UUID filler satisfies ``uuid``-typed
+ parameters (depth 7.1 introduced the tree's first). The caller probes with
+ the first and retries with the second before calling a route unreachable,
+ so a route no filler can reach is still reported.
"""
counter = 0
def fill(_: re.Match[str]) -> str:
nonlocal counter
counter += 1
+ if uuid_filler:
+ return f"00000000-0000-4000-8000-{counter:012d}"
return f"aisocprobe{counter}"
return _PARAM.sub(fill, path)
@@ -141,6 +148,11 @@ def unreachable_routes(app: FastAPI, *, minimum: int = MINIMUM_PUBLISHED_OPERATI
for method, path in operations:
response = client.request(method.upper(), _probe_url(path))
matched = recorder.route
+ if matched is None and "{" in path:
+ # A uuid-convertor parameter rejects the alphanumeric filler
+ # before any route can match; retry with a well-formed UUID.
+ response = client.request(method.upper(), _probe_url(path, uuid_filler=True))
+ matched = recorder.route
if matched is None:
problems.append(f"{method.upper()} {path} is published but no route matched it (status {response.status_code})")
continue