Prelude-IDS センサーの追加 - Nepenthes (Malware収集)

更新履歴

  • 2006/06/02 センサーとマネージャを分離
  • 2006/05/17 初版

概要

  • Malware収集ツール Nepenthes を監視するためのセンサー。
  • prelude-manager と Nepenthesセンサー は 別々のサーバ で構築する。

バージョン

  • Nepenthes開発版 ($Rev 555)

インストール環境

  • CentOS4.3 (X + Gnome + 開発環境)

前提条件

  • Prelude Manager が正常に動作していること

参考URL

インストール手順

libprelude インストール

  • Preludeアーキティクチャのベースライブラリをインストールする。
# yum install gnutls-devel
# rpm -qa |grep gnutls
gnutls-1.0.20-3.2.2
gnutls-devel-1.0.20-3.2.2
# 
# rpm -qa |grep "^python-"
python-urlgrabber-2.9.6-2
python-elementtree-1.2.6-4
python-sqlite-1.1.6-1
python-2.3.4-14.2
python-devel-2.3.4-14.2
python-ldap-2.0.1-2
# 
# yum install pcre-devel
# rpm -qa |grep pcre
pcre-4.5-3.2.RHEL4
pcre-devel-4.5-3.2.RHEL4
# 
# 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.prelude-ids.org/download/releases/libprelude-latest.tar.gz
# tar xvzf libprelude-latest.tar.gz
# cd libprelude-0.9.8
# ./configure

~ 省略 ~

*** Dumping configuration ***
    - Generate documentation : no
    - Perl binding           : yes
    - Python binding         : yes

# make 
# make install
# ldconfig
# 
# libprelude-config --version
0.9.8
# 

Nepenthes インストール

  • Nepenthesをインストールする。
  • 現時点(2006/06/05)では、開発版を使用する必要があるので、ソース取得のために Subversion が必要。
  • バージョンについては Rev:555 を使用すること。
    • Rev:562 では prelude を有効にするとnepenthesが起動しない
  • 以下手順では、rpmコマンドでパッケージが既にインストールされていないか確認している。導入されていない場合は yum 等でインストールすること。
# yum install subversion ※インストールされていない場合のみ実施
# 
# 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
# 
# 
# 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
# 
# 
# groupadd nepenthes
# useradd -g nepenthes -d /dev/null -s /sbin/nologin nepenthes
# 
# cd /usr/local/src/
# mkdir nepenthes-svn
# cd nepenthes-svn
# svn co https://svn.mwcollect.org/nepenthes/trunk/ --revision 555
# cd trunk
# autoreconf -v -i
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal 
/usr/share/aclocal/libgcrypt.m4:23: warning: underquoted definition of AM_PATH_LIBGCRYPT
  run info '(automake)Extending aclocal'
  or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy
