type.inbound
and (
sender.email.domain.domain == "messaging.microsoft.com"
or sender.email.email == 'office365alerts@microsoft.com'
)
// CrossTenant headers
and any(headers.hops,
any(.fields,
strings.ilike(.name,
"X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp"
)
)
)
// needs to contain at least one link
and length(filter(body.current_thread.links, .href_url.scheme != 'mailto')) > 0
// exclude Purview links or rpmsg attachments
and not (
any(body.current_thread.links,
strings.starts_with(.href_url.url,
'https://outlook.office365.com/Encryption'
)
or .href_url.domain.domain in (
'purview.microsoft.com',
'security.microsoft.com'
)
)
or any(attachments,
.file_extension == "rpmsg"
or .content_type == "application/x-microsoft-rpmsg-message"
)
)
Playground
Test against your own EMLs or sample data.