Nepenthes

작성일: 2007.10.25(목)

소개
Nepenthes는 MS Windows 서버에 존재하는 기존의 취약성들을 유사하게 재현하여 웜이나 Malware의 동작을 로그에 기록하는 허니팟(HoneyPot)이다. 또한 Nepenthes는 허니팟에 침입한 웜이나 Malware를 완전히 격리시키는 방법으로 보존할 수 있다.

설치 환경
• CentOS 4.4

필요한 라이브러리
• libcurl
• libpcap
• libpcre
• libmagic
• libadns(http://www.chiark.greenend.org.uk/~ian/adns/adns.tar.gz) # 소스 설치

설치 소프트웨어 버전
• Nepenthes 0.2.0(http://nepenthes.mwcollect.org/)

설치 과정
1. 위에 열거한 라이브러리를 yum이나 rpm 또는 소스 설치를 통해 모두 설치한다.

2. YUM을 사용하기 위해 GPG Key를 등록한다.

# rpm --import http://ftp.riken.jp/Linux/caos/centos/RPM-GPG-KEY-CentOS-4

※참고: /etc/yum.repos.d/CentOS-Base.repo의 내용

[base]
name=CentOS-$releasever - Base
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://ftp.riken.jp/Linux/caos/centos/$releasever/os/$basearch/
gpgcheck=1

#released updates
[update]
name=CentOS-$releasever - Updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=http://ftp.riken.jp/Linux/caos/centos/$releasever/updates/$basearch/
gpgcheck=1

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
baseurl=http://ftp.riken.jp/Linux/caos/centos/$releasever/addons/$basearch/
gpgcheck=1

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=http://ftp.riken.jp/Linux/caos/centos/$releasever/extras/$basearch/
gpgcheck=1

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0

#contribs - packages by Centos Users
[contribs]
name=CentOS-$releasever - Contribs
baseurl=http://mirror.centos.org/centos/$releasever/contribs/$basearch/
gpgcheck=1
enabled=0

#packages in testing
[testing]
name=CentOS-$releasever - Testing
baseurl=http://mirror.centos.org/centos/$releasever/testing/$basearch/
gpgcheck=1
enabled=0


3. 라이브러리 패스 적용 및 확인

# echo “/usr/local/lib” > /etc/ld.so.conf.d/user-local.conf #파일명은 마음대로
# ldconfig
# ldconfig -p |grep libadns

libadns.so.1 (libc6) ⇒ /usr/local/lib/libadns.so.1
libadns.so (libc6) ⇒ /usr/local/lib/libadns.so

#

4. nepenthes 전용 유저 작성

# groupadd nepenthes
# useradd -g nepenthes -d /dev/null -s /sbin/nologin nepenthes


5. 설치(디폴트 설치 디렉터리: /opt/nepenthes)

# ./configure

6. 컴파일

# make
생략…
download-curl.cpp:233: error: `CURLOPT_SOURCE_USERPWD' was not declared in this scope
download-curl.cpp:233: warning: unused variable 'CURLOPT_SOURCE_USERPWD'
make[3]: *** [download-curl.lo] error 1
make[3]: Leaving directory `/root/nepenthes-0.2.0/modules/download-curl'
make[2]: *** [all-recursive] error 1
make[2]: Leaving directory `/root/nepenthes-0.2.0/modules'
make[1]: *** [all-recursive] error 1
make[1]: Leaving directory `/root/nepenthes-0.2.0'
make: *** [all] error 2

#

본인의 경우 위와 같은 에러가 출력되었다. 이런 경우에는 nepenthes-0.2.0 디렉터리(현재 디렉터리)에 있는 download-curl.cpp를 다음과 같이 수정한다.

# 50번째 행에 다음 행을 추가
#define CURLOPT_SOURCE_USERPWD 100123

# 234번째 행을 다음과 같이 수정
curl_easy_setopt(pCurlHandle, (CURLoption)CURLOPT_SOURCE_USERPWD,(char *)down
->getDownloadUrl()->getAuth().c_str());


6. 설치

# make; make install

이상으로 설치가 완료되었다.


설정 파일의 편집

파일명: /opt/nepenthes/etc/nepenthes/nepenthes.conf

bind_address "0.0.0.0"; # 이 부분을 이하와 같이 수정
bind_address "if:eth0";

nepenthes 실행

기동전 주의사항
Nepenthes를 기동하면 설정된 서비스를 위장하여 리스닝하게 된다. 즉, 실제 서비스를 제공하고 있는 호스트에서 기동하면, 실제 기동되고 있는 서비스와 위장된 서비스가 충돌하게 된다. 그러므로, 전용 호스트를 준비하도록 하자.

1. 전용 유저(nepenthes)에게 nepenthes실행 권한을 부여하기 위해 소유권을 변경한다.

# chown –R nepenthes:nepenthes /opt/nepenthes/

2. 실행(현재 디렉터리 /opt/nepenthes)

# ./bin/nepenthes –u nepenthes –g nepenthes

3. 서비스 확인
# nmap -O --osscan-guess <ip address>

이상으로 웜, Malware 수집용 허니팟의 핵심이 되는 Nepenthes의 설치가 완료되었다. 하지만 허니팟은 Snort와 같은 IDS나 패킷 분석 툴과 연동해야 더욱 위력을 발휘할 수 있다. 다음 회에는 Snort 설치와 허니팟으로 취득한 데이터의 분석 방법에 대해서 알아 보자.

by Jang | 2007/10/25 11:16 | Tools | 트랙백

트랙백 주소 : http://misman95.egloos.com/tb/1552191
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

◀ 이전 페이지          다음 페이지 ▶