Detection rules › Sublime MQL

Attachment: Office document with VSTO add-in

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

Recursively scans files and archives to detect Office documents with VSTO Add-ins.

Threat classification

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

CategoryValues
Attack typesMalware/Ransomware
Tactics and techniquesScripting

Event coverage

Rule body MQL

type.inbound
and any(attachments,
        (
          .file_extension in~ $file_extensions_macros
          or .file_extension in~ $file_extensions_common_archives
          or (
            .file_extension is null
            and .file_type == "unknown"
            and .content_type == "application/octet-stream"
            and .size < 100000000
          )
        )
        and any(file.explode(.),
                .file_extension in~ (
                  "doc",
                  "docm",
                  "docx",
                  "dot",
                  "dotm",
                  "xls",
                  "xlsx",
                  "xlsm",
                  "xlm",
                  "xlsb",
                  "xlt",
                  "xltm",
                  "ppt",
                  "pptx",
                  "pptm",
                  "ppsm"
                )
                and any(.scan.exiftool.fields,
                        .key == "Tag_AssemblyLocation"
                        and strings.ilike(.value, "*.vsto*")
                        and not strings.ilike(.value, 'C:\Program Files*')
                        and not any($org_domains, strings.contains(..value, .))
                )
        )
)
// the message is unsolicited and no false positives
and (
  not profile.by_sender().solicited
  or (
    length(headers.reply_to) > 0
    and all(headers.reply_to, .email.email not in $recipient_emails)
  )
)
and not profile.by_sender().any_messages_benign

Detection logic

Scope: inbound message.

Recursively scans files and archives to detect Office documents with VSTO Add-ins.

  1. inbound message
  2. any of attachments where all hold:
    • any of:
      • .file_extension in $file_extensions_macros
      • .file_extension in $file_extensions_common_archives
      • all of:
        • .file_extension is missing
        • .file_type is 'unknown'
        • .content_type is 'application/octet-stream'
        • .size < 100000000
    • any of file.explode(.) where all hold:
      • .file_extension in ('doc', 'docm', 'docx', 'dot', 'dotm', 'xls', 'xlsx', 'xlsm', 'xlm', 'xlsb', 'xlt', 'xltm', 'ppt', 'pptx', 'pptm', 'ppsm')
      • any of .scan.exiftool.fields where all hold:
        • .key is 'Tag_AssemblyLocation'
        • .value matches '*.vsto*'
        • not:
          • .value matches 'C:\\Program Files*'
        • not:
          • any of $org_domains where:
            • strings.contains(.value)
  3. any of:
    • not:
      • profile.by_sender().solicited
    • all of:
      • length(headers.reply_to) > 0
      • all of headers.reply_to where:
        • .email.email not in $recipient_emails
  4. not:
    • profile.by_sender().any_messages_benign

Inspects: attachments[].content_type, attachments[].file_extension, attachments[].file_type, attachments[].size, headers.reply_to, headers.reply_to[].email.email, type.inbound. Sensors: file.explode, profile.by_sender, strings.contains, strings.ilike. Reference lists: $file_extensions_common_archives, $file_extensions_macros, $org_domains, $recipient_emails.

Indicators matched (21)

FieldMatchValue
attachments[].file_typeequalsunknown
attachments[].content_typeequalsapplication/octet-stream
file.explode(attachments[])[].file_extensionmemberdoc
file.explode(attachments[])[].file_extensionmemberdocm
file.explode(attachments[])[].file_extensionmemberdocx
file.explode(attachments[])[].file_extensionmemberdot
file.explode(attachments[])[].file_extensionmemberdotm
file.explode(attachments[])[].file_extensionmemberxls
file.explode(attachments[])[].file_extensionmemberxlsx
file.explode(attachments[])[].file_extensionmemberxlsm
file.explode(attachments[])[].file_extensionmemberxlm
file.explode(attachments[])[].file_extensionmemberxlsb
9 more
file.explode(attachments[])[].file_extensionmemberxlt
file.explode(attachments[])[].file_extensionmemberxltm
file.explode(attachments[])[].file_extensionmemberppt
file.explode(attachments[])[].file_extensionmemberpptx
file.explode(attachments[])[].file_extensionmemberpptm
file.explode(attachments[])[].file_extensionmemberppsm
file.explode(attachments[])[].scan.exiftool.fields[].keyequalsTag_AssemblyLocation
strings.ilikesubstring*.vsto*
strings.ilikesubstringC:\Program Files*