Brand impersonation: Microsoft with low reputation links
Detects low reputation links with Microsoft specific indicators in the body.
Sublime rule (View on GitHub)
1name: "Brand impersonation: Microsoft with low reputation links"
2description: "Detects low reputation links with Microsoft specific indicators in the body."
3type: "rule"
4severity: "medium"
5source: |
6 type.inbound
7 and 0 < length(body.links) < 100
8 // suspicious link
9 and any(body.links,
10 (
11 .href_url.domain.root_domain not in $tranco_1m
12 or .href_url.domain.domain in $free_file_hosts
13 or .href_url.domain.root_domain in $free_file_hosts
14 or .href_url.domain.root_domain in $free_subdomain_hosts
15 or .href_url.domain.domain in $url_shorteners
16 or
17
18 // mass mailer link, masks the actual URL
19 .href_url.domain.root_domain in (
20 "hubspotlinks.com",
21 "mandrillapp.com",
22 "sendgrid.net",
23 "rs6.net"
24 )
25
26 // Google AMP redirect
27 or (
28 .href_url.domain.sld == "google"
29 and strings.starts_with(.href_url.path, "/amp/")
30 )
31
32 // Recipient email address in link
33 or any(body.links,
34 any(recipients.to,
35 strings.icontains(..href_url.url, .email.email)
36 and any(recipients.to, .email.domain.valid)
37 )
38 )
39 or .href_url.domain.root_domain == "beehiiv.com"
40 )
41
42 // exclude sources of potential FPs
43 and (
44 .href_url.domain.root_domain not in (
45 "svc.ms",
46 "sharepoint.com",
47 "1drv.ms",
48 "microsoft.com",
49 "aka.ms",
50 "msftauthimages.net",
51 "mimecastprotect.com",
52 "office.com",
53 "microsoftproject.com"
54 )
55 or any(body.links, .href_url.domain.domain in $free_file_hosts)
56 )
57 and .href_url.domain.root_domain not in $org_domains
58 and .href_url.domain.valid
59 )
60
61 // not a reply
62 and (
63 length(headers.references) == 0
64 or not any(headers.hops, any(.fields, strings.ilike(.name, "In-Reply-To")))
65 )
66
67 // Microsoft logo
68 and (
69 any(attachments,
70 .file_type in $file_types_images
71 and any(ml.logo_detect(.).brands, strings.starts_with(.name, "Microsoft"))
72 )
73 or strings.istarts_with(body.current_thread.text, "Microsoft ")
74 or any(ml.logo_detect(beta.message_screenshot()).brands,
75 strings.starts_with(.name, "Microsoft")
76 )
77 or (
78 regex.icontains(body.html.raw,
79 '<table[^>]*>\s*<tbody[^>]*>\s*<tr[^>]*>\s*(<td[^>]*bgcolor="#[0-9A-Fa-f]{6}"[^>]*>\s* \s*</td>\s*){2}\s*</tr>\s*<tr[^>]*>\s*(<td[^>]*bgcolor="#[0-9A-Fa-f]{6}"[^>]*>\s* \s*</td>\s*){2}'
80 )
81 or regex.icontains(body.html.raw,
82 '<td style="background:\s*rgb\(246,\s*93,\s*53\);\s*height:\d+px;">.*?<td style="background:\s*rgb\(129,\s*187,\s*5\);\s*height:\d+px;">.*?<td style="background:\s*rgb\(4,\s*165,\s*240\);\s*height:\d+px;">.*?<td style="background:\s*rgb\(255,\s*186,\s*7\);\s*height:\d+px;">'
83 )
84 or 4 of (
85 regex.icontains(body.html.raw,
86 '<td style="width:.\d.px;.height:.\d.px;.background-color:.rgb\(245, 189, 67\);">.{0,10}</td>'
87 ),
88 regex.icontains(body.html.raw,
89 '<td style="width:.\d.px;.height:.\d.px;.background-color:.rgb\(137, 184, 57\);">.{0,10}</td>'
90 ),
91 regex.icontains(body.html.raw,
92 '<td style="width:.\d.px;.height:.\d.px;.background-color:.rgb\(217, 83, 51\);">.{0,10}</td>'
93 ),
94 regex.icontains(body.html.raw,
95 '<td style="width:.\d.px;.height:.\d.px;.background-color:.rgb\(71, 160, 218\);">.{0,10}</td>'
96 )
97 )
98 )
99 or regex.icontains(body.html.raw,
100 '<table[^>]*>\s*<tbody[^>]*>\s*<tr[^>]*>\s*(<td[^>]*bgcolor="#[0-9A-Fa-f]{6}"[^>]*>\s* \s*</td>\s*){2}\s*</tr>\s*<tr[^>]*>\s*(<td[^>]*bgcolor="#[0-9A-Fa-f]{6}"[^>]*>\s* \s*</td>\s*){2}'
101 )
102 or 3 of (
103 regex.icontains(body.html.raw, '.password-expiration'),
104 regex.icontains(body.html.raw, 'color: #2672ec;'),
105 regex.icontains(body.html.raw, 'Microsoft')
106 )
107 or 4 of (
108 regex.icontains(body.html.raw, 'rgb\(246,\s?93,\s?53\)'),
109 regex.icontains(body.html.raw, 'rgb\(129,\s?187,\s?5\)'),
110 regex.icontains(body.html.raw, 'rgb\(4,\s?165,\s?240\)'),
111 regex.icontains(body.html.raw, 'rgb\(255,\s?186,\s?7\)'),
112 )
113 or 4 of (
114 regex.icontains(body.html.raw,
115 '(background-color:|background:|bgcolor=)(.)red'
116 ),
117 regex.icontains(body.html.raw, 'rgb\(19,\s?186,\s?132\)'),
118 regex.icontains(body.html.raw, 'rgb\(4,\s?166,\s?240\)'),
119 regex.icontains(body.html.raw, 'rgb\(255,\s?186,\s?8\)'),
120 )
121 or 4 of (
122 regex.icontains(body.html.raw, 'rgb\(245,\s?189,\s?67\)'),
123 regex.icontains(body.html.raw, 'rgb\(137,\s?184,\s?57\)'),
124 regex.icontains(body.html.raw, 'rgb\(217,\s?83,\s?51\)'),
125 regex.icontains(body.html.raw, 'rgb\(71,\s?160,\s?218\)')
126 )
127 or 4 of (
128 regex.icontains(body.html.raw, 'rgb\(73,\s?161,\s?232\)'),
129 regex.icontains(body.html.raw, 'rgb\(224,\s?92,\s?53\)'),
130 regex.icontains(body.html.raw, 'rgb\(139,\s?183,\s?55\)'),
131 regex.icontains(body.html.raw, 'rgb\(244,\s?188,\s?65\)')
132 )
133 or 4 of (
134 regex.icontains(body.html.raw, 'rgb\(213,\s?56,\s?62\)'),
135 regex.icontains(body.html.raw, 'rgb\(0,\s?114,\s?30\)'),
136 regex.icontains(body.html.raw, 'rgb\(0,\s?110,\s?173\)'),
137 regex.icontains(body.html.raw, 'rgb\(227,\s?209,\s?43\)'),
138 )
139 or 4 of (
140 regex.icontains(body.html.raw, 'rgb\(246,\s?93,\s?53\)'),
141 regex.icontains(body.html.raw, 'rgb\(129,\s?187,\s?5\)'),
142 regex.icontains(body.html.raw, 'rgb\(4,\s?165,\s?240\)'),
143 regex.icontains(body.html.raw, 'rgb\(255,\s?186,\s?7\)')
144 )
145 or 4 of (
146 regex.icontains(body.html.raw, 'rgb\(242,\s?80,\s?34\)'),
147 regex.icontains(body.html.raw, 'rgb\(127,\s?186,\s?0\)'),
148 regex.icontains(body.html.raw, 'rgb\(0,\s?164,\s?239\)'),
149 regex.icontains(body.html.raw, 'rgb\(255,\s?185,\s?0\)'),
150 )
151 or 4 of (
152 regex.icontains(body.html.raw, 'rgb\(243,\s?83,\s?37\)'),
153 regex.icontains(body.html.raw, 'rgb\(129,\s?188,\s?6\)'),
154 regex.icontains(body.html.raw, 'rgb\(5,\s?166,\s?240\)'),
155 regex.icontains(body.html.raw, 'rgb\(255,\s?186,\s?8\)')
156 )
157 or 4 of (
158 regex.icontains(body.html.raw, 'rgb\(243,\s?80,\s?34\)'),
159 regex.icontains(body.html.raw, 'rgb\(128,\s?187,\s?3\)'),
160 regex.icontains(body.html.raw, 'rgb\(3,\s?165,\s?240\)'),
161 regex.icontains(body.html.raw, 'rgb\(255,\s?185,\s?3\)')
162 )
163 or 4 of (
164 regex.icontains(body.html.raw,
165 '(background-color:|background:|bgcolor=)(.)?(#)?(FF1940|eb5024|F25022|FF1941|red)'
166 ),
167 regex.icontains(body.html.raw,
168 '(background-color:|background:|bgcolor=)(.)?(#)?(36ba57|3eb55d|7db606|7FBA00|36ba58|green)'
169 ),
170 regex.icontains(body.html.raw,
171 '(background-color:|background:|bgcolor=)(.)?#(04a1d6|04B5F0|05a1e8|00A4EF|01a4ef|04a5f0)'
172 ),
173 regex.icontains(body.html.raw,
174 '(background-color:|background:|bgcolor=)(.)?#(FFCA07|f7b408|FFB900|FFCA08|ffb901|ffba07)'
175 ),
176 )
177 or 4 of (
178 regex.icontains(body.html.raw,
179 '(background-color:|background:|bgcolor=)(.)?#(f65314|f65d35|49a1e8|E74F23|F35325)'
180 ),
181 regex.icontains(body.html.raw,
182 '(background-color:|background:|bgcolor=)(.)?#(7cbf42|81bb05|e05c35|7AB206|81BC06)'
183 ),
184 regex.icontains(body.html.raw,
185 '(background-color:|background:|bgcolor=)(.)?#(00a4ef|0078d7|8bb737|04a5f0|059EE4|05A6F0)'
186 ),
187 regex.icontains(body.html.raw,
188 '(background-color:|background:|bgcolor=)(.)?#(ffb900|ffba07|f4bc41|F2B108|FFBA08)'
189 ),
190 )
191 // fuzzy approach
192 or 4 of (
193 regex.icontains(body.html.raw,
194 'rgb\((2[1-4][0-9]|250),\s?(7[0-9]|8[0-9]|9[0-3]),\s?(3[0-9]|4[0-9]|5[0-3])\)'
195 ),
196 regex.icontains(body.html.raw,
197 'rgb\((12[0-9]|13[0-9]),\s?(18[0-9]|190),\s?([0-9]|10)\)'
198 ),
199 regex.icontains(body.html.raw,
200 'rgb\(([0-9]|1[0-5]),\s?(16[0-5]|166),\s?(23[0-9]|240)\)'
201 ),
202 regex.icontains(body.html.raw,
203 'rgb\((25[0-5]),\s?(18[5-9]|19[0-9]),\s?([0-9]|10)\)'
204 )
205 )
206 )
207
208 // suspicious content
209 and (
210 // current thread is empty, but an image attachment is branded as microsoft.
211 // common in image as content
212 (
213 body.current_thread.text == ""
214 and any(attachments,
215 .file_type in $file_types_images
216 and any(ml.logo_detect(.).brands,
217 strings.starts_with(.name, "Microsoft")
218 )
219 )
220 )
221 or (
222 strings.ilike(body.plain.raw,
223 "*password*",
224 "*document*",
225 "*voicemail*",
226 "*cache*",
227 "*fax*",
228 "*storage*",
229 "*quota*",
230 "*message*"
231 )
232 and strings.ilike(body.plain.raw,
233 "*terminated*",
234 "*review*",
235 "*expire*",
236 "*click*",
237 "*view*",
238 "*exceed*",
239 "*clear*",
240 "*only works*",
241 "*failed*",
242 "*deleted*",
243 "*revalidated*",
244 "*renewal*"
245 )
246 )
247
248 or (
249 any(attachments,
250 .file_type in $file_types_images
251 and any(file.explode(.),
252 strings.ilike(.scan.ocr.raw,
253 "*password*",
254 "*document*",
255 "*voicemail*",
256 "*cache*",
257 "*fax*",
258 "*storage*",
259 "*quota*",
260 "*messages*"
261 )
262 and strings.ilike(.scan.ocr.raw,
263 "*terminated*",
264 "*review*",
265 "*expire*",
266 "*click*",
267 "*view*",
268 "*exceed*",
269 "*clear*",
270 "*only works*",
271 "*failed*",
272 "*deleted*"
273 )
274 )
275 )
276 )
277 or (
278 any(file.explode(beta.message_screenshot()),
279 strings.ilike(.scan.ocr.raw,
280 "*password*",
281 "*document*",
282 "*voicemail*",
283 "*cache*",
284 "*fax*",
285 "*storage*",
286 "*quota*",
287 "*messages*"
288 )
289 and strings.ilike(.scan.ocr.raw,
290 "*terminated*",
291 "*review*",
292 "*expire*",
293 "*click*",
294 "*view*",
295 "*exceed*",
296 "*clear*",
297 "*only works*",
298 "*failed*",
299 "*deleted*",
300 "*revalidated*",
301 "*renewal*"
302 )
303 )
304 )
305 or (
306 any(ml.nlu_classifier(body.current_thread.text).intents,
307 .name == "cred_theft" and .confidence in~ ("medium", "high")
308 )
309 or any(attachments,
310 .file_type in $file_types_images
311 and any(file.explode(.),
312 any(ml.nlu_classifier(.scan.ocr.raw).intents,
313 .name == "cred_theft"
314 and .confidence in ("medium", "high")
315 )
316 )
317 )
318 )
319 )
320 and sender.email.domain.root_domain not in (
321 "bing.com",
322 "microsoft.com",
323 "microsoftonline.com",
324 "microsoftproject.com",
325 "microsoftstoreemail.com",
326 "microsoftsupport.com",
327 "microsoft365.com",
328 "office.com",
329 "office365.com",
330 "onedrive.com",
331 "sharepointonline.com",
332 "yammer.com",
333 )
334
335 // negate legitimate Office 365 bouncebacks
336 and not (
337 length(attachments) > 0
338 and all(attachments,
339 .content_type in ("message/delivery-status", "message/rfc822")
340 )
341 and (sender.email.local_part in ('postmaster', 'mailer-daemon'))
342 )
343
344 // negate Microsoft "welcome to the X group" notifications
345 and not (
346 headers.auth_summary.dmarc.pass
347 and length(attachments) == 6
348 and length(filter(attachments,
349 strings.istarts_with(.file_name, "GuestWelcomeEmail")
350 )
351 ) == 5
352 and length(filter(body.links,
353 (
354 .href_url.domain.domain not in (
355 "outlook.office365.com",
356 "aka.ms",
357 "go.microsoft.com"
358 )
359 )
360 and not .href_url.domain.domain == sender.email.domain.domain
361 )
362 ) == 0
363 and subject.subject == strings.replace_confusables(subject.subject)
364 )
365
366 // negate highly trusted sender domains unless they fail DMARC authentication
367 and (
368 (
369 sender.email.domain.root_domain in $high_trust_sender_root_domains
370 and not headers.auth_summary.dmarc.pass
371 )
372 or sender.email.domain.root_domain not in $high_trust_sender_root_domains
373 )
374 and (
375 not profile.by_sender().solicited
376 or (
377 profile.by_sender().any_messages_malicious_or_spam
378 and not profile.by_sender().any_false_positives
379 )
380 )
381 and not profile.by_sender().any_false_positives
382
383 // exclude marketing jargon from ms partners
384 and not regex.icontains(body.current_thread.text,
385 '(schedul(e|ing)|set up).{0,20}(call|meeting|demo|zoom|conversation|time|tool|discussion)|book.{0,10}(meeting|demo|call|slot|time)|connect.{0,12}(with me|phone|email)|my.{0,10}(calendar|cal)|reserve.{0,10}s[pl]ot|break the ice|want to know more?|miss your chance|if you no longer wish|if you no longer want|if you wish to opt out|low-code (development|approach|solution|journey|platform)|(?:invite|virtual).{0,30}(webinar|presentation)'
386 )
387attack_types:
388 - "Credential Phishing"
389tactics_and_techniques:
390 - "Free file host"
391 - "Image as content"
392 - "Impersonation: Brand"
393 - "Social engineering"
394detection_methods:
395 - "Computer Vision"
396 - "Content analysis"
397 - "File analysis"
398 - "Header analysis"
399 - "Natural Language Understanding"
400 - "Optical Character Recognition"
401 - "Sender analysis"
402 - "URL analysis"
403id: "b59201b6-f253-55a6-9c0a-e1500a32a751"