简体   繁体   English

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

[英]owasp-modsecurity-crs detected but not deny the request

I built Nginx 1.10.3 with ModSecurity and owasp-modsecurity-crs, and test it with curl. 我使用ModSecurity和owasp-modsecurity-crs构建了Nginx 1.10.3,并使用curl对其进行了测试。 From the nginx log, it works since it has already been detected with rules, but the client still get http response success, not the expected deny response like 403. 从nginx日志开始,它可以工作,因为已经使用规则检测到它,但是客户端仍然获得http响应成功,而不是预期的拒绝响应(如403)。

Could you please help? 能否请你帮忙? is there any addtional configuration are required? 是否需要任何其他配置?

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

The nginx error.log: 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"]

I have found the solution below: 我在下面找到了解决方案:

The INSTALL file says you need to load the rule files explicitly for Nginx because Nginx does not use alphabetical load order by itself. INSTALL文件表示您需要为Nginx显式加载规则文件,因为Nginx本身并不使用按字母顺序排列的加载顺序。 You used the Apache Include form *.conf which resulted in Nginx evaluating the Anomaly Score before your rule triggered. 您使用了Apache Include形式* .conf,这导致Nginx在触发规则之前评估了Anomaly Score。 (-> 949 file was loaded before the 942 file). (在942文件之前已加载-> 949文件)。

Load them as follows and you should be OK: 如下加载它们,您应该可以:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM