Query Details

Security for AI - MITRE ATLAS Coverage Percentage Visualization

MDXDR Security For AI MITRE ATLAS 08 Coverage Percentage Visualization

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),
    Observed = dcountif(TechniqueId, AlertCount > 0) by Tactic
| extend CoveragePercentage = round(100.0 * Observed / TotalTechniques, 2)
| project Tactic, CoveragePercentage
| order by CoveragePercentage desc
| render columnchart

About this query

Explanation

This KQL query is designed to visualize the coverage of MITRE ATLAS techniques by displaying the percentage of techniques observed for each tactic. Here's a simplified breakdown of what the query does:

  1. Data Retrieval:

    • It fetches data from an external JSON file containing MITRE ATLAS techniques.
    • It processes this data to extract relevant details like technique IDs, names, descriptions, and associated tactics.
  2. Alert Information:

    • It pulls alert data from the AlertInfo table, specifically focusing on alerts related to "Security for AI" and "Microsoft Defender for AI Services".
    • It extracts technique IDs from these alerts and counts the number of unique alerts for each technique.
  3. Data Combination:

    • The query combines the MITRE ATLAS data with the alert data to determine which techniques have been observed in alerts.
  4. Coverage Calculation:

    • For each tactic, it calculates the total number of techniques and the number of techniques that have been observed in alerts.
    • It then computes the coverage percentage, which is the proportion of observed techniques out of the total techniques for each tactic.
  5. Visualization:

    • The results are displayed in a column chart, showing the coverage percentage for each tactic, sorted in descending order.

Overall, this query helps identify how well the observed alerts cover the MITRE ATLAS techniques for different tactics, highlighting potential gaps in detection capabilities.