Detection rules › Sublime MQL

Attachment: HTML smuggling with fromCharCode and other signals

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

Recursively scans files and archives to detect HTML smuggling techniques.

Threat classification

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

CategoryValues
Attack typesCredential Phishing, Malware/Ransomware
Tactics and techniquesEvasion, HTML smuggling, Scripting

Event coverage

Rule body MQL

type.inbound
and any(attachments,
        (
          .file_extension in~ ("html", "htm", "shtml", "dhtml")
          or .file_extension in~ $file_extensions_common_archives
          or .file_type == "html"
        )
        and any(file.explode(.),
                length(.scan.javascript.identifiers) < 100
                and "location" in .scan.javascript.identifiers
                and "charCodeAt" in .scan.javascript.identifiers
                and "fromCharCode" in .scan.javascript.identifiers
                and "indexOf" in .scan.javascript.identifiers
                and "try" in .scan.javascript.keywords
                and "catch" in .scan.javascript.keywords
        )
)

Detection logic

Scope: inbound message.

Recursively scans files and archives to detect HTML smuggling techniques.

  1. inbound message
  2. any of attachments where all hold:
    • any of:
      • .file_extension in ('html', 'htm', 'shtml', 'dhtml')
      • .file_extension in $file_extensions_common_archives
      • .file_type is 'html'
    • any of file.explode(.) where all hold:
      • length(.scan.javascript.identifiers) < 100
      • .scan.javascript.identifiers contains 'location'
      • .scan.javascript.identifiers contains 'charCodeAt'
      • .scan.javascript.identifiers contains 'fromCharCode'
      • .scan.javascript.identifiers contains 'indexOf'
      • .scan.javascript.keywords contains 'try'
      • .scan.javascript.keywords contains 'catch'

Inspects: attachments[].file_extension, attachments[].file_type, type.inbound. Sensors: file.explode. Reference lists: $file_extensions_common_archives.

Indicators matched (11)

FieldMatchValue
attachments[].file_extensionmemberhtml
attachments[].file_extensionmemberhtm
attachments[].file_extensionmembershtml
attachments[].file_extensionmemberdhtml
attachments[].file_typeequalshtml
file.explode(attachments[])[].scan.javascript.identifierscontainslocation
file.explode(attachments[])[].scan.javascript.identifierscontainscharCodeAt
file.explode(attachments[])[].scan.javascript.identifierscontainsfromCharCode
file.explode(attachments[])[].scan.javascript.identifierscontainsindexOf
file.explode(attachments[])[].scan.javascript.keywordscontainstry
file.explode(attachments[])[].scan.javascript.keywordscontainscatch