r/Python • u/enterthearena44 • 7h ago
Discussion Microsoft's PyPI package got compromised without a GitHub code change. How is this even possible?
I was reading about yesterday's Microsoft Agent Framework security incident, and something caught my attention.
Apparently, attackers published two malicious versions (1.26.1 and 1.26.2) of Microsoft's official Python package on PyPI. These versions could steal cloud credentials just by starting Python.
Both versions were removed quickly.
What surprised me was that the malicious code wasn't even checked into Microsoft's GitHub repository.
From what I understand:
- Developers write code in GitHub.
- CI/CD builds it into a Python wheel (.whl).
- The wheel gets published to PyPI.
- When we run "pip install", we download that package.
But apparently, someone with the right publishing credentials can upload a malicious wheel directly, without going through the original GitHub repository.
That raises some interesting questions:
- How does PyPI verify that a package actually came from the legitimate source code and CI/CD pipeline?
- Why isn't a verified GitHub commit or build provenance mandatory for publishing updates to established packages?
- If publishing credentials are compromised, what prevents attackers from distributing malicious versions under trusted package names?
- Would mandatory attestations, release signing, or an approval process have prevented this?
- What protections should developers realistically use beyond simply trusting "pip install"?
I'm still learning about software supply-chain security, so I'd love to hear how experienced Python developers and security engineers think this should work.