Engineering

Microsoft agent-framework PyPI Hijack: .pth Startup Execution & Cloud Credential Theft

On November 17, 2026, attackers published two hijacked releases (1.26.1 and 1.26.2) of Microsoft's official agent-framework PyPI package during a ~45-minute window. Both releases dropped .pth startup hooks that execute on any Python invocation—even pip—to harvest environment variables, credential files, Azure IMDS tokens, and CI OIDC credentials before exfiltrating them to webhook.site.

By 0xScorPionSon

11 min read

Microsoft agent-framework PyPI Hijack: .pth Startup Execution & Cloud Credential Theft

Microsoft agent-framework PyPI hijack architecture infographic

Executive Summary

On November 17, 2026, two malicious releases of Microsoft's official agent-framework Python package—versions 1.26.1 and 1.26.2—were published to the Python Package Index (PyPI) within a roughly 45-minute exposure window between 20:35 UTC and 21:20 UTC. Rather than waiting for application code to import agent_framework, the attackers embedded .pth path-configuration files inside site-packages alongside a _telemetry module. Because Python's site initialization processes import directives inside .pth files on every interpreter startup, any command invoking Python—including pip itself—triggered credential harvesting and exfiltration.

Both hijacked releases targeted developer workstations, container builds, and CI/CD runners, collecting matching environment variables, local credential files, /proc/*/environ entries, Azure Instance Metadata Service (IMDS) tokens, Azure DevOps OIDC tokens, and (in 1.26.2) GitHub Actions OIDC tokens before posting a compressed JSON payload to webhook.site. The last known clean release on PyPI is 1.26.0, published on November 12, 2026.

Confidence & Evidence Caveats: Confidence in the technical indicators, timeline, and payload behavior is high based on independent forensic reporting from OX Security, The Hacker News, and AI/TLDR, as well as the official PyPI project page. However, as of November 18, 2026, Microsoft has not published an official root-cause postmortem explaining how the PyPI publishing credentials or release pipeline were compromised, nor has a verified victim count or benchmark of downstream blast radius been disclosed. Additionally, observers noted that the microsoft/agent-framework and microsoft/onnxruntime GitHub repositories returned HTTP 404 on November 18, 2026, without an official explanation linking or separating those outages from the PyPI incident.


Technical Mechanics and Architecture

Why .pth Startup Hooks Bypass Import-Time Controls

In standard Python environments, agent-framework acts as a meta-package that pulls in agent-framework-core and related sub-packages. Because the malicious 1.26.1 and 1.26.2 wheels retained the dependency pin agent-framework-core==1.26.0, applications importing the framework continued operating without crashes or functional regressions, masking the compromise during automated builds and tests.

The critical architectural shift in this attack is the use of .pth files placed directly in site-packages. During Python interpreter startup, the standard site module scans site-packages for .pth files. While .pth files normally list filesystem paths to append to sys.path, Python's site.addpackage() implementation also executes any line beginning with import (or import\t). This behavior occurs before user scripts run and without any import agent_framework statement in application code.

As a result, merely installing agent-framework==1.26.1 or 1.26.2—or running pip list, pytest, python --version, or a subsequent pip uninstall inside the same virtual environment—is sufficient to execute the payload. In addition to the .pth hook, the attackers appended from . import _telemetry; _telemetry._start() inside __init__.py, wrapped in exception handling so initialization errors would not surface to users.

+-------------------------------------------------------------------+
|  Python Interpreter Startup (python, pip, pytest, uvicorn, etc.)  |
+---------------------------------+---------------------------------+
                                  |
                                  v
+-------------------------------------------------------------------+
|  site.py reads site-packages/*.pth                                |
|   - 1.26.1: agent_framework_meta.pth -> import agent_framework_meta
|   - 1.26.2: af_runtime_diag.pth      -> import af_runtime_diag     |
+---------------------------------+---------------------------------+
                                  |
                                  v
+-------------------------------------------------------------------+
|  _telemetry._start()                                              |
|   - Checks/sets _AF_TEL=1 (executes once per process tree)        |
|   - Forks detached child via setsid() (or background thread)      |
+---------------------------------+---------------------------------+
                                  |
        +-------------------------+-------------------------+
        |                         |                         |
        v                         v                         v
+---------------+       +-------------------+     +-----------------+
| Env & Process |       | Local Credential  |     | Cloud & CI OIDC |
| Harvesting    |       | Files (max 60)    |     | Token Requests  |
| - Matching    |       | - ~/.azure/*.json |     | - Azure IMDS    |
|   env vars    |       | - .npmrc, .netrc  |     |   169.254.169.  |
| - /proc/*/    |       | - pip.conf, .env  |     |   254           |
|   environ     |       | - .git-credentials|     | - Azure DevOps  |
|   (<=300 pids)|       | - .docker/config  |     |   OIDC endpoint |
|               |       | - HF / Foundry    |     | - GitHub Actions|
|               |       | - ADO .credentials|     |   OIDC (1.26.2) |
+-------+-------+       +---------+---------+     +--------+--------+
        |                         |                        |
        +-------------------------+------------------------+
                                  |
                                  v
