-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from tstromberg/main
Improve PHP/Python/NodeJS rules through BSKC analysis
- Loading branch information
Showing
41 changed files
with
314 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
rule shutdown_s : suspicious { | ||
meta: | ||
description = "calls shutdown command" | ||
strings: | ||
$ref = /shutdown -[\w ]{0,16}/ | ||
$ref2 = "shutdown now" | ||
condition: | ||
any of them | ||
} |
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
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,8 @@ | ||
rule ruby_eval_base64_decode : critical { | ||
meta: | ||
description = "Evaluates base64 content" | ||
strings: | ||
$eval_base64_decode = "eval(Base64." | ||
condition: | ||
any of them | ||
} |
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,9 @@ | ||
rule sudo_nohup : suspicious { | ||
meta: | ||
description = "calls nohup sudo" | ||
strings: | ||
$nohup_sudo = /nohup sudo[ \.\/\w]{0,32}/ | ||
$sudo_nohup = /sudo nohup[ \.\/\w]{0,32}/ | ||
condition: | ||
any of them | ||
} |
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,9 @@ | ||
rule timeout_eval : critical { | ||
meta: | ||
description = "evaluate code dynamically using eval() after timeout" | ||
strings: | ||
$ref = /setTimeout\(.{0,64}eval\([\w\(\,\)\;\*\}]{0,32}/ fullword | ||
condition: | ||
any of them | ||
} | ||
|
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,15 @@ | ||
|
||
rule npm_sysinfoexfil : suspicious { | ||
meta: | ||
description = "exfiltrate system information" | ||
strings: | ||
$p1 = "process.platform" | ||
$p2 = "process.arch" | ||
$p3 = "process.versions" | ||
$h = "http.request" | ||
$post = "POST" | ||
condition: | ||
$h and $post and any of ($p*) | ||
} |
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,15 @@ | ||
|
||
rule python_sysinfo_http : suspicious { | ||
meta: | ||
description = "exfiltrate system information" | ||
strings: | ||
$r_user = "getpass.getuser" | ||
$r_hostname = "socket.gethostname" | ||
$r_platform = "platform.platform" | ||
$u = /[\w\.]{0,16}urlopen/ | ||
condition: | ||
filesize < 4096 and any of ($r*) and any of ($u*) | ||
} | ||
|
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 testing_key { | ||
meta: | ||
description = "Contains TESTING KEY directive" | ||
strings: | ||
$ref = "TESTING KEY-----" | ||
condition: | ||
any of them | ||
} | ||
|
||
|
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
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,28 @@ | ||
rule LANG_getenv { | ||
meta: | ||
description = "Looks up language of current user" | ||
strings: | ||
$ref = "LANG" fullword | ||
$getenv = "getenv" | ||
condition: | ||
all of them | ||
} | ||
|
||
rule LANG_node { | ||
meta: | ||
description = "Looks up language of current user" | ||
strings: | ||
$ref = "env.LANG" fullword | ||
condition: | ||
all of them | ||
} | ||
|
||
|
||
rule dollar_LANG { | ||
meta: | ||
description = "Looks up language of current user" | ||
strings: | ||
$ref = "$LANG" fullword | ||
condition: | ||
all of them | ||
} |
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,8 @@ | ||
rule os_environ : harmless { | ||
meta: | ||
description = "Dump values from the environment" | ||
strings: | ||
$ref = "os.environ" fullword | ||
condition: | ||
any of them | ||
} |
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,9 @@ | ||
|
||
rule node_hex_parse : suspicious { | ||
meta: | ||
description = "converts hex data to ASCII" | ||
strings: | ||
$ref = /Buffer\.from\(\w{0,16}, {0,2}'hex'\)/ | ||
condition: | ||
$ref | ||
} |
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
Oops, something went wrong.