Detection rules › Sublime MQL

Attachment: EML containing a base64 encoded script

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

Attached EML contains a base64 encoded script in the message body.

Threat classification

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

CategoryValues
Attack typesCredential Phishing
Tactics and techniquesEvasion, HTML smuggling, Scripting, Social engineering

Event coverage

Rule body MQL

type.inbound
and length(body.current_thread.text) < 1000
and any(attachments,
        (.content_type == "message/rfc822" or .file_extension == "eml")
        and strings.ilike(file.parse_eml(.).body.html.raw,
                          "*script*data:text/html;base64*"
        )
)
// exclude bounce backs & read receipts
and not strings.like(sender.email.local_part,
                     "*postmaster*",
                     "*mailer-daemon*",
                     "*administrator*"
)
and not any(attachments, .content_type == "message/delivery-status")

Detection logic

Scope: inbound message.

Attached EML contains a base64 encoded script in the message body.

  1. inbound message
  2. length(body.current_thread.text) < 1000
  3. any of attachments where all hold:
    • any of:
      • .content_type is 'message/rfc822'
      • .file_extension is 'eml'
    • file.parse_eml(.).body.html.raw matches '*script*data:text/html;base64*'
  4. not:
    • sender.email.local_part matches any of 3 patterns
      • *postmaster*
      • *mailer-daemon*
      • *administrator*
  5. not:
    • any of attachments where:
      • .content_type is 'message/delivery-status'

Inspects: attachments[].content_type, attachments[].file_extension, body.current_thread.text, sender.email.local_part, type.inbound. Sensors: file.parse_eml, strings.ilike, strings.like.

Indicators matched (7)

FieldMatchValue
attachments[].content_typeequalsmessage/rfc822
attachments[].file_extensionequalseml
strings.ilikesubstring*script*data:text/html;base64*
strings.likesubstring*postmaster*
strings.likesubstring*mailer-daemon*
strings.likesubstring*administrator*
attachments[].content_typeequalsmessage/delivery-status