Query Details

Security for AI - MITRE ATLAS Observed Detection Coverage

MDXDR Security For AI MITRE ATLAS 01 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 =
    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),
        DetectionCount = dcount(Title),
        DetectionTitles = make_set(Title),
        DetectionSources = make_set(DetectionSource),
        ServiceSources = make_set(ServiceSource),
        Categories = make_set(Category),
        Severities = make_set(Severity),
        FirstSeen = min(Timestamp),
        LastSeen = max(Timestamp)
        by TechniqueId;
MitreAtlas
| join kind=leftouter AIAlertCoverage on TechniqueId
| extend
    AlertCount = coalesce(AlertCount, 0),
    DetectionCount = coalesce(DetectionCount, 0)
| extend CoverageStatus = iff(
    AlertCount > 0, "Observed", "Not Observed")
| project
    Tactic, TechniqueId, TechniqueName, IsSubTechnique,
    CoverageStatus, AlertCount, DetectionCount, DetectionTitles,
    DetectionSources, ServiceSources, Categories, Severities,
    FirstSeen, LastSeen, Description, Url, Created, Modified
| order by AlertCount desc, Tactic asc, TechniqueId asc

About this query

Explanation

This KQL query is designed to analyze AI security alerts in relation to the MITRE ATLAS framework. Here's a simplified breakdown of what the query does:

  1. Data Collection:

    • It retrieves data from an external MITRE ATLAS JSON file, which contains information about various attack techniques.
    • It also gathers alert data from the AlertInfo table in Microsoft Defender XDR, focusing on alerts related to AI security.
  2. Data Processing:

    • The query extracts and processes technique IDs from the MITRE ATLAS data and matches them with technique IDs found in AI security alerts.
    • It identifies which techniques have been observed in alerts and which have not.
  3. Analysis:

    • For each technique, it counts how many alerts have been observed and summarizes details such as alert titles, sources, categories, and severities.
    • It determines the coverage status of each technique, labeling them as "Observed" if alerts were found or "Not Observed" if no alerts were detected.
  4. Output:

    • The results include detailed information about each technique, such as its name, description, associated tactics, and the number of times it has been observed in alerts.
    • The output is sorted by the number of alerts observed, providing a clear view of which techniques are most frequently detected.

Overall, this query helps identify gaps in detection coverage by highlighting techniques that have not been observed in alerts, which could indicate untested detection capabilities or gaps in telemetry.