Skip to content

조회 수 24064 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부

ModSecurity는 Apache 웹 서버를 위한 오픈 소스 웹 방화벽입니다.

ModSecurity의 주요 특징은 다음과 같습니다.
 o 요청(request) 필터링
- 클라이언트로부터 웹요청이 들어올 때 웹서버 또는 다른 모듈들이 처리하기 전에 ModSecurity가 요청 내용을 분석하여 사전에 필터링합니다.
 o 우회 방지 기술
- 경로와 파라미터를 분석하기 전에 정규화시켜 우회 공격을 차단합니다.
- 즉, “//”, “\/”, “.”, “%00” 등 우회 공격용 스트링을 제거하고, 인코딩된 URL을 디코딩합니다.
 o HTTP 프로토콜 이해
- 엔진이 HTTP 프로토콜을 이해하기 때문에 아주 전문적이고 미세한 필터링을 수행합니다.
 o POST 페이로드(payload) 분석
- GET 방식 뿐만 아니라 POST 메소드를 사용해서 전송되는 컨텐츠도 가로채어 분석합니다.
 o 감사 로깅
- POST를 포함하여 모든 요청의 모든 상세한 부분들까지 추후 분석을 위해서 로깅됩니다.
- MosSecurity에서 차단기능을 비활성화시킨 후, 강력한 로깅 기능만으로 침입탐지 시스템 역할을 수행할 수 있도록 합니다.
 o HTTPS 필터링
- 엔진은 웹서버에 임베디드되어 있기 때문에 복호화 한 후에 요청 데이터에 접근하여 HTTPS
를 통한 공격도 필터링할 수 있습니다.


1. ModSecurity 다운

wget http://www.modsecurity.org/download/modsecurity-apache_2.5.7.tar.gz
wget http://sk5.nettor.com/modsecurity-apache_2.5.7.tar.gz

다른 버젼 필요시
http://www.modsecurity.org/


2. apxs, libxml2, lua, pcre library 설치

yum -y install httpd-devel \
libxml2 \
lua \
pcre-devel.i386


3. 컴파일

cd /usr/local/modsecurity-apache_2.5.7/apache2/

chmod 701 configure (실행 권한 변경)

./configure  --with-apxs=/usr/sbin/apxs   또는

./configure  --with-apxs=/usr/local/apache/bin/apxs

★아래와 같이 config안될 시

configure: using ' -luuid -lrt -lcrypt  -lpthread -ldl' for apr Library
checking for libapr-util config script... no
configure: *** apu library not found.
configure: error: apu library is required

./configure --with-apr=/usr/local/apache --with-apu=/usr/local/apache --with-apxs=/usr/local/apache/bin/apxs

make && make install

설치가 완료되면 아래 파일이 생성됩니다.

/usr/lib/httpd/modules mod_security2.so


4. httpd.conf 파일 하단에 추가


LoadFile /usr/lib/libxml2.so  

LoadModule security2_module    modules/mod_security2.so
Include conf/modsecurity.conf // 자신에 맞는 conf 파일을 conf 폴더안에 수정하여 복사합니다.

/usr/local/apache/bin/apachectl restart

-- modules/mod_security2.so 없다 나오면 /usr/local/apache/module 안에 mod_security2.so 복사해서 넣습니다.

각각의 파일이 해당경로에 있어야 합니다.

mod_security2.so 없어 오류 발생하면
/usr/lib/httpd/modules mod_security2.so 파일을
/usr/local/apache/modules 폴더 넣습니다.


5. 공격 차단룰 복사


ModSecurity_1x_hosting_090311.conf - 1.9.x 버전 호스팅업체용
ModSecurity_1x_SMB_090311.conf - 1.9.x 버전 중소기업용
ModSecurity_2x_hosting_09311.conf - 2.x 버전 호스팅업체용
ModSecurity_2x_SMB_09311.conf - 2.x 버전 중소기업용
알맞은 파일을 /usr/local/apache/conf/폴더 넣습니다.

알맞은 파일 conf 열고 38번,39번줄에
#SecDefaultAction "deny,log,phase:2,status:406,t:urlDecodeUni,t:htmlEntityDecode,t:lowercase"
SecDefaultAction "pass,log,auditlog,phase:2,t:urlDecodeUni,t:htmlEntityDecode,t:lowercase"


