Detection rules › Kusto
Egress Defend - Dangerous Attachment Detected
'Defend has detected a user has a suspicious file type from a suspicious sender in their mailbox.'
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Initial Access | T1566 Phishing |
| Execution | T1204 User Execution |
| Persistence | T1546 Event Triggered Execution |
| Privilege Escalation | T1546 Event Triggered Execution |
| Execution | T0853 Scripting, T0863 User Execution |
Rule body kusto
id: a0e55dd4-8454-4396-91e6-f28fec3d2cab
name: Egress Defend - Dangerous Attachment Detected
description: |
'Defend has detected a user has a suspicious file type from a suspicious sender in their mailbox.'
severity: Medium
status: Available
requiredDataConnectors:
- connectorId: EgressDefend
dataTypes:
- EgressDefend_CL
queryFrequency: 30m
queryPeriod: 30m
triggerOperator: gt
triggerThreshold: 0
tactics:
- Execution
- InitialAccess
- Persistence
- PrivilegeEscalation
relevantTechniques:
- T1204
- T0853
- T0863
- T1566
- T1546
- T1546
tags:
- Defend
query: |
DefendAuditData
| where ThreatLevel == "suspicious" or ThreatLevel == "dangerous"
| mv-expand todynamic(Attachments)
| where Attachments.name matches regex @"(?i)^.*\.(doc|docx|docm|pdf|xls|xlsx|xlsm|html|zip)$(?-i)"
| summarize attachmentCount=count() by TimeGenerated, tostring(Attachments.name), Subject, From, Account_0_FullName = trim(@"[^@.\w]+",Recipients), timesClicked = LinksClicked, SenderIP
entityMappings:
- entityType: Account
fieldMappings:
- identifier: FullName
columnName: Account_0_FullName
- entityType: File
fieldMappings:
- identifier: Name
columnName: Attachments_name
- entityType: Mailbox
fieldMappings:
- identifier: MailboxPrimaryAddress
columnName: Account_0_FullName
- entityType: IP
fieldMappings:
- identifier: Address
columnName: SenderIP
alertDetailsOverride:
alertDisplayNameFormat: Alert - {{Account_0_FullName}} has suspicious attachment.
version: 1.0.0
kind: Scheduled
Stages and Predicates
Stage 1: source
DefendAuditData
Stage 2: where
| where ThreatLevel == "suspicious" or ThreatLevel == "dangerous"
Stage 3: mv-expand
| mv-expand todynamic(Attachments)
Stage 4: where
| where Attachments.name matches regex @"(?i)^.*\.(doc|docx|docm|pdf|xls|xlsx|xlsm|html|zip)$(?-i)"
Stage 5: summarize
| summarize attachmentCount=count() by TimeGenerated, tostring(Attachments.name), Subject, From, Account_0_FullName = trim(@"[^@.\w]+",Recipients), timesClicked = LinksClicked, SenderIP
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
ThreatLevel | eq |
|
name | regex_match |
|
Output fields
Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.
| Field | Source |
|---|---|
Account_0_FullName | summarize |
From | summarize |
SenderIP | summarize |
Subject | summarize |
TimeGenerated | summarize |
attachmentCount | summarize |
timesClicked | summarize |