Security for AI - MITRE ATLAS Unmapped AI Alerts
MDXDR Security For AI MITRE ATLAS 06 Unmapped Alerts
Query
let MitreAtlas =
externaldata(objects: dynamic)
[
@"https://raw.githubusercontent.com/mitre-atlas/atlas-navigator-data/main/dist/stix-atlas.json"
]
with (format="multijson")
| mv-expand objects
| where objects.type == "attack-pattern"
| mv-expand Reference = objects.external_references
| where Reference.source_name == "mitre-atlas"
| project
TechniqueId = tostring(Reference.external_id),
TechniqueName = tostring(objects.name),
Description = tostring(objects.description),
Tactics = objects.kill_chain_phases,
IsSubTechnique = tobool(objects.x_mitre_is_subtechnique),
Url = tostring(Reference.url),
Created = todatetime(objects.created),
Modified = todatetime(objects.modified)
| mv-expand Tactics
| extend Tactic = tostring(Tactics.phase_name)
| project-away Tactics;
let KnownAtlas = MitreAtlas | distinct TechniqueId | extend CatalogueMatch = 1;
let AIAlerts = materialize(
AlertInfo
| where DetectionSource in (
"Security for AI",
"Microsoft Defender for AI Services"
)
| summarize arg_max(Timestamp, *) by AlertId
| extend TechniqueIds = extract_all(
@"(AML\.T\d{4}(?:\.\d{3})?)",
tostring(AttackTechniques))
);
let AlertMappingStatus = materialize(
AIAlerts
| mv-expand TechniqueId = TechniqueIds to typeof(string)
| where isnotempty(TechniqueId)
| join kind=leftouter KnownAtlas on TechniqueId
| summarize
ValidAtlasIds = make_set_if(TechniqueId, CatalogueMatch == 1),
UnknownAtlasIds = make_set_if(TechniqueId, isnull(CatalogueMatch))
by AlertId
);
AIAlerts
| join kind=leftouter AlertMappingStatus on AlertId
| extend ValidMappingCount = coalesce(array_length(ValidAtlasIds), 0),
UnknownMappingCount = coalesce(array_length(UnknownAtlasIds), 0)
| extend MappingStatus = case(
ValidMappingCount == 0 and UnknownMappingCount == 0, "No ATLAS Mapping",
ValidMappingCount == 0 and UnknownMappingCount > 0, "Unknown ATLAS ID",
ValidMappingCount > 0 and UnknownMappingCount > 0, "Partial Mapping", "Mapped")
| where MappingStatus != "Mapped"
| summarize AlertCount = dcount(AlertId), AlertIds = make_set(AlertId),
AttackTechniques = make_set(AttackTechniques),
ValidAtlasIds = make_set(ValidAtlasIds), UnknownAtlasIds = make_set(UnknownAtlasIds),
Categories = make_set(Category), Severities = make_set(Severity),
FirstSeen = min(Timestamp), LastSeen = max(Timestamp)
by Title, DetectionSource, ServiceSource, MappingStatus
| project Title, MappingStatus, DetectionSource, ServiceSource, AlertCount,
AttackTechniques, ValidAtlasIds, UnknownAtlasIds, Categories, Severities,
AlertIds, FirstSeen, LastSeen
| order by AlertCount desc, Title ascAbout this query
Explanation
This KQL query is designed to identify security alerts related to AI that do not have corresponding MITRE ATLAS IDs or have IDs that are not present in the current ATLAS catalogue. Here's a simplified breakdown of what the query does:
-
External Data Retrieval: It fetches the MITRE ATLAS data from an external JSON source, focusing on attack patterns and their associated details like technique IDs, names, descriptions, and tactics.
-
Known ATLAS Techniques: It creates a list of known ATLAS technique IDs from the fetched data.
-
AI Alerts Extraction: It gathers alerts from the
AlertInfotable that are related to AI security, specifically those from "Security for AI" or "Microsoft Defender for AI Services". It extracts technique IDs from these alerts. -
Mapping Status Evaluation: It checks each alert's technique IDs against the known ATLAS techniques to determine if they are valid, unknown, or partially mapped.
-
Filtering and Summarization: The query filters out alerts that are fully mapped and focuses on those with no mapping, unknown IDs, or partial mapping. It then summarizes these alerts by counting them, listing their IDs, and categorizing them by various attributes like detection source, severity, and time range.
-
Output: The results are ordered by the number of alerts and include details such as the alert title, mapping status, detection source, and other relevant information.
Overall, this query helps identify gaps in the mapping of AI-related security alerts to the MITRE ATLAS framework, which can highlight areas where detection capabilities might be incomplete or where there are discrepancies between the alert data and the ATLAS catalogue.