Back to all lessons
Awareness Lessons
2 weeks ago

Microsoft PyPI Package Hijacked to Harvest Cloud Credentials

Written by AI from the linked story. Not reviewed by an editor. How this works

Attackers compromised Microsoft's official Agent Framework PyPI package, injecting malware into versions 1.26.1 and 1.26.2 that automatically executed on Python startup to steal cloud credentials from Azure, AWS, and GitHub. This is a classic software supply chain attack: developers who installed or updated the package in good faith became unwitting victims without any vulnerability in their own code. The fact that a second malicious version was published shortly after the first was removed highlights the need for robust publisher account security and rapid, coordinated response between maintainers and package repositories. Organizations relying on third-party packages without integrity verification or dependency pinning are particularly exposed, as a single compromised update can silently exfiltrate sensitive credentials at scale.

Tactical Insight

Immediate actions

  • Audit all environments that installed versions 1.26.1 or 1.26.2 of the Agent Framework package and rotate any cloud credentials (Azure, AWS, GitHub) exposed on those systems.
  • Pin dependencies to known-good, verified versions and use hash-based lockfiles (e.g., `pip-compile` with `--generate-hashes`) to prevent automatic ingestion of malicious updates.
  • Enable PyPI package integrity verification and check published checksums against trusted sources before deploying any update.

Long-term improvements

  • Implement a private internal package mirror or proxy (e.g., Artifactory, Nexus) where all third-party packages are vetted before they reach developer or production environments.
  • Enforce multi-factor authentication and hardware security keys on all accounts that have publish rights to official package repositories.
  • Establish a software bill of materials (SBOM) process so the organization knows exactly which third-party package versions are running in every environment.

Detection measures

  • Deploy runtime monitoring and endpoint detection tools capable of alerting on anomalous network connections or credential file access initiated during Python interpreter startup.
  • Integrate software composition analysis (SCA) tooling into CI/CD pipelines to flag newly published package versions for review before they are permitted into builds.

Back this up with a control

All controls and vendors

Training helps people spot this. These controls make the attack fail even on the day someone does not.