Detection rules › Sublime MQL

Attachment: DocX embedded binary

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

This rule is designed to detect sophisticated phishing attacks that deliver binary payloads through MS office open XML files. It identifies malicious documents containing embedded scripts or objects, either encoded in base64 or using specific JavaScript functions like createObjectURL or msSaveOrOpenBlob, which are indicative of attempts to download and execute a binary payload.

Threat classification

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

CategoryValues
Attack typesMalware/Ransomware
Tactics and techniquesEvasion

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 .content_type == "application/zip"
          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(.flavors.yara, . == "base64_pe")
                  // The malicious file to be downloaded and run with the data URI may not always be portable executable
                  or any(.scan.strings.strings,
                         strings.ilike(., "*.createObjectURL(*)*")
                  )
                  or any(.scan.strings.strings,
                         strings.ilike(., "*.msSaveOrOpenBlob(*)*")
                  )
                )
        )
)

Detection logic

Scope: inbound message.

This rule is designed to detect sophisticated phishing attacks that deliver binary payloads through MS office open XML files. It identifies malicious documents containing embedded scripts or objects, either encoded in base64 or using specific JavaScript functions like createObjectURL or msSaveOrOpenBlob, which are indicative of attempts to download and execute a binary payload.

  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
      • .content_type is 'application/zip'
      • 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:
        • any of .flavors.yara where:
          • . is 'base64_pe'
        • any of .scan.strings.strings where:
          • . matches '*.createObjectURL(*)*'
        • any of .scan.strings.strings where:
          • . matches '*.msSaveOrOpenBlob(*)*'

Inspects: attachments[].content_type, attachments[].file_extension, attachments[].file_type, attachments[].size, type.inbound. Sensors: file.explode, strings.ilike. Reference lists: $file_extensions_common_archives, $file_extensions_macros.

Indicators matched (22)

FieldMatchValue
attachments[].content_typeequalsapplication/zip
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
10 more
file.explode(attachments[])[].file_extensionmemberxlsb
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[])[].flavors.yara[]equalsbase64_pe
strings.ilikesubstring*.createObjectURL(*)*
strings.ilikesubstring*.msSaveOrOpenBlob(*)*