Detection rules › Sublime MQL

EML attachment with credential theft language (unknown sender)

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

Identifies EML attachments that use credential theft language from unknown senders.

Threat classification

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

CategoryValues
Attack typesCredential Phishing
Tactics and techniquesEvasion, Social engineering

Event coverage

Rule body MQL

type.inbound
// we don't look for links because it could be a QR code
and any(attachments,
        (.content_type == "message/rfc822" or .file_extension =~ "eml")
        and (
          // credential theft language in the attached EML
          any(ml.nlu_classifier(file.parse_eml(.).body.current_thread.text).intents,
              .name == "cred_theft" and .confidence == "high"
          )
          // credential theft language in an attachment in the attached EML
          or any(file.parse_eml(.).attachments,
                 any(ml.nlu_classifier(beta.ocr(.).text).intents,
                     .name == "cred_theft" and .confidence == "high"
                 )
          )
        )
        and not strings.like(file.parse_eml(.).sender.email.local_part,
                             "*postmaster*",
                             "*mailer-daemon*",
                             "*administrator*"
        )
        // some systems attach the bounceback this way
        and not any(file.parse_eml(.).attachments,
                    .content_type in (
                      "message/delivery-status",
                      "message/feedback-report"
                    )
        )
        // negate Microsoft Dynamic Delivery
        and not (
          length(file.parse_eml(.).attachments) == 0
          and strings.icontains(file.parse_eml(.).body.current_thread.text,
                                "Your attachments are currently being scanned by Safe Attachments"
          )
        )
        // Mimecast Protection attached EMLs when replacing attachments
        and not (
          (
            strings.iends_with(.file_name, 'was removed from this message')
            or .file_name == "We found suspicious links"
            or .file_name == 'We sent you safe versions of your files'
          )
          and length(file.parse_eml(.).headers.hops) == 1
          and any(file.parse_eml(.).headers.hops[0].fields,
                  .name == "X-MC-System"
          )
          and any(file.parse_eml(.).headers.hops[0].fields,
                  .name == "Content-Type"
                  and strings.contains(.value, '; boundary="MCBoundary=_')
          )
        )
)
// exclude bounce backs & read receipts
and not strings.like(sender.email.local_part,
                     "*postmaster*",
                     "*mailer-daemon*",
                     "*administrator*"
)
and not regex.icontains(subject.subject, "^(undelivered|undeliverable|read:)")
and not any(attachments,
            .content_type in (
              "message/delivery-status",
              "message/feedback-report"
            )
)
// if the "References" is in the body of the message, it's probably a bounce
and not any(headers.references, strings.contains(body.html.display_text, .))
and (
  not profile.by_sender_email().solicited
  or (
    profile.by_sender_email().any_messages_malicious_or_spam
    and not profile.by_sender_email().any_messages_benign
  )
  // sender address listed as a recipient
  or (
    length(recipients.to) == 1
    and sender.email.email in map(recipients.to, .email.email)
  )
)
and not profile.by_sender_email().any_messages_benign
// negate instances where proofpoint sends a review of a reported message via analyzer
and not (
  sender.email.email == "analyzer@analyzer.securityeducation.com"
  and any(headers.domains, .root_domain == "pphosted.com")
  and headers.auth_summary.spf.pass
  and headers.auth_summary.dmarc.pass
)

Detection logic

Scope: inbound message.

