Nepenthes - Malware収集ツール

更新履歴

  • 2007/01/10 Nepenthes 0.1.7 → 開発版(Subversion) にバージョンアップ
  • 2006/05/17 Nepenthes 0.1.6 → 0.1.7, adns 1.1 → 1.2 にバージョンアップ
  • 2006/02/13 初版

概要

  • マルウェア収集ツール。
  • 名前の由来は、食虫植物「Nepenthes(ネペンテス、うつぼかずら)」
  • 攻撃を受けた場合、受け側のエミュレートを行い、仕込まれるファイルを取得する。

バージョン

  • Nepenthes 開発版 ($Rev 735)

インストール環境

  • CentOS 4.4

前提条件

参考URL

インストール手順

事前準備

  • インストール・動作に必要となるライブラリ・ヘッダーファイル・プログラムをインストールする。
  • rpmコマンドでインストールされているか確認しているすべてのパッケージを yum 等で事前にインストールしておくこと。
    • Subversion, pcre-devel 以外は標準インストールされていると思われる。

# rpm -qa |grep subversion
subversion-1.1.4-2.ent
# 
# rpm -qa |grep curl
curl-devel-7.12.1-8.rhel4
curl-7.12.1-8.rhel4
# 
# rpm -qa |grep pcre
pcre-4.5-3.2.RHEL4
pcre-devel-4.5-3.2.RHEL4
# 
# rpm -qa |grep pcap
libpcap-0.8.3-10.RHEL4
# 
# rpm -qa |grep ^file-
file-4.10-2.EL4.4
# 

libadns インストール

  • Nepenthes は libadns(DNSクライアントライブラリ) を使用する。
  • CentOS では標準パッケージが存在しないため、ソースからインストールする。

# vi /etc/ld.so.conf.d/local-i386.conf  ※新規作成(名前は適当)

/etc/ld.so.conf.d/local-i386.conf

以下を追加

/usr/local/lib

# cd /usr/local/src
# wget http://www.chiark.greenend.org.uk/~ian/adns/adns.tar.gz
# tar xvzf adns.tar.gz
# cd adns-1.2/
# ./configure
# make
# make install
# 
# ldconfig
# ldconfig -p |grep libadns
        libadns.so.1 (libc6) ⇒ /usr/local/lib/libadns.so.1
        libadns.so (libc6) ⇒ /usr/local/lib/libadns.so
# 

nepenthes インストール

  • nepenthes をインストールする。
  • インストール先は「/opt/nepenthes」(標準インストール先) とする。

# groupadd nepenthes
# useradd -g nepenthes -d /dev/null -s /sbin/nologin nepenthes
# 
# cd /usr/local/src/
# svn co https://svn.mwcollect.org/nepenthes/trunk/ nepenthes-dev
‘https://svn.mwcollect.org:443’ のサーバ証明書の認証中にエラーがありました:
 - 証明書は信頼のおける機関が発行したものではありません。証明書を手動で認証
   するためにフィンガープリントを用いてください!
証明書情報:
 - ホスト名: *.mwcollect.org
 - 有効範囲: Aug 12 00:17:46 2006 GMT から Aug 12 00:17:46 2007 GMT まで
 - 発行者: Development, mwcollect.org, Amsterdam, NL
 - フィンガープリント: 05:e3:9a:54:d8:a2:83:72:91:89:35:f4:49:5e:ec:2d:c3:c2:fc:c4
拒否しますか (R)、一時的に承認しますか (t)、常に承認しますか (p)? p
A  nepenthes-dev/nepenthes-core
A  nepenthes-dev/nepenthes-core/include
A  nepenthes-dev/nepenthes-core/include/Dialogue.hpp

[snip]

