Query Details

Security for AI - MITRE ATLAS Navigator JSON Export

MDXDR Security For AI MITRE ATLAS 10 Navigator Export

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)
| extend DetectionCount = coalesce(array_length(DetectionTitles), 0)
| extend CoverageScore = iff(AlertCount > 0, 100, 0),
    CoverageColor = iff(AlertCount > 0, "#31a354", "#d9d9d9")
| extend Comment = strcat(TechniqueName, " | Alerts: ", tostring(AlertCount),
    " | Detection Count: ", tostring(DetectionCount),
    " | Detection Titles: ", tostring(DetectionTitles))
| extend Technique = bag_pack(
    "techniqueID", TechniqueId, "tactic", Tactic,
    "score", CoverageScore, "color", CoverageColor,
    "comment", Comment, "enabled", true, "showSubtechniques", true)
| summarize Techniques = make_list(Technique)
| extend NavigatorLayer = bag_pack(
    "name", "Microsoft Defender XDR - MITRE ATLAS Coverage",
    "description", "Observed AI security detection coverage based on Microsoft Defender XDR alerts",
    "domain", "atlas-atlas",
    "versions", bag_pack("navigator", "5.3.2", "layer", "4.5"),
    "techniques", Techniques,
    "gradient", bag_pack("colors", dynamic(["#d9d9d9", "#31a354"]), "minValue", 0, "maxValue", 100),
    "legendItems", pack_array(bag_pack("label", "Observed", "color", "#31a354"),
        bag_pack("label", "Not Observed", "color", "#d9d9d9")),
    "hideDisabled", false, "showTacticRowBackground", false)
| project NavigatorLayer = tostring(NavigatorLayer)

About this query

Explanation

This KQL query is designed to create a JSON file that can be imported into the MITRE ATLAS Navigator tool. Here's a simplified breakdown of what the query does:

  1. Data Retrieval: It pulls data from two main sources:

    • The MITRE ATLAS JSON file, which contains information about various attack techniques.
    • The AlertInfo table from Microsoft Defender XDR, which contains alerts related to AI security.
  2. Data Processing:

    • It extracts relevant details from the MITRE ATLAS data, such as technique IDs, names, descriptions, and associated tactics.
    • It processes the AlertInfo data to identify alerts related to specific techniques, counting the number of alerts and collecting their titles.
  3. Data Integration:

    • The query combines the MITRE ATLAS data with the alert data to determine which techniques have been observed in alerts and which have not.
    • It calculates a "coverage score" for each technique, indicating whether alerts have been observed (100 for observed, 0 for not observed).
  4. Output Formatting:

    • The results are formatted into a JSON structure that includes details like technique IDs, tactics, coverage scores, and alert information.
    • This JSON structure is designed to be imported into the MITRE ATLAS Navigator, allowing users to visually analyze the coverage of AI security detections.
  5. Purpose:

    • The main goal is to help users understand which attack techniques have been detected by their AI security systems and which have not, highlighting potential gaps in detection capabilities.

Overall, this query helps security analysts visualize and assess the effectiveness of their AI security measures against known attack techniques.