Identifies EML attachments that use credential theft language from unknown senders.

  1. inbound message
  2. any of attachments where all hold:
    • any of:
      • .content_type is 'message/rfc822'
      • .file_extension is 'eml'
    • any of:
      • any of ml.nlu_classifier(file.parse_eml(.).body.current_thread.text).intents where all hold:
        • .name is 'cred_theft'
        • .confidence is 'high'
      • any of file.parse_eml(.).attachments where:
        • any of ml.nlu_classifier(beta.ocr(.).text).intents where all hold:
          • .name is 'cred_theft'
          • .confidence is 'high'
    • not:
      • file.parse_eml(.).sender.email.local_part matches any of 3 patterns
        • *postmaster*
        • *mailer-daemon*
        • *administrator*
    • not:
      • any of file.parse_eml(.).attachments where:
        • .content_type in ('message/delivery-status', 'message/feedback-report')
    • not:
      • all of:
        • length(file.parse_eml(.).attachments) is 0
        • file.parse_eml(.).body.current_thread.text contains 'Your attachments are currently being scanned by Safe Attachments'
    • not:
      • all of:
        • any of:
          • .file_name ends with 'was removed from this message'
          • .file_name is 'We found suspicious links'
          • .file_name is 'We sent you safe versions of your files'
        • length(file.parse_eml(.).headers.hops) is 1
        • any of file.parse_eml(.).headers.hops[0].fields where:
          • .name is 'X-MC-System'
        • any of file.parse_eml(.).headers.hops[0].fields where all hold:
          • .name is 'Content-Type'
          • .value contains '; boundary="MCBoundary=_'
  3. not:
    • sender.email.local_part matches any of 3 patterns
      • *postmaster*
      • *mailer-daemon*
      • *administrator*
  4. not:
    • subject.subject matches '^(undelivered|undeliverable|read:)'
  5. not:
    • any of attachments where:
      • .content_type in ('message/delivery-status', 'message/feedback-report')
  6. not:
    • any of headers.references where:
      • strings.contains(body.html.display_text)
  7. any of:
    • not:
      • profile.by_sender_email().solicited
    • all of:
      • profile.by_sender_email().any_messages_malicious_or_spam
      • not:
        • profile.by_sender_email().any_messages_benign
    • all of:
      • length(recipients.to) is 1
      • sender.email.email in map(recipients.to, .email.email)
  8. not:
    • profile.by_sender_email().any_messages_benign
  9. not:
    • all of:
      • sender.email.email is 'analyzer@analyzer.securityeducation.com'
      • any of headers.domains where:
        • .root_domain is 'pphosted.com'
      • headers.auth_summary.spf.pass
      • headers.auth_summary.dmarc.pass

Inspects: attachments[].content_type, attachments[].file_extension, attachments[].file_name, body.html.display_text, headers.auth_summary.dmarc.pass, headers.auth_summary.spf.pass, headers.domains, headers.domains[].root_domain, headers.references, recipients.to, recipients.to[].email.email, sender.email.email, sender.email.local_part, subject.subject, type.inbound. Sensors: beta.ocr, file.parse_eml, ml.nlu_classifier, profile.by_sender_email, regex.icontains, strings.contains, strings.icontains, strings.iends_with, strings.like.

Indicators matched (23)

FieldMatchValue
attachments[].content_typeequalsmessage/rfc822
attachments[].file_extensionequalseml
ml.nlu_classifier(file.parse_eml(attachments[]).body.current_thread.text).intents[].nameequalscred_theft
ml.nlu_classifier(file.parse_eml(attachments[]).body.current_thread.text).intents[].confidenceequalshigh
ml.nlu_classifier(beta.ocr(file.parse_eml(attachments[]).attachments[]).text).intents[].nameequalscred_theft
ml.nlu_classifier(beta.ocr(file.parse_eml(attachments[]).attachments[]).text).intents[].confidenceequalshigh
strings.likesubstring*postmaster*
strings.likesubstring*mailer-daemon*
strings.likesubstring*administrator*
file.parse_eml(attachments[]).attachments[].content_typemembermessage/delivery-status
file.parse_eml(attachments[]).attachments[].content_typemembermessage/feedback-report
strings.icontainssubstringYour attachments are currently being scanned by Safe Attachments
11 more
strings.iends_withsuffixwas removed from this message
attachments[].file_nameequalsWe found suspicious links
attachments[].file_nameequalsWe sent you safe versions of your files
file.parse_eml(attachments[]).headers.hops[0].fields[].nameequalsX-MC-System
file.parse_eml(attachments[]).headers.hops[0].fields[].nameequalsContent-Type
strings.containssubstring; boundary="MCBoundary=_
regex.icontainsregex^(undelivered|undeliverable|read:)
attachments[].content_typemembermessage/delivery-status
attachments[].content_typemembermessage/feedback-report
sender.email.emailequalsanalyzer@analyzer.securityeducation.com
headers.domains[].root_domainequalspphosted.com