mod_security 룰 설정 내용
<IfModule mod_security.c>
# Turn the filtering engine On or Off
SecFilterEngine On # => 엔진 사용유무 설정
# Change Server: string
SecServerSignature " Microsoft-IIS/5.0"
# httpd.conf 에서 ServerTokens Prod 이용
# The audit engine works independently and can be turned On or Off on the per-server or
# on the per-directory basis. "On" will log everything,"DynamicOrRelevant" will log dynamic
# requests or violations, and "RelevantOnly" will only log policy violations
SecAuditEngine RelevantOnly
# => 비정상적인 것에 대하서 판결하겠다
# The name of the audit log file
SecAuditLog logs/audit_log
# => 로그를 어디에 저장할 것인가 로그 저장경로
# Should mod_security inspect POST payloads
SecFilterScanPOST On
# => post로 오는것도 필터링을 할 것인지 설정
# Action to take by default
SecFilterDefaultAction "deny,log,status:403"
# => 디폴트 액션 - 필터링 방법 " 차단하고 로그를 남기고 403에러를 내겠다"
SecFilterSelective REQUEST_METHOD "!(GET|POST|HEAD)" deny,log,status:403
# => 리퀘스트 메소드가 get post head 가 아닌경우 차단하고 로그 남기고 403에러를 낸다.
# Require Content-Length to be provided with
# every POST request
SecFilterSelective REQUEST_METHOD "^POST$" chain
SecFilterSelective HTTP_Content-Length "^$"
SecFilterSelective ARG_username admin chain
SecFilterSelective REMOTE_ADDR "!^211.47.64.5$“
SecFilterSelective REMOTE_ADDR "^127.0.0.1$" nolog,allow
SecFilterSelective THE_REQUEST "wget "
SecFilterSelective THE_REQUEST “lynx”
SecFilterSelective THE_REQUEST "mkdir"
SecFilterSelective THE_REQUEST "/tmp"
SecFilterSelective THE_REQUEST "/bin"
SecFilterSelective THE_REQUEST "/admin_/" log,pass
SecFilterSelective THE_REQUEST "/₩.bash_history"
# WEB-CGI bash access
SecFilterSelective THE_REQUEST "/bash" log,pass
SecFilterSelective THE_REQUEST "awstats" chain
SecFilterSelective ARGS "(pluginmode|loadplugin|debug|configdir|perl|cgi|chmod|exec|print)"
SecFilterSelective OUTPUT "Fatal error:" deny,status:500
# => 서버측 기반 프로그램 실행시 Fatal error 가 나오면 차단을 하고 500에러를 낸다
# 비정상 sql문이나 장애발생시 에러메세지를 통하여 페이지를 보여주지 않고 500에러로 출력
ErrorDocument 500 /php-fatal-error.html
SecFilterOutputMimeTypes "(null) text/html text/plain"
# output은 html이나 txt만 모니터링하도록 설정
<Location /cgi-bin/FormMail>
# Reject request where the value of parameter "recipient"
# does not end with "@test.com"
SecFilterSelective ARG_recipient "!@test.com$">
# => 폼메일에서 @test.com 이 아니면 차단을 한다
</Location>
SecUploadDir /tmp
SecUploadKeepFiles On
SecUploadApprovescript /full/path/to/the/script.sh # => 바이러스 체크 스크립트지정
# 업로드되는 파일에 대해 바이러스 체크등
SecFilter "delete[[:space:]]+from"
SecFilter "insert[[:space:]]+into"
SecFilter "select.+from“
SecFilter "drop[[:space:]]table"
</IfModule>
http://www.samplesite.com/login.php?username=admin';
DROP%20TABLE%20users--