Incident: A trusted package changed hands
Module 7 · Incident file · About 30 minutes
What happened
In May 2022 the Python Package Index, PyPI, reported on its blog that a package called ctx had been taken over. ctx was an old package that its author had stopped working on. Someone else gained control of it and published new versions under the same name.
Those new versions did something the old ones never did. When they ran, they collected the computer's environment variables, the named settings every program can read, and sent them to the attacker. Environment variables often hold secrets, such as passwords and access keys for online services, so those secrets went too.
This file keeps to those facts; the PyPI blog post of May 2022 tells the full story. What matters here is the shape of the failure. Nobody installed a stranger's package. People installed a name they already trusted, and the code behind the name had changed.