## 漏洞详情
在struts2中,DefaultActionMapper类支持以"action:"、"redirect:"、"redirectAction:"作为导航或是重定向前缀,但是这些前缀后面同时可以跟OGNL表达式,由于struts2没有对这些前缀做过滤,导致利用OGNL表达式调用java静态方法执行任意系统命令。
这里以“redirect:”前缀举例,struts2会将“redirect:”前缀后面的内容设置到redirect.location当中,这里我们一步步跟踪,首先是这个getMapping函数跟入

这里一直到这个handleSpecialParameters(),继续跟入


这里真正传入OGNL表达式是在这个parameterAction.execute()中,继续跟入来到DefaultActionMapper.java的代码

然而上面的过程只是传递OGNL表达式,真正执行是在后面,这里是在FilterDispatcher类中的dispatcher.serviceAction()方法,这里的mapping对象中设置了传入的OGNL

这里跟入方法最终会在TextParseUtil这个类的调用stack.findValue()方法执行OGNL。

详情来源:http://drops.wooyun.org/papers/902
暂无评论