CVE-2002-0121 in PHPinfo

Summary

by MITRE

PHP 4.0 through 4.1.1 stores session IDs in temporary files whose name contains the session ID, which allows local users to hijack web connections.

Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.

Analysis

by VulDB Data Team • 04/26/2017

This vulnerability exists in PHP versions 4.0 through 4.1.1 where session identifiers are stored in temporary files with filenames directly containing the session ID value. The flaw stems from the insecure temporary file naming convention that exposes session identifiers in the filesystem, creating a significant security risk for web applications relying on PHP session management. The vulnerability is classified as a weakness in temporary file handling and falls under the broader category of session management flaws that can lead to unauthorized access to web resources. According to CWE-377, this represents an insecure temporary file creation vulnerability where the session ID becomes directly exposed in the filesystem path, making it easily discoverable by local users.

The technical implementation of this vulnerability allows local attackers to enumerate session files in the temporary directory and extract session identifiers from their filenames. Since the session ID appears directly in the temporary file name, an attacker with local file system access can simply list the contents of the temporary directory and identify valid session files. Once the session ID is known, the attacker can use it to impersonate the legitimate user and hijack their web session. This attack vector operates at the operating system level where the temporary file naming convention exposes session data to any user with read access to the temporary directory. The vulnerability is particularly dangerous because it does not require network access or complex exploitation techniques, relying instead on simple local file system enumeration.

The operational impact of this vulnerability extends beyond simple session hijacking to potentially compromise entire web applications and user data. Attackers can gain unauthorized access to user accounts, modify session data, and perform actions as authenticated users without requiring any network-based exploitation. This type of attack can be classified under the ATT&CK framework as privilege escalation through local system access, specifically targeting credential access and persistence mechanisms. The vulnerability affects web applications that depend on PHP sessions for authentication and user state management, potentially allowing attackers to access sensitive information, perform unauthorized transactions, or maintain persistent access to compromised systems.

Mitigation strategies for this vulnerability include upgrading to PHP versions 4.1.2 or later where the temporary file naming convention was corrected, implementing proper temporary file directory permissions, and using alternative session storage mechanisms such as database or memory-based sessions. Organizations should also ensure that temporary directories have restricted access permissions and that session files are not stored with predictable naming patterns. The fix implemented in PHP 4.1.2 involved changing the temporary file naming convention to use random or hash-based filenames instead of directly embedding the session ID in the file name. Additionally, system administrators should monitor and audit temporary file directories regularly, implement proper access controls, and consider using secure session storage solutions that do not expose session identifiers in the filesystem. This vulnerability demonstrates the critical importance of secure temporary file handling practices in web application security and aligns with security best practices outlined in OWASP top ten vulnerabilities related to session management and insecure temporary file creation.

Sources

Want to know what is going to be exploited?

We predict KEV entries!