As reported by Elastic Security Labs, a supply-chain compromise of the popular agent-framework PyPI package demonstrates exactly how fast a malicious upload can weaponize the Python ecosystem. Versions 1.26.1 and 1.26.2, published on November 17, 2026, contained a credential stealer embedded in a .pth startup hook — a mechanism that executes code automatically every time the Python interpreter launches, with no import required. Elastic's supply-chain monitor flagged the package as malicious within six minutes of publication, but the damage window for any host that pulled either version is severe.
Why This Compromise Is Especially Dangerous
The .pth hook technique is what makes this attack particularly insidious. Python's site module processes .pth files in site-packages on every interpreter startup. Any line beginning with import in a .pth file is executed as code — before the user's script runs, before any application logic, and regardless of whether the package is ever explicitly imported. This means simply having the malicious package installed on a host is sufficient for compromise.
The stealer targeted a broad credential surface:
The attacker didn't just steal static credentials — they minted fresh cloud tokens via OIDC and IMDS, which means a compromised build agent could pivot directly into the Azure subscription backing it. This is lateral movement to cloud infrastructure by design.
Who Is at Risk
With approximately 196,000 monthly downloads, the agent-framework package has a significant footprint. The populations most exposed include:
- CI/CD build agents running in Azure DevOps or GitHub Actions pipelines — these hosts typically hold long-lived tokens and OIDC permissions that grant subscription-level access
- Developer workstations with Azure CLI, Docker, git, and npm credentials cached locally
- ML/AI engineering teams using Hugging Face credentials alongside the Microsoft Agent Framework for AI agent orchestration
- Container build environments where Python images are constructed with the compromised package as a dependency
Compromise Assessment Table
| Attribute | Detail |
|---|---|
| Package | agent-framework (PyPI) |
| Compromised Versions | 1.26.1, 1.26.2 |
| Safe Version | 1.26.0 (pin to this version) |
| Published | Nov 17, 2026 — 20:35 UTC (1.26.1), 21:08 UTC (1.26.2) |
| Detected by Elastic | 20:41 UTC — six minutes after publication |
| PyPI Takedown | Within ~1 hour of detection |
| Technique | .pth startup hook → credential exfiltration to webhook.site |
| Active Exploitation | Yes — any host that installed either version is compromised |
| Exfiltration Endpoint | webhook[.]site (zlib-compressed, Base64-encoded payloads) |
Broader Implications for the Python Ecosystem
This incident underscores a structural weakness in Python package management that defenders have underweighted. The .pth execution mechanism is well-documented and has been abused before, but it remains a viable pre-import persistence vector because it operates entirely within Python's expected startup behavior — no unusual file permissions, no modified system binaries, no process injection. Traditional endpoint detection that focuses on post-import behavior will miss it entirely.
The speed of detection — six minutes — is commendable and represents a best-case scenario for automated supply-chain monitoring. Yet even in that best case, the package was live and downloading for a full hour before PyPI removed it. For organizations without real-time supply-chain controls, the exposure window could have been days or weeks.
Shield53 Recommendations
Immediate Actions
- Identify and isolate affected hosts: Search all build agents, developer laptops, and container images for
agent-frameworkversions 1.26.1 or 1.26.2. Any host that installed either version should be treated as fully compromised. - Rotate all credentials on affected hosts: This includes Azure CLI tokens, GitHub PATs, Azure DevOps tokens, npm tokens, Docker Hub credentials, git credentials, Hugging Face tokens, and any secrets exposed via environment variables to running processes. Do not assume any secret on the host survived.
- Revoke and reissue OIDC trust relationships: Review Azure DevOps and GitHub Actions OIDC token configurations. Any tokens minted via the IMDS or OIDC endpoints during the exposure window should be considered compromised and revoked at the identity provider level.
- Pin to version 1.26.0: Downgrade or pin
agent-framework==1.26.0in requirements files, lockfiles, and CI configurations. Do not install 1.26.1 or 1.26.2 under any circumstances. - Rebuild from clean baselines: For any CI/CD build agent that ran the compromised versions, rebuild the agent from a known-good image rather than attempting to clean the existing host. The
.pthhook and its payload files (agent_framework_meta.pth,_telemetry.py) may persist in cached virtual environments.
Detection Guidance
- Search for the files
agent_framework_meta.pthand_telemetry.pyacross all Python site-packages directories - Monitor for outbound connections to
webhook[.]sitefrom Python processes - Audit
.pthfiles across all Python environments forimportstatements — any.pthfile containing an import line should be reviewed as a potential persistence mechanism - Review Azure activity logs for unexpected token minting via IMDS or OIDC endpoints during the November 17–18 window
Strategic Hardening
- Implement automated PyPI dependency scanning with real-time alerting on new package versions, especially for high-download-count packages
- Use
pip install --require-hashesor dependency lockfiles with hash verification to prevent installation of unexpected versions - Restrict build agents to scoped, short-lived OIDC tokens rather than long-lived credentials — this limits blast radius even when a stealer succeeds
- Consider adopting a private package mirror or proxy that can block or quarantine new package versions pending review