Detection rules › Sublime MQL

Attachment: Fake scan-to-email

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

Message and attachment resemble an email from a scan-to-email service or device with credential theft language.

Threat classification

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

CategoryValues
Attack typesCredential Phishing
Tactics and techniquesFree file host, Image as content, PDF, Social engineering

Event coverage

Rule body MQL

type.inbound
and (
  length(body.current_thread.text) < 1500
  // body length without disclaimer is shorter than 1500 characters
  or (
    any(map(filter(ml.nlu_classifier(body.current_thread.text).entities,
                   .name == "disclaimer"
            ),
            .text
        ),
        (length(body.current_thread.text) - length(.)) < 1500
    )
  )
)
and (
  3 of (
    strings.icontains(body.current_thread.text, "Number of Images:"),
    strings.icontains(body.current_thread.text, "Attachment File Type:"),
    strings.icontains(body.current_thread.text, "Device Model:"),
    strings.icontains(body.current_thread.text, "Device Name:"),
    strings.icontains(body.current_thread.text, "Resolution:"),
    strings.icontains(body.current_thread.text, "File Format:"),
    strings.icontains(body.current_thread.text, "Device Location:")
  )
  or (
    3 of (
      strings.ilike(body.current_thread.text, "*scan date*"),
      strings.ilike(body.current_thread.text, "*was sent from*"),
      strings.ilike(body.current_thread.text, "*of pages*"),
      strings.ilike(body.current_thread.text, "*scanned file*"),
    )
    or any(file.explode(file.message_screenshot()),
           3 of (
             strings.ilike(body.current_thread.text, "*scan date*"),
             strings.ilike(body.current_thread.text, "*was sent from*"),
             strings.ilike(body.current_thread.text, "*of pages*"),
             strings.ilike(body.current_thread.text, "*scanned file*"),
             strings.icontains(body.current_thread.text, "Number of Images:"),
             strings.icontains(body.current_thread.text,
                               "Attachment File Type:"
             ),
             strings.icontains(body.current_thread.text, "Device Name:"),
             strings.icontains(body.current_thread.text, "Device Location:"),
             strings.icontains(body.current_thread.text, "Device Model:")
           )
    )
  )
)
and (
  (
    length(filter(attachments, .file_type in ("pdf"))) == 1
    and any(attachments,
            .file_type == "pdf"
            and (
              any(file.explode(.),
                  (
                    strings.ilike(.scan.ocr.raw,
                                  "*scan date*",
                                  "*was sent from*",
                                  "*of pages*",
                                  "*verif*document*",
                                  "*scanned file*"
                    )
                    or any(ml.nlu_classifier(.scan.ocr.raw).intents,
                           .name == "cred_theft"
                    )
                    or any(ml.logo_detect(..).brands,
                           .name in ("DocuSign", "Microsoft")
                    )
                  )
                  and length(.scan.url.urls) == 1
              )
              // encrypted pdf
              or any(file.explode(.),
                     any(.scan.exiftool.fields, .key == "Encryption")
                     or (
                       .scan.entropy.entropy > 7
                       and any(.scan.strings.strings,
                               strings.icontains(., "/Encrypt")
                       )
                     )
              )
            )
    )
  )
  or length(filter(attachments, .file_type in ("doc", "docx"))) == 1
)
and sender.email.domain.domain not in~ $org_domains
and (
  not profile.by_sender().solicited
  or (
    profile.by_sender().any_messages_malicious_or_spam
    and not profile.by_sender().any_messages_benign
  )
)
and not profile.by_sender().any_messages_benign

Detection logic

Scope: inbound message.

Message and attachment resemble an email from a scan-to-email service or device with credential theft language.

  1. inbound message
  2. any of:
    • length(body.current_thread.text) < 1500
    • any of map(...) where:
      • length(body.current_thread.text) - length(.) < 1500
  3. any of:
    • at least 3 of 7: body.current_thread.text contains any of 7 patterns
      • Number of Images:
      • Attachment File Type:
      • Device Model:
      • Device Name:
      • Resolution:
      • File Format:
      • Device Location:
    • any of:
      • at least 3 of 4: body.current_thread.text matches any of 4 patterns
        • *scan date*
        • *was sent from*
        • *of pages*
        • *scanned file*
      • any of file.explode(...) where:
        • at least 3 of:
          • body.current_thread.text matches '*scan date*'
          • body.current_thread.text matches '*was sent from*'
          • body.current_thread.text matches '*of pages*'
          • body.current_thread.text matches '*scanned file*'
          • body.current_thread.text contains 'Number of Images:'
          • body.current_thread.text contains 'Attachment File Type:'
          • body.current_thread.text contains 'Device Name:'
          • body.current_thread.text contains 'Device Location:'
          • body.current_thread.text contains 'Device Model:'
  4. any of:
    • all of:
      • length(filter(attachments, .file_type in ('pdf'))) is 1
      • any of attachments where all hold:
        • .file_type is 'pdf'
        • any of:
          • any of file.explode(.) where all hold:
            • any of:
              • .scan.ocr.raw matches any of 5 patterns
                • *scan date*
                • *was sent from*
                • *of pages*
                • *verif*document*
                • *scanned file*
              • any of ml.nlu_classifier(.scan.ocr.raw).intents where:
                • .name is 'cred_theft'
              • any of ml.logo_detect(.).brands where:
                • .name in ('DocuSign', 'Microsoft')
            • length(.scan.url.urls) is 1
          • any of file.explode(.) where any holds:
            • any of .scan.exiftool.fields where:
              • .key is 'Encryption'
            • all of:
              • .scan.entropy.entropy > 7
              • any of .scan.strings.strings where:
                • . contains '/Encrypt'
    • length(filter(attachments, .file_type in ('doc', 'docx'))) is 1
  5. sender.email.domain.domain not in $org_domains
  6. any of:
    • not:
      • profile.by_sender().solicited
    • all of:
      • profile.by_sender().any_messages_malicious_or_spam
      • not:
        • profile.by_sender().any_messages_benign
  7. not:
    • profile.by_sender().any_messages_benign

Inspects: attachments[].file_type, body.current_thread.text, sender.email.domain.domain, type.inbound. Sensors: file.explode, file.message_screenshot, ml.logo_detect, ml.nlu_classifier, profile.by_sender, strings.icontains, strings.ilike. Reference lists: $org_domains.

Indicators matched (22)

FieldMatchValue
ml.nlu_classifier(body.current_thread.text).entities[].nameequalsdisclaimer
strings.icontainssubstringNumber of Images:
strings.icontainssubstringAttachment File Type:
strings.icontainssubstringDevice Model:
strings.icontainssubstringDevice Name:
strings.icontainssubstringResolution:
strings.icontainssubstringFile Format:
strings.icontainssubstringDevice Location:
strings.ilikesubstring*scan date*
strings.ilikesubstring*was sent from*
strings.ilikesubstring*of pages*
strings.ilikesubstring*scanned file*
10 more
attachments[].file_typememberpdf
attachments[].file_typeequalspdf
strings.ilikesubstring*verif*document*
ml.nlu_classifier(file.explode(attachments[])[].scan.ocr.raw).intents[].nameequalscred_theft
ml.logo_detect(attachments[]).brands[].namememberDocuSign
ml.logo_detect(attachments[]).brands[].namememberMicrosoft
file.explode(attachments[])[].scan.exiftool.fields[].keyequalsEncryption
strings.icontainssubstring/Encrypt
attachments[].file_typememberdoc
attachments[].file_typememberdocx