目录穿越漏洞
虽然漏洞的payload非常简单,但是java的编程方法还是值得一看的。
漏洞分析
进入controller下的PathTraversal类下,可以看到如下代码。
@GetMapping("/path_traversal/vul")
public String getImage(String filepath) throws IOException {
return getImgBase64(filepath);
}
这是漏洞的产生点,传入的参数filepath没有经过任何处理就传入了getImgBase64函数中。
进入getImgBase64函数中查看
private String getImgBase64(String imgFile) throws IOException {
logger.info("Working directory: " + System.getProperty("user.dir"));
logger.info("File path: " + imgFile);
File f = new File(imgFile);
if (f.exists()