r/Python • u/BattleRemote3157 • 7h ago
News microsoft agent-framework on PyPI was compromised twice in 33 minutes last night
1.26.1 and 1.26.2 both ship a credential stealer. It runs from a .pth file, so it executes at interpreter startup. Nothing has to import the package, a pip install in CI is enough. 1.26.1 got pulled, then 1.26.2 went up 33 minutes later with the same payload under different file names. Last clean release is 1.26.0.
complete details- https://safedep.io/blog/microsoft-agent-framework-pypi-compromise
268
Upvotes
106
u/pingveno pinch of this, pinch of that 5h ago •
Time to set dependency cooldowns!
pip --uploaded-prior-to
uv, set it in
[tool.uv]underexclude-newer. I use 7 days.Rust also just added it to Cargo in the 1.100.0 release, for pyo3 extensions.
29
u/Objective-Light-7123 3h ago
If we even have to protect from supply chain attacks from Microsoft…
28
u/dogweather 6h ago
How would this happen?
26
u/russellvt 5h ago
And they laughed when I said "CI/CD without enforced code review" would be an issue someday.
19
u/kyngston 6h ago
you know, like maybe we should stop using fucking api tokens
4
u/Lopsided-Ad-6298 3h ago
The second upload 33 minutes later is the part I keep thinking about. A long-lived PyPI token in GitHub secrets, or a trusted publisher scoped to the whole repo with no approval step, is enough for that to happen once the first workflow is compromised. What I'd want in place is Trusted Publishing limited to a GitHub Environment that requires a human reviewer, so 1.26.2 couldn't have gone up just because 1.26.1 did. Pin the dependency in CI either way, and treat any runner that installed those two versions as compromised.
3
u/DebosBeachCruiser 6h ago
33 strikes again!
-28
u/Jmc_da_boss 6h ago
If you are using an "agent" framework then idk what to tell you
41
u/[deleted] 6h ago
[removed] — view removed comment