SecDefaultAction "deny,log,phase:2,status:406,t:urlDecodeUni,t:htmlEntityDecode,t:lowercase"
#SecDefaultAction "pass,log,auditlog,phase:2,t:urlDecodeUni,t:htmlEntityDecode,t:lowercase"
주석을 바꿔줍니다.

다른 자료가 필요하시면
http://www.securenet.or.kr/main.jsp?menuSeq=501


6. 정상적으로 설치 됐는지 확인

curl --head http://127.0.0.1/
HTTP/1.1 200 OK
Date: Fri, 16 Oct 2009 06:54:49 GMT
Server: Microsoft-IIS/5.0 <-- 정상적인 설치




7. 테스트

http://ip주소/index.test?file=../../etc/passwd

# tail  /usr/local/apache/log/주소-error_log       아래와 같은 경고 문구 확인

ModSecurity: Warning. Pattern match "\\.\\./" at REQUEST_URI. [file "/usr/local/apache/conf.d/modsecurity_2x_hosting_090311.conf"] [line "307"] [hostname "sk3.nettor.com"] [uri "/index.html"] [unique_id "StgDdX8AAAEAACwWCFUAAAAA"]

---------------------------------------------------------------------------
tail -f /usr/local/apache/logs/modsec_audit.log 차단은 되는데 로그가 안쌓이는 경우

wget ftp://ftp.superuser.co.kr/apache/httpd-2.2.6.tar.bz2
모듈 올려야 함..
최신 버전 아파치 tar 해지 후
httpd-2.2.6/modules/metadata 이동
/usr/local/apache/bin/apxs -cia mod_unique_id.c 모듈 적재
modsecurity 로그 분석 및 고급 룰 설정 파일 (참고 문서 )


 공개 방화벽 커뮤니티

http://www.securenet.or.kr/main.jsp?menuSeq=496



  1. 홈페이지 보안 강화 도구(CASTLE) 보급 안내

    Date2010.01.22 ByADMINPLAY Views8929
    Read More
  2. 홈페이지 변조 대처법 (FTP 계정을 이용한 아이프레임 코...

    Date2009.10.15 ByADMINPLAY Views9047
    Read More
  3. 해킹툴이 사용하는 포트번호

    Date2009.05.22 ByADMINPLAY Views9818
    Read More
  4. 해킹이 의심될 때 사용되는 명령어들

    Date2010.03.08 Byl2zeo Views9868
    Read More
  5. 해킹 당했는지 알아보는 방법

    Date2010.05.03 ByADMINPLAY Views19992
    Read More
  6. 해외에서 접근하는 IP 차단하기

    Date2009.11.30 ByADMINPLAY Views9262
    Read More
  7. 파일 퍼미션 설정을 통한 로컬 공격 방지

    Date2010.03.08 Byl2zeo Views8172
    Read More
  8. 최신 버전으로 구축하는 웹 파이어월, modsecurity

    Date2009.03.17 ByADMINPLAY Views12856
    Read More
  9. 접속 로그파일 보기(wtmp)

    Date2009.05.11 ByADMINPLAY Views13883
    Read More
  10. 웹취약점 점검

    Date2008.11.25 ByADMIN Views9258
    Read More
  11. 웹어플리케이션 보안

    Date2010.05.03 ByADMINPLAY Views17163
    Read More
  12. 안티 루트킷 사용 예

    Date2010.03.28 Byl2zeo Views11577
    Read More
  13. 실전 테스트!! 스니퍼 공격

    Date2009.11.30 ByADMINPLAY Views9774
    Read More
  14. 시스템 로그를 메일로 - logcheck

    Date2009.09.08 ByADMINPLAY Views8776
    Read More
  15. 스위칭 허브 상에서의 sniffing 툴

    Date2009.09.08 ByADMINPLAY Views9583
    Read More
  16. 서버종합점검[리눅스]

    Date2009.05.28 ByADMINPLAY Views8371
    Read More
  17. 서버의 iptable 보안설정 일부분

    Date2009.05.28 ByADMINPLAY Views8790
    Read More
  18. 보안서버로 redirection 설정 하기

    Date2008.12.14 ByADMIN Views10275
    Read More
  19. 보안서버구축 - SSL(설치 및 키생성)

    Date2009.01.04 ByADMIN Views10467
    Read More
  20. 보안서버 구축시 openssl/modssl/apache 버전 호환성

    Date2008.12.14 ByADMIN Views10904
    Read More
Board Pagination Prev 1 2 3 4 5 Next
/ 5

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234