|
最近网络上爆发大规模的struts2远程代码执行漏洞。
漏洞说明
|
漏洞危害
|
漏洞可以远程执行任意Java代码
|
|
危险等级
|
高危
|
|
受影响版本
|
Struts 2.3.20 - Struts 2.3.28 (2.3.20.2 和 2.3.24.2 除外)
|
|
CVE
|
CVE-2016-3081
|
漏洞前提
开启动态方法调用, struts.xml配置
<constant name="struts.enable.DynamicMethodInvocation" value="true" />
沙盒绕过
通过ognl表达式静态调用获取ognl.OgnlContext的DEFAULT_MEMBER_ACCESS属性,并将获取的结果覆盖_memberAccess属性,这样就可以绕过SecurityMemberAccess的限制。
漏洞详情
https://struts.apache.org/docs/s2-032.html
http://www.freebuf.com/vuls/102836.html
临时解决方案
1. 检查是否使用struts2
2. 检查是否开启动态方法调用
3. 在struts前端nginx配置正则拦截攻击请求
正则:if($args ~ @ognl.OgnlContext@DEFAULT_MEMBER_ACCESS) { return 404;}
升级Struts 2至Struts 2.3.20.2, Struts 2.3.24.2 或者 Struts 2.3.28.1,以便彻底解决此问题。 |