Unsanitized User Input in File Path Traversal
Overview
Description
Remediation Guidelines
public class Cls extends HttpServlet { public void handleRequest(HttpServletRequest request, HttpServletResponse response) { String image = request.getParameter("user_profile_picture"); // normalize path Path imagePath = Paths.get("user/profile/" + FilenameUtils.getName(image)).normalize(); File file = new File(imagePath.toString()); } }
References
Configuration
Last updated