Detection rules › Sublime MQL

Attachment: Archive contains DLL-loading macro

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

An attacker could send a trusted and signed document that references an untrusted DLL file, which will be loaded by the signed document.

Threat classification

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

CategoryValues
Attack typesMalware/Ransomware
Tactics and techniquesExploit, LNK, Macros, Scripting

Event coverage

Rule body MQL

type.inbound
and any(attachments,
        (
          .file_extension in~ $file_extensions_common_archives
          or .file_type == "rar"
        )
        and (
          (
            any(file.explode(.),
                .scan.zip.encrypted == false
                // zip contains a dll file
                and any(.scan.zip.all_paths, strings.icontains(., "dll"))
            )
            and any(file.explode(.),
                    // macro references a dll file
                    any(.flavors.yara, strings.like(., "vb_file"))
                    and any(.scan.strings.strings, strings.icontains(., "dll"))
            )
          )
          or any(file.explode(.), // fallback for encrypted zips
                 .scan.zip.encrypted == true
                 and any(.scan.zip.all_paths,
                         any($file_extensions_macros, strings.icontains(.., .))
                 )
                 // zip contains a dll file
                 and any(.scan.zip.all_paths, strings.icontains(., "dll"))
          )
          or (
            any(file.explode(.),
                any(.flavors.yara, strings.like(., "vb_file"))
                and any(.scan.strings.strings, strings.ilike(., "*Lib*.dll*"))
            )
            and any(file.explode(.), strings.ilike(.file_extension, "dll"))
          )
        )
)

Detection logic

Scope: inbound message.

An attacker could send a trusted and signed document that references an untrusted DLL file, which will be loaded by the signed document.

  1. inbound message
  2. any of attachments where all hold:
    • any of:
      • .file_extension in $file_extensions_common_archives
      • .file_type is 'rar'
    • any of:
      • all of:
        • any of file.explode(.) where all hold:
          • .scan.zip.encrypted is False
          • any of .scan.zip.all_paths where:
            • . contains 'dll'
        • any of file.explode(.) where all hold:
          • any of .flavors.yara where:
            • . matches 'vb_file'
          • any of .scan.strings.strings where:
            • . contains 'dll'
      • any of file.explode(.) where all hold:
        • .scan.zip.encrypted is True
        • any of .scan.zip.all_paths where:
          • any of $file_extensions_macros where:
            • strings.icontains(.)
        • any of .scan.zip.all_paths where:
          • . contains 'dll'
      • all of:
        • any of file.explode(.) where all hold:
          • any of .flavors.yara where:
            • . matches 'vb_file'
          • any of .scan.strings.strings where:
            • . matches '*Lib*.dll*'
        • any of file.explode(.) where:
          • .file_extension matches 'dll'

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

Indicators matched (5)

FieldMatchValue
attachments[].file_typeequalsrar
strings.icontainssubstringdll
strings.likesubstringvb_file
strings.ilikesubstring*Lib*.dll*
strings.ilikesubstringdll