【问题标题】:mod_security blocks only internet explorermod_security 仅阻止 Internet Explorer
【发布时间】:2012-06-08 02:52:10
【问题描述】:

我用 apache 服务器安装了 mod_security,现在它只阻止了 ie7/8/9 浏览器。 (我可以用 firefox/chromium/etc 浏览网页)

日志说:

Message: String match within "Proxy-Connection Lock-Token Content-Range Translate via if" at REQUEST_HEADERS_NAMES:Connection. [file "/etc/apache2/mod_security/modsecurity_crs_30_http_policy.conf"] [line "99"] [id "960038"] [msg "HTTP header is restricted by policy"] [data "Connection"] [severity "WARNING"] [tag "POLICY/HEADER_RESTRICTED"] [tag "POLICY/FILES_NOT_ALLOWED"] [tag "WASCTC/WASC-21"] [tag "OWASP_TOP_10/A7"] [tag "PCI/12.1"] [tag "WASCTC/WASC-15"] [tag "OWASP_TOP_10/A7"] [tag "PCI/12.1"]
Message: Access denied with code 403 (phase 2). [file "/etc/apache2/mod_security/modsecurity_crs_49_enforcement.conf"] [line "25"] [msg "Anomaly Score Exceeded (score 20): Common SPAM/Email Harvester crawler"]
Action: Intercepted (phase 2)
Stopwatch: 1337888078594451 2694 (918 2353 -)
Producer: ModSecurity for Apache/2.5.12 (http://www.modsecurity.org/); core ruleset/2.0.6.
Server: Apache

而规则 id "960038" 是:

SecRule REQUEST_HEADERS_NAMES "@within %{tx.restricted_headers}""phase:2,t:none,pass,nolog,auditlog,msg:'HTTP header is restricted by policy',id:'960038',tag:'POLICY/HEADER_RESTRICTED',tag:'POLICY/FILES_NOT_ALLOWED',tag:'WASCTC/WASC-21',tag:'OWASP_TOP_10/A7',tag:'PCI/12.1',tag:'WASCTC/WASC-15',tag:'OWASP_TOP_10/A7',tag:'PCI/12.1',severity:'4',logdata:'%{matched_var}',setvar:'tx.msg=%{rule.msg}',setvar:tx.anomaly_score=+%{tx.warning_anomaly_score},setvar:tx.policy_score=+%{tx.warning_anomaly_score},setvar:tx.%{rule.id}-POLICY/HEADERS_RESTRICTED-%{matched_var_name}=%{matched_var}"

我有一个主要问题,另外两个源自第一个问题:

  • 我怎么知道这条规则的含义?
    • 忽略此规则是否安全?
    • 有没有办法修改规则以允许 ie 浏览网页?

【问题讨论】:

    标签: apache mod-security2


    【解决方案1】:
    1. 回答您的第一个问题 Mod-Security 为我们提供了一个非常 有关其规则语言的语法的详细文档和 以下是其文档的链接。 ModSecurity Rule Language

    2. TX 用于用户定义的变量 tx.restricted_headers 它定义 您的 HTTP 策略,如

      SecAction "phase:1,t:none,nolog,pass,setvar:'tx.restricted_headers=/Proxy-Connection/ /Lock-Token/ /Content-Range/ /Translate/ /via/ /if/'" 有关更多详细信息,请参阅HTTP Policy

    3. 您上面提到的规则不是阻止,而是 增加针对可疑标头维护的数值 我在上面解释的 HTTP 策略中提到的名称。

    4. 从提到的日志中可以看出阻止 IE 的规则

      消息:访问被拒绝,代码为 403(第 2 阶段)。 [file "/etc/apache2/mod_security/modsecurity_crs_49_enforcement.conf"] [line "25"] [msg "Anomaly Score Exceeded (score 20): Common SPAM/Email Harvester crawler"]

    您可以修改异常分数阈值,也可以更改您的 HTTP 策略。您提到的规则是正确的,不需要评论。希望您明白我的意思

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-19
      • 1970-01-01
      • 1970-01-01
      • 2012-10-01
      • 2020-06-09
      • 2012-11-06
      • 2013-04-10
      相关资源
      最近更新 更多