JavaMail API 1.1.3 through 1.3, as used by Apache Tomcat 5.0.16, allows remote attackers to read arbitrary files via a full pathname in the argument to the Download parameter. NOTE: Sun and Apache dispute this issue. Sun states: "The report makes references to source code and files that do not exist in the mentioned products.
Remote attackers can exploit a vulnerability in JavaMail API, potentially used by Apache Tomcat, to read arbitrary files on the server. This occurs due to a flaw in how the Download parameter handles file path inputs, leading to a critical information disclosure risk. The vulnerability's impact could lead to sensitive data breaches and system compromise.
Step 1: Craft the Request: The attacker crafts a malicious HTTP request targeting the vulnerable application (e.g., a web application using JavaMail API). The request includes a Download parameter.
Step 2: Inject the Payload: The attacker sets the value of the Download parameter to a full file path on the server (e.g., /etc/passwd or /WEB-INF/web.xml).
Step 3: Server-Side Processing: The vulnerable JavaMail API, within the context of the application (e.g., Tomcat), receives the request and attempts to process the Download parameter.
Step 4: File Read: The API, due to the lack of input validation, uses the attacker-supplied file path to open and read the contents of the specified file.
Step 5: Information Disclosure: The contents of the file are then returned to the attacker, completing the information disclosure.
The vulnerability stems from a lack of proper input validation in the JavaMail API, specifically within the handling of the Download parameter. The API fails to sanitize or validate the file path provided by the user, allowing an attacker to specify an absolute path to any file accessible by the Tomcat process. This allows for reading of sensitive files such as configuration files, passwords, or other confidential information. The root cause is a missing or insufficient check on the user-supplied input, leading to a path traversal vulnerability. The API does not properly restrict the file access to only intended files.