CVE-2026-5271: Python Sys Path Empty String

Assigning an empty string to an element of `sys.path` (e.g., `sys.path[0] = ""`) instructs Python to include the current working directory (CWD) in its module resolution path. This can lead to local Search Path Hijacking (CWE-426) if the script is executed from an attacker-controlled directory, allowing malicious modules to be imported in place of legitimate

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0Python
greprules fetch cve-2026-5271-python-sys-path-empty-string --engine opengrep

Description

Assigning an empty string to an element of `sys.path` (e.g., `sys.path[0] = ""`) instructs Python to include the current working directory (CWD) in its module resolution path. This can lead to local Search Path Hijacking (CWE-426) if the script is executed from an attacker-controlled directory, allowing malicious modules to be imported in place of legitimate