Detection rules › Sublime MQL

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

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

A link 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. This rule also catches direct Google Drive download links (drive.google.com/uc?export=download) that automatically download archive files, as these are frequently abused by threat actors to distribute malware. This technique has been used by known threat actors in the wild.

Threat classification

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

CategoryValues
Attack typesMalware/Ransomware
Tactics and techniquesEncryption, Evasion, LNK, Social engineering

Event coverage

Rule body MQL

type.inbound
and any(body.links,
        // Detect suspicious direct Google Drive downloads
        (
          strings.icontains(.href_url.url, "drive.google.com/uc")
          and strings.icontains(.href_url.url, "export=download")
          and any(ml.link_analysis(., mode="aggressive").files_downloaded,
                  .file_extension in $file_extensions_common_archives
          )
        )
        or any(ml.link_analysis(.).files_downloaded,
               // call parse_exif to see if there is a sus file
               any(beta.parse_exif(.).fields,
                   .key == "ArchivedFileName"
                   and strings.ilike(.value,
                                     "*.dll",
                                     "*.html",
                                     "*.exe",
                                     "*.lnk",
                                     "*.js",
                                     "*.vba",
                                     "*.vbs",
                                     "*.vbe",
                                     "*.bat"
                   )
               )
               or any(file.explode(.),
                      (
                        // look for files in encrypted zips.
                        // if password cracking the zip wasn't
                        // successful, our only opportunity to look
                        // for suspicious file types is here under
                        // .zip.attempted_files
                        "encrypted_zip" in .flavors.yara
                        and any(.scan.zip.attempted_files,
                                strings.ilike(.,
                                              "*.dll",
                                              "*.html",
                                              "*.exe",
                                              "*.lnk",
                                              "*.js",
                                              "*.vba",
                                              "*.vbs",
                                              "*.vbe",
                                              "*.bat"
                                )
                        )
                      )
                      // for both non-encrypted zips and encrypted zips
                      // that were successfully cracked
                      or .file_extension in (
                        "dll",
                        "exe",
                        "html",
                        "lnk",
                        "js",
                        "vba",
                        "vbs",
                        "vbe",
                        "bat"
                      )
                      or strings.ilike(.file_name, "*.exe")
                      or (
                        .file_extension not in ("dll", "exe")
                        and (
                          .flavors.mime in ("application/x-dosexec")
                          or any(.flavors.yara, . in ('mz_file'))
                        )
                      )
                      or any(.flavors.yara, . == "macho_file")
               )
               and not (
                 ml.link_analysis(..).effective_url.domain.root_domain == "zoom.us"
                 and .file_extension == "exe"
               )
        )
)
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 link 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. This rule also catches direct Google Drive download links (drive.google.com/uc?export=download) that automatically download archive files, as these are frequently abused by threat actors to distribute malware. This technique has been used by known threat actors in the wild.

  1. inbound message
  2. any of body.links where any holds:
    • all of:
      • .href_url.url contains 'drive.google.com/uc'
      • .href_url.url contains 'export=download'
      • any of ml.link_analysis(., mode='aggressive').files_downloaded where:
        • .file_extension in $file_extensions_common_archives
    • any of ml.link_analysis(.).files_downloaded where any holds:
      • any of beta.parse_exif(.).fields where all hold:
        • .key is 'ArchivedFileName'
        • .value matches any of 9 patterns
          • *.dll
          • *.html
          • *.exe
          • *.lnk
          • *.js
          • *.vba
          • *.vbs
          • *.vbe
          • *.bat
      • all of:
        • any of file.explode(.) where any holds:
          • all of:
            • .flavors.yara contains 'encrypted_zip'
            • any of .scan.zip.attempted_files where:
              • . matches any of 9 patterns
                • *.dll
                • *.html
                • *.exe
                • *.lnk
                • *.js
                • *.vba
                • *.vbs
                • *.vbe
                • *.bat
          • .file_extension in ('dll', 'exe', 'html', 'lnk', 'js', 'vba', 'vbs', 'vbe', 'bat')
          • .file_name matches '*.exe'
          • 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'
        • not:
          • all of:
            • ml.link_analysis(.).effective_url.domain.root_domain is 'zoom.us'
            • .file_extension is 'exe'
  3. 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: body.links, body.links[].href_url.url, type.inbound. Sensors: beta.parse_exif, file.explode, ml.link_analysis, profile.by_sender, strings.icontains, strings.ilike. Reference lists: $file_extensions_common_archives.

Indicators matched (26)

FieldMatchValue
strings.icontainssubstringdrive.google.com/uc
strings.icontainssubstringexport=download
beta.parse_exif(ml.link_analysis(body.links[]).files_downloaded[]).fields[].keyequalsArchivedFileName
strings.ilikesubstring*.dll
strings.ilikesubstring*.html
strings.ilikesubstring*.exe
strings.ilikesubstring*.lnk
strings.ilikesubstring*.js
strings.ilikesubstring*.vba
strings.ilikesubstring*.vbs
strings.ilikesubstring*.vbe
strings.ilikesubstring*.bat
14 more
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].flavors.yaracontainsencrypted_zip
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].file_extensionmemberdll
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].file_extensionmemberexe
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].file_extensionmemberhtml
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].file_extensionmemberlnk
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].file_extensionmemberjs
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].file_extensionmembervba
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].file_extensionmembervbs
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].file_extensionmembervbe
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].file_extensionmemberbat
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].flavors.mimememberapplication/x-dosexec
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].flavors.yara[]membermz_file
file.explode(ml.link_analysis(body.links[]).files_downloaded[])[].flavors.yara[]equalsmacho_file
ml.link_analysis(body.links[]).files_downloaded[].file_extensionequalsexe