WAF Modsecurity CRS 规则不扣除 HTML 标签

问题描述 投票:0回答:1

我们在我们的 nginx 网络服务器中使用了 modsecurity nginx owasp coreruleset-3.3。以下是网络用户界面的输入。

1. {
  "data": {
    "id": 1002,
    "email": "[email protected]",    
    "name": "ske<h1 onmouseover='console.log(\"js\")'>test</h1>",
    "locale": "en",
    "category": 1,
    "status": 0,
  }
}

2. {
  "data": {
    "id": 1002,
    "email": "[email protected]",    
    "name": "ske<img src=''onerror='alert(1)'>",
    "locale": "en",
    "category": 1,
    "status": 0,
  }
}

3. {
  "data": {
    "id": 1002,
    "email": "[email protected]",    
    "name": "ske<h1>test</h1>",
    "locale": "en",
    "category": 1,
    "status": 0,
  }
}

输入 1 和 2 由 HTML 注入 crs 规则 941 触发,但输入 3 crs 规则 941320 未触发 HTML 标记处理程序。

我们需要通过 modsec crs 规则阻止所有 3 个输入。

使用 coreruleset 版本 v3.3

请帮忙

html nginx owasp mod-security
1个回答
0
投票

I̶ ̶t̶h̶i̶n̶k̶ ̶t̶h̶i̶s̶ ̶i̶s̶ ̶a̶ ̶t̶y̶p̶i̶c̶a̶l̶ ̶e̶x̶a̶m̶p̶l̶e̶ ̶o̶f̶ ̶f̶a̶l̶s̶e̶ ̶p̶o̶s̶i̶t̶i̶v̶e̶ ̶m̶a̶t̶c̶h̶ ̶(̶F̶P̶)̶.̶ ̶T̶h̶e̶ ̶s̶o̶l̶u̶t̶i̶o̶n̶ ̶i̶s̶ ̶t̶o̶ ̶m̶a̶k̶e̶ ̶a̶ ̶c̶u̶s̶t̶o̶m̶ ̶e̶x̶c̶l̶u̶s̶i̶o̶n̶.

编辑:(对不起,那是我的错误...)

但不幸的是我无法重现你的问题。我使用 Apache+mod_security2 和 Nginx+libmodsecurity3 测试了上面的所有请求(1、2 和 3),但在所有情况下都触发了规则 941320。

查看 Apache 和 Nginx 的日志行(尤其是

[data]
字段值)。

ModSecurity: Warning. Pattern match "<(?:a|abbr|acronym|address|applet|area|audioscope|b|base|basefront|bdo|bgsound|big|blackface|blink|blockquote|body|bq|br|button|caption|center|cite|code|col|colgroup|comment|dd|del|dfn|dir|div|dl|dt|em|embed|fieldset|fn|font|form|frame|frameset|h1|head ..." at ARGS:data.name. [file "/home/airween/src/coreruleset/rules/REQUEST-941-APPLICATION-ATTACK-XSS.conf"] [line "784"] [id "941320"] [msg "Possible XSS Attack Detected - HTML Tag Handler"] [data "Matched Data: <h1> found within ARGS:data.name: ske<h1>test</h1>"]
ModSecurity: Warning. Matched "Operator `Rx' with parameter `<(?:a|abbr|acronym|address|applet|area|audioscope|b|base|basefront|bdo|bgsound|big|blackface|blink|blockquote|body|bq|br|button|caption|center|cite|code|col|colgroup|comment|dd|del|dfn|dir|div|dl|dt|e (452 characters omitted)' against variable `ARGS:json.data.name' (Value: `ske<h1>test</h1>' ) [file "/home/airween/src/coreruleset/rules/REQUEST-941-APPLICATION-ATTACK-XSS.conf"] [line "765"] [id "941320"] [rev ""] [msg "Possible XSS Attack Detected - HTML Tag Handler"] [data "Matched Data: <h1> found within ARGS:json.data.name: ske<h1>test</h1>"]

请注意,上面的 JSON 请求是错误的:字段

,
后面的
"status": 0,
不是必需的。但这可能只是一个错字。

© www.soinside.com 2019 - 2024. All rights reserved.