« All posts

Python Bytecode: The Security Blind Spot Beyond Source Review

Study of over 1M PyPI packages shows Python .pyc bytecode bypasses source-level security review, exposing CPython to crashes and memory-corruption bugs.

A new empirical study reveals that Python's security tooling is overwhelmingly source-centric, even though CPython runtimes can execute bytecode directly via .pyc files and compiled-only modules. Scanning over one million PyPI artifacts, researchers identified thousands of bytecode-containing packages, a meaningful share of which ship as source-less compiled files—invisible to typical code-review pipelines.

The study found that modern decompilers can emit source for nearly all in-scope CPython 3.8–3.14 bytecode files, but this emission does not guarantee functional equivalence to the original code. More concerning, both real-world PyPI bytecode and adversarially mutated bytecode reliably trigger exceptions, timeouts, and even native process crashes in decompiler tools and the CPython interpreter itself.

Fuzzing surfaced over a thousand distinct runtime findings dominated by pointer-dereference bugs, with a substantial subset showing memory-corruption characteristics—and the vast majority reaching execution past the interpreter's documented-unsafe ingestion boundary. Critically, none of these issues reproduce from ordinary Python source code, meaning bytecode constitutes an independent, largely unmonitored attack surface that current supply-chain security tooling fails to cover.