Skip to content

Commit 7d28a97

Browse files
authored
2025/08/04 false positive reduction (#1072)
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
1 parent 4a891f0 commit 7d28a97

File tree

22 files changed

+152
-57
lines changed

22 files changed

+152
-57
lines changed

pkg/compile/compile.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ var badRules = map[string]bool{
3838
"DELIVRTO_SUSP_SVG_Foreignobject_Nov24": true,
3939
"CAPE_Eternalromance": true,
4040
"CAPE_Formhookb": true,
41+
"TELEKOM_SECURITY_Cn_Utf8_Windows_Terminal": true,
4142
// ThreatHunting Keywords (some duplicates)
4243
"Adobe_XMP_Identifier": true,
4344
"Antivirus_Signature_signature_keyword": true,
@@ -72,7 +73,8 @@ var badRules = map[string]bool{
7273
"malware_PlugX_config": true,
7374
"malware_shellcode_hash": true,
7475
// bartblaze
75-
"Rclone": true,
76+
"Rclone": true,
77+
"Extract_MachineKey_SharePoint": true,
7678
// Rules that are incompatible with yara-x (unescaped braces in regex strings)
7779
"RTF_Header_Obfuscation": true,
7880
"RTF_File_Malformed_Header": true,

pkg/report/report.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,8 +821,7 @@ func handleOverrides(original, override []*malcontent.Behavior, minScore int, sc
821821
// append every behavior so we can handle filtering correctly
822822
if scan && quantityIncreasesRisk && b.RiskScore >= HIGH {
823823
modified = append(modified, b)
824-
}
825-
if b.RiskScore >= minScore {
824+
} else if !scan && b.RiskScore >= minScore {
826825
modified = append(modified, b)
827826
}
828827
}

rules/anti-behavior/blocklist/user.yara

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ rule common_username_block_list: high {
3737
$ = "test" fullword
3838
$ = "w0fjuOVmCcP5A" fullword
3939
40+
$not_gpt_tokenizer1 = "GPTTokenizer"
41+
$not_gpt_tokenizer2 = "GPT-4"
42+
$not_gpt_tokenizer3 = "const bpe = c0.concat();"
43+
$not_gpt_tokenizer4 = "const bpe = c0.concat(c1);"
44+
$not_gpt_tokenizer5 = "export default bpe;"
45+
$not_vale = "github.com/errata-ai/vale"
46+
4047
condition:
41-
12 of them
48+
12 of them and none of ($not*)
4249
}

rules/anti-static/obfuscation/bitwise.yara

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ rule unsigned_bitwise_math_excess: high {
138138
$left = /[a-z]\>\>\>\d{1,3}/
139139
$right = /[a-z]\>\>\>\d{1,3}/
140140
141-
$not_webpack = "webpack-api-runtime.js" fullword
141+
$not_elastic1 = "/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements."
142+
$not_elastic2 = "* Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */"
143+
$not_webpack = "webpack-api-runtime.js" fullword
142144
143145
condition:
144146
filesize < 5MB and $function and $charAt and (#left > 50 or #right > 50) and none of ($not*)

rules/c2/addr/ip.yara

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ rule http_hardcoded_ip: high exfil {
5656
description = "hardcoded IP address within a URL"
5757

5858
strings:
59-
$ipv4 = /https*:\/\/([1-9][0-9]{1,2}\.){3}[1-9][0-9]{1,2}[:\/\w\-\?\.\=]{0,64}/
60-
$not_metadata = "http://169.254.169.254"
61-
$not_100 = "http://100.100.100"
62-
$not_11 = "http://11.11.11"
63-
$not_192 = "http://192.168"
64-
$not_169 = "http://169.254"
65-
$not_aria = "http://210.104.33.10/ARIA/"
59+
$ipv4 = /https*:\/\/([1-9][0-9]{1,2}\.){3}[1-9][0-9]{1,2}[:\/\w\-\?\.\=]{0,64}/
60+
$not_metadata = "http://169.254.169.254"
61+
$not_100 = "http://100.100.100"
62+
$not_11 = "http://11.11.11"
63+
$not_192 = "http://192.168"
64+
$not_169 = "http://169.254"
65+
$not_aria = "http://210.104.33.10/ARIA/"
66+
$not_placeholder1 = "placeholder:\"e.g. https://192.168.99.200:443/api\""
67+
$not_placeholder2 = "placeholder:\"e.g. http://138.68.74.142:7860\""
6668
6769
condition:
6870
$ipv4 and none of ($not*)

rules/evasion/file/location/dev-shm.yara

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ rule dev_shm_file: high linux {
4040
$not_yarn3 = "@yarnpkg"
4141
$not_yarn4 = "YARN_"
4242
$not_yarn5 = "b.mkdir(\"/dev/shm/tmp\")"
43+
$not_libheif = "EA.mkdir(\"/dev/shm\"),EA.mkdir(\"/dev/shm/tmp\")"
4344
4445
condition:
4546
$ref and none of ($not*) and not dev_shm_mkstemp

rules/evasion/mimicry/fake-process.yara

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ rule fake_bash: high {
4646
strings:
4747
$bash = "-bash" fullword
4848
49+
$not_kong_template = "name: {{ template \"kong.fullname\" . }}-bash-wait-for-postgres"
50+
4951
condition:
50-
filesize < 8KB and $bash
52+
filesize < 8KB and $bash and none of ($not*)
5153
}
5254

5355
rule fake_systemd: critical linux {

rules/evasion/rootkit/userspace.yara

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ rule readdir_dlsym_interceptor: high {
5858
$f_readlink_maybe_not_needed = "readlink"
5959
$f_proc = "/proc"
6060
61+
$not_j9 = "j9port_" fullword
6162
$not_sbcl = "SBCL_HOME" fullword
6263
6364
condition:

rules/exec/remote_commands/code_eval.yara

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ rule js_eval_obfuscated_fromChar: high {
7575
$eval = /[\s\{]eval\(/
7676
$ref = /fromCharCode\(\w{0,16}\s{0,2}[\-\+\*\^]{0,2}\w{0,16}/
7777
78+
$not_elastic1 = "/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements."
79+
$not_elastic2 = "* Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */"
80+
7881
condition:
79-
filesize < 5MB and all of them and math.abs(@eval - @ref) > 384
82+
filesize < 5MB and all of them and math.abs(@eval - @ref) > 384 and none of ($not*)
8083
}
8184

8285
rule js_anonymous_function: medium {

rules/exfil/stealer/creds.yara

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,39 @@ rule suspected_data_stealer: high {
33
description = "suspected data stealer"
44

55
strings:
6-
$e_atomic = "Atomic" fullword
7-
$e_bitcoin = "Bitcoin" fullword
8-
$e_chromium = "Chromium"
9-
$e_chrome = "Chrome" fullword
10-
$e_firefox = "Firefox"
11-
$e_openvpn = "OpenVPN"
12-
$s_bookmarks = "Bookmarks"
13-
$s_history = "History"
14-
$s_binance = "Binance"
15-
$s_discord = "Discord"
16-
$s_electrum = "Electrum"
17-
$s_electrum2 = "/.elect"
18-
$s_exodus = "Exodus"
19-
$s_exodus_ext = "aholpfdial"
20-
$s_crypto = "cfgodnhcel"
21-
$s_obs = "obs-studio"
22-
$s_pidgin = "Pidgin"
23-
$s_snowflake = "Snowflake"
24-
$s_telegram = "Telegram"
25-
$s_zcash = "Zcash"
26-
$s_zip = "zip -r"
27-
$s_login = "Login Data"
28-
$not_electron = "ELECTRON_RUN_AS_NODE"
29-
$not_chromium = "RasterCHROMIUM"
30-
$not_descriptive = "Binance Pay is a contactless"
6+
$e_atomic = "Atomic" fullword
7+
$e_bitcoin = "Bitcoin" fullword
8+
$e_chromium = "Chromium"
9+
$e_chrome = "Chrome" fullword
10+
$e_firefox = "Firefox"
11+
$e_openvpn = "OpenVPN"
12+
$s_bookmarks = "Bookmarks"
13+
$s_history = "History"
14+
$s_binance = "Binance"
15+
$s_discord = "Discord"
16+
$s_electrum = "Electrum"
17+
$s_electrum2 = "/.elect"
18+
$s_exodus = "Exodus"
19+
$s_exodus_ext = "aholpfdial"
20+
$s_crypto = "cfgodnhcel"
21+
$s_obs = "obs-studio"
22+
$s_pidgin = "Pidgin"
23+
$s_snowflake = "Snowflake"
24+
$s_telegram = "Telegram"
25+
$s_zcash = "Zcash"
26+
$s_zip = "zip -r"
27+
$s_login = "Login Data"
28+
$not_chromium = "RasterCHROMIUM"
29+
$not_descriptive = "Binance Pay is a contactless"
30+
$not_electron = "ELECTRON_RUN_AS_NODE"
31+
$not_gpt_tokenizer1 = "GPTTokenizer"
32+
$not_gpt_tokenizer2 = "GPT-4"
33+
$not_gpt_tokenizer3 = "const bpe = c0.concat();"
34+
$not_gpt_tokenizer4 = "const bpe = c0.concat(c1);"
35+
$not_gpt_tokenizer5 = "export default bpe;"
3136
3237
condition:
33-
(8 of them and none of ($not*)) or 5 of ($s*)
38+
(8 of them or 5 of ($s*)) and none of ($not*)
3439
}
3540

3641
rule steal_creds: high {

0 commit comments

Comments
 (0)