-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into microsoft_scl_spam
- Loading branch information
Showing
7 changed files
with
249 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: "Image as content linking to an open redirect" | ||
description: "Body contains little, no, or only disclaimer text, and an image linking to an open redirect." | ||
type: "rule" | ||
severity: "high" | ||
source: | | ||
type.inbound | ||
and length(body.links) < 3 | ||
and 0 < (length(attachments)) < 3 | ||
and all(attachments, (.file_type in $file_types_images)) | ||
and ( | ||
// body text is very short | ||
( | ||
0 <= (length(body.current_thread.text)) < 10 | ||
or body.current_thread.text is null | ||
) | ||
or ( | ||
length(body.current_thread.text) < 900 | ||
// or body is most likely all warning banner (text contains the sender and common warning banner language) | ||
and ( | ||
( | ||
strings.contains(body.current_thread.text, sender.email.email) | ||
and strings.contains(body.current_thread.text, 'caution') | ||
) | ||
or regex.icontains(body.current_thread.text, | ||
"intended recipient's use only|external email|sent from outside|you don't often|confidential" | ||
) | ||
) | ||
) | ||
) | ||
and ( | ||
any(body.links, | ||
any(.href_url.rewrite.encoders, strings.icontains(., "open_redirect")) | ||
) | ||
or any(body.links, | ||
.href_url.domain.root_domain == 'sng.link' | ||
and strings.ilike(.href_url.query_params, "*fallback_redirect*") | ||
) | ||
) | ||
attack_types: | ||
- "Credential Phishing" | ||
- "Malware/Ransomware" | ||
tactics_and_techniques: | ||
- "Evasion" | ||
- "Image as content" | ||
- "Open redirect" | ||
- "Social engineering" | ||
detection_methods: | ||
- "Content analysis" | ||
- "HTML analysis" | ||
- "URL analysis" | ||
id: "f5cec36b-76ea-5cd6-958b-74f819d73a47" |
77 changes: 77 additions & 0 deletions
77
detection-rules/impersonation_recipient_domain_display_name.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: "Display name impersonation using recipient SLD (new sender)" | ||
description: | | ||
The recipient domain's SLD is used in the sender's display name | ||
in order to impersonate the organization. | ||
type: "rule" | ||
severity: "medium" | ||
source: | | ||
type.inbound | ||
and ( | ||
// recipient SLD is being impersonated in the subject + display name | ||
( | ||
// these are usually targeted with just 1 recipient, | ||
// but sometimes they CC themselves or have a blank CC | ||
length(recipients.to) + length(recipients.cc) + length(recipients.bcc) <= 2 | ||
and any(recipients.to, | ||
// ensure that we're checking the org SLD | ||
.email.domain.sld in $org_slds | ||
and strings.icontains(sender.display_name, .email.domain.sld) | ||
) | ||
) | ||
or ( | ||
// accounts for BCC'd messages where the recipients are empty | ||
// if BCC, sometimes the recipient will be the attacker's email | ||
length(recipients.to) + length(recipients.cc) + length(recipients.bcc) <= 2 | ||
and strings.icontains(sender.display_name, mailbox.email.domain.sld) | ||
) | ||
) | ||
and ( | ||
// at least 1 link or non-image attachment | ||
( | ||
length(body.links) > 0 | ||
// these attacks all use compromosed senders, so we look for a domain | ||
// that doesn't match the sender's domain to weed out legit messages | ||
and any(body.links, .href_url.domain.root_domain != sender.email.domain.root_domain) | ||
) | ||
or length(filter(attachments, .file_type not in $file_types_images)) > 0 | ||
) | ||
and not ( | ||
strings.contains(sender.display_name, "on behalf of") | ||
and sender.email.domain.root_domain == "microsoftonline.com" | ||
) | ||
and all(recipients.to, .email.email != sender.email.email) | ||
// negate highly trusted sender domains unless they fail DMARC authentication | ||
and ( | ||
( | ||
sender.email.domain.root_domain in $high_trust_sender_root_domains | ||
and ( | ||
any(distinct(headers.hops, .authentication_results.dmarc is not null), | ||
strings.ilike(.authentication_results.dmarc, "*fail") | ||
) | ||
) | ||
) | ||
or sender.email.domain.root_domain not in $high_trust_sender_root_domains | ||
) | ||
and ( | ||
( | ||
profile.by_sender().prevalence in ("new", "outlier") | ||
and not profile.by_sender().solicited | ||
) | ||
or ( | ||
profile.by_sender().any_messages_malicious_or_spam | ||
and not profile.by_sender().any_false_positives | ||
) | ||
) | ||
and not profile.by_sender().any_false_positives | ||
attack_types: | ||
- "Credential Phishing" | ||
tactics_and_techniques: | ||
- "Social engineering" | ||
detection_methods: | ||
- "Header analysis" | ||
- "Sender analysis" | ||
id: "81a8ed12-0e26-5998-90ae-03334f358704" |
79 changes: 79 additions & 0 deletions
79
detection-rules/impersonation_recipient_domain_display_name_subject.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: "Display name and subject impersonation using recipient SLD (new sender)" | ||
description: | | ||
The recipient domain's SLD is used in the sender's display name | ||
and in the subject to impersonate the organization. | ||
type: "rule" | ||
severity: "medium" | ||
source: | | ||
type.inbound | ||
and ( | ||
// recipient SLD is being impersonated in the subject + display name | ||
( | ||
// these are usually targeted with just 1 recipient, | ||
// but sometimes they CC themselves or have a blank CC | ||
length(recipients.to) + length(recipients.cc) + length(recipients.bcc) <= 2 | ||
and any(recipients.to, | ||
// ensure that we're checking the org SLD | ||
.email.domain.sld in $org_slds | ||
and strings.icontains(subject.subject, .email.domain.sld) | ||
and strings.icontains(sender.display_name, .email.domain.sld) | ||
) | ||
) | ||
or ( | ||
// accounts for BCC'd messages where the recipients are empty | ||
// if BCC, sometimes the recipient will be the attacker's email | ||
length(recipients.to) + length(recipients.cc) + length(recipients.bcc) <= 2 | ||
and strings.icontains(subject.subject, mailbox.email.domain.sld) | ||
and strings.icontains(sender.display_name, mailbox.email.domain.sld) | ||
) | ||
) | ||
and ( | ||
// at least 1 link or non-image attachment | ||
( | ||
length(body.links) > 0 | ||
// these attacks all use compromosed senders, so we look for a domain | ||
// that doesn't match the sender's domain to weed out legit messages | ||
and any(body.links, .href_url.domain.root_domain != sender.email.domain.root_domain) | ||
) | ||
or length(filter(attachments, .file_type not in $file_types_images)) > 0 | ||
) | ||
and not ( | ||
strings.contains(sender.display_name, "on behalf of") | ||
and sender.email.domain.root_domain == "microsoftonline.com" | ||
) | ||
and all(recipients.to, .email.email != sender.email.email) | ||
// negate highly trusted sender domains unless they fail DMARC authentication | ||
and ( | ||
( | ||
sender.email.domain.root_domain in $high_trust_sender_root_domains | ||
and ( | ||
any(distinct(headers.hops, .authentication_results.dmarc is not null), | ||
strings.ilike(.authentication_results.dmarc, "*fail") | ||
) | ||
) | ||
) | ||
or sender.email.domain.root_domain not in $high_trust_sender_root_domains | ||
) | ||
and ( | ||
( | ||
profile.by_sender().prevalence in ("new", "outlier") | ||
and not profile.by_sender().solicited | ||
) | ||
or ( | ||
profile.by_sender().any_messages_malicious_or_spam | ||
and not profile.by_sender().any_false_positives | ||
) | ||
) | ||
and not profile.by_sender().any_false_positives | ||
attack_types: | ||
- "Credential Phishing" | ||
tactics_and_techniques: | ||
- "Social engineering" | ||
detection_methods: | ||
- "Header analysis" | ||
- "Sender analysis" | ||
id: "cb2b3ed3-268f-5753-9d2b-194d2ee1ed2e" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: "Recipient email in attachment link" | ||
type: "query" | ||
source: | | ||
filter( | ||
map(attachments, | ||
map(file.explode(.), | ||
distinct(map(filter(.scan.url.urls, any(recipients.to, strings.icontains(..url, .email.email))), .url), .) | ||
) | ||
), | ||
length(.) > 0 | ||
) | ||
severity: "medium" |