Pytest Security Flaw CVE-2025-71176: Local UNIX Users Risk Privilege Escalation via /tmp Directory
A critical security vulnerability in the widely-used Python testing framework, pytest, exposes UNIX systems to local privilege escalation and denial-of-service attacks. The flaw, tracked as CVE-2025-71176, stems from the framework's predictable use of directories named `/tmp/pytest-of-{user}`. This pattern allows any local user on the system to potentially interfere with or manipulate these temporary directories, creating a pathway to elevate privileges or disrupt testing operations. The vulnerability affects all versions of pytest through 9.0.2, prompting urgent dependency updates to version 9.0.3 or later.
The core of the issue lies in pytest's reliance on a predictable, user-specific temporary directory path. Because the path is not securely randomized or isolated, a malicious local actor could exploit this to overwrite files, inject code, or cause a crash. The Common Vulnerability Scoring System (CVSS) rates this as a medium-severity flaw with a score of 6.8, noting its local attack vector and the potential for impacts on confidentiality, integrity, and availability. The update to pytest 9.0.3, referenced in the GitHub pull request, is a direct security patch to mitigate this specific risk.
This vulnerability places immediate pressure on development and DevOps teams across countless Python projects to audit and update their dependencies. The risk is particularly acute in multi-user development environments, CI/CD pipelines, and shared hosting servers where local user accounts exist. Failure to patch could leave systems open to insider threats or lateral movement by attackers who gain an initial foothold. While the attack requires local access, the consequence of privilege escalation within a development or testing environment could lead to further compromise of sensitive code, build artifacts, or adjacent systems.