오늘 웹쉘 탐지와 관련하여 흥미로운 툴을 봐서 기록에 남깁니다. 웹쉘 탐지와 관련해서 국내에도 많은 솔루션이 나와 있는데 이 툴 또한 꽤나 퍼포먼스도 좋고 잘 탐지하는거 같습니다.
무엇보다 obfuscated 된 파일에 대해서도 탐지를 할 수 있다는 점이 신선하네요. 탐지 방법은 엔트로피를 이용하여 통계적인 방법을 이용해 탐지하는 것으로 보입니다.
다운로드 : https://github.com/Neohapsis/NeoPI
간단하게 제 리눅스 서버에 몇가지 웹쉘을 올려놓고 돌려봤는데 잘 탐지를 하네요.
[root@ByJJoon Neohapsis-NeoPI-1167c8e]# python2.7 neopi.py --h
Usage: neopi.py [options] <start directory> <OPTIONAL: filename regex>
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-c FILECSV, --csv=FILECSV
generate CSV outfile
-a, --all Run all (useful) tests [Entropy, Longest Word, IC,
Signature]
-z, --zlib Run compression Test
-e, --entropy Run entropy Test
-l, --longestword Run longest word test
-i, --ic Run IC test
-s, --signature Run signature test
-A, --auto Run auto file extension tests
[root@ByJJoon Neohapsis-NeoPI-1167c8e]# python2.7 neopi.py -a -A /var/www/html/
[[ Average IC for Search ]]
0.0224645152241
[[ Top 10 lowest IC files ]]
0.0205 /var/www/html/We35he11/r57.txt
0.0251 /var/www/html/We35he11/bot1.txt
0.0292 /var/www/html/We35he11/c99.txt
0.0381 /var/www/html/We35he11/spread.txt
0.0386 /var/www/html/irc/client-perl.cgi
0.0412 /var/www/html/We35he11/cmd.txt
0.0425 /var/www/html/irc/docs/decode.pl
0.0484 /var/www/html/We35he11/ce.pl
0.0542 /var/www/html/shellcode2exe/index.php
0.0542 /var/www/html/shellcode2exe/shellcode_2_exe.php
[[ Top 10 entropic files for a given search ]]
5.8192 /var/www/html/We35he11/bot1.txt
5.7631 /var/www/html/We35he11/r57.txt
5.7100 /var/www/html/We35he11/c99.txt
5.4953 /var/www/html/irc/client-perl.cgi
5.3739 /var/www/html/We35he11/ce.pl
5.3318 /var/www/html/We35he11/cmd.txt
5.2819 /var/www/html/irc/modules/parse.pl
5.2375 /var/www/html/irc/irc.cgi
5.2209 /var/www/html/irc/docs/decode.pl
5.2172 /var/www/html/irc/docs/viewconnects.pl
[[ Top 10 longest word files ]]
134892 /var/www/html/We35he11/r57.txt
422 /var/www/html/We35he11/c99.txt
103 /var/www/html/We35he11/bot1.txt
89 /var/www/html/We35he11/cmd.txt
62 /var/www/html/irc/nph-irc.cgi
61 /var/www/html/shellcode2exe/shellcode_2_exe.php
61 /var/www/html/shellcode2exe/index.php
53 /var/www/html/XSS/xss.php
50 /var/www/html/index.php
49 /var/www/html/irc/irc.cgi
[[ Top 10 signature match counts ]]
103 /var/www/html/We35he11/c99.txt
53 /var/www/html/shellcode2exe/shellcode_2_exe.php
53 /var/www/html/shellcode2exe/index.php
34 /var/www/html/We35he11/bot1.txt
10 /var/www/html/We35he11/cmd.txt
7 /var/www/html/We35he11/spread.txt
4 /var/www/html/We35he11/go.txt
3 /var/www/html/irc/nph-irc.cgi
3 /var/www/html/We35he11/ce.pl
2 /var/www/html/We35he11/r57.txt
[[ Top cumulative ranked files ]]
9 /var/www/html/We35he11/c99.txt
10 /var/www/html/We35he11/bot1.txt
14 /var/www/html/We35he11/r57.txt
21 /var/www/html/We35he11/cmd.txt
29 /var/www/html/shellcode2exe/index.php
29 /var/www/html/shellcode2exe/shellcode_2_exe.php
34 /var/www/html/We35he11/ce.pl
36 /var/www/html/We35he11/spread.txt
37 /var/www/html/irc/client-perl.cgi
41 /var/www/html/irc/irc.cgi
좀 더 상세한 내용은 아래 페이지를 참고하시기 바랍니다.
http://resources.infosecinstitute.com/web-shell-detection/