Compromised PyPI Package Delivers Credential-Harvesting Payload via Python Startup Hook
Written by AI from the linked story. Not reviewed by an editor. How this works
Attackers gained publishing access to Microsoft's agent-framework PyPI package and uploaded two malicious versions containing a Python startup hook that harvests cloud and CI/CD credentials without even requiring an explicit import of the package. The fact that a second malicious version was uploaded shortly after the first was quarantined reveals that the attacker retained publishing credentials throughout the incident, indicating a failure in access control revocation. This matters because developers who installed the package during the exposure window may have silently exfiltrated credentials powering their entire cloud and pipeline infrastructure. Supply chain attacks of this kind are particularly dangerous because they exploit implicit trust in legitimate, well-known packages.
Tactical Insight
Immediate actions
- Audit all environments that installed agent-framework versions 1.26.1 or 1.26.2 and rotate any cloud and CI/CD credentials present on those systems
- Remove or pin to a known-good version of the package and verify integrity via hash or lockfile before re-enabling pipelines
Access control hardening
- Enforce multi-factor authentication and least-privilege publishing roles on all package registry accounts
- Immediately revoke all publishing tokens and reissue scoped, short-lived credentials after any suspected account compromise
Long-term improvements
- Implement a software composition analysis (SCA) tool in CI/CD pipelines to detect newly flagged or yanked package versions before they reach production
- Adopt a private package mirror or artifact proxy that caches approved versions and blocks unapproved upstream updates until they pass review
- Monitor Python startup hooks and environment modifications as part of endpoint and pipeline behavioural detection