EXPLORE
← Back to Explore
sublimehighRule

Attachment: Archive contains DLL-loading macro

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

Detection Query

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"))
          )
        )
)

Data Sources

Email MessagesEmail HeadersEmail Attachments

Platforms

email
Raw Content
name: "Attachment: Archive contains DLL-loading macro"
description: |
  An attacker could send a trusted and signed document that references an untrusted DLL file, which will be loaded by the signed document.
references:
  - "https://outflank.nl/blog/2023/04/25/so-you-think-you-can-block-macros"
type: "rule"
severity: "high"
source: |
  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"))
            )
          )
  )
attack_types:
  - "Malware/Ransomware"
tactics_and_techniques:
  - "Exploit"
  - "LNK"
  - "Macros"
  - "Scripting"
detection_methods:
  - "Archive analysis"
  - "File analysis"
  - "Macro analysis"
  - "YARA"
id: "3a193f5f-1596-54d8-8fd7-1e09e63e6ea4"