PR_Snort for windows & HSC

 

 

 

작성일: 2014년 01월 08일

작성자: juwon1405

E-mail: hotyougo@naver.com

Proprietary & Confidential

01. 개요

1. Snort란 무엇 인가부터, Windows 기반 Snort 환경 구축에 대해 알아본다.

2. Snort 옵션 별 Rule 설정 방법 및 탐지에 대해 알아본다.

3. Snort Rule Content의 PCRE를 적용하여, 탐지 Rule 고도화 방안에 대해 알아본다.

02. 본론

1. Snort for windows

  • Snort란 무엇인가?

    Snort는 "sniffer and more"라는 말에서 유래되었는데,

    처음 공개되었을 때는 코드도 얼마 되지 않는 단순한 Packet Sniffer 프로그램이었다.

    그러나 이후 현재의 IDS와 같이 rule을 이용한 분석 기능이 추가되고,

    보완과 향상을 통해 지금과 같이 다양한 기능과 탁월한 성능을 갖춘 프로그램이 되었다.

     

    현재 많은 침입탐지시스템 솔루션 제품에서 Snort 룰 기반으로 정책을 설계하고,

    전 세계에서 IDS 룰 이라 함은 Snort Rule을 비 공식적으로 통용화되고 있는 실정이다.

Snort는 공식 홈페이지인 http://www.snort.org 를 통해 지속적인 업그레이드를 제공하고 있으며,

Snort 홈페이지에서 Source를 다운 받아 IDS를 설치할 수 있고, Rule을 다운받을 수 도 있다.

 

  • Snort는 일종의 침입탐지시스템(IDS:Intrusion Detection System)으로

    + 실시간 트래픽 분석, 프로토콜 분석, 내용검색/매칭, 침입탐지 Rule에 의거하여 오버플로우,

    포트스캔, CGI공격, OS확인 시도, DoS등의 다양한 공격과 스캔을 탐지할 수 있다.

    + 침입탐지 Rule은 보안 커뮤니티를 통해 지속적으로 업데이트되고 또한 사용자가 직접

    Rule을 작성하여 추가할 수 있도록 설계되어 최신공격에 대한 적응에 빨리 대처할 수 있다.

  • Snort의 개발자인 Marty Roesch의 말에 의하면

    "Snort는 실시간 트래픽 분석과 IP 네트워크 상에서 패킷 로깅이 가능한 가벼운(lightweight) 네트워크 침입탐지시스템" 이라고 한다.

    1-1. Snort for windows 구축

  • 다음은 Windows기반 에서 Snort를 구축하는 방법에 대해서 알아본다.

▲[그림 1-1] 구축환경 (VMware)

 

  1. Mysql-essential 설치

Mysql-essential Installer 5.1.38 for windows (32bit): https://drive.google.com/file/d/0B6N5okuxlzbpT05UQ3pITEcyNUk/view?usp=sharing

 

다음 그림 순서에 따라서, 설치를 진행한다.

▲[그림 1-2] Mysql-essential 설치과정 (Default는 다음으로 넘김)

 

 

 

▲[그림 1-3] Mysql-essential 설치과정

 

 

▲[그림 1-4] Mysql-essential 설치과정

 

 

 

 

▲[그림 1-5] Mysql-essential 설치과정

 

 

▲[그림 1-6] Mysql-essential 설치과정

 

 

 

▲[그림 1-7] Mysql-essential 설치과정

 

 

▲[그림 1-8] Mysql-essential 설치과정

 

 

 

▲[그림 1-9] Mysql-essential 설치과정 (계정: root / 패스워드 입력)

 

 

▲[그림 1-10] Mysql-essential 설치과정

 

  1. Snort & HSC Schema Download
  1. Snort Database 및 Schema 생성

    c:\Program Files\MySQL\MySQL Server 5.1\bin>mysqladmin -u root -p create snortdb

    Enter password: Mysql 설치시 입력했던 패스워드 입력

▲[그림 1-11] Snortdb database 생성

 

c:\Program Files\MySQL\MySQL Server 5.1\bin> mysql -D snortdb -u root -p < create_mysql

Enter password: Mysql 설치시 입력했던 패스워드 입력

▲[그림 1-12] Snortdb Schema 생성

 

  1. HSC Database 및 Schema 생성

    C c:\Program Files\MySQL\MySQL Server 5.1\bin>mysqladmin -u root -p create aw_hsc

    Enter password: Mysql 설치시 입력했던 패스워드 입력

▲[그림 1-13] HSC database 생성

 

c:\Program Files\MySQL\MySQL Server 5.1\bin> mysql -u root -p aw_hsc < dump_aw_hsc.sql

Enter password: Mysql 설치시 입력했던 패스워드 입력

▲[그림 1-14] HSC DB Dump 쓰기

 

 

 

C:\Program Files\MySQL\MySQL Server 5.5\bin> mysql -u root -p

Enter password: Mysql 설치시 입력했던 패스워드 입력

▲[그림 1-15] Mysql Login 화면

 

