Detection rules › Sublime MQL

Brand impersonation: SharePoint PDF attachment with credential theft language

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

PDF attachment contains SharePoint logo and high-confidence credential theft language detected via OCR analysis. The attachment includes URLs and originates from an unsolicited or low-reputation sender, excluding legitimate SharePoint file sharing notifications.

Threat classification

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

CategoryValues
Attack typesCredential Phishing
Tactics and techniquesImpersonation: Brand, Social engineering, PDF, Evasion

Event coverage

Rule body MQL

type.inbound
and (
  any(attachments,
      (
        .file_type == "pdf"
        and any(ml.logo_detect(.).brands, .name == "Microsoft SharePoint")
        and any(file.explode(.), length(.scan.url.urls) > 0)
        and any(file.explode(.),
                any(ml.nlu_classifier(.scan.ocr.raw).intents,
                    .name == "cred_theft" and .confidence == "high"
                )
        )
      )
  )
)
// negate sharepoint file share
and not (
  // based on the message id format
  (
    (
      strings.starts_with(headers.message_id, '<Share-')
      and strings.ends_with(headers.message_id, '@odspnotify>')
    )
    // negate legitimate access request to file
    or (
      strings.starts_with(headers.message_id, '<Sharing')
      and strings.ends_with(headers.message_id, '@odspnotify>')
    )
    // deal with Google thinking the message ID is "broke"
    or (
      strings.icontains(headers.message_id, 'SMTPIN_ADDED_BROKEN')
      and any(headers.hops,
              any(.fields,
                  .name == "X-Google-Original-Message-ID"
                  and strings.starts_with(.value, '<Share-')
                  and strings.ends_with(.value, '@odspnotify>')
              )
      )
    )
  )
  // all of the "action" links are sharepoint/ms
  and all(filter(body.links,
                 strings.icontains(subject.subject, .display_text)
                 or .display_text == "Open"
          ),
          .href_url.domain.root_domain in ("sharepoint.com")
          or (
            .href_url.domain.tld == "ms"
            // Microsoft does not own the .ms TLD, this checks to ensure it is one of their domains
            and (
              network.whois(.href_url.domain).registrant_company == "Microsoft Corporation"
              or strings.ilike(network.whois(.href_url.domain).registrar_name,
                               "*MarkMonitor*",
                               "*CSC Corporate*",
                               "*com laude*"
              )
            )
          )
  )
)
and not (
  (
    (subject.is_reply or subject.is_forward)
    and (
      (length(headers.references) > 0 or headers.in_reply_to is not null)
      // ensure that there are actual threads
      and (
        length(body.previous_threads) > 0
        or (length(body.html.display_text) - length(body.current_thread.text)) > 200
      )
    )
  )
)
// negate highly trusted sender domains unless they fail DMARC authentication
and (
  (
    sender.email.domain.root_domain in $high_trust_sender_root_domains
    and not headers.auth_summary.dmarc.pass
  )
  or sender.email.domain.root_domain not in $high_trust_sender_root_domains
)

Detection logic

Scope: inbound message.

PDF attachment contains SharePoint logo and high-confidence credential theft language detected via OCR analysis. The attachment includes URLs and originates from an unsolicited or low-reputation sender, excluding legitimate SharePoint file sharing notifications.

  1. inbound message
  2. any of attachments where all hold:
    • .file_type is 'pdf'
    • any of ml.logo_detect(.).brands where:
      • .name is 'Microsoft SharePoint'
    • any of file.explode(.) where:
      • length(.scan.url.urls) > 0
    • any of file.explode(.) where:
      • any of ml.nlu_classifier(.scan.ocr.raw).intents where all hold:
        • .name is 'cred_theft'
        • .confidence is 'high'
  3. not:
    • all of:
      • any of:
        • all of:
          • headers.message_id starts with '<Share-'
          • headers.message_id ends with '@odspnotify>'
        • all of:
          • headers.message_id starts with '<Sharing'
          • headers.message_id ends with '@odspnotify>'
        • all of:
          • headers.message_id contains 'SMTPIN_ADDED_BROKEN'
          • any of headers.hops where:
            • any of .fields where all hold:
              • .name is 'X-Google-Original-Message-ID'
              • .value starts with '<Share-'
              • .value ends with '@odspnotify>'
      • all of filter(body.links) where any holds:
        • .href_url.domain.root_domain in ('sharepoint.com')
        • all of:
          • .href_url.domain.tld is 'ms'
          • any of:
            • network.whois(.href_url.domain).registrant_company is 'Microsoft Corporation'
            • network.whois(.href_url.domain).registrar_name matches any of 3 patterns
              • *MarkMonitor*
              • *CSC Corporate*
              • *com laude*
  4. not:
    • all of:
      • any of:
        • subject.is_reply
        • subject.is_forward
      • all of:
        • any of:
          • length(headers.references) > 0
          • headers.in_reply_to is set
        • any of:
          • length(body.previous_threads) > 0
          • length(body.html.display_text) - length(body.current_thread.text) > 200
  5. any of:
    • all of:
      • sender.email.domain.root_domain in $high_trust_sender_root_domains
      • not:
        • headers.auth_summary.dmarc.pass
    • sender.email.domain.root_domain not in $high_trust_sender_root_domains

Inspects: attachments[].file_type, body.links, body.links[].display_text, body.previous_threads, headers.auth_summary.dmarc.pass, headers.hops, headers.hops[].fields, headers.hops[].fields[].name, headers.hops[].fields[].value, headers.in_reply_to, headers.message_id, headers.references, sender.email.domain.root_domain, subject.is_forward, subject.is_reply, subject.subject, type.inbound. Sensors: file.explode, ml.logo_detect, ml.nlu_classifier, network.whois, strings.ends_with, strings.icontains, strings.ilike, strings.starts_with. Reference lists: $high_trust_sender_root_domains.

Indicators matched (15)

FieldMatchValue
attachments[].file_typeequalspdf
ml.logo_detect(attachments[]).brands[].nameequalsMicrosoft SharePoint
ml.nlu_classifier(file.explode(attachments[])[].scan.ocr.raw).intents[].nameequalscred_theft
ml.nlu_classifier(file.explode(attachments[])[].scan.ocr.raw).intents[].confidenceequalshigh
strings.starts_withprefix<Share-
strings.ends_withsuffix@odspnotify>
strings.starts_withprefix<Sharing
strings.icontainssubstringSMTPIN_ADDED_BROKEN
headers.hops[].fields[].nameequalsX-Google-Original-Message-ID
body.links[].display_textequalsOpen
filter(body.links)[].href_url.domain.root_domainmembersharepoint.com
filter(body.links)[].href_url.domain.tldequalsms
3 more
strings.ilikesubstring*MarkMonitor*
strings.ilikesubstring*CSC Corporate*
strings.ilikesubstring*com laude*