Detection rules › Sublime MQL

Credential phishing: Onedrive impersonation

Severity
high
Type
rule
Source
github.com/sublime-security/sublime-rules

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.

Threat classification

Sublime's own taxonomy (not MITRE ATT&CK).

CategoryValues
Attack typesCredential Phishing
Tactics and techniquesFree subdomain host, Impersonation: Brand, Social engineering

Event coverage

Rule body MQL

type.inbound
// one drive is found in the sender display name or sender local part
and (
  (
    regex.icontains(sender.display_name, '[0o]ne\s?dr[il1]ve')
    or regex.icontains(sender.email.local_part, '[0o]ne\s?dr[il1]ve')
    or 0 < strings.ilevenshtein(strings.replace_confusables(sender.display_name),
                                "one?drive"
    ) < 2
    or any(attachments,
           (
             regex.icontains(.file_name, '[0o]ne\s?dr[il1]ve')
             and not any(file.explode(.),
                         any(.scan.exiftool.fields,
                             .key == "Model"
                             or (
                               .key == "Software"
                               and strings.starts_with(.value, "Android")
                             )
                         )
                         // exclude images taken with mobile cameras and screenshots from Apple
                         or any(.scan.exiftool.fields,
                                .key == "DeviceManufacturer"
                                and .value == "Apple Computer Inc."
                         )
             )
           )
           // pdf with OneDrive impersonation
           or (
             .file_type == "pdf"
             and any(ml.logo_detect(.).brands, .name == "Microsoft")
             and any(file.explode(.),
                     any(.scan.strings.strings,
                         strings.icontains(., "shared a file")
                     )
             )
           )
    )
  )
  or regex.imatch(strings.replace_confusables(body.current_thread.text),
                  '[0o]ne\s?dr[il1]ve.*'
  )
  // or one drive is in the subject with a freefile host, additional suspicious language, or suspicious display text
  or (
    regex.icontains(strings.replace_confusables(subject.subject),
                    '[0o]ne\s?dr[il1]ve'
    )
    and (
      any(body.links,
          .href_url.domain.root_domain in $free_subdomain_hosts
          and .href_url.domain.subdomain is not null
          and .href_url.domain.subdomain != "www"
      )
      or regex.contains(subject.subject, '(shared.{0,30}document)')
      or any(body.links,
             regex.icontains(.display_text,
                             "((view|show|access).(?:report|document)|review doc|view doc|view.attached)"
             )
      )
    )
  )
  or (
    any(beta.ml_topic(body.current_thread.text).topics,
        .name == "File Sharing and Cloud Services" and .confidence == "high"
    )
    // more than half of the links with display text contain the keyword "onedrive"
    and ratio(filter(body.links, .display_text is not null),
              regex.icontains(.display_text, '[0o]ne\s?dr[il1]ve')
    ) > 0.5
  )
)

// and body language is med/high confidence cred theft
and (
  any(ml.nlu_classifier(body.current_thread.text).intents,
      .name == "cred_theft" and .confidence in ("medium", "high")
  )
  or any(ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intents,
         .name == "cred_theft" and .confidence in ("medium", "high")
  )
)
and length(body.links) < 10
and not (
  sender.email.domain.root_domain in (
    "bing.com",
    "microsoft.com",
    "microsoftonline.com",
    "microsoftsupport.com",
    "microsoft365.com",
    "office.com",
    "onedrive.com",
    "sharepointonline.com",
    "yammer.com",
  )
  and coalesce(headers.auth_summary.dmarc.pass, false)
)

// negate highly trusted sender domains unless they fail DMARC authentication
and not (
  sender.email.domain.root_domain in $high_trust_sender_root_domains
  and coalesce(headers.auth_summary.dmarc.pass, false)
)

// excludes docusign senders that contain "via" in the display name
and not (
  any(headers.hops,
      any(.fields,
          .name == "X-Api-Host" and strings.ends_with(.value, "docusign.net")
      )
  )
  and strings.contains(sender.display_name, "via")
)
and not profile.by_sender().any_messages_benign

Detection logic

