The root cause of the vulnerability (CVE-2025-46701) is the improper handling of case sensitivity in Apache Tomcat's CGI servlet when processing the pathInfo component of a URI. This allows an attacker to bypass security constraints that are applied case-sensitively. The findCGI method, in its various implementations before the final patch, was responsible for resolving the pathInfo to an actual CGI script on the server.
Initially, findCGI (often within an inner class CGIServlet$CGIEnvironment) used direct file system operations (java.io.File). On many common operating systems, file system lookups are case-insensitive or case-preserving. This meant that a pathInfo like /cgi-bin/SCRIPT.pl could bypass a security rule for /cgi-bin/script.pl but still resolve to the same script file, leading to a security constraint bypass.
Later refactoring efforts changed findCGI to use ServletContext.getResource() and ServletContext.getRealPath(). However, these methods also did not guarantee strict case-sensitive behavior consistent with how security constraints might be defined or enforced, allowing the vulnerability to persist. An attacker could still use a pathInfo with an alternative casing to bypass constraints while the servlet successfully located the script.
The provided patches show the transition from these vulnerable mechanisms to a more secure approach using the WebResource API. This API allows for more precise control and understanding of resource characteristics, including canonical paths and whether a resource is a file or directory, effectively mitigating the case sensitivity ambiguity. The vulnerable functions identified are the specific findCGI implementations that exhibited these flawed path resolution behaviors.