您的位置:首页 > 编程语言 > Java开发

记Struts2版本升级Struts 2.3.25

2016-03-22 00:00 405 查看
背景:

3月16日Apache Struts2 爆出远程代码执行漏洞,危险级别为高危。

18日客户邮件,需升级Struts2版本2.3.25(3月16日发布),21号接收此任务。

此时Apache Struts2 最新版本到2.3.28(3月19日发布)版本。

两个项目中Struts2版本是2.3.7和2.3.16。

漏洞描述:

受影响的Struts 2版本:Struts 2.0.0 – Struts Struts 2.3.24.1

建议升级到2.3.25,官方建议2.3.26。

ps:漏洞信息参考http://struts.apache.org/docs/s2-029.html

过程:

我司采用maven管理jar,当时在各大maven库没有找到Struts2-2.3.25或2.3.26版本的jar。因此直接下载了jar替换服务器的jar包。官方下载链接:https://dist.apache.org/repos/dist/dev/struts

ps:但在https://repo1.maven.org/maven2/org/apache/struts/struts2-core/2.3.28/ 找到了struts2-2.3.28版本进行maven管理。

升级直接替换7个jar包:struts2-convention-plugin-2.3.25.jar、struts2-core-2.3.25.jar、struts2-dojo-plugin-2.3.25.jar、struts2-junit-plugin-2.3.25.jar、struts2-spring-plugin-2.3.25.jar、xwork-core-2.3.25.jar、freemarker-2.3.22.jar

问题:

替换上面描述的7个jar包在,在旧版本2.3.16的项目中生效,但在2.3.7版本的项目却报错。报错信息如下:

2016-03-21 22:33:53:514:WARN catalina-exec-14 - Could not find action or result: /epo/intf/login!login.action--org.apache.struts2.dispatcher.Dispatcher

There is no Action mapped for namespace [/intf] and action name [login!login] associated with context path [/epo]. - [unknown location]

at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)

at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)

at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)

at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)

最终查询原因,发现是2.3.7版本的struts2-core.jar中的default.properties的默认配置:

struts.enable.DynamicMethodInvocation = true


动态方法调用默认为true。动态方法调用为true时,可以在struts.xml配置通配符“*”,来调用action里的方法。

而在2.3.16以及后续的版本,default.properties的默认配置:

struts.enable.DynamicMethodInvocation = false


如果要修改次参数,需在struts.properties覆盖此变量值为true。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: