


<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<init-param><param-name>readonly</param-name><param-value>false</param-value></init-param>
<load-on-startup>1</load-on-startup>
</servlet>
protected void doPut(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
if (this.readOnly)
{
resp.sendError(403);
return;
}
String path = getRelativePath(req);
.........
try
{
Resource newResource = new Resource(resourceInputStream);
if (exists) {
this.resources.rebind(path, newResource);
} else {
this.resources.bind(path, newResource);
}
}
catch (NamingException e)
{
result = false;
}
.........
}
生成文件的语句为 this.resources.bind(path, newResource);和 this.resources.rebind(path, newResource);,而this.resources对象是由init()的下面的代码实例化的

点进ProxyDirContext找一下bind方法,可以看到这里面又用了this.dirContext.bind(),继续往下跟代码

继续往下,最后跳到到了FileDirContext.java的bind(),这里面又调用rebind()方法


最后通过rebind方法生成文件

Tomcat PUT高危漏洞(CVE-2017-12615)复现与分析
原文:https://www.cnblogs.com/kimjun/p/13348063.html