记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的默认配置:
动态方法调用默认为true。动态方法调用为true时,可以在struts.xml配置通配符“*”,来调用action里的方法。
而在2.3.16以及后续的版本,default.properties的默认配置:
如果要修改次参数,需在struts.properties覆盖此变量值为true。
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。
相关文章推荐
- 【JMS 4】spring 整合activemq
- Spring通过配置文件注入bean
- java synchronized VS volatile
- Java遍历删除
- Spring整合JMS(一)——基于ActiveMQ实现
- Java并发编程:volatile关键字解析
- 40个Java多线程问题总结
- Maven新建项目更改默认JDK版本
- 从头认识java-特辑-foreach在java里面两种实现原理总结
- 学java时遇到的一些小问题
- JAVA 基础 final关键字
- Java对象的序列化和反序列化
- java基础学习02(简单的java程序)
- SpringBoot配置log4j输出日志
- 3.20 JAVA
- String.getBytes()& JAVA编码转换的详细过程
- java——基础02
- Java基础小结
- Java的心路历程——杂谈向
- spring mvc4使用及json 日期转换解决方案