Ask HN: Why no AI-led memory vulns in Python? 10 points · 2 comments TL;DR A tex...
HN Best 200 @best
Ask HN: Why no AI-led memory vulns in Python? 10 points · 2 comments
TL;DR A text post asks why AI-assisted vulnerability hunting has produced many memory-corruption bugs in C code, yet few in Python, even though CPython is written in C. The one commenter argues it may be a matter of time, pointing to memory-safety issues in Ruby and fuzzing findings in Python, while a second commenter says those reasons do not explain the absence of a Python equivalent of Ruby's exploits.
- The poster notes that Python usually means CPython, which is implemented in C, and that most recent AI-found vulnerabilities have been memory mismanagement bugs.
- The question is what keeps Python isolated from that class of bug given its C implementation.
- Commenter zahlman says Ruby has recently had serious issues in string case conversion and the regex engine, and that Python fuzzing has found real bugs, though not on the same scale.
- Zahlman argues the interface to compiled code (C extensions and bytecode) was never meant to be secure, since a crafted code object can segfault and ctypes can corrupt memory.
- Zahlman suggests the normal paths are well tested and that the interpreter's dynamic behaviour makes it slower and harder to optimise, while the frequently changing bytecode format may leave room for mistakes.
Discussion The thread is short, with only two comments. The first is a detailed reply that cites Ruby CVEs and Python fuzzing work and offers possible explanations for why Python has been less exposed. The second is a brief rebuttal saying those explanations do not account for the lack of a comparable Python exploit. The mood is curious and analytical rather than heated.
- Python's absence of bugs may simply be a matter of time (some): Zahlman argues that Ruby already shows similar memory and parsing bugs and that Python has had fuzzing finds, so the gap may just reflect less scrutiny or effort. Python's bytecode format changes almost every release, which could add room for mistakes.
- Offered explanations do not answer the question (some): The second commenter says the reasons given, such as the insecure compiled-code interface and the slow interpreter, do not explain why no python2shell-style exploit has appeared.
Links from the comments