Skip to content

Commit 54af234

Browse files
[PR sublime-security#3747] added rule: Link: Suspicious URL with recipient targeting and special characters
1 parent 9b089b4 commit 54af234

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "Link: Suspicious URL with recipient targeting and special characters"
2+
description: "Detects messages containing links with special characters in the path that include the recipient's email address in either the URL path or fragment, potentially encoded in base64. The URLs have a simple path structure and may end with suspicious patterns."
3+
type: "rule"
4+
severity: "high"
5+
source: |
6+
type.inbound
7+
and length(recipients.to) == 1
8+
and recipients.to[0].email.domain.valid
9+
and any(body.current_thread.links,
10+
// a single path
11+
strings.count(.href_url.path, '/') == 2
12+
// special chars
13+
and (
14+
strings.icontains(.href_url.path, '/$')
15+
or strings.icontains(.href_url.path, '/*')
16+
or strings.icontains(.href_url.url, '/#')
17+
)
18+
// and not where the # is within a directory structure
19+
// which is followed by url query params (the ? or = )
20+
// had some fps based on an unsual use of this char within paths where url query param
21+
and not regex.icontains(.href_url.url, '\/[^\/]*#[^\/]*\/[^$]*\?', )
22+
23+
// also not where it's #! or #, which causes the fragment to start with punctuation unless that puncutation is a ?
24+
// we use coalesce to account for where there is no fragment and the regex.icontains returns null
25+
and not coalesce(regex.icontains(.href_url.fragment, '^[!,]'), false)
26+
27+
// recipient email in url or path
28+
and (
29+
strings.icontains(.href_url.path, recipients.to[0].email.email)
30+
or any(strings.scan_base64(.href_url.url,
31+
ignore_padding=true,
32+
format="url"
33+
),
34+
strings.icontains(., recipients.to[0].email.email)
35+
)
36+
)
37+
)
38+
attack_types:
39+
- "Credential Phishing"
40+
tactics_and_techniques:
41+
- "Social engineering"
42+
- "Evasion"
43+
detection_methods:
44+
- "URL analysis"
45+
- "Content analysis"
46+
id: "35c17ab0-86d1-5235-8bef-1eff9010e139"
47+
og_id: "e808be3a-e00c-5565-87f7-d0ca0411650d"
48+
testing_pr: 3747
49+
testing_sha: 1a6d783968c36bc8ef7c2ce3179d7cc833bade65

0 commit comments

Comments
 (0)