Attachment: HTML with JavaScript functions for HTTP requests

This rule identifies HTML attachments which contain multiple references to JavaScript functions that support making HTTP requests. This has been observed in phishing campaigns to load remote payloads into otherwise benign HTML attachments.

Sublime rule (View on GitHub)

 1name: "Attachment: HTML with JavaScript functions for HTTP requests"
 2description: "This rule identifies HTML attachments which contain multiple references to JavaScript functions that support making HTTP requests. This has been observed in phishing campaigns to load remote payloads into otherwise benign HTML attachments."
 3type: "rule"
 4severity: "high"
 5source: |
 6  type.inbound
 7  and not profile.by_sender().solicited
 8  // not high trust sender domains
 9  and not (
10    sender.email.domain.root_domain in $high_trust_sender_root_domains
11    and coalesce(headers.auth_summary.dmarc.pass, false)
12  )
13  and any(attachments,
14          .file_extension in~ ("html", "htm", "shtml", "dhtml")
15          and 3 of (
16            strings.icontains(file.parse_html(.).raw, '.replace'),
17            strings.icontains(file.parse_html(.).raw, 'XMLHttpRequest'),
18            strings.icontains(file.parse_html(.).raw, 'onreadystate'),
19            strings.icontains(file.parse_html(.).raw, 'GET'),
20            strings.icontains(file.parse_html(.).raw, 'send()'),
21            strings.icontains(file.parse_html(.).raw, 'responseText'),
22          )
23  )  
24
25attack_types:
26  - "Credential Phishing"
27tactics_and_techniques:
28  - "Evasion"
29  - "Scripting"
30detection_methods:
31  - "Content analysis"
32  - "HTML analysis"
33  - "Javascript analysis"
34  - "File analysis"
35id: "01e679fd-6c5a-542f-b98b-1b8de7132311"
to-top