Credential phishing: Onedrive impersonation
This rule detects messages impersonating Microsoft's OneDrive service with medium to high credential theft language in the current thread. The subject is inspected for one drive language, with additional checks for free_subdomain hosted links, additional suspicious subject language or suspicious display text language.
Sublime rule (View on GitHub)
1name: "Credential phishing: Onedrive impersonation"
2description: "This rule detects messages impersonating Microsoft's OneDrive service with medium to high credential theft language in the current thread. The subject is inspected for one drive language, with additional checks for free_subdomain hosted links, additional suspicious subject language or suspicious display text language."
3type: "rule"
4severity: "high"
5source: |
6 type.inbound
7 // one drive is found in the sender display name or sender local part
8 and (
9 (
10 regex.icontains(sender.display_name, '[0o]ne\s?dr[il1]ve')
11 or regex.icontains(sender.email.local_part, '[0o]ne\s?dr[il1]ve')
12 or 0 < strings.ilevenshtein(strings.replace_confusables(sender.display_name),
13 "one?drive"
14 ) < 2
15 or any(attachments,
16 (
17 regex.icontains(.file_name, '[0o]ne\s?dr[il1]ve')
18 and not any(file.explode(.),
19 any(.scan.exiftool.fields,
20 .key == "Model"
21 or (
22 .key == "Software"
23 and strings.starts_with(.value, "Android")
24 )
25 )
26 // exclude images taken with mobile cameras and screenshots from Apple
27 or any(.scan.exiftool.fields,
28 .key == "DeviceManufacturer"
29 and .value == "Apple Computer Inc."
30 )
31 )
32 )
33 // pdf with OneDrive impersonation
34 or (
35 .file_type == "pdf"
36 and any(ml.logo_detect(.).brands, .name == "Microsoft")
37 and any(file.explode(.),
38 any(.scan.strings.strings,
39 strings.icontains(., "shared a file")
40 )
41 )
42 )
43 )
44 )
45 or regex.imatch(body.current_thread.text, '[0o]ne\s?dr[il1]ve.*')
46 // or one drive is in the subject with a freefile host, additional suspicious language, or suspicious display text
47 or (
48 regex.icontains(strings.replace_confusables(subject.subject),
49 '[0o]ne\s?dr[il1]ve'
50 )
51 and (
52 any(body.links,
53 .href_url.domain.root_domain in $free_subdomain_hosts
54 and .href_url.domain.subdomain is not null
55 and .href_url.domain.subdomain != "www"
56 )
57 or regex.contains(subject.subject, '(shared.{0,30}document)')
58 or any(body.links,
59 regex.icontains(.display_text,
60 "((view|show|access).(?:report|document)|review doc|view doc|view.attached)"
61 )
62 )
63 )
64 )
65 or (
66 any(beta.ml_topic(body.current_thread.text).topics,
67 .name == "File Sharing and Cloud Services" and .confidence == "high"
68 )
69 // more than half of the links with display text contain the keyword "onedrive"
70 and ratio(filter(body.links, .display_text is not null),
71 regex.icontains(.display_text, '[0o]ne\s?dr[il1]ve')
72 ) > 0.5
73 )
74 )
75
76 // and body language is med/high confidence cred theft
77 and (
78 any(ml.nlu_classifier(body.current_thread.text).intents,
79 .name == "cred_theft" and .confidence in ("medium", "high")
80 )
81 or any(ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intents,
82 .name == "cred_theft" and .confidence in ("medium", "high")
83 )
84 )
85 and length(body.links) < 10
86 and not (
87 sender.email.domain.root_domain in (
88 "bing.com",
89 "microsoft.com",
90 "microsoftonline.com",
91 "microsoftsupport.com",
92 "microsoft365.com",
93 "office.com",
94 "onedrive.com",
95 "sharepointonline.com",
96 "yammer.com",
97 )
98 and coalesce(headers.auth_summary.dmarc.pass, false)
99 )
100
101 // negate highly trusted sender domains unless they fail DMARC authentication
102 and not (
103 sender.email.domain.root_domain in $high_trust_sender_root_domains
104 and coalesce(headers.auth_summary.dmarc.pass, false)
105 )
106
107 // excludes docusign senders that contain "via" in the display name
108 and not (
109 any(headers.hops,
110 any(.fields,
111 .name == "X-Api-Host" and strings.ends_with(.value, "docusign.net")
112 )
113 )
114 and strings.contains(sender.display_name, "via")
115 )
116 and not profile.by_sender().any_messages_benign
117
118attack_types:
119 - "Credential Phishing"
120tactics_and_techniques:
121 - "Free subdomain host"
122 - "Impersonation: Brand"
123 - "Social engineering"
124detection_methods:
125 - "Content analysis"
126 - "Header analysis"
127 - "Natural Language Understanding"
128 - "URL analysis"
129id: "1f990c92-a6d5-5a0b-9462-ac469a8d556e"