+-------------------------------------------------------------------+
|  Payload Packaging & Exfiltration                                 |
|   - Serialize JSON -> zlib compress -> Base64 encode              |
|   - HTTPS POST (User-Agent: af-runtime-diagnostics/1)             |
|   - Target: https://webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetry
+-------------------------------------------------------------------+

Process Isolation and Credential Harvesting Scope

To avoid slowing down CLI commands or triggering obvious timeouts in CI pipelines, _telemetry._start() checks for the _AF_TEL environment variable and sets _AF_TEL=1 so the routine fires only once per process tree. On POSIX systems, it forks a detached child process using os.setsid(), falling back to a background thread if fork is unavailable.

Once detached, the collector gathers three categories of sensitive material:

  1. Environment Variables and Process Environments: It scans os.environ for keys matching high-value substrings including TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB, HF_, OPENAI, SYSTEM, BUILD, CI_, PIP, NPM, NUGET, COSMOS, TENANT, CLIENT, and MSI. On Linux hosts, it also reads /proc/*/environ across up to 300 running processes, allowing a single unprivileged Python process to capture secrets belonging to sibling processes running under the same UID.
  2. Local Credential and Configuration Files: It reads up to 60 files from known developer and CI agent paths, including ~/.azure/*.json, pip.conf, .npmrc, .netrc, .git-credentials, .docker/config.json, Hugging Face tokens, AI Foundry configuration files, /app/.env, /workspace/*.json, and Azure DevOps agent .credentials files under /agent/_work, /vss-agent, and /mnt/azure_nvme_temp/_work.
  3. Live Cloud and CI/CD Identity Tokens: Rather than relying solely on static files, the script actively mints short-lived tokens. It queries Azure DevOps OIDC (SYSTEM_ACCESSTOKEN paired with SYSTEM_OIDCREQUESTURI for api://AzureADTokenExchange) and requests Azure Managed Identity tokens from the Azure IMDS endpoint (169.254.169.254) or IDENTITY_ENDPOINT/MSI_ENDPOINT across multiple audiences: Azure Resource Manager (ARM), Microsoft Graph, Key Vault, Storage, Cognitive Services, ML/AI Foundry, Azure Container Registry (ACR), Azure AI Search, and Azure DevOps, while retaining up to 8,000 characters of VM metadata. Version 1.26.2 expanded this capability to also harvest GitHub Actions OIDC tokens and broaden environment variable matching patterns.

The collected dictionary is serialized to JSON, compressed with zlib, Base64-encoded, and transmitted via an HTTPS POST request to https://webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetry using the User-Agent header af-runtime-diagnostics/1.

Defensive Pinning and Hash Verification

To prevent unverified transitive or meta-package updates from entering builds, teams should pin exact versions and enforce cryptographic hash verification in pip workflows:

# Generate a hash-pinned lockfile using pip-compile (from pip-tools) on a clean workstation
pip-compile --generate-hashes --output-file=requirements.lock requirements.in

# Enforce strict hash checking in CI/CD so unverified wheels fail before installation
pip install --require-hashes --no-deps -r requirements.lock

Evidence: Timeline, Version Diff, and Indicators of Compromise

Incident Timeline (UTC)

Timestamp (UTC) Date Event Source
— Nov 12, 2026 Clean agent-framework 1.26.0 wheel (6.7 kB, Python 3.11–3.15) published to PyPI. PyPI
20:35 UTC Nov 17, 2026 Malicious version 1.26.1 published to PyPI with agent_framework_meta.pth. OX Security
21:08 UTC Nov 17, 2026 Malicious version 1.26.2 published 33 minutes later with af_runtime_diag.pth and GitHub OIDC harvesting. OX Security, The Hacker News
~21:20 UTC Nov 17, 2026 Both 1.26.1 and 1.26.2 quarantined/removed from PyPI (~45-minute total window). OX Security, AI/TLDR

Even though the upstream PyPI exposure lasted roughly 45 minutes, downstream exposure persists wherever internal PyPI mirrors (such as Artifactory, Nexus, or DevPI), CI dependency caches, or container image layers pulled agent-framework during that window. With OX Security reporting roughly 192,534 monthly downloads (and The Hacker News citing ~190,000), automated pipelines running unpinned pip install agent-framework during that window were directly exposed.

Comparison: 1.26.1 vs. 1.26.2

Attribute agent-framework==1.26.1 agent-framework==1.26.2
Publish Time Nov 17, 2026, 20:35 UTC Nov 17, 2026, 21:08 UTC
.pth Hook File site-packages/agent_framework_meta.pth site-packages/af_runtime_diag.pth
Payload Module agent_framework_meta/_telemetry.py af_runtime_diag.py
Core Dependency Pin agent-framework-core==1.26.0 agent-framework-core==1.26.0
Cloud / CI Targets Env vars, local files, /proc/*/environ, Azure IMDS, Azure DevOps OIDC Adds GitHub Actions OIDC token harvesting and broader env-var patterns
Exfiltration Endpoint webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb

