Brand impersonation: Sharepoint

Body, attached images or pdf contains a Sharepoint logo. The message contains a link and credential theft language.

Sublime rule (View on GitHub)

  1name: "Brand impersonation: Sharepoint"
  2description: |
  3    Body, attached images or pdf contains a Sharepoint logo. The message contains a link and credential theft language.
  4type: "rule"
  5severity: "high"
  6source: |
  7  type.inbound
  8  and length(body.links) > 0
  9  and (
 10    any(attachments,
 11        (.file_type in $file_types_images or .file_type == "pdf")
 12        and any(ml.logo_detect(.).brands, .name == "Microsoft SharePoint")
 13    )
 14    or any(ml.logo_detect(file.message_screenshot()).brands,
 15           .name == "Microsoft SharePoint"
 16    )
 17    or strings.istarts_with(strings.replace_confusables(body.current_thread.text),
 18                            "Sharepoint"
 19    )
 20    or regex.icontains(body.html.raw,
 21                       '<img.*(title=|alt=).share.*src=""'
 22    ) // broken Sharepoint logo
 23    or (
 24      strings.icontains(strings.replace_confusables(body.plain.raw), "SharePoint")
 25      // message body references file deletion
 26      and regex.icontains(body.plain.raw,
 27                          '(expired )?file\s(was|has been|will be|scheduled (for|to be))\s?delet(ed|ion)'
 28      )
 29    )
 30    or (
 31      strings.icontains(body.current_thread.text, 'Sharepoint')
 32      and (
 33        regex.icontains(body.html.raw, '{(?:domain|randomNumber\d?)}')
 34        or any(body.links,
 35               regex.icontains(.href_url.url, 'mailto:[^@]+@{domain}')
 36        )
 37        or regex.icontains(body.html.raw, '<title>[^<]*Easearch[^<]*</title>')
 38      )
 39    )
 40  )
 41  and (
 42    (
 43      any(ml.nlu_classifier(body.current_thread.text).intents,
 44          .name == "cred_theft" and .confidence == "high"
 45      )
 46      //
 47      // This rule makes use of a beta feature and is subject to change without notice
 48      // using the beta feature in custom rules is not suggested until it has been formally released
 49      //
 50      or any(ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intents,
 51             .name == "cred_theft" and .confidence == "high"
 52      )
 53      or any(attachments,
 54             .file_type == "pdf"
 55             and beta.parse_exif(.).page_count == 1
 56             and any(file.explode(.),
 57                     any(ml.nlu_classifier(.scan.ocr.raw).intents,
 58                         .name == "cred_theft" and .confidence == "high"
 59                     )
 60             )
 61      )
 62    )
 63    or any(ml.nlu_classifier(body.current_thread.text).entities,
 64           .name == "urgency" and strings.ilike(.text, "*encrypted*")
 65    )
 66    or any(body.links,
 67           regex.imatch(.display_text,
 68                        '(?:re)?view (?:(?:&|and) (?:e([[:punct:]]|\s)?)?sign )?(?:complete )?(?:document|file)'
 69           )
 70    )
 71  )
 72  and not (
 73    (
 74      (
 75        strings.istarts_with(subject.subject, "RE:")
 76        or strings.istarts_with(subject.subject, "R:")
 77        or strings.istarts_with(subject.subject, "ODG:")
 78        or strings.istarts_with(subject.subject, "答复:")
 79        or strings.istarts_with(subject.subject, "AW:")
 80        or strings.istarts_with(subject.subject, "TR:")
 81        or strings.istarts_with(subject.subject, "FWD:")
 82        or regex.imatch(subject.subject, '(\[[^\]]+\]\s?){0,3}(re|fwd?)\s?:')
 83        or regex.imatch(subject.subject,
 84                        '^\[?(EXT|EXTERNAL)\]?[: ]\s*(RE|FWD?|FW|AW|TR|ODG|答复):.*'
 85        )
 86      )
 87      and (
 88        (length(headers.references) > 0 or headers.in_reply_to is not null)
 89        // ensure that there are actual threads
 90        and (
 91          length(body.previous_threads) > 0
 92          or (length(body.html.display_text) - length(body.current_thread.text)) > 200
 93        )
 94      )
 95    )
 96  )
 97  and (
 98    profile.by_sender_email().prevalence != 'common'
 99    or not profile.by_sender_email().solicited
100    or profile.by_sender().any_messages_malicious_or_spam
101  )
102  and not profile.by_sender().any_messages_benign
103  
104  // negate highly trusted sender domains unless they fail DMARC authentication
105  and not (
106    sender.email.domain.root_domain in $high_trust_sender_root_domains
107    and coalesce(headers.auth_summary.dmarc.pass, false)
108  )
109  
110  // negate sharepoint file share
111  and not (
112    // based on the message id format
113    (
114      (
115        strings.starts_with(headers.message_id, '<Share-')
116        and strings.ends_with(headers.message_id, '@odspnotify>')
117      )
118      // negate legitimate access request to file
119      or (
120        strings.starts_with(headers.message_id, '<Sharing')
121        and strings.ends_with(headers.message_id, '@odspnotify>')
122      )
123      // deal with Google thinking the message ID is "broke"
124      or (
125        strings.icontains(headers.message_id, 'SMTPIN_ADDED_BROKEN')
126        and any(headers.hops,
127                any(.fields,
128                    .name == "X-Google-Original-Message-ID"
129                    and strings.starts_with(.value, '<Share-')
130                    and strings.ends_with(.value, '@odspnotify>')
131                )
132        )
133      )
134    )
135    // all of the "action" links are sharepoint/ms
136    and all(filter(body.links,
137                   strings.icontains(subject.subject, .display_text)
138                   or .display_text == "Open"
139            ),
140            .href_url.domain.root_domain in ("sharepoint.com", "1drv.ms")
141            or (
142              .href_url.domain.tld == "ms"
143              // Microsoft does not own the .ms TLD, this checks to ensure it is one of their domains
144              and (
145                network.whois(.href_url.domain).registrant_company == "Microsoft Corporation"
146                or strings.ilike(network.whois(.href_url.domain).registrar_name,
147                                 "*MarkMonitor*",
148                                 "*CSC Corporate*",
149                                 "*com laude*"
150                )
151              )
152            )
153    )
154  )
155  // negate sharepoint file shares with mimecast rewrites
156  and not (
157    // rewritten message ID
158    strings.iends_with(headers.message_id, 'mimecast.lan>')
159    and all(filter(body.links,
160                   strings.icontains(subject.subject, .display_text)
161                   or .display_text == "Open"
162            ),
163            .href_url.domain.root_domain in (
164              "mimecastprotect.com",
165              "mimecast.com"
166            )
167            and any(.href_url.query_params_decoded["domain"],
168                    strings.parse_domain(.).tld == "ms"
169                    or strings.parse_domain(.).root_domain == "sharepoint.com"
170            )
171    )
172  )  
173attack_types:
174  - "Credential Phishing"
175tactics_and_techniques:
176  - "Impersonation: Brand"
177  - "Social engineering"
178detection_methods:
179  - "Computer Vision"
180  - "Content analysis"
181  - "File analysis"
182  - "Natural Language Understanding"
183  - "Sender analysis"
184id: "284b1b70-8daa-5adf-9df8-15d4c6b5ead9"
to-top