Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Python’s popularity, ease of use, and widespread adoption make it an attractive target for malicious actors. It is commonly pre-installed or readily available on developer workstations, servers, and cloud environments, giving attackers an easily accessible tool for misuse.

Python itself does not implement privilege separation within the interpreter to limit the attack surface when executing code. Once an attacker gains the ability to run arbitrary Python code, they inherit the full privileges of the process running the interpreter — typically those of the user account executing the program. This often grants broad access to the filesystem, network, environment variables, and other system resources.

While true privilege separation cannot be reliably enforced inside Python (due to the large attack surface of the interpreter), it can be applied externally by running Python code within a sandboxed environment (e.g., using containers, seccomp filters, virtual machines, or tools like GraalVM isolates). However, no sandbox is 100% secure — escapes and bypasses remain possible, as demonstrated in various real-world vulnerabilities.

Vulnerabilities in Python programs are commonly exposed through:

A particularly significant risk is Python’s ability to execute arbitrary code provided as data. This capability underpins many injection and remote code execution (RCE) attacks, such as unsafe deserialisation (e.g., via the pickle module), eval()/exec() misuse, or dynamic code loading from untrusted sources.

Security Vulnerabilities Specific to Python Software

Beyond general environmental risks during execution, certain threat vectors are inherent to Python applications and often stem from gaps in the Software Development Life Cycle (SDLC):

The combination of Python’s powerful dynamic execution features and longstanding systemic weaknesses in development practices — such as minimal code review, inadequate dependency management, and reliance on over-privileged accounts — creates a particularly fertile environment for compromise.

common Python vulnerabilities