我被我的WHM ModSecurity使用OWASP3规则绊倒了。
我想为Home>Security Center > ModSecurity Tools>Rules List中的规则列表创建一个自定义规则,如下所示:
<locationmatch "/wp-admin/admin-ajax.php">
SecRuleRemoveById 300013
SecRuleRemoveById 300015
SecRuleRemoveById 300016
SecRuleRemoveById 300017
SecRuleRemoveById 949110
SecRuleRemoveById 980130
</locationmatch>
<locationmatch "/wp-admin/page.php">
SecRuleRemoveById 300013
SecRuleRemoveById 300015
SecRuleRemoveById 300016
SecRuleRemoveById 300017
SecRuleRemoveById 949110
SecRuleRemoveById 980130
</locationmatch>
<locationmatch "/wp-admin/post.php">
SecRuleRemoveById 300013
SecRuleRemoveById 300015
SecRuleRemoveById 300016
SecRuleRemoveById 300017
SecRuleRemoveById 949110
SecRuleRemoveById 980130
</locationmatch>
我不知道如何使用modsec规则语法'SecRule / phase,等等‘来构建这个框架。
欢迎任何建议。
*这里是ModSecurity HitList的触发项
921110: HTTP请求走私攻击请求: POST / Warning /post.php动作描述:警告。理由:模式匹配"(?:get|post|head|options|connect|put|delete|trace|track|patch|propfind|propatch|mkcol|copy|move|lock|unlock)\s+(?:\/|\w)^\s*(?:\s+http\/\d|\r\n)“在ARGS:content。
941100:通过libinjection请求检测到XSS攻击: POST / Warning /post.php动作描述:警告。理由:使用液体注射检测XSS。
941160: NoScript XSS InjectionChecker: HTML请求: POST / Warning /admin-ajax.php操作描述:警告。说明:模式匹配"(?i:(?:<\w\s\S*\s\/|'"?)(?:on(?:d(?:e(?:vice(?:(?:orienta|mo)tion|proximity|found|light)|livery(?:success|error)|activate)|r(?:ag(?:e(?:n(?:ter|d)|xit)|(?:gestur|leav)e|start|drop|over)|op)|i(?:s(?:c(?:hargingtimechange .“at ARGS:action。
发布于 2022-01-14 22:51:13
核心规则设定任务发展在这里。由于你给出的排除列表来自于别人的博客文章,所以最好忽略它们。它们禁用了核心规则集的一些关键功能(您正在使用的9 9xxxxx规则是OWASP核心规则集),所以最好不要应用这些规则排除,除非您确定您知道要做什么以及为什么需要这些排除。
您引用的"HitList“中的三个条目:您确定这些条目是已知良好流量的结果吗?这些绝对是你试图更新页面时得到的403个错误吗?如果您确信这些是真正的假阳性(而不是攻击),那么让我们继续…
假阳性#1
导致假阳性的
应用规则排除意味着在WAF的安全性上戳一个洞。我们想要尽可能的具体,这样我们就只需要做最小的洞。我们只想让被错误阻塞的事务通过,仅此而已。我们不想打开一个大洞,为攻击者提供一个通过的机会。
考虑到这一点,让我们尝试采取以下方法:只排除所讨论的变量(ARGS:content),并仅将其从导致问题的规则(921110)中排除,并且只排除问题发生在(/wp/post.php)的位置。
把所有这些放在一起看上去是这样的:
SecRule REQUEST_URI "@beginsWith /wp-admin/post.php" \
"id:1000,\
phase:1,\
pass,\
nolog,\
ctl:ruleRemoveTargetById=921110;ARGS:content"
假阳性#2
导致假阳性的
我们不知道是什么变量导致了这个问题。
对于location /wp/post.php,您可以完全禁用规则941100,但这可能会导致过度(还记得我们试图制造的最小漏洞吗?)
您可能希望再次检查您的日志,以找出哪个变量导致了规则941100的问题。
假阳性#3
导致假阳性的
按照和以前一样的食谱:
SecRule REQUEST_URI "@beginsWith /wp-admin/admin-ajax.php" \
"id:1010,\
phase:1,\
pass,\
nolog,\
ctl:ruleRemoveTargetById=941160;ARGS:actions"
更多信息
有关规则排除和大量示例的更多信息,您可以自己使用和调整,请查看我们在这里的优秀文档:https://coreruleset.org/docs/configuring/false_positives_tuning/。
https://stackoverflow.com/questions/70687169
复制相似问题