Detection rules › Sublime MQL
Attachment: HTML smuggling with auto-downloaded file
HTML attachments containing files that are automatically downloaded with Javascript.
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) |
| type |
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(.),
any(.scan.javascript.identifiers, strings.ilike(., 'click'))
and any(.scan.javascript.identifiers,
strings.ilike(., 'addEventListener')
)
and (
length(filter(.scan.javascript.identifiers,
strings.like(., "document", "write", "atob")
)
) == 3
// usage: document['write'](atob)
or any(.scan.strings.strings,
strings.ilike(., "*document*write*atob*")
)
// usage: some_var = atob();
or any(.scan.strings.strings, strings.ilike(., "*=*atob*;"))
// 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*write*atob*",
"*document*insertAdjacentHTML*atob*"
)
)
)
)
)
Detection logic
Scope: inbound message.
HTML attachments containing files that are automatically downloaded with Javascript.
- inbound message
any of
attachmentswhere 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:any of
.scan.javascript.identifierswhere:- . matches 'click'
any of
.scan.javascript.identifierswhere:- . matches 'addEventListener'
any of:
- length(filter(.scan.javascript.identifiers, strings.like(., 'document', 'write', 'atob'))) is 3
any of
.scan.strings.stringswhere:- . matches '*document*write*atob*'
any of
.scan.strings.stringswhere:- . matches '*=*atob*;'
any of
.scan.javascript.identifierswhere:- . matches '*ato\\u0062*'
any of
.scan.strings.stringswhere:. matches any of 2 patterns
*document*write*atob**document*insertAdjacentHTML*atob*
Inspects: attachments[].file_extension, attachments[].file_type, type.inbound. Sensors: file.explode, strings.ilike, strings.like. Reference lists: $file_extensions_common_archives.
Indicators matched (14)
| 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_type | equals | html |
strings.ilike | substring | click |
strings.ilike | substring | addEventListener |
strings.like | substring | document |
strings.like | substring | write |
strings.like | substring | atob |
strings.ilike | substring | *document*write*atob* |
strings.ilike | substring | *=*atob*; |
2 more
strings.ilike | substring | *ato\u0062* |
strings.ilike | substring | *document*insertAdjacentHTML*atob* |