A  nepenthes-dev/hexdump
A  nepenthes-dev/nepenthes.doxy
リビジョン 735 をチェックアウトしました。
# 
# cd nepenthes-dev/
# autoreconf -v -i
autoreconf: Entering directory `.’
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal 
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize –copy
autoreconf: running: /usr/bin/autoconf
autoreconf: running: /usr/bin/autoheader
autoreconf: running: automake –add-missing –copy –no-force
configure.ac: installing `./install-sh’
configure.ac: installing `./missing’
modules/dnsresolve-adns/Makefile.am: installing `./depcomp’
autoreconf: Leaving directory `.’
# 
# cp /usr/include/pcre/pcre.h nepenthes-core/include/ ※make時に pcre.h が見つからないとのエラーが出るため
# 
# ./configure

[snip]

* Dumping Nepenthes Configuration *
- Debug Logging               : no

- link on liby                : yes

- DNS Resolve                 
  - Support adns              : yes

- Support Large Filesystem    : yes

- Support MySQL               : no

- Support PostgreSQL          : no

- Support ssh                 : no

- Support prelude             : no

- Support capabilities        : yes

- Packet Monitoring/Sniffing
  - linux ip_queue (ipq)      : no
  - FBSD ipfw Divert sockets  : no
  - Packet Capture Lib (pcap) : yes
# 
# make
# make install
# 
# chown -R nepenthes:nepenthes /opt/nepenthes
#

nepenthes 設定

  • 動作に必要な設定を行う。
  • 基本的にはデフォルトでOK。

# vi /opt/nepenthes/etc/nepenthes/nepenthes.conf

/opt/nepenthes/etc/nepenthes/nepenthes.conf

// main configuration file for nepenthes
// see also configuration files for modules (second row in the modules section)

nepenthes
{
    moduledir               "lib/nepenthes";        // relative to workdir
    moduleconfigdir         "etc/nepenthes";                  // relative to workdir

    modules(
//  module name (in moduledir)      config file (in moduleconfigdir)

// dns handling modules, load only one
    "dnsresolveadns.so"             ""                              ""
    


// geolocation resolver modules, load only one, disabled by default
//    "geolocationhostip.so"          ""                              ""
//    "geolocationgeoip.so"           ""                              ""


// download handler for various protocols
    "downloadcsend.so",             "download-csend.conf",          ""
    "downloadcreceive.so",          "",                             ""
//    "downloadcurl.so",              "download-curl.conf",           ""
    "downloadftp.so",               "download-ftp.conf",            ""
    "downloadhttp.so",               "",                             ""
    "downloadlink.so",              "download-link.conf",           ""
//  "downloadnepenthes.so",         "download-nepenthes.conf",      ""  // get data from others via submit-nepenthes
    "downloadtftp.so",              "download-tftp.conf",           ""
    "downloadrcp.so",               ""                              ""

// submission handler
    "submitfile.so",                "submit-file.conf",             ""  // save to disk
//  "submitnorman.so",              "submit-norman.conf",           ""
//  "submitnepenthes.so",           "submit-nepenthes.conf",        ""  // send to download-nepenthes in other nepenthes instances
//  "submitxmlrpc.so",              "submit-xmlrpc.conf",           ""  // submit files to a xmlrpc server

// logging
    "logdownload.so",               "log-download.conf",            ""
//  "logirc.so",                    "log-irc.conf",                 ""  // needs configuration


// dumping and logging
    "moduleportwatch.so",           "module-portwatch.conf",        ""

// cmd.exe simulation
    "shellemuwinnt.so"              "",                             ""

// single shellcodehandler modules 
    "shellcodesignatures.so",       "",                             ""
    "shellcodegeneric.so",          "shellcode-generic.conf",       ""

// vulnerability modules
    "vulnbagle.so",                 "vuln-bagle.conf",              ""
    "vulndameware.so",              "vuln-dameware.conf",           ""    
    "vulndcom.so",                  "vuln-dcom.conf",               ""
    "vulnftpd.so",                  "vuln-ftpd.conf",               ""
    "vulniis.so",                   "vuln-iis.conf",                ""
    "vulnkuang2.so",                "vuln-kuang2.conf",             ""
    "vulnlsass.so",                 "vuln-lsass.conf",              ""
    "vulnmsmq.so",                  "vuln-msmq.conf",               ""
    "vulnmsdtc.so",                 "vuln-msdtc.conf",              ""
    "vulnmssql.so",                 "vuln-mssql.conf",              ""
    "vulnmydoom.so",                "vuln-mydoom.conf",             ""
    "vulnnetbiosname.so",           "vuln-netbiosname.conf",        ""
    "vulnnetdde.so",                "vuln-netdde.conf",             ""
    "vulnoptix.so",                 "vuln-optix.conf",              ""
    "vulnpnp.so",                   "vuln-pnp.conf",                ""
    "vulnsasserftpd.so",            "vuln-sasserftpd.conf",         ""
    "vulnsub7.so",                  "vuln-sub7.conf",               ""
    "vulnupnp.so",                  "vuln-upnp.conf",               ""
    "vulnveritas.so",               "vuln-veritas.conf",            ""
    "vulnwins.so",                  "vuln-wins.conf",               ""
    "vulnasn1.so",                  "vuln-asn1.conf",               ""


// eXample modules for testing - disabled by default
//  "x1.so",                       "x-1.conf",                     "",
//  "x2.so",                       "x-2.conf",                     "",
//  "x3.so",                       "",                             "",
//  "x4.so",                       "",                             "",
//  "x5.so",                       "",                             "",
//  "x6.so",                       "",                             "",
//  "x7.so",                       "",                             "",
    );


    logmanager
    {
        ring_logging_file               "var/log/nepenthes.%d.log";
        file_logging_file               "var/log/nepenthes.log";
    };

    modulemanager
    {
        exit_on_broken_moduleload   "1";
    };

    submitmanager
    {
        strictfiletype              "1";
        // where does submit-file write to? set this to the same dir
        filesdir                    "var/binaries/"; 
    };

    downloadmanager
    {
        replace_local_ips           "1";
    };

    socketmanager
    {
        use_rawsockets              "0"; // unstable feature
        bind_address                "0.0.0.0";

        // specify "if:ethX" to get the ip from an interface at startup,
        // only works on linux!
    };
    
    utilities
    {
        hexdump_path                "var/hexdumps/";
    };
    
    geolocationmanager
    {
        cache_path                   "var/cache/nepenthes/geolocation/";
    };
};

nepenthes 実行

  • 実行ユーザ・グループは nepenthes を指定する。

# cd /opt/nepenthes/
# ./bin/nepenthes -u nepenthes -g nepenthes
User nepenthes has uid 501
Group nepenthes has gid 501
#                                                                             #
                                                                               
                 !..,(’                                                       
                 !!..,,                                                       
                 !*’.,!*                                                       
                 *!’.,!                                                       
                 ‘!’.,!                                                       
                 .,’,*,,.                                                    
            ,#=%(#%##%C                                                    
         .#%C=,:::::::,,5%#.                                                   
         (#!!,,,,,,,,,,,J7#’                                                   
         =#!(=,,,,,,,,:==(7!                       ,%###!##%’.                 
         .=#(CJ3$#%C7==((77                     ,%##!#%#%*                
       .#(#J#A3#$==7=J=!(=3’                 ,%##::::,,::%#%, '!(====((!,'. 
     ######$@53C=(==(=C7                %##(::::,,,,,::%##A$$3$CCJ3CJC(7C!
   #(###3#'J%J(!!!*!!J(((=J'              ,##(:::,,,,,:::%##5%C'           . 
 .#3#3#$#. C5$C7!=!7=((7=              ;##(:,,,,,,,::%###%.               
 '####*.   7AJC7!7(!((=7C.             |###((,,,,,,,)%##%=C,    .*(7!    
           (%7C77!(==!!=7=C!             ((%############%!(CC.,JAA%3C'    
           $C7C7=(=((=(=J= ,:@M;;.77C7(=C!!*!=!C(777J3$3=!,'.      
           ,%CJJ=C(7(((((=((=JC 7####::###CC=(CC=(=(*!=!==7=77JJ,            
           .%J337J==(=7==C=C7C3,##J!::::77#%J=CJ===!====(7C7C*             
            C$33C3C7=7C777CJJJ%7##C:,,,,,:#$3CJC==(=7((=C(J$CJ*             
            '%$333CCC3CCCCCJ%3%#%#$C:,,,:3#AJJ3C7=JC=(((((7C7C3J3!             
             (#$$3JJJ%3J$J33$$AA33#5J:,,:A#$$$JC7CJCC7=(=(CJ$CJJ$,             
              J#%$$%33%$5$A#$%#%CJ3#A%:35#%J3$3JJCCC$C7J77JC$J33$'             
              .75AA%$AA%#A%5#%CJC#J###3#J$%3$JJCCJCC3J33$33$$A.              
                =5555A%AA5#5@%,%CJC3J###ACJJ$5$33JJJJJJJJ%3A%              
                .3@55##A5###=’!AJCJJ3###ACJ3A#$$$%$$33333$%AA5!              
                 %3J%55$J='  '533CC3###ACJ$#@A%AA$A%$$A%AA55               
                 A=(3$A’.      3A3J33###%CJ$#AA55AA%5#AA5#5                
                .AC=$J        'A%$J$A##A33AA555###55#5555#A!                 
                *J7==A         '$%$##A3A=.JA###555%55##5(.                  
                =JJJJ5’          ‘(A5A#JA%!   *=@#%AA5553                    
                J$3J$$             .55A$#*     .#A$A%7*                       
               .$33$%C              %$JJ5.     !3J(%.                         
               ‘%%%A$7              %CC75.     C(J7(                           
               *A%J$A=              %==73     ,J7C$’                           
               7%$JJ@!             ‘A7=CC     =C7CJ                            
               $J3(3#.             *$77C=     %(CC(                            
              .#33($J              7C73,    ‘$JJC,                            
                                                                               
#                                                                             #
                                                                               
                              Nepenthes Ampullaria                             
                                                                               
#                                                                             #


Nepenthes Version 0.2.0 
Compiled on Linux/x86 at Jan  9 2007 19:10:02 with g++ 3.4.6 20060404 (Red Hat 3.4.6-3) 
Started on xxx.jp running Linux/i686 release 2.6.9-42.0.3.EL

[ info mgr ] Loaded Nepenthes Configuration from “/opt/nepenthes/etc/nepenthes/nepenthes.conf”.
[ info sc module ] Loading signatures from file var/cache/nepenthes/signatures/shellcode-signatures.sc
[ info mgr ] The process 31847 was given capabilities = cap_setgid,cap_setuid,cap_net_bind_service,cap_net_admin,cap_net_raw,cap_sys_chroot+eip
[ info mgr ] Process groupid 501
[ info mgr ] Process userid 501

補足事項

  • /opt/nepenthes 以下に バイナリファイル・ログ等が保存されていく。
/opt/nepenthes/var/binaries/ worm等のバイナリファイルが保存される (ファイル名はmd5ハッシュ値)
/opt/nepenthes/var/hexdumps/ 送られてきたコマンド
/opt/nepenthes/var/log/ ログファイル
 
honey/nepenthes.txt · 最終更新: 2007/10/16 12:02 by kikuzou
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki NINJA TOOLS