Security/ModSecurity 5

[ModSecurity 2.9] Apache + ModSecurity OWASP 룰셋 적용 (IDS, ModSecurity SQL Injection, modsecurity detection mode)

APache + ModSeucirty OWASP 룰셋 적용 (IDS, ModSecurity SQL Injection, modsecurity detection mode) 룰셋 적용 후 차단하는 방식(IPS)가 아니라, 탐지된 내용을 로깅만 하는 방식(IDS)으로 구성 합니다. 룰셋 적용 자체에 큰 어려움은 없기에 하나하나 자세히 설명하기보다는 코드블럭에 주석처리로 간단히 설명만 해두었습니다. 적용 이후에 공격을 시도하면 /var/log/httpd/modsec.log 파일에서 공격이 탐지되는것을 확인할 수 있습니다. ## OWASP 룰셋 설치 cd /etc/http git clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git mkdir /etc/htt..

[ModSecurity 2.9] 아파치 modsecurity2 소스 설치 (apache modsecurity2 install)

아파치 modsecurity2 소스 설치 (apache modsecurity2 install) 아래와 같이 의존성 및 컴파일을 위한 패키지를 설치 해줍니다. yum -y install gcc gcc-c++ httpd-devel pcre-devel wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz tar xvfz pcre-8.00.tar.gz cd pcre-8.43 ./configure --prefix=/usr/local/pcre make make install 이후 아래와 같이 modsecurity2를 직접 설치 합니다. 만약, libxml 에러가 발생할 경우 아래 링크를 참고하여 해결해주신 후 진행 하시면 됩니다. modsecurity libxml 에러 발생 ..

[ModSecurity 2.9] 아파치 modsecurity2 설치 시 에러 "checking for libxml2 config script... no configure: *** xml library not found. configure: error: libxml2 is required"

아파치 modsecurity2 설치 시 에러 "checking for libxml2 config script... no configure: *** xml library not found. configure: error: libxml2 is required" 해당 에러는 modeseucirty2 소스 설치 시 libxml 2.6.29 이하 버전일 경우 발생할 수 있습니다. 아래와 같이 상위 버전을 설치받아 해결하실 수 있습니다. cd /usr/local/src wget ftp://xmlsoft.org/libxml2/libxml2-2.7.7.tar.gz tar xvzf libxml2-2.7.7.tar.gz cd libxml2-2.7.7 ./configure --prefix=/usr/local/xml make..

[ModSecurity 2.9] 모드 시큐리티를 이용해 Apahe POST Body data Logging 하는 방법

Apache POST Body data Logging (mod_security2) yum으로 modsecurity2 설치 후 mod_security2.so 파일이 있는지 확인 합니다. (yum 설치 기준 경로 /etc/httpd/modules) /etc/httpd/conf/httpd.conf 파일로 진입하여 Load_Module mod_security2 modules/mod_security2.so 를 입력하여 모드시큐리티 모듈을 읽어 드립니다. /etc/httpd/conf.d/ 디렉토리로 이동하여 mod_security.conf 파일을 생성 후 아래와 같이 코드를 삽입합니다. SecRuleEngine DetectionOnly SecAuditEngine On SecAuditLog /var/log/httpd..