Scope: inbound message.

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.

  1. inbound message
  2. any of:
    • any of:
      • sender.display_name matches '[0o]ne\\s?dr[il1]ve'
      • sender.email.local_part matches '[0o]ne\\s?dr[il1]ve'
      • all of:
        • strings.replace_confusables(sender.display_name) is similar to 'one?drive'
        • strings.replace_confusables(sender.display_name) is similar to 'one?drive'
      • any of attachments where any holds:
        • all of:
          • .file_name matches '[0o]ne\\s?dr[il1]ve'
          • not:
            • any of file.explode(.) where any holds:
              • any of .scan.exiftool.fields where any holds:
                • .key is 'Model'
                • all of:
                  • .key is 'Software'
                  • .value starts with 'Android'
              • any of .scan.exiftool.fields where all hold:
                • .key is 'DeviceManufacturer'
                • .value is 'Apple Computer Inc.'
        • all of:
          • .file_type is 'pdf'
          • any of ml.logo_detect(.).brands where:
            • .name is 'Microsoft'
          • any of file.explode(.) where:
            • any of .scan.strings.strings where:
              • . contains 'shared a file'
    • strings.replace_confusables(body.current_thread.text) matches '[0o]ne\\s?dr[il1]ve.*'
    • all of:
      • strings.replace_confusables(subject.subject) matches '[0o]ne\\s?dr[il1]ve'
      • any of:
        • any of body.links where all hold:
          • .href_url.domain.root_domain in $free_subdomain_hosts
          • .href_url.domain.subdomain is set
          • .href_url.domain.subdomain is not 'www'
        • subject.subject matches '(shared.{0,30}document)'
        • any of body.links where:
          • .display_text matches '((view|show|access).(?:report|document)|review doc|view doc|view.attached)'
    • all of:
      • any of beta.ml_topic(body.current_thread.text).topics where all hold:
        • .name is 'File Sharing and Cloud Services'
        • .confidence is 'high'
      • ratio(filter(body.links, .display_text is not null)) > 0.5
  3. any of:
    • any of ml.nlu_classifier(body.current_thread.text).intents where all hold:
      • .name is 'cred_theft'
      • .confidence in ('medium', 'high')
    • any of ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intents where all hold:
      • .name is 'cred_theft'
      • .confidence in ('medium', 'high')
  4. length(body.links) < 10
  5. not:
    • all of:
      • sender.email.domain.root_domain in ('bing.com', 'microsoft.com', 'microsoftonline.com', 'microsoftsupport.com', 'microsoft365.com', 'office.com', 'onedrive.com', 'sharepointonline.com', 'yammer.com')
      • coalesce(headers.auth_summary.dmarc.pass)
  6. not:
    • all of:
      • sender.email.domain.root_domain in $high_trust_sender_root_domains
      • coalesce(headers.auth_summary.dmarc.pass)
  7. not:
    • all of:
      • any of headers.hops where:
        • any of .fields where all hold:
          • .name is 'X-Api-Host'
          • .value ends with 'docusign.net'
      • sender.display_name contains 'via'
  8. not:
    • profile.by_sender().any_messages_benign

Inspects: attachments[].file_name, attachments[].file_type, body.current_thread.text, body.links, body.links[].display_text, body.links[].href_url.domain.root_domain, body.links[].href_url.domain.subdomain, headers.auth_summary.dmarc.pass, headers.hops, headers.hops[].fields, headers.hops[].fields[].name, headers.hops[].fields[].value, sender.display_name, sender.email.domain.root_domain, sender.email.local_part, subject.subject, type.inbound. Sensors: beta.ml_topic, beta.ocr, file.explode, file.message_screenshot, ml.logo_detect, ml.nlu_classifier, profile.by_sender, regex.contains, regex.icontains, regex.imatch, strings.contains, strings.ends_with, strings.icontains, strings.ilevenshtein, strings.replace_confusables, strings.starts_with. Reference lists: $free_subdomain_hosts, $high_trust_sender_root_domains.

Indicators matched (33)

FieldMatchValue
regex.icontainsregex[0o]ne\s?dr[il1]ve
strings.ilevenshteinfuzzyone?drive
file.explode(attachments[])[].scan.exiftool.fields[].keyequalsModel
file.explode(attachments[])[].scan.exiftool.fields[].keyequalsSoftware
strings.starts_withprefixAndroid
file.explode(attachments[])[].scan.exiftool.fields[].keyequalsDeviceManufacturer
file.explode(attachments[])[].scan.exiftool.fields[].valueequalsApple Computer Inc.
attachments[].file_typeequalspdf
ml.logo_detect(attachments[]).brands[].nameequalsMicrosoft
strings.icontainssubstringshared a file
regex.imatchregex[0o]ne\s?dr[il1]ve.*
regex.containsregex(shared.{0,30}document)
21 more
regex.icontainsregex((view|show|access).(?:report|document)|review doc|view doc|view.attached)
beta.ml_topic(body.current_thread.text).topics[].nameequalsFile Sharing and Cloud Services
beta.ml_topic(body.current_thread.text).topics[].confidenceequalshigh
ml.nlu_classifier(body.current_thread.text).intents[].nameequalscred_theft
ml.nlu_classifier(body.current_thread.text).intents[].confidencemembermedium
ml.nlu_classifier(body.current_thread.text).intents[].confidencememberhigh
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intents[].nameequalscred_theft
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intents[].confidencemembermedium
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intents[].confidencememberhigh
sender.email.domain.root_domainmemberbing.com
sender.email.domain.root_domainmembermicrosoft.com
sender.email.domain.root_domainmembermicrosoftonline.com
sender.email.domain.root_domainmembermicrosoftsupport.com
sender.email.domain.root_domainmembermicrosoft365.com
sender.email.domain.root_domainmemberoffice.com
sender.email.domain.root_domainmemberonedrive.com
sender.email.domain.root_domainmembersharepointonline.com
sender.email.domain.root_domainmemberyammer.com
headers.hops[].fields[].nameequalsX-Api-Host
strings.ends_withsuffixdocusign.net
strings.containssubstringvia