Skip to content

Commit 709e42e

Browse files
authored
convert to subject.base /subject.is_reply/subject.is_forward (#3470)
1 parent cb566b4 commit 709e42e

File tree

5 files changed

+24
-31
lines changed

5 files changed

+24
-31
lines changed

detection-rules/body_job_scam_freemail_pivot.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ source: |
1414
or
1515

1616
// HTML is not null but fake thread
17-
(
18-
strings.istarts_with(subject.subject, "RE:")
19-
or strings.istarts_with(subject.subject, "FWD:")
20-
)
17+
(subject.is_reply or subject.is_forward)
2118
and (
2219
(length(headers.references) == 0 and headers.in_reply_to is null)
2320
or not any(headers.hops, any(.fields, strings.ilike(.name, "In-Reply-To")))

detection-rules/impersonation_google_groups_suspicious.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ source: |
4444

4545
// fake thread
4646
(
47-
regex.imatch(subject.subject, "(re|fw(d)?):.*")
47+
(subject.is_forward or subject.is_reply)
4848
and (
4949
(length(headers.references) == 0 and headers.in_reply_to is null)
5050
or not any(headers.hops,

detection-rules/link_fake_thread_nlu_financial_request.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ source: |
77
and length(body.links) < 10
88

99
// fake thread check
10-
and (
11-
strings.istarts_with(subject.subject, "RE:")
12-
or strings.istarts_with(subject.subject, "FWD:")
13-
)
10+
and (subject.is_reply or subject.is_forward)
1411

1512
// Check for the Presence of References or In-Reply-To properties
1613
and (

detection-rules/spam_google_group_explict_invite.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ source: |
99
//
1010
and sender.email.email == "noreply@groups.google.com"
1111
and (
12-
strings.istarts_with(subject.subject, 'Invitation to join ')
13-
or strings.istarts_with(subject.subject, 'You have been added to ')
12+
strings.istarts_with(subject.base, 'Invitation to join ')
13+
or strings.istarts_with(subject.base, 'You have been added to ')
1414
// the group name contains sexually explicit keywords
1515
// this regex should be kept in sync between the Google Group, Google Drive Share, and Looker Studio rules
16-
or regex.icontains(subject.subject,
16+
or regex.icontains(subject.base,
1717
'(?:Invitation to join|You have been added to) .*(?:sex|horny|cock|fuck|\bass\b|pussy|dick|tits|cum|girlfriend|boyfriend|naked|porn|video|webcam|masturbate|orgasm|breasts|penis|vagina|strip|suck|blowjob|hardcore|xxx|nudes?|sexting|cheating|affair|erotic|\blust\b|desire|intimate|explicit|fetish|kinky|seduce|adult community|cam shows|local (?:girls?|women|single)|hook.?up|bed partner)'
1818
)
1919
)
@@ -31,15 +31,15 @@ source: |
3131
)
3232
and (
3333
// the group name contains 7 char sets at the start and end and must contain a number
34-
regex.icontains(subject.subject,
34+
regex.icontains(subject.base,
3535
'(?:added to|to join) [A-Z0-9]{5,7} .*(?:[[:^ascii:]]|[[:^alpha:]]) [A-Z0-9]{5,7}$'
3636
)
3737
// calls to action in the group name
38-
or regex.icontains(subject.subject,
38+
or regex.icontains(subject.base,
3939
'(?:added to|to join) .*(join|(?:click|go|tap) here)'
4040
)
4141
// it contains an emoji in the group name
42-
or regex.icontains(subject.subject,
42+
or regex.icontains(subject.base,
4343
'(?:added to|to join) .*[\x{1F300}-\x{1F5FF}\x{1F600}-\x{1F64F}\x{1F680}-\x{1F6FF}\x{1F700}-\x{1F77F}\x{1F780}-\x{1F7FF}\x{1F900}-\x{1F9FF}\x{2600}-\x{26FF}\x{2700}-\x{27BF}\x{2300}-\x{23FF}]'
4444
)
4545
// the description of the group contains sexually explicit keywords

detection-rules/vip_impersonation_charity.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ type: "rule"
44
severity: "high"
55
source: |
66
type.inbound
7-
and strings.ilike(body.current_thread.text, "*charity*", "*gala*", "*donation*", "*donor*")
7+
and strings.ilike(body.current_thread.text,
8+
"*charity*",
9+
"*gala*",
10+
"*donation*",
11+
"*donor*"
12+
)
813
and any(ml.nlu_classifier(body.current_thread.text).entities,
914
.name == "financial"
1015
)
@@ -17,11 +22,7 @@ source: |
1722
)
1823
and (
1924
(
20-
(
21-
strings.istarts_with(subject.subject, "RE:")
22-
or strings.istarts_with(subject.subject, "FW:")
23-
or strings.istarts_with(subject.subject, "FWD:")
24-
)
25+
(subject.is_forward or subject.is_reply)
2526
and (
2627
(length(headers.references) == 0 and headers.in_reply_to is null)
2728
or not any(headers.hops,
@@ -32,17 +33,15 @@ source: |
3233
// fake thread, but no indication in the subject line
3334
// current_thread pulls the recent thread, but the full body contains the fake "original" email
3435
or (
35-
not (
36-
(
37-
strings.istarts_with(subject.subject, "RE:")
38-
or strings.istarts_with(subject.subject, "FWD:")
36+
not ((subject.is_forward or subject.is_reply))
37+
and (
38+
3 of (
39+
strings.icontains(body.html.display_text, "from:"),
40+
strings.icontains(body.html.display_text, "to:"),
41+
strings.icontains(body.html.display_text, "sent:"),
42+
strings.icontains(body.html.display_text, "subject:")
3943
)
40-
)
41-
and 3 of (
42-
strings.icontains(body.html.display_text, "from:"),
43-
strings.icontains(body.html.display_text, "to:"),
44-
strings.icontains(body.html.display_text, "sent:"),
45-
strings.icontains(body.html.display_text, "subject:")
44+
or length(body.previous_threads) > 0
4645
)
4746
and (
4847
length(body.current_thread.text) + 100 < length(body.html.display_text)

0 commit comments

Comments
 (0)