owasp-modsecurity-crs检测到但未拒绝请求

时间:2017-09-21 00:20:19

标签: nginx owasp mod-security

我用ModSecurity和owasp-modsecurity-crs构建了Nginx 1.10.3,并用curl测试它。 从nginx日志开始,它可以运行,因为它已经被规则检测到,但客户端仍然获得http响应成功,而不是像403这样的预期拒绝响应。

你可以帮忙吗?是否需要任何附加配置?

[sib@sib ~]$ curl -H "User-Agent: Nikto" http://15.116.78.110
...
Welcome to nginx!
...

nginx error.log:

2017/09/20 20:11:14 [error] 20545#0: [client 15.116.79.38] ModSecurity: Warning. Matched phrase "nikto" at REQUEST_HEADERS:User-Agent. [file "/etc/nginx/owasp-modsecurity-crs/rules/REQUEST-913-SCANNER-DETECTION.conf"] [line "60"] [id "913100"] [rev "2"] [msg "Found User-Agent associated with security scanner"] [data "Matched Data: nikto found within REQUEST_HEADERS:User-Agent: nikto"] [severity "CRITICAL"] [ver "OWASP_CRS/3.0.0"] [maturity "9"] [accuracy "9"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-reputation-scanner"] [tag "OWASP_CRS/AUTOMATION/SECURITY_SCANNER"] [tag "WASCTC/WASC-21"] [tag "OWASP_TOP_10/A7"] [tag "PCI/6.5.10"] [hostname ""] [uri "/"] [unique_id "AcAcAcdcAcAcscAcRcAclc8T"]

1 个答案:

答案 0 :(得分:0)

我找到了以下解决方案:

INSTALL文件说您需要为Nginx显式加载规则文件,因为Nginx本身不使用字母加载顺序。您使用了Apache Include表单* .conf,导致Nginx在您的规则触发之前评估异常分数。 ( - > 949文件在942文件之前加载。)

按如下方式加载它们,你应该没问题:

include owasp-modsecurity-crs/crs-setup.conf
include owasp-modsecurity-crs/rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf
...
include owasp-modsecurity-crs/rules/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf