CVE-2026-25645: CWE-377: Insecure Temporary File in psf requests
Requests is a HTTP library. Prior to version 2.33.0, the `requests.utils.extract_zipped_paths()` utility function uses a predictable filename when extracting files from zip archives into the system temporary directory. If the target file already exists, it is reused without validation. A local attacker with write access to the temp directory could pre-create a malicious file that would be loaded in place of the legitimate one. Standard usage of the Requests library is not affected by this vulnerability. Only applications that call `extract_zipped_paths()` directly are impacted. Starting in version 2.33.0, the library extracts files to a non-deterministic location. If developers are unable to upgrade, they can set `TMPDIR` in their environment to a directory with restricted write access.
AI Analysis
Technical Summary
The vulnerability CVE-2026-25645 affects the Python Requests library versions prior to 2.33.0. The issue lies in the function requests.utils.extract_zipped_paths(), which is used internally by HTTPAdapter.cert_verify() to load the CA bundle, often sourced from the certifi package's zipapp structure. This function extracts certificate files into the system's temporary directory (/tmp) using a predictable filename, such as cacert.pem. Before extraction, it checks if the file already exists and reuses it without verifying its contents or ensuring atomic, unique extraction. This insecure temporary file handling (CWE-377) allows a local attacker to pre-create a malicious CA bundle file in /tmp with the same name. When a vulnerable application running with higher privileges initializes the Requests library, it trusts the attacker-controlled CA bundle, potentially allowing the attacker to manipulate certificate validation processes. This can lead to integrity violations, such as accepting forged certificates, enabling man-in-the-middle attacks or code injection in TLS-secured communications. The vulnerability requires local access with low privileges and user interaction, as the attacker must place the malicious file before the vulnerable process runs. The patch in Requests 2.33.0 addresses this by implementing secure extraction methods that use unique, non-predictable temporary filenames and verify file integrity, preventing reuse of attacker-controlled files.
Potential Impact
The primary impact of this vulnerability is the compromise of integrity in TLS certificate validation within applications using the vulnerable Requests library. By tricking the application into trusting a malicious CA bundle, an attacker can perform man-in-the-middle attacks, intercept or alter supposedly secure communications, or inject malicious content. This undermines the trust model of TLS and can lead to further exploitation such as credential theft, data manipulation, or unauthorized access. Since exploitation requires local access, the threat is significant in multi-user systems, shared hosting environments, or containerized platforms where untrusted users have some level of access. The vulnerability does not directly affect confidentiality or availability but can indirectly lead to data breaches or system compromise through trust violations. Organizations relying on Requests for secure HTTP communications, especially in environments where local users exist, face increased risk until patched. The absence of known exploits in the wild reduces immediate risk but does not eliminate the threat due to the ease of local file manipulation.
Mitigation Recommendations
To mitigate this vulnerability, organizations should upgrade the Requests library to version 2.33.0 or later, where the issue is patched. For environments where immediate upgrade is not feasible, implement strict access controls on the system's temporary directories to prevent untrusted users from creating or modifying files such as /tmp/cacert.pem. Use filesystem permissions and mount options like noexec and nodev on /tmp to reduce risk. Employ containerization or sandboxing to isolate processes using Requests from untrusted local users. Additionally, monitor and audit /tmp for unexpected files or changes to certificate bundles. Developers should avoid running Requests-based applications with elevated privileges unnecessarily and consider using alternative certificate loading mechanisms that do not rely on temporary file extraction. Finally, educate local users about the risks of placing files in shared temporary directories and enforce policies to restrict such behavior.
Affected Countries
United States, Germany, United Kingdom, France, Japan, South Korea, India, Canada, Australia, Netherlands, Brazil
CVE-2026-25645: CWE-377: Insecure Temporary File in psf requests
Description
Requests is a HTTP library. Prior to version 2.33.0, the `requests.utils.extract_zipped_paths()` utility function uses a predictable filename when extracting files from zip archives into the system temporary directory. If the target file already exists, it is reused without validation. A local attacker with write access to the temp directory could pre-create a malicious file that would be loaded in place of the legitimate one. Standard usage of the Requests library is not affected by this vulnerability. Only applications that call `extract_zipped_paths()` directly are impacted. Starting in version 2.33.0, the library extracts files to a non-deterministic location. If developers are unable to upgrade, they can set `TMPDIR` in their environment to a directory with restricted write access.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability CVE-2026-25645 affects the Python Requests library versions prior to 2.33.0. The issue lies in the function requests.utils.extract_zipped_paths(), which is used internally by HTTPAdapter.cert_verify() to load the CA bundle, often sourced from the certifi package's zipapp structure. This function extracts certificate files into the system's temporary directory (/tmp) using a predictable filename, such as cacert.pem. Before extraction, it checks if the file already exists and reuses it without verifying its contents or ensuring atomic, unique extraction. This insecure temporary file handling (CWE-377) allows a local attacker to pre-create a malicious CA bundle file in /tmp with the same name. When a vulnerable application running with higher privileges initializes the Requests library, it trusts the attacker-controlled CA bundle, potentially allowing the attacker to manipulate certificate validation processes. This can lead to integrity violations, such as accepting forged certificates, enabling man-in-the-middle attacks or code injection in TLS-secured communications. The vulnerability requires local access with low privileges and user interaction, as the attacker must place the malicious file before the vulnerable process runs. The patch in Requests 2.33.0 addresses this by implementing secure extraction methods that use unique, non-predictable temporary filenames and verify file integrity, preventing reuse of attacker-controlled files.
Potential Impact
The primary impact of this vulnerability is the compromise of integrity in TLS certificate validation within applications using the vulnerable Requests library. By tricking the application into trusting a malicious CA bundle, an attacker can perform man-in-the-middle attacks, intercept or alter supposedly secure communications, or inject malicious content. This undermines the trust model of TLS and can lead to further exploitation such as credential theft, data manipulation, or unauthorized access. Since exploitation requires local access, the threat is significant in multi-user systems, shared hosting environments, or containerized platforms where untrusted users have some level of access. The vulnerability does not directly affect confidentiality or availability but can indirectly lead to data breaches or system compromise through trust violations. Organizations relying on Requests for secure HTTP communications, especially in environments where local users exist, face increased risk until patched. The absence of known exploits in the wild reduces immediate risk but does not eliminate the threat due to the ease of local file manipulation.
Mitigation Recommendations
To mitigate this vulnerability, organizations should upgrade the Requests library to version 2.33.0 or later, where the issue is patched. For environments where immediate upgrade is not feasible, implement strict access controls on the system's temporary directories to prevent untrusted users from creating or modifying files such as /tmp/cacert.pem. Use filesystem permissions and mount options like noexec and nodev on /tmp to reduce risk. Employ containerization or sandboxing to isolate processes using Requests from untrusted local users. Additionally, monitor and audit /tmp for unexpected files or changes to certificate bundles. Developers should avoid running Requests-based applications with elevated privileges unnecessarily and consider using alternative certificate loading mechanisms that do not rely on temporary file extraction. Finally, educate local users about the risks of placing files in shared temporary directories and enforce policies to restrict such behavior.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-02-04T05:15:41.791Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 69c41848f4197a8e3b706bce
Added to database: 3/25/2026, 5:15:52 PM
Last enriched: 3/25/2026, 5:31:55 PM
Last updated: 3/26/2026, 6:29:19 AM
Views: 56
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.