/usr/share/aclocal/libgcrypt.m4:23: warning: underquoted definition of AM_PATH_LIBGCRYPT
  run info '(automake)Extending aclocal'
  or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
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 `.'
# 
# ./configure --prefix=/opt/nepenthes \
--enable-prelude \
--disable-capabilities

~ 省略 ~

*** Dumping Nepenthes Configuration ***
- Debug Logging               : no

- DNS Resolve                 
  - Support adns              : yes

- Support Large Filesystem    : yes

- Support MySQL               : no

- Support PostgreSQL          : no

- Support ssh                 : no

- Support prelude             : yes

- Support capabilities        : no
# 
# cp /usr/include/pcre/pcre.h ./nepenthes-core/include/
# cp /usr/local/include/libprelude/*.h ./nepenthes-core/include/
# 
# make
# make check
# make install
# chown -R nepenthes:nepenthes /opt/nepenthes
  • インストール完了後、Nepenthes の設定を行う。
# vi /opt/nepenthes/etc/nepenthes/nepenthes.conf

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

41行目を追加する

39 // logging
40     "logdownload.so",               "log-download.conf",            ""
41     "logprelude.so",                "log-prelude.conf",             ""
42 //  "logirc.so",                    "log-irc.conf",                 ""  // needs configuration

Nepenthes センサー登録

  • Nepenthes を Prelude-manager にレジストレーション(登録)する。
  • レジストレーションサーバ用ターミナル(manager)と登録用ターミナル(sensor)を切り替えて作業を行う。
    • 画面左のプロンプトに注目
  • 最初に、レジストレーションサーバを起動する。(manager)
  • レジストレーションサーバを起動すると、登録用のパスワードが表示される。
  • そのパスワードを使用して、センサー側で作業を行う。
[manager]# prelude-adduser registration-server prelude-manager ※レジストレーションサーバの起動

- Using default TLS settings from /usr/local/etc/prelude/default/tls.conf:
  - Generated key size: 1024 bits.
  - Authority certificate lifetime: unlimited.
  - Generated certificate lifetime: unlimited.

- Using analyzer prelude-manager.
  - Using /usr/local/etc/prelude/profile/prelude-manager...
  - Using already allocated ident for prelude-manager: 678335395428313.
  - Using /usr/local/var/spool/prelude/prelude-manager...

- Starting registration server.
  - generated one-shot password is "09y4co9m". ※登録のためのパスワード

    This password will be requested by "prelude-adduser" in order to connect.
    Please remove the first and last quote from this password before using it.

  - Generating 1024 bits Diffie-Hellman key for anonymous authentication...
  - Waiting for peers install request on 0.0.0.0:5553...
  • 次に、Nepenthes をマネージャに登録する。(sensor)
  • 登録に際には、マネージャを起動した際に表示された登録用パスワードが必要となる。
[sensor]# prelude-adduser register nepenthes "idmef:w admin:r" <マネージャIPアドレス> --uid nepenthes --gid nepenthes

- Using default TLS settings from /usr/local/etc/prelude/default/tls.conf:
  - Generated key size: 1024 bits.
  - Authority certificate lifetime: unlimited.
  - Generated certificate lifetime: unlimited.

- Creating analyzer nepenthes.
  - Creating /usr/local/etc/prelude/profile/nepenthes...
  - Allocated ident for nepenthes: 3609268325107070.
    - Generating RSA private key... This might take a very long time.
      [Increasing system activity will speed-up the process.]

    - Generating 1024 bits RSA private key... Done.

  - Creating /usr/local/var/spool/prelude/nepenthes...

- Registering analyzer idmef:w admin:r to <マネージャIPアドレス>:5553.

  You now need to start "prelude-adduser" on the server host where
  you need to register to:

  use: "prelude-adduser registration-server <analyzer profile>"
  example: "prelude-adduser registration-server prelude-manager"

  This is used in order to register the 'sending' analyzer to the 'receiving'
  analyzer. <analyzer profile> should be set to the profile name of the
  'receiving' analyzer, the one where 'sending' analyzer will register to.

  Please remember that "prelude-adduser" should be used to register
  every server used by this analyzer.

  Enter the one-shot password provided by the "prelude-adduser" program:
  - enter registration one-shot password: レジストレーションサーバで表示されたパスワードを入力
  - confirm registration one-shot password: レジストレーションサーバで表示されたパスワードを入力
  - connecting to registration server (<マネージャIPアドレス>:5553)...
  - Anonymous authentication to registration-server successful.
  - Sending certificate request.
  - Receiving signed certificate.
  • マネージャ側で登録するか確認画面が表示されているので “y” を入力する。(manager)
 レジストレーションサーバを起動しているターミナルに移動すると
 登録確認画面になっているので「y」を入力する

  - Connection from <センサーIPアドレス>:<ポート番号>.
  - Anonymous authentication one-shot password check successful.
  - Waiting for client certificate request.
  - Analyzer with ID="3609268325107070" ask for registration with permission="idmef:w admin:r".
    Approve registration [y/n]: y ※y を入力
    Registering analyzer "3609268325107070" with permission "idmef:w admin:r".
  - Generating signed certificate for client.
  - Sending server certificate to client.
  - <センサーIPアドレス>:<ポート番号> successfully registered.
  • Nepenthes側で登録が完了しているか確認する。(sensor)

  - Receiving CA certificate.

- nepenthes registration to <マネージャIPアドレス> successful.

prelude-manager 設定変更

  • prelude-manager はデフォルトでは、ローカルホスト(127.0.0.1)からのみ接続を受け付ける設定になっている。
  • リモートのセンサーから prelude-manager に接続可能にするため、設定ファイルを修正する。
# vi /usr/local/etc/prelude-manager/prelude-manager.conf

/usr/local/etc/prelude-manager/prelude-manager.conf

25行目を修正

     15 # Address where the prelude-manager server is listening on.
     16 # if value is unix, or unix:/path/to/unix/socket, an UNIX domain
     17 # socket will be used.
     18 # 
     19 # Multiple listen address are supported.
     20 #
     21 # listen = address:port
     22 # listen = unix:/tmp/prelude-manager.socket
     23 # listen = unix
     24 #
     25 listen = 0.0.0.0
     26
  • 修正後、prelude-manager を再起動する。

libprelude 設定変更

  • センサーについては、デフォルトでローカルホスト(127.0.0.1)に接続するように設定されている。
  • リモートのマネージャに接続するように、libpreludeの設定ファイルを修正する。
# vi /usr/local/etc/prelude/default/client.conf

/usr/local/etc/prelude/default/client.conf

19行目を修正

     10 # Try to connect on a Manager listening on 127.0.0.1.
     11 #
     12 # server-addr = x.x.x.x:port || y.y.y.y && z.z.z.z
     13 #
     14 # This mean the emission should occur on x.x.x.x:port or, if it fail,
     15 # on y.y.y.y and z.z.z.z (if one of the two host in the AND fail, 
     16 # the emission will be considered as failed involving saving the 
     17 # message locally).
     18 
     19 server-addr = <prelude-manager IPアドレス>

Nepenthes 起動

  • センサー側で Nepenthes を起動する。
# cd /opt/nepenthes/
# ./bin/nepenthes -u nepenthes -g nepenthes
Change User to nepenthes 
Change Group to nepenthes
User nepenthes has uid 1002
Group nepenthes has gid 1002
#                                                                             #
                                                                               
                 !..,('                                                       
                 !!..,,                                                       
                 !*'.,!*                                                       
                 *!'.,!                                                       
                 '!'.,!                                                       
                 .,',*,,.                                                    
            ,#=%(#%#%%#%%%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%%%3%%A%              
                .3@55##A5###='!AJCJJ3###ACJ3A#$$$%$$33333$%%%AA5!              
                 %3J%55$J='  '533CC3###ACJ$#@A%%%AA$A%$$A%AA55               
                 A=(3$A'.      3A3J33###%CJ$#AA55AA%5#AA%%5#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.1.7 
Compiled on Linux/x86 at May 17 2006 14:44:33 with g++ 3.4.5 20051201 (Red Hat 3.4.5-2) 
Started on manager01 running Linux/i686 release 2.6.9-34.EL

[ info mgr ] Loaded Nepenthes Configuration from "/opt/nepenthes/etc/nepenthes/nepenthes.conf".
prelude_string_set_ref_fast:482: warning, string is not NULL terminated.
prelude_string_set_ref_fast:482: warning, string is not NULL terminated.
- Connecting to 127.0.0.1:4690 prelude Manager server.
- TLS authentication succeed with Prelude Manager.
[ info sc module ] Loading signatures from file var/cache/nepenthes/signatures/shellcode-signatures.sc
[ info mgr ] Changed logfile var/log/nepenthes.log owner to 1002:1002 (nepenthes:nepenthes)
[ crit mgr ] Compiled without support for capabilities, no way to run capabilities
[ info mgr ] Process groupid 1002
[ info mgr ] Process userid 1002
  • Prewikkaにログインして、[Agents] を選択すると、”nepenthes” が追加されている。

センサー一覧

  • アラート一覧画面は以下のようになる。

アラート一覧

 
ids/prelude_sensor_nepenthes.txt · 最終更新: 2007/10/16 12:02
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki NINJA TOOLS