Verified Indicators of Compromise (IOCs)

All cryptographic hashes and file paths below are sourced from OX Security:

Indicator Type Value Notes
Wheel SHA-256 d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110 Malicious wheel digest
_telemetry.py RECORD SHA-256 (base64url) OfoynyqT9zSwu49a2yA-ozMdGuR5gypQFaVMsXqr1mM Payload module digest in wheel RECORD
.pth RECORD SHA-256 (base64url) IfKOhRehD_5DH41o9YdcheykABrm0RgyKwpBhzmY614 Startup hook digest in wheel RECORD
Exfiltration Domain / Path https://webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetry HTTPS POST with User-Agent: af-runtime-diagnostics/1
Dropped Files (1.26.1) site-packages/agent_framework_meta.pth, agent_framework_meta/_telemetry.py Executes on Python startup
Dropped Files (1.26.2) site-packages/af_runtime_diag.pth, af_runtime_diag.py Executes on Python startup

Hardening Playbook & Incident Response

Critical Warning Before Inspecting Environments

Do not run pip list, pip show, pip uninstall, or python -m ... inside a potentially affected virtual environment or container to check which version is installed. Because .pth files execute before pip processes any subcommand, running pip inside an infected environment will re-trigger the payload and exfiltrate fresh credentials. Inspect the filesystem directly using OS-level tools (find, grep, cat) or container image layer inspection (docker history, SBOMs, or mounted rootfs scans).

Six-Step Response Playbook

  1. Audit Filesystems and Artifacts Offline: Scan CI build caches, internal PyPI proxies, Docker image tarballs, and workstation site-packages directories for 1.26.1, 1.26.2, agent_framework_meta.pth, and af_runtime_diag.pth without invoking Python inside those environments.
  2. Quarantine Internal Package Mirrors: Purge agent-framework 1.26.1 and 1.26.2 from Artifactory, Sonatype Nexus, Azure Artifacts, or local pip HTTP caches (~/.cache/pip). Allowlist only 1.26.0 (verified against PyPI) until Microsoft publishes an official advisory and new signed release.
  3. Hunt Network & DNS Telemetry: Query egress firewall logs, corporate web proxies, and DNS resolvers for lookups or TLS connections to webhook.site or the specific path /d381fd80-ec62-42ad-8f5c-d1b15103c9bb, as well as the User-Agent string af-runtime-diagnostics/1 (where TLS inspection is enabled), between 2026-11-17T20:35:00Z and the present.
  4. Rotate Exposed Credentials Immediately: If any host, container, or CI runner installed 1.26.1 or 1.26.2, treat all secrets accessible to that UID as compromised. Rotate Azure service principal secrets, Azure DevOps PATs, GitHub tokens, PyPI/npm/NuGet tokens, Docker registry credentials, Hugging Face/OpenAI API keys, and revoke active Azure Managed Identity / Entra ID sessions where applicable.
  5. Rebuild Ephemeral Runners and Environments: Do not attempt in-place cleanup with pip uninstall. Destroy affected virtual environments, rebuild container images from verified base layers, and re-provision compromised CI/CD runners.
  6. Enforce Supply-Chain Guardrails: Pin dependencies using hash-verified lockfiles (pip install --require-hashes), restrict outbound egress from CI/CD runners and production workloads to explicit allowlists (blocking webhook.site and arbitrary paste/bin domains), and require IMDSv2-equivalent token scoping or workload identity federation with tight audience and repository constraints.

Defensive Detection Queries

Use these read-only filesystem and log checks without executing the target Python interpreter:

# 1. Safe filesystem scan for malicious .pth files and modules (does NOT invoke python/pip)
find / -xdev \( -name "agent_framework_meta.pth" -o -name "af_runtime_diag.pth" -o -name "af_runtime_diag.py" \) 2>/dev/null

# 2. Safe METADATA version check across virtualenvs and system site-packages
grep -rnE "^Version: 1\.26\.[12]$" /opt /home /root /app /usr/local/lib 2>/dev/null | grep -i "agent_framework"

