Query Details

Security for AI - MITRE ATLAS Coverage Statistics by Tactic

MDXDR Security For AI MITRE ATLAS 04 Coverage Statistics By Tactic

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
);
MitreAtlas
| join kind=leftouter AIAlertCoverage on TechniqueId
| extend AlertCount = coalesce(AlertCount, 0)
| summarize
    TotalTechniques = dcount(TechniqueId),
    ObservedTechniques = dcountif(TechniqueId, AlertCount > 0),
    ObservedTechniqueNames = make_set_if(TechniqueName, AlertCount > 0),
    NotObservedTechniqueNames = make_set_if(TechniqueName, AlertCount == 0),
    DetectionTitles = make_set(DetectionTitles),
    AlertIds = make_set(AlertIds)
    by Tactic
| extend
    NotObservedTechniques = TotalTechniques - ObservedTechniques,
    UniqueAlertCount = array_length(AlertIds),
    DetectionCount = array_length(DetectionTitles),
    CoveragePercentage = round(100.0 * ObservedTechniques / TotalTechniques, 2)
| project Tactic, TotalTechniques, ObservedTechniques, NotObservedTechniques,
    CoveragePercentage, UniqueAlertCount, DetectionCount, DetectionTitles,
    ObservedTechniqueNames, NotObservedTechniqueNames
| order by CoveragePercentage desc

About this query

Explanation

This KQL query is designed to analyze and summarize the coverage of MITRE ATLAS techniques by tactic, using data from Microsoft Defender XDR. Here's a simplified explanation of what the query does:

  1. Data Retrieval:

    • It pulls data from an external JSON file containing MITRE ATLAS techniques and their details.
    • It also retrieves 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 information about each technique, including its ID, name, description, associated tactics, and whether it's a sub-technique.
    • It identifies alerts related to these techniques and counts how many distinct alerts are associated with each technique.
  3. Analysis:

    • It joins the technique data with alert data to determine which techniques have been observed (i.e., have associated alerts) and which have not.
    • It calculates various statistics for each tactic, such as the total number of techniques, the number of observed and not observed techniques, and the percentage of techniques covered by alerts.
  4. Output:

    • The query outputs a summary for each tactic, showing the number of techniques, the coverage percentage, and details about the alerts and techniques observed.
    • The results are sorted by coverage percentage in descending order, highlighting which tactics have better detection coverage.

Overall, this query helps identify gaps in detection coverage for different tactics within the MITRE ATLAS framework, providing insights into where improvements might be needed in AI security monitoring.