security - CSR 规则 _23 上的 mod_sec 触发器

标签 security apache2 mod-security

我正在使用 mod_security 和最新的核心规则。

每当我使用查询字符串时,它就会在我的所有页面上触发。即。

www.mypage.com/index.php?querystring=1

我收到一条警告,指出它超出了允许的最大争论数量,但是基本配置将 max_numb_args 定义为 = 255,当然它不会超过。

有什么想法吗?

基础配置:

SecRuleEngine On
SecAuditEngine RelevantOnly
SecAuditLog /var/log/apache2/modsec_audit.log
SecDebugLog /var/log/apache2/modsec_debug_log
SecDebugLogLevel 3
SecDefaultAction "phase:2,pass,log,status:500"
SecRule REMOTE_ADDR "^127.0.0.1$" nolog,allow
SecRequestBodyAccess On
SecResponseBodyAccess On
SecResponseBodyMimeType (null) text/html text/plain text/xml
SecResponseBodyLimit 2621440
SecServerSignature Apache
SecUploadDir /tmp
SecUploadKeepFiles Off
SecAuditLogParts ABIFHZ
SecArgumentSeparator "&"
SecCookieFormat 0
SecRequestBodyInMemoryLimit 131072
SecDataDir /tmp
SecTmpDir /tmp
SecAuditLogStorageDir /var/log/apache2/audit
SecResponseBodyLimitAction ProcessPartial
SecAction "phase:1,t:none,nolog,pass,setvar:tx.max_num_args=255"

触发的规则:

# Maximum number of arguments in request limited  
SecRule &TX:MAX_NUM_ARGS "@eq 1" "chain,phase:2,t:none,pass,nolog,auditlog,msg:'Maximum number of arguments in request reached',id:'960335',severity:'4',rev:'2.0.7'"
    SecRule &ARGS "@gt %{tx.max_num_args}" "t:none,setvar:'tx.msg=%{rule.msg}',setvar:tx.anomaly_score=+%{tx.notice_anomaly_score},setvar:tx.policy_score=+%{tx.notice_anomaly_score},setvar:tx.%{rule.id}-POLICY/SIZE_LIMIT-%{matched_var_name}=%{matched_var}"

日志输出:

--ad5dc005-C-- queryString=2 --ad5dc005-F-- HTTP/1.1 200 OK
X-Powered-By: PHP/5.3
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: SESSION=ak19oq36gpi94rco2qbi6j2k20; path=/
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 1272
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8

--ad5dc005-H--
Message: Operator GT matched 0 at ARGS. [file "/etc/apache2/conf/modsecurity_crs/base_rules/modsecurity_crs_23_request_limits.conf"] [line "30"] [id "960335"] [rev "2.0.7"] [msg "Maximum number of arguments in request reached"] [severity "WARNING"]
Message: Operator GE matched 0 at TX:anomaly_score. [file "/etc/apache2/conf/modsecurity_crs/base_rules/modsecurity_crs_49_inbound_blocking.conf"] [line "18"] [msg "Inbound Anomaly Score Exceeded (Total Score: 5, SQLi=, XSS=): Maximum number of arguments in request reached"]
Message: Warning. Operator GE matched 0 at TX:inbound_anomaly_score. [file "/etc/apache2/conf/modsecurity_crs/base_rules/modsecurity_crs_60_correlation.conf"] [line "35"] [msg "Inbound Anomaly Score Exceeded (Total Inbound Score: 5, SQLi=, XSS=): Maximum number of arguments in request reached"]
Apache-Handler: application/x-httpd-php
Stopwatch: 1279667800315092 76979 (1546* 7522 72931)
Producer: ModSeurity for Apache/2.5.11 (http://www.modsecurity.org/); core ruleset/2.0.7. Server: Apache

最佳答案

我使用的是 Ubuntu 的 lib..,它有 .11 版本。我卸载了它,从源代码 .12 版本编译,现在它还活着,又踢又尖叫!

最新的 CSR 规则需要 .12 版本。干杯。

关于security - CSR 规则 _23 上的 mod_sec 触发器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3295233/

相关文章:

google-authentication - ModSecurity 403 访问被拒绝

https - 如何重定向https ://to https://www

apache - VirtualHost 相同服务器名称不同目录

python - 让 PSP 和 Publisher 处理程序在 Apache2 mod-python 中协同工作

php - exec() 只是在我在浏览器中访问目标 php 时运行

asp.net - 使用sqlite或其他提供程序的asp.net成员资格?

java - 为什么 IntelliJ 要接受传入的网络连接?

java - 使用 JAXB XMLStreamReader 防止 XXE 攻击

c# - Aspnet_regiis 会加密存储在外部配置文件中的连接字符串信息吗?