静的殺害
機能書かれたルールベースの抽出、ルールベースの殺害を呼び出します。ルールベースは、より速くなりますが、漏れは、偽陽性がより明白になり、一般的なウェブシェル単語トロイの木馬の変形をより混乱になります。
yara规则
$eval = /(<\?php|[;{}])[ \t]*@?(eval|preg_replace|system|assert|passthru|(pcntl_)?exec|shell_exec|call_user_func(_array)?)\s*\(/ nocase // ;eval( <- this is dodgy
$eval_comment = /(eval|preg_replace|system|assert|passthru|(pcntl_)?exec|shell_exec|call_user_func(_array)?)\/\*[^\*]*\*\/\(/ nocase // eval/*lol*/( <- this is dodgy
$b374k = "'ev'.'al'"
$align = /(\$\w+=[^;]*)*;\$\w+=@?\$\w+\(/ //b374k
$weevely3 = /\$\w=\$[a-zA-Z]\('',\$\w\);\$\w\(\);/ // weevely3 launcher
$c99_launcher = /;\$\w+\(\$\w+(,\s?\$\w+)+\);/ // http://bartblaze.blogspot.fr/2015/03/c99shell-not-dead.html
$nano = /\$[a-z0-9-_]+\[[^]]+\]\(/ //https://github.com/UltimateHackers/nano
$ninja = /base64_decode[^;]+getallheaders/ //https://github.com/UltimateHackers/nano
$variable_variable = /\${\$[0-9a-zA-z]+}/
$too_many_chr = /(chr\([\d]+\)\.){8}/ // concatenation of more than eight `chr()`
$concat = /(\$[^\n\r]+\.){5}/ // concatenation of more than 5 words
$concat_with_spaces = /(\$[^\n\r]+\. ){5}/ // concatenation of more than 5 words, with spaces
$var_as_func = /\$_(GET|POST|COOKIE|REQUEST|SERVER)\s*\[[^\]]+\]\s*\(/
$comment = /\/\*([^*]|\*[^\/])*\*\/\s*\(/ // eval /* comment */ (php_code)
ログ分析
ログデータの分析に基づいて、疑わしい動作を検出するために、時間の抽出、特定の期間のアプリケーションの動作に固有のIPアクセスを利用します。
①提交数据(POST/GET)的熵
②URI的访问频率
③请求头中有/无Referer字段
④提交数据(POST/GET)中key的出现频率
⑤请求数据(POST/GET)中key关联的页面数
モーション検知
不審な分析ウェブシェル検出層、フック関数
フィーチャー寸法:
- セマンティックテキスト(nグラム/ TF-IDF / word2vec / CNN / RNN)
- 統計的特性(エントロピー/一致指数/長大語/圧縮比)
- ヒストリカルデータ機能(「距離」オフ時間の権限やその他のファイルを持つ単一のファイル/ファイルの作成プロセス/ファイルタイプ/コードスタイル/ディレクトリを計算します)
- OPのLAYERコマンド(コマンド/コールチェーン/テキスト特徴パラメータ)
- 動的特性(ドキュメントリーダ/ネットワーク接続は、実行またはサンドボックス解決混乱ベースの符号化の場合バイパスする能力に依存してもよいです)
テキストベースのファイル属性
- ファイルの作成時刻
- ファイルの修正時刻
- ファイルのパーミッションファイル
- ファイルのファイルの所有者
統計
- coincidencの一致インデックスファイルのインデックス(IC)
- 情報エントロピーファイル
- ファイルの中で最も長い単語
- より、圧縮ファイル
プロジェクト
https://github.com/nbs-system/php-malware-finder
https://github.com/404notf0und/AI-for-Security-Learning
参照
[1] https://www.cdxy.me/?p=788
[2] http://www.cnetsec.com/article/22593.html
[3] https://www.s0nnet.com/archives/ fshell-機能-1