Back to all lessons
Awareness Lessons
3 days ago

Malicious PyPI Package Targets Azure and GitHub Credentials via Supply Chain Attack

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

Attackers hijacked or impersonated Microsoft's agent-framework PyPI package by publishing two trojanized versions (1.26.1 and 1.26.2) containing a credential stealer that executed automatically at Python startup via a .pth file. This technique is particularly dangerous because .pth files are processed before user code runs, making the malicious payload nearly invisible to developers who trust the package ecosystem. The malware silently exfiltrated Azure identities, GitHub tokens, and CI/CD secrets to an attacker-controlled webhook, meaning any automated build pipeline that pulled these versions could have handed over credentials without any user interaction. This incident illustrates how dependency on public package registries without integrity verification creates a silent, high-impact attack vector that bypasses most traditional security controls.

Tactical Insight

Immediate actions

  • Audit all Python environments and CI/CD pipelines for the presence of agent-framework versions 1.26.1 or 1.26.2 and remove them immediately.
  • Rotate all Azure, GitHub, and CI/CD secrets that may have been exposed in affected build environments.
  • Pin dependencies to known-good, cryptographically verified versions using hash-pinning in requirements files (e.g., `--hash` in pip).

Long-term improvements

  • Establish a private package mirror or artifact repository (e.g., Azure Artifacts, JFrog Artifactory) so all third-party packages are vetted before use.
  • Integrate software composition analysis (SCA) tooling into CI/CD pipelines to flag newly introduced or updated transitive dependencies before they execute.
  • Enforce a dependency review process that requires explicit approval for any package version change in production pipelines.

Detection measures

  • Monitor outbound network traffic from build agents for unexpected connections to external webhook or data-exfiltration endpoints.
  • Alert on the creation or modification of .pth files within Python site-packages directories in build and production environments.
  • Subscribe to PyPI security advisories and package integrity feeds (e.g., OSV, GitHub Advisory Database) to receive timely notification of malicious packages.

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.