Security for AI - MITRE ATLAS Enriched Observed Detection Coverage
MDXDR Security For AI MITRE ATLAS 02 Enriched Detection Coverage
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 AIAlertCoverage = 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))
| mv-expand TechniqueId = TechniqueIds to typeof(string)
| where isnotempty(TechniqueId)
| summarize
AlertCount = dcount(AlertId),
AlertIds = make_set(AlertId),
DetectionTitles = make_set(Title)
by TechniqueId
);
let AIEvidenceCoverage =
AIAlertCoverage
| mv-expand AlertId = AlertIds to typeof(string)
| project TechniqueId, AlertId
| join kind=inner (
AlertEvidence
| extend AF = parse_json(AdditionalFields)
| project
AlertId,
EvidenceCategories = parse_json(Categories),
EntityType,
AgentName = tostring(AF.AgentName),
AgentId = tostring(AF.AgentId),
AgentPlatform = tostring(AF.HostingPlatformType)
) on AlertId
| summarize
EvidenceCategories = make_set(EvidenceCategories),
EntityTypes = make_set(EntityType),
AgentNames = make_set_if(AgentName, isnotempty(AgentName)),
AgentIds = make_set_if(AgentId, isnotempty(AgentId)),
AgentPlatforms = make_set_if(AgentPlatform, isnotempty(AgentPlatform))
by TechniqueId
| extend AffectedAgents = array_length(AgentIds);
let EnrichedCoverage = materialize(
AIAlertCoverage
| join kind=leftouter AIEvidenceCoverage on TechniqueId
| project
TechniqueId,
AlertCount,
DetectionTitles,
EvidenceCategories,
EntityTypes,
AgentNames,
AgentIds,
AgentPlatforms,
AffectedAgents,
AlertIds
);
MitreAtlas
| join kind=leftouter EnrichedCoverage on TechniqueId
| extend
AlertCount = coalesce(AlertCount, 0),
AffectedAgents = coalesce(AffectedAgents, 0)
| extend CoverageStatus = iff(
AlertCount > 0, "Observed", "Not Observed")
| project
Tactic,
TechniqueId,
TechniqueName,
IsSubTechnique,
CoverageStatus,
AlertCount,
DetectionTitles,
EvidenceCategories,
EntityTypes,
AffectedAgents,
AgentNames,
AgentIds,
AgentPlatforms,
AlertIds,
Description,
Url,
Created,
Modified
| order by AlertCount desc, Tactic asc, TechniqueId ascAbout this query
Explanation
This KQL query is designed to enhance the visibility of AI-related security detections by integrating MITRE ATLAS data with observed alerts from Microsoft Defender XDR. Here's a simplified breakdown of what the query does:
-
Data Retrieval: It fetches MITRE ATLAS data from an external JSON source, focusing on attack patterns and their details like technique IDs, names, descriptions, and associated tactics.
-
Alert Information: It gathers alert data from the
AlertInfotable, specifically those related to AI security, and extracts technique IDs from these alerts. It then summarizes the alerts by counting them and collecting their IDs and titles. -
Evidence Information: It further examines the
AlertEvidencetable to gather additional details about each alert, such as evidence categories, entity types, and information about AI agents involved (names, IDs, and platforms). -
Data Enrichment: The query combines the alert and evidence data, enriching it with the MITRE ATLAS information. This results in a comprehensive view of which techniques have been observed and the context around these observations.
-
Output: The final output includes details like tactics, technique IDs and names, whether a technique is a sub-technique, the status of coverage (observed or not), alert counts, detection titles, evidence categories, entity types, affected agents, and more. The results are sorted by the number of alerts, tactic, and technique ID.
Overall, this query helps identify gaps in detection coverage and provides insights into the AI-related security landscape by correlating observed alerts with known attack techniques from the MITRE ATLAS framework.