Detection rules › Sublime MQL

Attachment: Fake attachment image lure

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

Message (or attached message) contains an image impersonating an Outlook attachment button.

Threat classification

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

CategoryValues
Attack typesCredential Phishing, Malware/Ransomware
Tactics and techniquesEvasion, Image as content, Social engineering

Event coverage

Rule body MQL

type.inbound
and length(attachments) < 15
and (
  // fake file attachment preview in original email
  any(attachments,
      .file_type in $file_types_images
      and (
        any(ml.logo_detect(.).brands,
            .name == "FakeAttachment" and .confidence == "high"
        )
        or (
          .size < 30000
          and any(file.explode(.),
                  strings.icontains(.scan.ocr.raw, 'sent you')
                  // the attached image includes a filesize string
                  and regex.icontains(.scan.ocr.raw,
                                      '\b\d+.\d{1,2}\s?(k|m)b(\s|$)'
                  )
          )
        )
      )
  )
  // message body/screenhot
  or any(ml.logo_detect(file.message_screenshot()).brands,
         .name == "FakeAttachment" and .confidence == "high"
  )

  // Suspicious table with file size indicators
  or regex.contains(body.html.raw,
                    "<table[^>]*>.*?<img[^>]+src=[\"']cid:[^\"']+[\"'][^>]*>.*?\\.(pdf|doc(x)|xls(x)?).*?<font[^>]*>\\s*\\d{1,4}\\.\\d{1,2}\\s*k[bB]"
  )

  // fake file attachment preview in attached EML
  or any(attachments,
         (.content_type == "message/rfc822" or .file_extension == "eml")
         and any(file.parse_eml(.).attachments,
                 .file_type in $file_types_images
                 and (
                   any(ml.logo_detect(.).brands, .name == "FakeAttachment")
                   or (
                     .size < 30000
                     and any(file.explode(.),
                             strings.icontains(.scan.ocr.raw, 'sent you')
                             // the attached image includes a filesize string
                             and regex.icontains(.scan.ocr.raw,
                                                 '\b\d+.\d{1,2}\s?(k|m)b(\s|$)'
                             )
                     )
                   )
                 )
         )
  )
)
and not (
  (
    strings.istarts_with(subject.subject, "RE:")
    or strings.istarts_with(subject.subject, "R:")
    or strings.istarts_with(subject.subject, "ODG:")
    or strings.istarts_with(subject.subject, "答复:")
    or strings.istarts_with(subject.subject, "AW:")
    or strings.istarts_with(subject.subject, "TR:")
    or strings.istarts_with(subject.subject, "FWD:")
    or regex.imatch(subject.subject, '(\[[^\]]+\]\s?){0,3}(re|fwd?)\s?:')
    or regex.imatch(subject.subject,
                    '^\[?(EXT|EXTERNAL)\]?[: ]\s*(RE|FWD?|FW|AW|TR|ODG|答复):.*'
    )
  )
  and (length(headers.references) > 0 or headers.in_reply_to is not null)
)
// 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
)
and (
  sender.email.domain.root_domain not in ("sharepointonline.com")
  or not headers.auth_summary.dmarc.pass
)

Detection logic

Scope: inbound message.

