Skip to content

Commit 648b547

Browse files
authored
Reduce false positives/increase signal for various languages, tools, and packages (#838)
* Reduce false positives/increase signal for various languages, tools, and packages Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Fix false positive for jitsu package Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Address PR comments Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Address psutil test_windows.py false positive Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Run make yara-x-fmt Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> --------- Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
1 parent 19734a7 commit 648b547

File tree

11 files changed

+76
-11
lines changed

11 files changed

+76
-11
lines changed

pkg/compile/compile.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ var badRules = map[string]bool{
3636
"SECUINFRA_SUSP_Powershell_Base64_Decode": true,
3737
"SIGNATURE_BASE_SUSP_ELF_LNX_UPX_Compressed_File": true,
3838
"DELIVRTO_SUSP_SVG_Foreignobject_Nov24": true,
39+
"CAPE_Eternalromance": true,
3940
// ThreatHunting Keywords (some duplicates)
4041
"Adobe_XMP_Identifier": true,
4142
"Antivirus_Signature_signature_keyword": true,

rules/anti-behavior/blocklist/user.yara

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ rule common_username_block_list: critical {
3737
$ = "test" fullword
3838
$ = "w0fjuOVmCcP5A" fullword
3939
40+
$not_jitsu = "jitsu.com"
4041
$not_redpanda = "redpanda"
4142
$not_wireshark = "wireshark.org"
4243

rules/anti-static/base64/obfuscated_caller.yara

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ rule obfuscated_caller_base64_str_replace: critical {
1414
$i = "'b'.'ase'.'6'.'4"
1515
$j = "'bas'.'e'.'6'.'4"
1616
17+
$not_unrelated1 = "_bias_eb604"
18+
1719
condition:
18-
any of them
20+
any of them and none of ($not*)
1921
}

rules/anti-static/obfuscation/python.yara

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import "hash"
2+
13
private rule probably_python {
24
strings:
35
$import = "import "
@@ -349,6 +351,10 @@ rule rename_base64: critical {
349351
strings:
350352
$ref = /import base64 as \w{0,64}/
351353
354+
$not_numcodecs1 = "Codec providing base64 compression via the Python standard library."
355+
$not_numcodecs2 = "codec_id = \"base64\""
356+
$not_numcodecs3 = "# normalise inputs"
357+
$not_numcodecs4 = "# do compression"
352358
$not_open_clip1 = "class ResampledShards2(IterableDataset)"
353359
$not_open_clip2 = "class SyntheticDataset(Dataset)"
354360
@@ -494,7 +500,9 @@ rule import_manipulator: critical {
494500
$def = "def "
495501
496502
condition:
497-
filesize < 10MB and all of them
503+
// a91160135598f3decc8ca9f9b019dcc5e1d73e79ebe639548cd9ee9e6d007ea6 is the sha256 hash
504+
// for https://github.com/pypy/pypy/blob/main/lib-python/2.7/pickle.py
505+
filesize < 10MB and (hash.sha256(0, filesize) != "a91160135598f3decc8ca9f9b019dcc5e1d73e79ebe639548cd9ee9e6d007ea6") and all of them
498506
}
499507

500508
rule bloated_hex_python: high {
@@ -518,5 +526,4 @@ rule bloated_hex_python: high {
518526
519527
condition:
520528
filesize > 512KB and filesize < 10MB and 90 % of ($f*) and none of ($not*)
521-
522529
}

rules/evasion/mimicry/fake-process.yara

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ rule fake_kworker: critical linux {
33
description = "Pretends to be a kworker kernel thread"
44

55
strings:
6-
$kworker = /\[{0,1}kworker\/[\w\%:\-\]]{1,16}/
7-
$kworker3 = "[kworker"
6+
$kworker1 = /\[{0,1}kworker\/[\w\%:\-\]]{1,16}/
7+
$kworker2 = "[kworker"
8+
9+
$not_rescue = "kworker/R-%s"
810
911
condition:
10-
filesize < 100MB and any of ($k*)
12+
filesize < 100MB and any of ($kworker*) and none of ($not*)
1113
}
1214

1315
rule kworker: medium linux {

rules/exfil/stealer/wallet.yara

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ rule crypto_stealer_names: critical {
3030
$not_js = /\"js\": \{[^}]{0,64}/
3131
$not_scriptsrc = /\"scriptSrc\": "([^"]{0,64})"/
3232
$not_website = /\"website\": "([^"]{0,64})"/
33+
$not_clef1 = "These data types are defined in the channel between clef and the UILedger"
34+
$not_clef2 = "The `transaction` (on input into clef) can have either `data` or `input`"
35+
$not_geth_site = "https://geth.ethereum.org"
3336
3437
condition:
3538
filesize < 100MB and $http and 2 of ($w*) and none of ($not*)

rules/false_positives/gitlab.yara

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
rule exec_regex: override {
2+
meta:
3+
description = "csv_builder_spec.rb"
4+
SEKOIA_Technique_Csv_Dde_Exec_Regex = "low"
5+
6+
strings:
7+
$example1 = "shared_examples 'excel sanitization' do"
8+
$example2 = "'sanitizes dangerous characters at the beginning of a column'"
9+
$example3 = "'does not sanitize safe symbols at the beginning of a column'"
10+
$example4 = "'when dangerous characters are after a line break'"
11+
$example5 = "'does not append single quote to description'"
12+
13+
condition:
14+
filesize < 8192 and all of them
15+
}

rules/false_positives/nmap.yara

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,16 @@ rule nmap_fingerprints: override {
1313
condition:
1414
filesize < 512KB and $description and $license and #fingerprint > 0
1515
}
16+
17+
rule nping_bin: override {
18+
meta:
19+
description = "/usr/bin/nping"
20+
SEKOIA_Tool_Nping_Strings = "medium"
21+
22+
strings:
23+
$nping = "Usage: nping [Probe mode] [Options] {target specification}"
24+
$site = "https://nmap.org/nping"
25+
26+
condition:
27+
filesize < 1MB and all of them
28+
}

rules/false_positives/psutil.yara

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
rule test_windows: override {
2+
meta:
3+
description = "test_windows.py"
4+
SIGNATURE_BASE_Powershell_Susp_Parameter_Combo = "low"
5+
6+
strings:
7+
$cext = "cext = psutil._psplatform.cext"
8+
$class = "class WindowsTestCase(PsutilTestCase)"
9+
$comment1 = "\"\"\"Windows specific tests.\"\"\""
10+
$comment2 = "\"\"\"Currently not used, but available just in case. Usage:"
11+
$comment3 = ">>> powershell("
12+
$comment4 = "Get-CIMInstance Win32_PageFileUsage | Select AllocatedBaseSize\")"
13+
$import = "import psutil"
14+
15+
condition:
16+
filesize < 40KB and all of them
17+
}

rules/impact/remote_access/py_setuptools.yara

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ rule setuptools_exec: medium {
106106
strings:
107107
$f_exec = /exec\([\"\'\/\w\,\.\ \-\)\(]{1,64}\)/ fullword
108108
109+
$not_hopper = "with open(\" hopper /__version__.py\") as fp:"
110+
109111
condition:
110-
remote_access_pythonSetup and any of ($f*)
112+
remote_access_pythonSetup and any of ($f*) and none of ($not*)
111113
}
112114

113115
rule setuptools_exec_high: high {

0 commit comments

Comments
 (0)