【问题标题】:How to configuration Modsecurity logs?如何配置 Modsecurity 日志?
【发布时间】:2022-01-24 14:16:43
【问题描述】:

【问题讨论】:

    标签: apache mod-security mod-security2


    【解决方案1】:

    CRS 开发人员在这里。确实,默认情况下日志包含大量信息。也许您可以通过使用 JSON 作为日志格式来帮助您。您可以通过添加:

    SecAuditLogFormat JSON
    

    到您的 mod_security.conf 文件。 (注意:我没有 Windows 经验,所以我不知道配置文件的确切名称和位置)。

    然后,对于每个记录的事件,日志每行包含一个 JSON 对象。您可以使用jq 实用程序来漂亮地打印 JSON 或仅选择感兴趣的部分。

    例如,如果您只想查看匹配的规则消息,您可以像这样使用jq

    curl 'https://sandbox.coreruleset.org/?test=posix_uname(123)' | jq .audit_data.messages
    
    [
      "Warning. Matched phrase \"posix_uname\" at ARGS:test. [file \"/etc/modsecurity.d/owasp-crs/rules/REQUEST-933-APPLICATION-ATTACK-PHP.conf\"] [line \"294\"] [id \"933150\"] [msg \"PHP Injection Attack: High-Risk PHP Function Name Found\"] [data \"Matched Data: posix_uname found within ARGS:test: posix_uname(123)\"] [severity \"CRITICAL\"] [ver \"OWASP_CRS/3.3.2\"] [tag \"modsecurity\"] [tag \"application-multi\"] [tag \"language-php\"] [tag \"platform-multi\"] [tag \"attack-injection-php\"] [tag \"paranoia-level/1\"] [tag \"OWASP_CRS\"] [tag \"capec/1000/152/242\"]",
      "Warning. Operator GE matched 5 at TX:anomaly_score. [file \"/etc/modsecurity.d/owasp-crs/rules/REQUEST-949-BLOCKING-EVALUATION.conf\"] [line \"93\"] [id \"949110\"] [msg \"Inbound Anomaly Score Exceeded (Total Score: 5)\"] [severity \"CRITICAL\"] [ver \"OWASP_CRS/3.3.2\"] [tag \"modsecurity\"] [tag \"application-multi\"] [tag \"language-multi\"] [tag \"platform-multi\"] [tag \"attack-generic\"]",
      "Unconditional match in SecAction. [file \"/etc/modsecurity.d/crs-demo-setvar.conf\"] [line \"11\"] [id \"100000\"] [tag \"modsecurity\"]",
      "Warning. Operator GE matched 5 at TX:inbound_anomaly_score. [file \"/etc/modsecurity.d/owasp-crs/rules/RESPONSE-980-CORRELATION.conf\"] [line \"91\"] [id \"980130\"] [msg \"Inbound Anomaly Score Exceeded (Total Inbound Score: 5 - SQLI=0,XSS=0,RFI=0,LFI=0,RCE=0,PHPI=5,HTTP=0,SESS=0): individual paranoia level scores: 5, 0, 0, 0\"] [ver \"OWASP_CRS/3.3.2\"] [tag \"modsecurity\"] [tag \"event-correlation\"]"
    ]
    

    【讨论】:

    • 哦,非常感谢。
    猜你喜欢
    • 2016-08-29
    • 2012-08-29
    • 2011-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-05
    • 2017-07-17
    相关资源
    最近更新 更多