CVE-2026-25645: Requests has Insecure Temp File Reuse in its extract_zipped_paths() utility function
Medium CVSS 4.4
- OSV id
- GHSA-gc5v-m9x4-r6x2
- Also known as
- CVE-2026-25645, PYSEC-2026-2275
- Published
- Last modified
Affected packages
| Package | Affected versions | Fixed in |
|---|---|---|
| requests PyPI |
< 2.33.0 | 2.33.0 |
Versions we track that it affects: requests 2.32.3, requests 2.31.0, requests 2.28.1
How to fix it
Upgrade requests to 2.33.0 or later.
# in requirements.txt: change the line to requests==2.33.0
pip install -r requirements.txt
- If it is an indirect dependency, upgrade the package that depends on it, or add a minimum version constraint for it (e.g. in constraints.txt, or as a dependency in pyproject.toml).
- Check the changelog for breaking changes (especially across major versions), update the lockfile with the package manager, and run your tests.
Not sure whether your project uses an affected version? Check your lockfile below for free.
Details
Impact
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.
Affected usages
Standard usage of the Requests library is not affected by this vulnerability. Only applications that call extract_zipped_paths() directly are impacted.
Remediation
Upgrade to at least Requests 2.33.0, where the library now 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.
References
- GHSA-gc5v-m9x4-r6x2 on OSV.dev
- Web: https://github.com/psf/requests/security/advisories/GHSA-gc5v-m9x4-r6x2
- Advisory: https://nvd.nist.gov/vuln/detail/CVE-2026-25645
- Web: https://github.com/psf/requests/commit/66d21cb07bd6255b1280291c4fafb71803cdb3b7
- Package: https://github.com/psf/requests
- Web: https://github.com/psf/requests/releases/tag/v2.33.0
Am I affected?
Upload or paste your lockfile. We check every package version in it against OSV.dev, this advisory included, and email you the vulnerable ones with the version that fixes them. Free, and no account needed.
About this data
Source: GitHub Advisory Database via OSV.dev (CC-BY 4.0). Severity comes from the advisory's own rating when it has one, else from its CVSS score.