# Microsoft: Microsoft agent-framework: malicious PyPI wheels ran .pth hooks to mint OIDC tokens

> **Safety notice:** Read-only filesystem check; installs no malicious packages.

- **Incident date:** Nov 17, 2026
- **Disclosed:** Nov 18, 2026
- **Source disclosure:** https://devblogs.microsoft.com/agent-framework/microsoft-agent-framework-repository-update/

## Reproduction lab
Audits clean local environments and CI lockfiles for unexpected .pth startup hooks and verifies uv or pip hash-pinned installation settings.

```bash
# list every .pth file inside your active virtualenv without importing untrusted packages
find .venv -name "*.pth" -exec head -n 5 {} + 2>/dev/null || true
```

## Policies and detection rules

### `check-pth-and-agent-framework.sh`
Inspect filesystems and lockfiles without invoking the compromised Python interpreter (since running pip or python inside an infected env fires the .pth hook again).

```sh
# Inspect lockfiles and site-packages WITHOUT running Python inside a suspect venv
grep -rnE "agent-framework.*1\.26\.[12]" . 2>/dev/null || echo "No 1.26.1/1.26.2 lockfile pin found"
find / -name "agent_framework_meta.pth" -o -name "af_runtime_diag.pth" -o -name "af_runtime_diag.py" 2>/dev/null || true
```

### `ci-egress-allowlist.yaml`
GitHub Actions egress allowlist blocking webhook.site during Python dependency installs and restricting OIDC id-token permissions.

```yaml
permissions:
  contents: read
steps:
  - name: Restrict runner egress
    uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a
    with:
      egress-policy: block
      allowed-endpoints: >
        pypi.org:443
        files.pythonhosted.org:443
        github.com:443
```

## Indicators of compromise
- **hash:** `d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110` (SHA-256 of malicious PyPI wheel agent-framework 1.26.1 (drops agent_framework_meta.pth and _telemetry.py).)
- **hash:** `3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9` (SHA-256 of malicious PyPI wheel agent-framework 1.26.2 (drops af_runtime_diag.pth and af_runtime_diag.py).)
- **url:** `https://webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetry` (Hardcoded base64-obfuscated exfiltration endpoint used by both wheels (User-Agent af-runtime-diagnostics/1 or runtime-diagnostics/1).)
- **log:** `GHSA-764m-3ppc-5m73 (uploader UA RestSharp/106.13.0.0, wheel-only, no provenance)` (Official GitHub Security Advisory tracking the Nov 17 PyPI hijack.)
