针对Struts2 系列漏洞进行记录,之前可能零零散散的看了一下,但是没有进行系统的记录,所以从头进行记录。
Demo是直接使用大佬们搭建好的,为了节约一下搭建环境的时间。
Demo地址:https://github.com/xhycccc/Struts2-Vuln-Demo
配置好Tomcat之后启动:
通过测试payload:%{1+1}
getValue:333, Ognl (ognl)
getValue:192, OgnlUtil (com.opensymphony.xwork2.util)
findValue:244, OgnlValueStack (com.opensymphony.xwork2.util)
translateVariables:123, TextParseUtil (com.opensymphony.xwork2.util)
translateVariables:72, TextParseUtil (com.opensymphony.xwork2.util)
findValue:303, Component (org.apache.struts2.components)
evaluateParams:680, UIBean (org.apache.struts2.components)
end:450, UIBean (org.apache.struts2.components)
doEndTag:36, ComponentTagSupport (org.apache.struts2.views.jsp)
入口是在username,因为我们的测试也是从username进行的。
调用this.component.end
通过调用evaluateParams来处理jsp的动态数据
解析nameValue:this.addParameter
调用TextParseUtil.translateVariables,也就是xwork2中的方法,这里就会针对ognl进行处理,那么也就是说如果找到了这个的调用位置,也就是发现了Ognl的相关漏洞
循环解析Ognl
,这里是直接调用了Ognl.getValue进行了ognl解析
在2.04中,通过判断抛出了循环,不再进行解析
以上