Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
缓解CVE-2017-5638 Apache Struts2漏洞_Apache_Security_Struts2 - Fatal编程技术网

缓解CVE-2017-5638 Apache Struts2漏洞

缓解CVE-2017-5638 Apache Struts2漏洞,apache,security,struts2,Apache,Security,Struts2,如何在不更新Java代码的情况下减轻Struts 2恶意内容类型攻击 攻击详细信息。Apache的mod_rewrite可以过滤出错误的内容类型 可以进行更高级的检查-但这会检查我们不希望在传入内容类型标题中看到的字符: RewriteCond %{HTTP:Content-type} [$\#()] RewriteRule . [F,L] 我会将“%”、“}”和“{”字符添加到条件中,它们也是无效的内容类型头条目,并且存在于该漏洞的POC攻击负载中 RewriteCond %{HTTP:Co

如何在不更新Java代码的情况下减轻Struts 2恶意
内容类型
攻击


攻击详细信息。

Apache的mod_rewrite可以过滤出错误的内容类型

可以进行更高级的检查-但这会检查我们不希望在传入内容类型标题中看到的字符:

RewriteCond %{HTTP:Content-type} [$\#()]
RewriteRule . [F,L]

我会将“%”、“}”和“{”字符添加到条件中,它们也是无效的内容类型头条目,并且存在于该漏洞的POC攻击负载中

RewriteCond %{HTTP:Content-type} [$\#()%}{]
RewriteRule . [F,L]
抱歉,如果我的语法错误,因为我还没有测试这个条目


顺便说一句,我甚至会冒险添加“@”、“?”和“;”字符,但如果进行过滤,这些字符可能会破坏应用程序,因为我认为它们实际上是技术上允许的,但我从未在我们的任何应用程序实现中的内容类型标题中看到过这些字符。

您可以在完成后将其添加到httpd.conf或虚拟主机中已启用mod_重写:

# MITIGATE CVE-2017-5638
RewriteCond %{HTTP:Content-type} [$\#()%}{'"] [OR]
RewriteCond %{HTTP:Content-Disposition} [$\#()%}{'"] [OR]
RewriteCond %{HTTP:Content-Length} [$\#()%}{'"]
RewriteRule . "-" [F,L]

True-添加{}真的很有帮助。添加“and”会更好。这会让我们
RewriteCond%{HTTP:Content-type}[$\\\\()%}{']
这是一个可行的解决方案,但不要忘记html entities.Point。此外,使用黑名单验证输入总是比较困难。更可靠的解决方案是根据内容类型标题的RFC定义开发一个白名单正则表达式。但这会很快奏效。相关:它是OGNL而不是EL,所以
%
否t
$