Brand impersonation: Microsoft with embedded logo and credential theft language
This rule detects messages impersonating Microsoft via a logo and contains credential theft language. From a new and unsolicited sender.
Sublime rule (View on GitHub)
1name: "Brand impersonation: Microsoft with embedded logo and credential theft language"
2description: "This rule detects messages impersonating Microsoft via a logo and contains credential theft language. From a new and unsolicited sender."
3type: "rule"
4severity: "high"
5source: |
6 type.inbound
7 and (
8 (
9 length(attachments) > 0
10 and all(attachments,
11 .file_type in $file_types_images or .file_type == "pdf"
12 )
13 )
14 or length(attachments) == 0
15 )
16 and any(ml.logo_detect(file.message_screenshot()).brands,
17 strings.starts_with(.name, "Microsoft")
18 )
19 and (
20 any(ml.nlu_classifier(body.current_thread.text).intents,
21 .name == "cred_theft" and .confidence in ("medium", "high")
22 )
23 or (
24 length(body.current_thread.text) == 0
25 //
26 // This rule makes use of a beta feature and is subject to change without notice
27 // using the beta feature in custom rules is not suggested until it has been formally released
28 //
29 and any(ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intents,
30 .name == "cred_theft" and .confidence in ("medium", "high")
31 )
32 )
33 )
34 and (
35 not (
36 headers.auth_summary.dmarc.pass
37 and headers.auth_summary.dmarc.details.from.domain in (
38 "azureadnotifications.us",
39 "microsoft.com",
40 "sharepointonline.com",
41 "cloudappsecurity.com",
42 "microsoftsupport.com",
43 "microsoft.onmicrosoft.com",
44 "yammer.com",
45 "microsoftrewards.com"
46 )
47 )
48 or headers.auth_summary.dmarc.pass is null
49 or headers.auth_summary.dmarc.details.from.domain is null
50 )
51 and not (
52 sender.email.domain.domain == "planner.office365.com"
53 and headers.return_path.email == "noreply@planner.office365.com"
54 and headers.auth_summary.dmarc.details.from.root_domain == "office365.com"
55 )
56
57 // Microsoft has some legit onmicrosoft domains...
58 and not (
59 sender.email.domain.domain == "microsoft.onmicrosoft.com"
60 and headers.auth_summary.spf.pass
61 and all(body.links, .href_url.domain.root_domain == "microsoft.com")
62 )
63
64 // message is not from sharepoint actual (additional check in case DMARC check above fails to bail out)
65 and not (
66 (
67 strings.ilike(headers.message_id,
68 '<Share-*',
69 '<MassDelete-*',
70 '<FileDeleteAfterExpiration-*',
71 '<NotifyOwnerSharedWithExternalUsers*',
72 '<OneTimePasscode*'
73 )
74 and strings.ends_with(headers.message_id, '@odspnotify>')
75 )
76 or (
77 any(headers.hops,
78 any(.fields,
79 .name == "X-Google-Original-Message-ID"
80 and strings.ilike(.value,
81 '<Share-*',
82 '<MassDelete-*',
83 '<FileDeleteAfterExpiration-*',
84 '<NotifyOwnerSharedWithExternalUsers*',
85 '<OneTimePasscode*'
86 )
87 and strings.ends_with(.value, '@odspnotify>')
88 )
89 )
90 )
91 )
92
93 // negate legitimate microsoft b2b applications invitations
94 and not (
95 length(body.links) > 0
96 and (
97 sender.email.local_part == "invites"
98 and sender.email.domain.root_domain == "onmicrosoft.com"
99 // infra validated message id
100 and strings.icontains(headers.message_id, "pepf")
101 )
102 )
103
104 // sender profiles
105 and (
106 not profile.by_sender().solicited
107 or (
108 profile.by_sender().any_messages_malicious_or_spam
109 and not profile.by_sender().any_messages_benign
110 )
111 )
112
113 // negate org domains unless they fail DMARC authentication
114 and (
115 (
116 sender.email.domain.root_domain in $org_domains
117 and (
118 not headers.auth_summary.dmarc.pass
119 // MS quarantine digest emails from an org domain are router "internally" to MS, therefore, there is no authentication information
120 or not (
121 headers.auth_summary.dmarc.pass is null
122 and all(headers.domains,
123 .root_domain in ("outlook.com", "office365.com")
124 )
125 // typical emails from freemail Outlook accounts are from prod.outlook.com
126 and strings.ends_with(headers.message_id, "protection.outlook.com>")
127 )
128 )
129 )
130 or sender.email.domain.root_domain not in $org_domains
131 )
132
133 // negate sharepoint file shares with mimecast rewrites
134 and not (
135 // rewritten message ID
136 strings.iends_with(headers.message_id, 'mimecast.lan>')
137 and all(filter(body.links,
138 strings.icontains(subject.subject, .display_text)
139 or .display_text == "Open"
140 ),
141 .href_url.domain.root_domain in (
142 "mimecastprotect.com",
143 "mimecast.com"
144 )
145 and any(.href_url.query_params_decoded["domain"],
146 strings.parse_domain(.).tld == "ms"
147 or strings.parse_domain(.).root_domain == "sharepoint.com"
148 )
149 )
150 )
151
152 // negate highly trusted sender domains unless they fail DMARC authentication
153 and not (
154 sender.email.domain.root_domain in $high_trust_sender_root_domains
155 and coalesce(headers.auth_summary.dmarc.pass, false)
156 )
157 and not profile.by_sender().any_messages_benign
158
159attack_types:
160 - "Credential Phishing"
161tactics_and_techniques:
162 - "Impersonation: Brand"
163 - "Social engineering"
164detection_methods:
165 - "Computer Vision"
166 - "Natural Language Understanding"
167 - "Sender analysis"
168id: "3ee9ef3d-8ec4-5df0-a8a2-5c6d037eb17a"