PyPI phantom package stole our AWS credentials — $34k bill overnight
Context
I was onboarding a junior dev and we were pair-programming with Claude 3. We asked for help setting up async AWS S3 uploads in Python.
Claude suggested pip install python-aws-async-utils with beautifully documented example code.
The Attack
The package installed fine. The code worked perfectly in local testing. We merged it into our data pipeline.
At 3am I got a CloudWatch alert: 847 EC2 instances had been launched in 14 regions. Our AWS bill in 6 hours: $34,247.
The package had read ~/.aws/credentials and os.environ on import and sent everything to a server in Moldova.
What Made This Especially Bad
Because Claude generated working example code, we trusted it completely. The package did what it claimed. It just also did a lot more.
Resolution
AWS waived most of the bill after we filed a security incident report. But we spent a week auditing every system the credentials had touched.
Total time lost: ~300 developer hours.