This hypothesis targets adversaries leveraging phishing campaigns (T1566) to deliver malware via email, where mapping sender IP addresses and geographic locations helps identify suspicious or inconsistent origin points. Proactively hunting for these patterns in Azure Sentinel allows the SOC to detect potential supply chain attacks or compromised senders before they result in widespread endpoint infections.
EmailEvents
| where Timestamp > ago(30d)
| where OrgLevelPolicy != "Phishing simulation" and OrgLevelPolicy != "SecOps Mailbox"
| extend Key = strcat(NetworkMessageId, "-", RecipientEmailAddress)
| summarize arg_max(Timestamp, *) by Key
| where ThreatTypes has "Malware" and isnotempty(SenderIPv4)
| summarize count() by SenderIPv4
| extend GeoInfo = geo_info_from_ip_address(SenderIPv4)
| extend Latitude = tostring(GeoInfo.latitude), Longitude = tostring(GeoInfo.longitude)
| project SenderIPv4, Latitude, Longitude, ['Malware Emails'] = count_
id: ecd834a7-cd3e-4932-afa3-25465fe41401
name: Malware Detection IP and Geo Position
description: |
This query summarises inbound email malware detections by sender IP address with geographic coordinates for mapping.
description-detailed: |
This query summarises inbound email malware detections in Microsoft Defender for Office 365 by sender IPv4 address, resolving each IP to its geographic latitude and longitude using geo_info_from_ip_address so the sending infrastructure can be plotted on a map.
Messages are de-duplicated to the latest record per NetworkMessageId and recipient, and deliveries to the SecOps mailbox and by the phishing simulation system are excluded.
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
dataTypes:
- EmailEvents
tactics:
- InitialAccess
relevantTechniques:
- T1566
query: |
EmailEvents
| where Timestamp > ago(30d)
| where OrgLevelPolicy != "Phishing simulation" and OrgLevelPolicy != "SecOps Mailbox"
| extend Key = strcat(NetworkMessageId, "-", RecipientEmailAddress)
| summarize arg_max(Timestamp, *) by Key
| where ThreatTypes has "Malware" and isnotempty(SenderIPv4)
| summarize count() by SenderIPv4
| extend GeoInfo = geo_info_from_ip_address(SenderIPv4)
| extend Latitude = tostring(GeoInfo.latitude), Longitude = tostring(GeoInfo.longitude)
| project SenderIPv4, Latitude, Longitude, ['Malware Emails'] = count_
version: 1.0.0
| Sentinel Table | Notes |
|---|---|
EmailEvents | Ensure this data connector is enabled |
Scenario: Automated vulnerability scanning or port scanning tools (e.g., Nessus, Qualys, or OpenSCAP) performing routine outbound/inbound checks where the scanner’s IP is geolocated in a region different from the corporate headquarters, potentially triggering geo-mismatch alerts if the rule flags “unexpected” locations for known scanner IPs.
sender_ip in (10.20.5.10, 10.20.5.11) or sender_domain ends with ".scan.internal").Scenario: Cloud-based backup or replication services (e.g., Veeam, Rubrik, or AWS S3) initiating data transfer sessions where the source IP belongs to a cloud provider’s regional endpoint (e.g., us-east-1 vs. eu-west-1), causing a geographic discrepancy if the enterprise HQ is in a different region.
sender_ip matches /10.0.0.0/8 for AWS or sender_domain contains "backup.azure.com").Scenario: Scheduled email notifications from internal monitoring or ticketing systems (e.g., ServiceNow, Jira, or Datadog) sent from a load balancer or mail relay IP that is geolocated in a data center region different from the user’s location, especially if the relay IP is shared across multiple regions.
sender_domain in ("alerts.datadoghq.com", "jira.internal", "servicenow.corp") or `subject contains ”