type.inbound
and not profile.by_sender().solicited
// not high trust sender domains
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
)
and any(attachments,
.file_extension in~ ("html", "htm", "shtml", "dhtml")
and 3 of (
strings.icontains(file.parse_html(.).raw, '.replace'),
strings.icontains(file.parse_html(.).raw, 'XMLHttpRequest'),
strings.icontains(file.parse_html(.).raw, 'onreadystate'),
strings.icontains(file.parse_html(.).raw, 'GET'),
strings.icontains(file.parse_html(.).raw, 'send()'),
strings.icontains(file.parse_html(.).raw, 'responseText'),
)
)
Playground
Test against your own EMLs or sample data.