r/Python • • 17d 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

464 Upvotes

57 comments sorted by

View all comments

228

u/pingveno pinch of this, pinch of that 17d ago • Bravo

Time to set dependency cooldowns!

pip --uploaded-prior-to

uv, set it in [tool.uv] under exclude-newer. I use 7 days.

Rust also just added it to Cargo in the 1.100.0 release, for pyo3 extensions.

25

u/HexDecimal 17d ago

Can also set environment variables globally, for example PIP_UPLOADED_PRIOR_TO=P3D, to make cooldowns the default for pip.

uv also has UV_EXCLUDE_NEWER=7 days, etc.

1

u/zurtex 17d ago

FYI uv and pip (26.1+) both accept the same PnD syntax, so you can use P3D or P7D for both.

6

u/russellvt 17d ago

Thanks for this ... it should likely be pinned to the top of this subreddit, likely in the wiki.

3

u/pingveno pinch of this, pinch of that 17d ago

Your comment made me think of making a website, but of course someone already did that.

1

u/russellvt 16d ago

Yeah, I'm sure there's quite a few of them... but, I'm not looking for "a website" or blog - just an easy reference / FAQ here (for now).

8

u/Rotcod 17d ago

Legend

2

u/UloPe 17d ago

And then you get hit with a zero day.

Damned if you don’t, damned if you do…

1

u/pingveno pinch of this, pinch of that 17d ago

Most have an escape hatch, if you need a specific package to be updated. So with uv, if you needed the latest certifi:

[uv.tool.exclude-newer-package]
certifi = false

1

u/UloPe 17d ago

Unless you can see the future I don’t understand how this would help.

1

u/pingveno pinch of this, pinch of that 17d ago

Turn it on temporarily if you need to pull in a package because of a CVE. Unless you're saying literally a zero day? But that's irrelevant, but zero days by definition don't have a fix out.