好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

Struts1 ClassLoader 漏洞解决方案 - 网站

与struts2类似,很多J2EE开发框架在实现参数数据绑定时存在越权操作class对象问题。早期apache基金会开发的struts1框架也不例外。2014年4月27日,apache struts官方已确认struts1框架存在classloader操控漏洞:

 

The Struts security team confirmed thatclassloader manipulation is also possible in Struts 1  

但apache struts官方表示:struts1已经 EOF 了,漏洞不予修复。  

从互联网应用来看,使用struts1的java web应用还是广泛存在。为了方便struts1框架的[忠实粉丝],腾讯安全应急响应中心分享了Struts1 ClassLoader漏洞修复补丁,建议广大厂商尽快修复漏洞。  

修复原理:  

思路:只需在参数绑定之前过滤掉含有恶意代码的请求参数,便可以达到修复漏洞的目的(与struts2修复思路类似)。

在struts1中,存在这么一个类: org.apache.struts.util.RequestUtils , 该类用于处理ActionForm request参数。而 org.apache.struts.util.RequestUtils 类的调用执行发生于参数绑定之前。  

简单说来,修改该类源码,添加类似struts2的正则过滤代码,便可修复漏洞。详细java代码如下:  

 

/* 2014/04/27 - CVE-2014-0114 security problem patch. */ public static final String regex ="(.*\\.|^|.*|\\[('|\")) (c|C)  lass(\\.|('|\")]|\\[).*"; if (stripped.matches(regex)) { log.info("ignoreparameter: paramName=" + stripped); continue; }

 

只要请求的参数名匹配上恶意代码规则,循环便continue跳过该参数的处理过程。  

修复方案:  

由于struts1 1.2系列版本和1.3系列版本存在较大差异,腾讯安全应急响应中心推出2大系列版本的升级补丁。

对于struts1.2.*系列版本,可删除J2EE lib目录下的struts.jar,替换成附件中的struts.jar;

对于struts1.3.*系列版本,可替换J2EE lib目录下的struts-core-1.3.xxx.jar为附件中的struts-core-1.3.10.1.jar

然后重启webserver即可修复漏洞。 struts1 补丁下载

查看更多关于Struts1 ClassLoader 漏洞解决方案 - 网站的详细内容...

  阅读:84次