Detection rules › Sublime MQL
Attachment: HTML smuggling with atob and high entropy
Recursively scans files and archives to detect HTML smuggling techniques using Javascript atob functions.
Threat classification
Sublime's own taxonomy (not MITRE ATT&CK).
| Category | Values |
|---|---|
| Attack types | Credential Phishing, Malware/Ransomware |
| Tactics and techniques | HTML smuggling, Scripting |
Event coverage
| Message attribute |
|---|
| attachments (collection) |
| headers.auth_summary |
| sender.email |
| type |
Rule body MQL
type.inbound
and any(attachments,
(
.file_extension in~ ("html", "htm", "shtml", "dhtml", "eml")
or .file_extension in~ $file_extensions_common_archives
or .file_type == "html"
or .content_type == "message/rfc822"
or .file_extension in ('eml')
)
and any(file.explode(.),
.scan.entropy.entropy >= 5
and (
length(filter(.scan.javascript.identifiers,
strings.like(., "document", "write", "atob")
)
) == 3
// usage: document['write'](atob)
or any(.scan.strings.strings,
regex.icontains(., "document.{0,10}write.{0,10}atob")
)
// usage: some_var = atob();
or any(.scan.strings.strings,
regex.icontains(., "=.?atob.*;")
)
// usage: atob(atob
or any(.scan.strings.strings, strings.ilike(., "*atob?atob*"))
// usage: {src: atob
or any(.scan.strings.strings,
strings.ilike(., "*{src: atob*")
)
// usage: eval(atob)
or any(.scan.strings.strings, strings.ilike(., "*eval?atob*"))
// usage: atob(_0x)
or any(.scan.strings.strings, strings.ilike(., "*atob(?0x*"))
// usage : 'at'+'ob'
or any(.scan.strings.strings, strings.ilike(., "*'at'+'ob'*"))
// usage: obfuscating "atob"
or any(.scan.javascript.identifiers,
strings.ilike(., '*ato\u0062*')
)
// usage: document.head.insertAdjacentHTML("beforeend", atob(...
or any(.scan.strings.strings,
strings.ilike(., "*document*insertAdjacentHTML*atob*")
)
)
)
)
// negate bouncebacks and undeliverables
and not any(attachments,
.content_type in (
"message/global-delivery-status",
"message/delivery-status"
)
)
// 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
)
Detection logic
Scope: inbound message.
Recursively scans files and archives to detect HTML smuggling techniques using Javascript atob functions.
- inbound message
any of
attachmentswhere all hold:any of:
- .file_extension in ('html', 'htm', 'shtml', 'dhtml', 'eml')
- .file_extension in $file_extensions_common_archives
- .file_type is 'html'
- .content_type is 'message/rfc822'
- .file_extension in ('eml')
any of
file.explode(.)where all hold:- .scan.entropy.entropy ≥ 5
any of:
- length(filter(.scan.javascript.identifiers, strings.like(., 'document', 'write', 'atob'))) is 3
any of
.scan.strings.stringswhere:- . matches 'document.{0,10}write.{0,10}atob'
any of
.scan.strings.stringswhere:- . matches '=.?atob.*;'
any of
.scan.strings.stringswhere:- . matches '*atob?atob*'
any of
.scan.strings.stringswhere:- . matches '*{src: atob*'
any of
.scan.strings.stringswhere:- . matches '*eval?atob*'
any of
.scan.strings.stringswhere:- . matches '*atob(?0x*'
any of
.scan.strings.stringswhere:- . matches "*'at'+'ob'*"
any of
.scan.javascript.identifierswhere:- . matches '*ato\\u0062*'
any of
.scan.strings.stringswhere:- . matches '*document*insertAdjacentHTML*atob*'
not:
any of
attachmentswhere:- .content_type in ('message/global-delivery-status', 'message/delivery-status')
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
Inspects: attachments[].content_type, attachments[].file_extension, attachments[].file_type, headers.auth_summary.dmarc.pass, sender.email.domain.root_domain, type.inbound. Sensors: file.explode, regex.icontains, strings.ilike, strings.like. Reference lists: $file_extensions_common_archives, $high_trust_sender_root_domains.
Indicators matched (21)
| Field | Match | Value |
|---|---|---|
attachments[].file_extension | member | html |
attachments[].file_extension | member | htm |
attachments[].file_extension | member | shtml |
attachments[].file_extension | member | dhtml |
attachments[].file_extension | member | eml |
attachments[].file_type | equals | html |
attachments[].content_type | equals | message/rfc822 |
strings.like | substring | document |
strings.like | substring | write |
strings.like | substring | atob |
regex.icontains | regex | document.{0,10}write.{0,10}atob |
regex.icontains | regex | =.?atob.*; |
9 more
strings.ilike | substring | *atob?atob* |
strings.ilike | substring | *{src: atob* |
strings.ilike | substring | *eval?atob* |
strings.ilike | substring | *atob(?0x* |
strings.ilike | substring | *'at'+'ob'* |
strings.ilike | substring | *ato\u0062* |
strings.ilike | substring | *document*insertAdjacentHTML*atob* |
attachments[].content_type | member | message/global-delivery-status |
attachments[].content_type | member | message/delivery-status |