gpt4 book ai didi

mod-security - mod_security 误报

转载 作者:行者123 更新时间:2023-12-04 00:16:25 36 4
gpt4 key购买 nike

在设置 mod_security 后,我收到了很多误报 [??]。我只是在检测中运行它,所以还没有问题,但是一旦我需要它上线,这些过滤器就会开始阻止请求。

恐怕我不能 100% 理解这些过滤器的重要性,我在几乎每个域上都有 100 个过滤器,并且所有请求看起来都是合法的。

Request Missing a User Agent Header
Request Missing an Accept Header

在这里做的最好的事情是什么?我应该禁用这些过滤器吗?我可以将严重性设置得更低,以便不会阻止请求吗?

这是一个完整的条目
[22/Nov/2011:21:32:37 --0500] u6t6IX8AAAEAAHSiwYMAAAAG 72.47.232.216 38543 72.47.232.216 80
--5fcb9215-B--
GET /Assets/XHTML/mainMenu.html HTTP/1.0
Host: www.domain.com
Content-type: text/html
Cookie: pdgcomm-babble=413300:451807c5d49b8f61024afdd94e57bdc3; __utma=100306584.1343043347.1321115981.1321478968.1321851203.4; __utmz=100306584.1321115981.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=XXXXXXXX%20clip%20ons

--5fcb9215-F--
HTTP/1.1 200 OK
Last-Modified: Wed, 23 Nov 2011 02:01:02 GMT
ETag: "21e2a7a-816d"
Accept-Ranges: bytes
Content-Length: 33133
Vary: Accept-Encoding
Connection: close
Content-Type: text/html

--5fcb9215-H--
Message: Operator EQ matched 0 at REQUEST_HEADERS. [file "/etc/httpd/modsecurity_crs/base_rules/modsecurity_crs_21_protocol_anomalies.conf"] [line "47"] [id "960015"] [rev "2.2.1"] [msg "Request Missing an Accept Header"] [severity "CRITICAL"] [tag "PROTOCOL_VIOLATION/MISSING_HEADER_ACCEPT"] [tag "WASCTC/WASC-21"] [tag "OWASP_TOP_10/A7"] [tag "PCI/6.5.10"]
Message: Operator EQ matched 0 at REQUEST_HEADERS. [file "/etc/httpd/modsecurity_crs/base_rules/modsecurity_crs_21_protocol_anomalies.conf"] [line "66"] [id "960009"] [rev "2.2.1"] [msg "Request Missing a User Agent Header"] [severity "NOTICE"] [tag "PROTOCOL_VIOLATION/MISSING_HEADER_UA"] [tag "WASCTC/WASC-21"] [tag "OWASP_TOP_10/A7"] [tag "PCI/6.5.10"]
Message: Warning. Operator LT matched 5 at TX:inbound_anomaly_score. [file "/etc/httpd/modsecurity_crs/base_rules/modsecurity_crs_60_correlation.conf"] [line "33"] [id "981203"] [msg "Inbound Anomaly Score (Total Inbound Score: 4, SQLi=5, XSS=): Request Missing a User Agent Header"]
Stopwatch: 1322015557122593 24656 (- - -)
Stopwatch2: 1322015557122593 24656; combined=23703, p1=214, p2=23251, p3=2, p4=67, p5=168, sr=88, sw=1, l=0, gc=0
Producer: ModSecurity for Apache/2.6.1 (http://www.modsecurity.org/); core ruleset/2.2.1.
Server: Apache/2.2.3 (CentOS)

最佳答案

如果您查看在生产者行中显示的审核日志条目的 H 部分,您将看到您正在使用 OWASP ModSecurity 核心规则集 (CRS) v2.2.1。在这种情况下,我建议您查看项目页面上的文档信息 -

https://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project#tab=Documentation

具体来说,您应该查看我所做的这两篇博客文章-

  • http://blog.spiderlabs.com/2010/11/advanced-topic-of-the-week-traditional-vs-anomaly-scoring-detection-modes.html
  • http://blog.spiderlabs.com/2011/08/modsecurity-advanced-topic-of-the-week-exception-handling.html

  • 博客文章#1 很有用,可以让您了解您对 CRS 使用的是哪种“操作模式”。通过查看您的审核日志,您似乎正在以异常评分模式运行。这是规则进行检测的地方,但阻止决定是通过检查 modsecurity_crs_49_inbound_blocking.conf 文件中的总体异常分数单独完成的。

    博客文章 #2 很有用,因此您可以准确决定如何处理这两个规则。如果您觉得这些对您不重要 - 那么我建议您使用 SecRuleRemoveById 指令从您自己的 modsecurity_crs_60_exceptions.conf 文件中禁用这些规则。现在的情况是,这两个警报仅生成 4 的入站异常分数 - 这低于 modsecurity_crs_10_config.conf 文件中设置的默认阈值 5,因此它不会被阻止。

    查看您的审核日志示例,虽然此请求确实生成了警报,但事务并未被阻止。如果是这样,H 部分下的消息数据将说明“拒绝访问...”。

    至于这些规则的目的 - 它们旨在标记不是从标准 Web 浏览器(IE、Chrome、Firefox 等)生成的请求,因为所有这些浏览器都会发送 User-Agent 和 Accept 请求 header 。 HTTP RFC 规范。

    最后一条评论——我建议你使用官方的 OWASP ModSecurity CRS 邮件列表来解决这些类型的问题——
    https://lists.owasp.org/mailman/listinfo/owasp-modsecurity-core-rule-set

    您还可以搜索文件以获取答案。

    干杯,
    瑞安·巴尼特
    ModSecurity 项目负责人
    OWASP ModSecurity CRS 项目负责人

    关于mod-security - mod_security 误报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8236736/

    36 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com