Message (or attached message) contains an image impersonating an Outlook attachment button.

  1. inbound message
  2. length(attachments) < 15
  3. any of:
    • any of attachments where all hold:
      • .file_type in $file_types_images
      • any of:
        • any of ml.logo_detect(.).brands where all hold:
          • .name is 'FakeAttachment'
          • .confidence is 'high'
        • all of:
          • .size < 30000
          • any of file.explode(.) where all hold:
            • .scan.ocr.raw contains 'sent you'
            • .scan.ocr.raw matches '\\b\\d+.\\d{1,2}\\s?(k|m)b(\\s|$)'
    • any of ml.logo_detect(file.message_screenshot()).brands where all hold:
      • .name is 'FakeAttachment'
      • .confidence is 'high'
    • body.html.raw matches '<table[^>]*>.*?<img[^>]+src=[\\"\']cid:[^\\"\']+[\\"\'][^>]*>.*?\\\\.(pdf|doc(x)|xls(x)?).*?<font[^>]*>\\\\s*\\\\d{1,4}\\\\.\\\\d{1,2}\\\\s*k[bB]'
    • any of attachments where all hold:
      • any of:
        • .content_type is 'message/rfc822'
        • .file_extension is 'eml'
      • any of file.parse_eml(.).attachments where all hold:
        • .file_type in $file_types_images
        • any of:
          • any of ml.logo_detect(.).brands where:
            • .name is 'FakeAttachment'
          • all of:
            • .size < 30000
            • any of file.explode(.) where all hold:
              • .scan.ocr.raw contains 'sent you'
              • .scan.ocr.raw matches '\\b\\d+.\\d{1,2}\\s?(k|m)b(\\s|$)'
  4. not:
    • all of:
      • any of:
        • subject.subject starts with 'RE:'
        • subject.subject starts with 'R:'
        • subject.subject starts with 'ODG:'
        • subject.subject starts with '答复:'
        • subject.subject starts with 'AW:'
        • subject.subject starts with 'TR:'
        • subject.subject starts with 'FWD:'
        • subject.subject matches '(\\[[^\\]]+\\]\\s?){0,3}(re|fwd?)\\s?:'
        • subject.subject matches '^\\[?(EXT|EXTERNAL)\\]?[: ]\\s*(RE|FWD?|FW|AW|TR|ODG|答复):.*'
      • any of:
        • length(headers.references) > 0
        • headers.in_reply_to is set
  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
  6. any of:
    • sender.email.domain.root_domain not in ('sharepointonline.com')
    • not:
      • headers.auth_summary.dmarc.pass

Inspects: attachments[].content_type, attachments[].file_extension, attachments[].file_type, attachments[].size, body.html.raw, headers.auth_summary.dmarc.pass, headers.in_reply_to, headers.references, sender.email.domain.root_domain, subject.subject, type.inbound. Sensors: file.explode, file.message_screenshot, file.parse_eml, ml.logo_detect, regex.contains, regex.icontains, regex.imatch, strings.icontains, strings.istarts_with. Reference lists: $file_types_images, $high_trust_sender_root_domains.

Indicators matched (20)

FieldMatchValue
ml.logo_detect(attachments[]).brands[].nameequalsFakeAttachment
ml.logo_detect(attachments[]).brands[].confidenceequalshigh
strings.icontainssubstringsent you
regex.icontainsregex\b\d+.\d{1,2}\s?(k|m)b(\s|$)
ml.logo_detect(file.message_screenshot()).brands[].nameequalsFakeAttachment
ml.logo_detect(file.message_screenshot()).brands[].confidenceequalshigh
regex.containsregex<table[^>]*>.*?<img[^>]+src=[\"']cid:[^\"']+[\"'][^>]*>.*?\\.(pdf|doc(x)|xls(x)?).*?<font[^>]*>\\s*\\d{1,4}\\.\\d{1,2}\\s*k[bB]
attachments[].content_typeequalsmessage/rfc822
attachments[].file_extensionequalseml
ml.logo_detect(file.parse_eml(attachments[]).attachments[]).brands[].nameequalsFakeAttachment
strings.istarts_withprefixRE:
strings.istarts_withprefixR:
8 more
strings.istarts_withprefixODG:
strings.istarts_withprefix答复:
strings.istarts_withprefixAW:
strings.istarts_withprefixTR:
strings.istarts_withprefixFWD:
regex.imatchregex(\[[^\]]+\]\s?){0,3}(re|fwd?)\s?:
regex.imatchregex^\[?(EXT|EXTERNAL)\]?[: ]\s*(RE|FWD?|FW|AW|TR|ODG|答复):.*
sender.email.domain.root_domainmembersharepointonline.com