Query Details

Pivot In Every Prompt Injection Detection For Investigation

Query

// Prompt-injection detections over the last 30 days, including details
let lookback = 30d;
EmailEvents
| where Timestamp > ago(lookback)
| where DetectionMethods has "Prompt injection"
| project Timestamp, NetworkMessageId, SenderFromAddress, RecipientEmailAddress,
          Subject, DeliveryAction, DeliveryLocation, DetectionMethods
| sort by Timestamp desc

About this query

Pivot in every prompt-injection detection for investigation

Description

This query helps investigate further, once you've run Uncover every prompt-injection detection and its disposition.

Microsoft Defender XDR

Versioning

VersionDateComments
1.008/10/2026Initial publish

Explanation

This query is designed to help investigate prompt-injection detections in email communications over the past 30 days. It is a follow-up step after identifying such detections and their outcomes. Here's a simple breakdown of what the query does:

  1. Time Frame: It looks at email events from the last 30 days.
  2. Filter for Prompt Injection: It specifically filters for email events where the detection method includes "Prompt injection."
  3. Select Relevant Information: The query retrieves specific details about these events, including:
    • The time the event was recorded (Timestamp).
    • A unique identifier for the email (NetworkMessageId).
    • The sender's email address (SenderFromAddress).
    • The recipient's email address (RecipientEmailAddress).
    • The subject of the email (Subject).
    • The action taken on the email (e.g., delivered, blocked) (DeliveryAction).
    • Where the email was delivered (DeliveryLocation).
    • The methods used to detect the threat (DetectionMethods).
  4. Sort the Results: The results are sorted by the timestamp in descending order, meaning the most recent events appear first.

This query is part of a broader investigation process to understand and respond to prompt-injection threats detected by Microsoft Defender XDR.