Service abuse: Microsoft domain with suspicious link

Detects inbound messages sent through Microsoft's messaging.microsoft.com or office365alerts@microsoft.com infrastructure that contain links with long numeric parameters, base64-like encoded paths, or links that resolve to Cloudflare Turnstile challenges, indicating attempts to obscure the final destination or evade analysis.

Sublime rule (View on GitHub)

 1name: "Service abuse: Microsoft domain with suspicious link"
 2description: "Detects inbound messages sent through Microsoft's messaging.microsoft.com or office365alerts@microsoft.com infrastructure that contain links with long numeric parameters, base64-like encoded paths, or links that resolve to Cloudflare Turnstile challenges, indicating attempts to obscure the final destination or evade analysis."
 3type: "rule"
 4severity: "high"
 5source: |
 6  type.inbound
 7  and (
 8    sender.email.email == 'office365alerts@microsoft.com'
 9    or (
10      sender.email.domain.root_domain == 'microsoft.com'
11      and (
12        sender.email.domain.subdomain in (
13          'messaging',
14          'communication',
15          'accountprotection'
16        )
17        or regex.icontains(body.current_thread.text, 'ref:?\s*M365-[a-z]+-\d+')
18      )
19    )
20  )
21  and any(filter(body.current_thread.links, .href_url.scheme != 'mailto'),
22          regex.icontains(.href_url.url, '=\d{15,}', '[a-z]+%[a-z]{4,}')
23          or regex.imatch(.href_url.path, '/[a-z0-9+/]{40,}={0,2}')
24          or any([ml.link_analysis(., mode="aggressive")],
25                 // CF Turnstile
26                 any(.unique_urls_accessed,
27                     .domain.domain == "challenges.cloudflare.com"
28                 )
29                 // or site is down behind Cloudflare
30                 or (
31                   regex.icontains(.final_dom.display_text,
32                                   'error\s*(?:code\s*)?(?:5\d{2}|1\d{3})'
33                   )
34                   and regex.icontains(.final_dom.display_text, 'cloudflare')
35                 )
36          )
37  )
38  and not any(ml.nlu_classifier(body.current_thread.text).topics,
39              .name in ("Advertising and Promotions")
40  )  
41attack_types:
42  - "Credential Phishing"
43tactics_and_techniques:
44  - "Evasion"
45  - "Social engineering"
46detection_methods:
47  - "URL analysis"
48  - "Content analysis"
49  - "Sender analysis"
50id: "fca5ddba-df52-546f-9683-6800f5d23fff"
to-top