mysql> show databases; (데이터 베이스 확인)

mysql> use aw_hsc; (데이터 베이스 진입)

mysql> show tables; (데이터 베이스 테이블 확인)

▲[그림 1-16] aw_hsc 와 snortdb가 정상적으로 생성된 화면

 

 

 

  1. WinPcap 설치 (기본설치)

    WinPcap Download: http://www.winpcap.org/install/bin/WinPcap_4_1_3.exe

     

  2. Snort(2.8.4.1 ver) 설치

    Snort Download: https://drive.google.com/file/d/0B6N5okuxlzbpUzJVbllMQjA1VkE/view?usp=sharing

     

  • 설치 후 C:\Snort\etc\snort.conf 파일을 열어 다음과 같이 수정 한다.
  1. 수정 전: dynamicpreprocessor directory /usr/local/lib/snort_dynamicpreprocessor/

수정 후: dynamicpreprocessor directory c:\snort\lib\snort_dynamicpreprocessor

 

  1. 수정 전: dynamicengine /usr/local/lib/snort_dynamicengine/libsf_engine.so

    수정 후: dynamicengine c:\snort\lib\snort_dynamicengine\sf_engine.dll  

     

  2. 수정 전: var RULE_PATH ../rules

    수정 후: var RULE_PATH c:\snort\rules

     

  3. 수정 전: var PREPROC_RULE_PATH ../preproc_rules

    수정 후: var PREPROC_RULE_PATH c:\snort\preproc_rules

     

  4. 수정 전: include classification.config

    수정 후: include c:\snort\etc\classification.config

     

  5. 삽입: output alert_fast: alert.ids  

     

  6. 삽입:

    output database: log, mysql, user=root password=DB 패스워드 dbname=snortdb host=127.0.0.1 port=3306 sensor_name=snortsensor

    output database: alert, mysql, user=root password=DB 패스워드 dbname=snortdb host=127.0.0.1 port=3306 sensor_name=snortsensor

    (설치한 Mysql의 계정과, 패스워드를 기입하여 삽입한다.)

     

  7. 수정 전: include $RULE_PATH/local.rules

    수정 후: #include $RULE_PATH/local.rules (해당 룰 아래의 모든 rules 에 대해 "#"주석 처리 한다.)

     

  8. 삽입: include $RULE_PATH\user.rules

▲[그림 1-17] Snort.conf의 user.rules 설정 화면

  1. 생성: 1개의 사용자 룰 파일을 C:\Snort\rules\ user.rules 생성

User.rules 내용: alert icmp any any -> any any (msg:"Detected ICMP Protocol"; sid:0; rev:1;)

 

  1. 실행 테스트: 1개의 사용자 룰 파일을 C:\Snort\rules\ user.rules 에 생성

    C:\Snort\bin> Snort -W (Sniffing 할 Network Interface 번호 확인)

    C:\Snort\bin> snort -v -c c:\snort\etc\snort.conf -l c:\snort\log -i 2 -k none

    (-k none옵션은 checksum 검사를 하지 않기 위함.)

▲[그림 1-18] Snort Sniffing 동작화면

 

  1. HSC(Honeynet Security Console) v.2.6.0.4 설치

    HSC Download: https://drive.google.com/file/d/0B6N5okuxlzbpUnpvWjF5czJ5eVE/view?usp=sharing

     

▲[그림 1-19] HSC 로그인 화면 (DB 계정정보를 입력 후 로그인)

HSC(Honeynet Security Console) 는 Snort의 3rd Party 솔루션으로써,

Snort 기반으로 탐지되는 이벤트를 GUI로 확인 할 수 있는 프로그램이다.

 

이 외에도 3rd Party 솔루션은 다양하며, https://snort.org/downloads 에서 확인 할 수 있다

▲[그림 1-20] Snort 3rd Party 솔루션들

 

Windows7기반 BASE(IDS)(참고): http://redkreuz.tistory.com/156

 

 

 

  1. IDS 탐지 테스트

    Snort Start: C:\Snort\bin>snort -v -c c:\snort\etc\snort.conf -l c:\snort\log -i 2 -k none

    발생 Event: 실행창 -> cmd.exe /s /k Ping 8.8.8.8 /t

    탐지 Rules: alert icmp any any -> any any (msg:"Detected ICMP Protocol"; priority:0; sid:0; rev:1; )

 

▲[그림 1-21] 정상적으로 HSC에서 보여지는 Event 화면

 

 

위와 같이 정상적으로 Windows에 Snort와 GUI로 탐지된 결과를 확인할 수 있는 HSC를 설치하여,

IDS 구축을 완료 하였다.

 

해당 문서는 따라 하기만 하면 쉽게 설치하고 테스트 할 수 있도록 초점을 맞추었기 때문에,

그대로 따라 하면 문제없이 설치 할 수 있을 것이라 판단됩니다.

 

잘 되지 않거나 할 때에는 질문 남겨 주세요. ^^

+ Recent posts