← Back to SOC feed Coverage →

Copilot Studio AI Agents - Sending email to external mailboxes

kql MEDIUM Azure-Sentinel
T1041
IdentityInfo
backdoorexploithuntingmicrosoftofficial
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-04-21T09:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may configure Copilot Studio AI agents to exfiltrate data by sending emails to external mailboxes, leveraging the environment to maintain persistence or steal sensitive information. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential data exfiltration channels and mitigate insider threats.

KQL Query

let OrgDomains = 
  IdentityInfo 
  | extend domains = tostring(split(AccountUpn, "@")[1]) 
  | distinct domains; 
let SendOps = dynamic([ 
  "SendEmailV2",             // Office 365 Outlook 
  "SharedMailboxSendEmailV2",// Office 365 Outlook 
  "| w",                     // Outlook.com 
  "SendEmailV2",             // Gmail 
  "SendEmailV3",             // SMTP 
  "SendEmailV3",             // Mail 
  "SendEmailGAVersion",      // Azure Communication Email 
  "PostAntTextEmail",        // Ant Text Automation 
  "SendEmailV4"              // SendGrid 
]); 
let FromActions = 
  AIAgentsInfo 
  | where RegistrySource != "A365"
  | summarize arg_max(Timestamp, *) by AIAgentId 
  | where AgentStatus != "Deleted" 
  | mv-expand ActionDetail = todynamic(AgentToolsDetails) 
  | where tostring(ActionDetail.action.operationId) in~ (SendOps) 
  | mv-expand ActionInput = ActionDetail.inputs 
  | where tostring(ActionInput.propertyName) == "To" 
  | extend ToAddress = tostring(ActionInput.value.literalValue) 
  | extend Domain = tostring(split(ToAddress, "@")[1]), MailConeector = tostring(ActionDetail.action.operationId), source = "AgentToolsDetails" 
  | where isnotempty(Domain) and Domain !in (OrgDomains) 
  | project-reorder AgentCreationTime, AIAgentId, AIAgentName, AgentStatus, CreatorAccountUpn, OwnerAccountUpns, ToAddress, Domain, source, MailConeector; 
let FromTopics = 
  AIAgentsInfo 
  | summarize arg_max(Timestamp, *) by AIAgentId 
  | where AgentStatus != "Deleted" 
  | mv-expand TopicDetail = todynamic(AgentTopicsDetails) 
  | mv-expand TopicAction = TopicDetail.beginDialog.actions 
  | where tostring(TopicAction.operationId) in~ (SendOps) 
  | extend ToAddress = tostring(coalesce(TopicAction.input.binding.To.literalValue, TopicAction.input.binding['to'].literalValue)) 
  | extend Domain = tostring(split(ToAddress, "@")[1]), MailConeector = tostring(TopicAction.operationId), source = "AgentTopicsDetails" 
  | where isnotempty(Domain) and Domain !in (OrgDomains) 
  | project-reorder AgentCreationTime, AIAgentId, AIAgentName, AgentStatus, CreatorAccountUpn, OwnerAccountUpns, ToAddress, Domain, source, MailConeector; 
FromActions 
| union FromTopics 
| project-reorder AgentCreationTime, AIAgentId, AIAgentName, AgentStatus, CreatorAccountUpn, OwnerAccountUpns 

Analytic Rule Definition

id: 0d5e9f1a-2b3c-4d5e-6f7a-8b9c0d1e2f3a
name: Copilot Studio AI Agents - Sending email to external mailboxes
description: |
  This query identifies Copilot Studio AI agents configured to send emails to external mailboxes (outside the organization`s domains). 
  Such configurations can lead to sensitive or internal data being exfiltrated beyond organizational boundaries, creating compliance and security risks. 
  Attackers could exploit this to leak confidential information or use compromised agents as a channel for data exfiltration.
  Recommended Action: Verify with the agent owner whether sending emails externally is necessary for the business scenario. 
  Confirm what data is being sent and ensure the external domain is authorized to receive it. If not required, remove or restrict this capability.
requiredDataConnectors: []
tactics:
  - Exfiltration
relevantTechniques:
  - T1041
query: |
  let OrgDomains = 
    IdentityInfo 
    | extend domains = tostring(split(AccountUpn, "@")[1]) 
    | distinct domains; 
  let SendOps = dynamic([ 
    "SendEmailV2",             // Office 365 Outlook 
    "SharedMailboxSendEmailV2",// Office 365 Outlook 
    "| w",                     // Outlook.com 
    "SendEmailV2",             // Gmail 
    "SendEmailV3",             // SMTP 
    "SendEmailV3",             // Mail 
    "SendEmailGAVersion",      // Azure Communication Email 
    "PostAntTextEmail",        // Ant Text Automation 
    "SendEmailV4"              // SendGrid 
  ]); 
  let FromActions = 
    AIAgentsInfo 
    | where RegistrySource != "A365"
    | summarize arg_max(Timestamp, *) by AIAgentId 
    | where AgentStatus != "Deleted" 
    | mv-expand ActionDetail = todynamic(AgentToolsDetails) 
    | where tostring(ActionDetail.action.operationId) in~ (SendOps) 
    | mv-expand ActionInput = ActionDetail.inputs 
    | where tostring(ActionInput.propertyName) == "To" 
    | extend ToAddress = tostring(ActionInput.value.literalValue) 
    | extend Domain = tostring(split(ToAddress, "@")[1]), MailConeector = tostring(ActionDetail.action.operationId), source = "AgentToolsDetails" 
    | where isnotempty(Domain) and Domain !in (OrgDomains) 
    | project-reorder AgentCreationTime, AIAgentId, AIAgentName, AgentStatus, CreatorAccountUpn, OwnerAccountUpns, ToAddress, Domain, source, MailConeector; 
  let FromTopics = 
    AIAgentsInfo 
    | summarize arg_max(Timestamp, *) by AIAgentId 
    | where AgentStatus != "Deleted" 
    | mv-expand TopicDetail = todynamic(AgentTopicsDetails) 
    | mv-expand TopicAction = TopicDetail.beginDialog.actions 
    | where tostring(TopicAction.operationId) in~ (SendOps) 
    | extend ToAddress = tostring(coalesce(TopicAction.input.binding.To.literalValue, TopicAction.input.binding['to'].literalValue)) 
    | extend Domain = tostring(split(ToAddress, "@")[1]), MailConeector = tostring(TopicAction.operationId), source = "AgentTopicsDetails" 
    | where isnotempty(Domain) and Domain !in (OrgDomains) 
    | project-reorde

Required Data Sources

Sentinel TableNotes
IdentityInfoEnsure this data connector is enabled

MITRE ATT&CK Context

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/AI Agents/Copilot Studio Connector/AIAgentsEmailExternalMailbox.yaml