-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve detection of cipherbcryptors (#519)
- Loading branch information
1 parent
537e8e4
commit a1ec05e
Showing
4 changed files
with
65 additions
and
2 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
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,40 @@ | ||
rule cipher_exfil : high { | ||
meta: | ||
description = "may exfiltrate base64-encoded zlib content" | ||
ref = "https://checkmarx.com/blog/crypto-stealing-code-lurking-in-python-package-dependencies/" | ||
filetypes = "py" | ||
strings: | ||
$s_zlib = "zlib" fullword | ||
$s_compress = "compress" fullword | ||
$s_b64encode = "b64encode" | ||
$s_json = "json" fullword | ||
$s_dumps = "dumps" fullword | ||
$s_map_chr = "chr" fullword | ||
$http = "http.client" | ||
$h_requests = "requests" | ||
condition: | ||
filesize < 8KB and all of ($s*) and any of ($h*) | ||
} | ||
|
||
rule cipher_exfil2 : high { | ||
meta: | ||
description = "may exfiltrate base64-encoded zlib content" | ||
ref = "https://checkmarx.com/blog/crypto-stealing-code-lurking-in-python-package-dependencies/" | ||
filetypes = "py" | ||
strings: | ||
$s_zlib = "zlib" fullword | ||
$s_compress = "compress" fullword | ||
$s_b64encode = "b64encode" | ||
$s_b64decode = "b64decode" | ||
$s_json = "json" fullword | ||
$s_dumps = "dumps" fullword | ||
$s_map_chr = "chr" fullword | ||
$s_getlogin = "getlogin" fullword | ||
$s_decode = "decode" fullword | ||
$http = "http" | ||
$h_requests = "requests" | ||
condition: | ||
filesize < 8KB and 85% of ($s*) and any of ($h*) | ||
} |
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,10 @@ | ||
rule join_map_chr : high { | ||
meta: | ||
description = "assembles strings from character code constants" | ||
ref = "https://checkmarx.com/blog/crypto-stealing-code-lurking-in-python-package-dependencies/" | ||
filetypes = "py" | ||
strings: | ||
$ref = /join\(map\(chr,\[\d{1,3},\d{1,3},[\d\,]{1,32}/ | ||
condition: | ||
filesize < 8KB and $ref | ||
} |