Sublime Security medium experimental mql

Attachment: Encrypted PDF with credential theft body

Attached PDF is encrypted, and email body contains credential theft language. Seen in-the-wild impersonating e-fax services.

View Source

Detection Logic

type.inbound
and any(filter(attachments, .file_type == "pdf"),
        any(file.explode(.),
            any(.scan.exiftool.fields, .key == "Encryption")
            or (
              .scan.entropy.entropy > 7
              and any(.scan.strings.strings, strings.icontains(., "/Encrypt"))
            )
        )
        and (
          // Encrypted PDFs do not have child nodes with any data
          all(filter(file.explode(.), .depth > 0), .size == 0)
          // if we cracked the password, it will have child objects
          or (
            any(file.explode(.), 'pdf_encryption_dict' in .flavors.yara)
            and any(file.explode(.),
                    .scan.encrypted_pdf.cracked_password is not null
            )
          )
        )
)
and (
  any(ml.nlu_classifier(body.current_thread.text).intents,
      .name == "cred_theft" and .confidence in ("medium", "high")
  )
  or any(ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intents,
         .name == "cred_theft" and .confidence in ("medium", "high")
  )
  or regex.icontains(body.current_thread.text,
                     'PDF\s*(?:Access
| Preview
| Unlock
| Decrypt
| pass(?:code
| word))',
                     '(Access
| Preview
| Unlock
| Decrypt
| Pass)\s*(?:word
| code)\s*(?:\S+\s+){0,3}PDF\s*is?\s*:',
                     'Th(?:is
| e)\s+(?:file
| document
| pdf)\s+is\s+(?:pin
| password)[-\s]?\s*protected[[:punct:]]\s*The\s+p(?:in
| assword)\s+is\s*:?',
                     '(?:Access
| Preview
| Unlock
| Decrypt)\s+(?:\S+\s+){0,3}(?:PDF
| statement)(?:\S+\s+){0,3}(?:pass(?:word
| code)
| \s*with\s+\S+)',
                     'The\s+(?:file
| document
| pdf
| attachment)\s+(?:pass(?:code
| word)
| access\s*code)\s+is\s*'
  )
  or (
    (
      length(body.current_thread.text) <= 10
      or (body.current_thread.text is null)
    )
    and any(body.previous_threads,
            regex.icontains(.text,
                            'PDF\s*(?:Access
| Preview
| Unlock
| Decrypt
| pass(?:code
| word))',
                            '(Access
| Preview
| Unlock
| Decrypt
| Pass)\s*(?:word
| code)\s*(?:\S+\s+){0,3}PDF\s*is?\s*:',
                            'Th(?:is
| e)\s+(?:file
| document
| pdf)\s+is\s+(?:pin
| password)[-\s]?\s*protected[[:punct:]]\s*The\s+p(?:in
| assword)\s+is\s*:?',
                            '(?:Access
| Preview
| Unlock
| Decrypt)\s+(?:\S+\s+){0,3}(?:PDF
| statement)(?:\S+\s+){0,3}(?:pass(?:word
| code)
| \s*with\s+\S+)',
                            'The\s+(?:file
| document
| pdf
| attachment)\s+(?:pass(?:code
| word)
| access\s*code)\s+is\s*'
            )
    )
  )
)
// not forwards/replies
and not (
  (length(headers.references) > 0 or headers.in_reply_to is not null)
  and (subject.is_forward or subject.is_reply)
  and length(body.previous_threads) >= 1
)
and (
  (
    profile.by_sender_email().prevalence in ("new", "outlier")
    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
  )
  or (
    length(recipients.to) == 0
    or all(recipients.to,
           strings.ilike(.display_name, "undisclosed?recipients")
    )
  )
  or (
    length(recipients.to) == 1
    and any(recipients.to, .email.email == sender.email.email)
  )
)
// negate highly trusted sender domains unless they fail DMARC authentication
and (
  (
    sender.email.domain.root_domain in $high_trust_sender_root_domains
    and not headers.auth_summary.dmarc.pass
  )
  or sender.email.domain.root_domain not in $high_trust_sender_root_domains
)

Field Validations

Loading…

Comments (0)

Loading comments...