EXPLORE
← Back to Explore
sublimemediumRule

Attachment with auto-executing macro (unsolicited)

Attachment from an unsolicited sender contains a macro that will auto-execute when the file is opened. Macros are a common phishing technique used to deploy malware.

Detection Query

type.inbound
and any(attachments,
        (
          .file_extension in~ $file_extensions_macros
          or (
            .file_extension is null
            and .file_type == "unknown"
            and .content_type == "application/octet-stream"
            and .size < 100000000
          )
        )
        and any(file.oletools(.).macros.keywords, .type =~ "autoexec")
)
and (
  not profile.by_sender().solicited
  or (
    profile.by_sender().any_messages_malicious_or_spam
    and not profile.by_sender().any_messages_benign
  )
)

// negate replies
and (
  length(headers.references) == 0
  or not any(headers.hops, any(.fields, strings.ilike(.name, "In-Reply-To")))
)

Data Sources

Email MessagesEmail HeadersEmail Attachments

Platforms

email
Raw Content
name: "Attachment with auto-executing macro (unsolicited)"
description: |
  Attachment from an unsolicited sender contains a macro that will auto-execute when the file is opened.

  Macros are a common phishing technique used to deploy malware.
references:
  - "https://www.trustedsec.com/blog/malicious-macros-for-script-kiddies/"
type: "rule"
severity: "medium"
source: |
  type.inbound
  and any(attachments,
          (
            .file_extension in~ $file_extensions_macros
            or (
              .file_extension is null
              and .file_type == "unknown"
              and .content_type == "application/octet-stream"
              and .size < 100000000
            )
          )
          and any(file.oletools(.).macros.keywords, .type =~ "autoexec")
  )
  and (
    not profile.by_sender().solicited
    or (
      profile.by_sender().any_messages_malicious_or_spam
      and not profile.by_sender().any_messages_benign
    )
  )
  
  // negate replies
  and (
    length(headers.references) == 0
    or not any(headers.hops, any(.fields, strings.ilike(.name, "In-Reply-To")))
  )
attack_types:
  - "Malware/Ransomware"
tactics_and_techniques:
  - "Macros"
detection_methods:
  - "Archive analysis"
  - "Header analysis"
  - "File analysis"
  - "Macro analysis"
  - "OLE analysis"
  - "Sender analysis"
id: "af6624c3-2a28-5fbb-8936-fb29e55dd29d"