Detection rules › Sublime MQL

QR code to auto-download of a suspicious file type (unsolicited)

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

A QR code in the body of the email downloads a suspicious file type (or embedded file) such as an LNK, JS, or VBA. Recursively explodes auto-downloaded files within archives to detect these file types.

Threat classification

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

CategoryValues
Attack typesMalware/Ransomware
Tactics and techniquesEvasion, LNK, Social engineering

Event coverage

Rule body MQL

type.inbound
//
// This rule makes use of a beta feature and is subject to change without notice
// using the beta feature in custom rules is not suggested until it has been formally released
//
and beta.scan_qr(file.message_screenshot()).found
and any(beta.scan_qr(file.message_screenshot()).items,
        any(ml.link_analysis(.url).files_downloaded,
            strings.ilike(.file_name, "*.exe")
            or .file_extension in (
              "dll",
              "exe",
              "html",
              "lnk",
              "js",
              "vba",
              "vbs",
              "vbe",
              "bat",
              "py",
              "ics",
              "sh",
              "ps1"
            )
            // or call file.explode to get yara/mime types
            or any(file.explode(.),
                   // file ext is not dll but is exe mime/yara
                   (
                     .file_extension not in ("dll", "exe")
                     and (
                       .flavors.mime in ("application/x-dosexec")
                       or any(.flavors.yara, . in ('mz_file'))
                     )
                   )
                   // or a macho file
                   or any(.flavors.yara, . == "macho_file")
            )
        )
)

// 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
  )
)

Detection logic

Scope: inbound message.

A QR code in the body of the email downloads a suspicious file type (or embedded file) such as an LNK, JS, or VBA. Recursively explodes auto-downloaded files within archives to detect these file types.

  1. inbound message
  2. beta.scan_qr(file.message_screenshot()).found
  3. any of beta.scan_qr(file.message_screenshot()).items where:
    • any of ml.link_analysis(.url).files_downloaded where any holds:
      • .file_name matches '*.exe'
      • .file_extension in ('dll', 'exe', 'html', 'lnk', 'js', 'vba', 'vbs', 'vbe', 'bat', 'py', 'ics', 'sh', 'ps1')
      • any of file.explode(.) where any holds:
        • all of:
          • .file_extension not in ('dll', 'exe')
          • any of:
            • .flavors.mime in ('application/x-dosexec')
            • any of .flavors.yara where:
              • . in ('mz_file')
        • any of .flavors.yara where:
          • . is 'macho_file'
  4. any of:
    • all of:
      • sender.email.domain.root_domain in $high_trust_sender_root_domains
      • not:
        • headers.auth_summary.dmarc.pass
    • sender.email.domain.root_domain not in $high_trust_sender_root_domains
  5. any of:
    • not:
      • profile.by_sender().solicited
    • all of:
      • profile.by_sender().any_messages_malicious_or_spam
      • not:
        • profile.by_sender().any_messages_benign

Inspects: headers.auth_summary.dmarc.pass, sender.email.domain.root_domain, type.inbound. Sensors: beta.scan_qr, file.explode, file.message_screenshot, ml.link_analysis, profile.by_sender, strings.ilike. Reference lists: $high_trust_sender_root_domains.

Indicators matched (19)

FieldMatchValue
strings.ilikesubstring*.exe
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmemberdll
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmemberexe
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmemberhtml
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmemberlnk
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmemberjs
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmembervba
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmembervbs
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmembervbe
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmemberbat
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmemberpy
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmemberics
7 more
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmembersh
ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[].file_extensionmemberps1
file.explode(ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[])[].file_extensionmemberdll
file.explode(ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[])[].file_extensionmemberexe
file.explode(ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[])[].flavors.mimememberapplication/x-dosexec
file.explode(ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[])[].flavors.yara[]membermz_file
file.explode(ml.link_analysis(beta.scan_qr(file.message_screenshot()).items[].url).files_downloaded[])[].flavors.yara[]equalsmacho_file