EXPLORE
← Back to Explore
sublimehighRule

Attachment: HTML smuggling - QR Code with suspicious links

This rule detects messages with HTML attachments containing QR codes

Detection Query

type.inbound
and 1 <= length(attachments) < 3

// inspects HTML attachments for QR codes
and any(attachments,
        (
          .file_extension in~ ("html", "htm", "shtml", "dhtml", "xhtml")
          or (
            .file_extension is null
            and .file_type == "unknown"
            and .content_type == "application/octet-stream"
          )
          or .file_extension in~ $file_extensions_common_archives
          or .file_type == "html"
          or .content_type == "text/html"
        )
        and any(file.explode(file.html_screenshot(.)),
                // any URL
                ml.link_analysis(.scan.qr.url).submitted
                // currently we won't pick it up as a URL if it's
                // not prefaced with a scheme. this is not very strong,
                // but it's unlikely to cause FPs for this rule
                or regex.contains(.scan.qr.data, '\.')
        )
)

// 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
)
and (
  not profile.by_sender().solicited
  or (
    profile.by_sender().any_messages_malicious_or_spam
    and not profile.by_sender().any_messages_benign
  )
)
and not profile.by_sender().any_messages_benign

Data Sources

Email MessagesEmail HeadersEmail Attachments

Platforms

email
Raw Content
name: "Attachment: HTML smuggling - QR Code with suspicious links"
description: "This rule detects messages with HTML attachments containing QR codes"
type: "rule"
severity: "high"
source: |
  type.inbound
  and 1 <= length(attachments) < 3
  
  // inspects HTML attachments for QR codes
  and any(attachments,
          (
            .file_extension in~ ("html", "htm", "shtml", "dhtml", "xhtml")
            or (
              .file_extension is null
              and .file_type == "unknown"
              and .content_type == "application/octet-stream"
            )
            or .file_extension in~ $file_extensions_common_archives
            or .file_type == "html"
            or .content_type == "text/html"
          )
          and any(file.explode(file.html_screenshot(.)),
                  // any URL
                  ml.link_analysis(.scan.qr.url).submitted
                  // currently we won't pick it up as a URL if it's
                  // not prefaced with a scheme. this is not very strong,
                  // but it's unlikely to cause FPs for this rule
                  or regex.contains(.scan.qr.data, '\.')
          )
  )
  
  // 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
  )
  and (
    not profile.by_sender().solicited
    or (
      profile.by_sender().any_messages_malicious_or_spam
      and not profile.by_sender().any_messages_benign
    )
  )
  and not profile.by_sender().any_messages_benign
attack_types:
  - "Credential Phishing"
tactics_and_techniques:
  - "QR code"
detection_methods:
  - "Computer Vision"
  - "Header analysis"
  - "Natural Language Understanding"
  - "QR code analysis"
  - "Sender analysis"
  - "URL analysis"
  - "URL screenshot"
id: "010e757d-f569-5f25-b68b-832edb5e1120"