# 3. Search pip HTTP cache and wheelhouse directories for the malicious wheel SHA-256
find ~/.cache/pip /root/.cache/pip -type f -name "*agent_framework*" -exec sha256sum {} + 2>/dev/null | grep "d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110"

For SIEM and proxy log hunting (e.g., Splunk/KQL-style concepts adapted to your environment):

  • DNS / Proxy Filter: dest_domain == "webhook.site" OR url_path contains "d381fd80-ec62-42ad-8f5c-d1b15103c9bb" OR http_user_agent == "af-runtime-diagnostics/1" with timestamp >= 2026-11-17T20:35:00Z.

Rollback & Remediation Notes

If a build or container image pulled agent-framework==1.26.1 or 1.26.2, rollback consists of reverting your lockfile or image tag to a build artifact created prior to 2026-11-17T20:35:00Z (using agent-framework==1.26.0), purging the pip cache, and rebuilding cleanly. Verify the restored environment by checking METADATA directly on disk before running any Python command.


Frequently Asked Questions

1. Am I safe if my code never called import agent_framework? No. Both 1.26.1 and 1.26.2 drop .pth files into site-packages. Python executes import lines in .pth files automatically whenever the interpreter starts—meaning pip, pytest, python --version, or any other Python script in that environment triggers the payload.

2. Can I fix an infected virtual environment by running pip uninstall agent-framework? No. Running pip invokes the Python interpreter inside that environment, which executes the .pth startup hook one more time before pip even begins uninstalling the package. Delete the virtual environment or container image completely and rebuild from a clean state after rotating credentials.

3. Is agent-framework==1.26.0 affected? No. Version 1.26.0, published on November 12, 2026, is the last known clean release on PyPI. Always verify the package version via METADATA on disk or lockfile hashes rather than trusting unpinned installs.

4. Why were microsoft/agent-framework and microsoft/onnxruntime returning 404 on GitHub? As reported on November 18, 2026, both repositories returned HTTP 404 on GitHub, but Microsoft has not issued an official statement confirming whether the repository unavailability is directly tied to the PyPI compromise or represents a separate containment or administrative action.

5. What is the difference between 1.26.1 and 1.26.2? Version 1.26.1 (published 20:35 UTC) used agent_framework_meta.pth and agent_framework_meta/_telemetry.py to harvest environment variables, local credential files, /proc/*/environ, Azure IMDS tokens, and Azure DevOps OIDC tokens. Version 1.26.2 (published 33 minutes later at 21:08 UTC) renamed the hook to af_runtime_diag.pth / af_runtime_diag.py and added GitHub Actions OIDC token collection alongside broader environment-variable matching.


Sources

  1. PyPI Official Project Page — agent-framework on PyPI (Clean release 1.26.0 published November 12, 2026)
  2. OX Security — BREAKING: Hijacked Releases of Microsoft's Official agent-framework Steals Azure and CI Credentials (Published November 17, 2026; IOCs, timeline, and .pth forensic analysis)
  3. The Hacker News — Attackers Compromise Microsoft's Agent Framework PyPI Package to Steal Cloud Credentials (Published November 18, 2026)
  4. AI/TLDR — Microsoft agent-framework hijacked on PyPI — two releases stole credentials (Published November 18, 2026)

More on Engineering

Engineering

Kubernetes 1.38 Enters Code Freeze Ahead of December 16: Breaking Removals, DRA Graduations, and Gang Scheduling Status

Kubernetes 1.38 has entered code and test freeze ahead of its planned December 16, 2026 release, locking down scope around v1.38.0-beta.0. While AI workload primitives like CompositePodGroup (v1beta1) and DRA Device Binding Conditions (GA) advance, several removed feature gates and stricter JWK/kubelet validations will break unverified upgrades. Here is what actually shipped in the 1.38 changelog, how the scheduling architecture works, and how to test your clusters before December 16.

9 min read

Engineering

Cloudflare Workers VPC Adds Custom CA and mTLS Support, Ending verify_ca Workarounds for Private Origins

Previously, connecting Cloudflare Workers VPC to internal APIs or private databases signed by an enterprise CA meant downgrading TLS verification to verify_ca or disabled—and origins requiring client certificates were unreachable. On November 18, 2026, Cloudflare added custom CA and mutual TLS (mTLS) client certificate support across both HTTP and TCP VPC Services, including Hyperdrive PostgreSQL connections to Amazon RDS. Here is how the certificate architecture works, how to configure it with Wrangler 4.164.0+ or Terraform 5.29.0+, and how to audit existing services.

11 min read

Tell us what is not working

A thirty-minute call, no deck and no obligation. You will leave with a straight answer about whether this is worth building - including if that answer is no.

Start a project

Direct line

hello@codebumble.net
Dhaka, Bangladesh  :   local timeCalls in English or Bangla