# Malicious agent-framework PyPI releases 1.26.1 and 1.26.2 (Microsoft Agent Framework meta-package) deliver credential stealer via .pth startup hook

> Two malicious versions (1.26.1 and 1.26.2) of the agent-framework PyPI package were published on 2026-11-17, 33 minutes apart. A .pth startup hook runs a stealer on every Python interpreter start that harvests environment secrets, credential files and Azure/GitHub Actions/Azure DevOps OIDC and managed-identity tokens, and exfiltrates them to a webhook.site endpoint. Elastic's supply-chain monitor flagged 1.26.1 about six minutes after publication and PyPI quarantined both versions within the hour.

- **Author:** Threadlinqs Team
- **Published:** 2026-12-01T13:15:06Z
- **Last updated:** 2026-12-01T13:15:06Z
- **Canonical:** https://intel.threadlinqs.com/threat/TL-2026-7173
- **Card image:** https://intel.threadlinqs.com/og/threat/TL-2026-7173.png
- **ID:** TL-2026-7173
- **Severity:** HIGH
- **Category:** SUPPLY_CHAIN
- **Status:** ACTIVE
- **Detections:** 9 (1 shown free below) · **IOCs:** 20 (3 shown free below)

## Description

On 2026-11-17 at 20:35 UTC a malicious wheel for agent-framework 1.26.1 (the Microsoft Agent Framework meta-package on PyPI) was uploaded, followed at 21:08 UTC by 1.26.2. The last clean release is 1.26.0 (published 2026-11-12). The package has roughly 196,000 downloads per month across all versions (Elastic). Both malicious releases kept a dependency on the legitimate agent-framework-core 1.26.0, so applications kept working while the malware ran.

Initial access / publishing vector: not established by any source. Aikido states the attacker held valid PyPI publishing credentials, and the method of obtaining them is unknown. StepSecurity reports the uploads were wheel-only with no provenance attestations (1.26.0 had a wheel and sdist), carried an uploader user-agent of RestSharp/106.13.0.0, and that a maintainer account named vibiret was created and added to the project the same day. Aikido's analysis indicates 1.26.1 appears to be a legitimate wheel unpacked, hand-edited and re-uploaded (stale WHEEL timestamp, world-writable injected files). The second upload occurred 2 min 23 s after the first was quarantined, showing publishing access persisted. Microsoft had not commented at the time of BleepingComputer's report; the main branch and release tag were reported not to contain malicious code (secondary report).

Execution: version 1.26.1 added agent_framework_meta.pth (single line 'import agent_framework_meta') and agent_framework_meta/_telemetry.py, and appended a loader to agent_framework_meta/__init__.py that imports _telemetry and calls _start() inside try/except. Python's site module executes import lines in .pth files at every interpreter startup, so the payload runs even if the package is never imported. Version 1.26.2 renamed the components to af_runtime_diag.pth / af_runtime_diag.py (restoring the original __init__.py) and added a GitHub Actions OIDC collector. _start() uses the _AF_TEL environment variable as a run-once guard; on POSIX it forks and calls setsid() so the child runs detached, on Windows it uses a daemon thread.

Collection: the stealer reads /proc/<pid>/environ of up to 300 processes and keeps variables whose names match secret-like substrings (TOKEN, SECRET, PASSWORD, KEY, CONNECTION, AZURE, AWS, GITHUB, GH_, HF_, OPENAI, FOUNDRY, PIP, NPM, CLIENT, IDENTITY, MSI and others), specifically targeting SYSTEM_ACCESSTOKEN and IDENTITY_HEADER. It reads up to 60 (1.26.1) or 80 (1.26.2) credential files under 256 KB from all home directories and /root: ~/.azure token caches, pip.conf, .npmrc, .netrc, .git-credentials, Docker config.json, Hugging Face tokens, Foundry configuration, .env files under /app and /workspace, Azure Pipelines agent .credentials files and (1.26.2) GitHub runner directories. It attempts to mint Azure DevOps OIDC tokens (SYSTEM_ACCESSTOKEN POST to SYSTEM_OIDCREQUESTURI, api-version=7.1), Azure managed identity tokens for 12 resources (ARM, Microsoft Graph, Key Vault, Storage, Azure AI Foundry, Azure ML, Container Registry, Azure DevOps 499b84ac-1321-427f-aa17-267ca6975798) via IDENTITY_ENDPOINT/MSI_ENDPOINT or IMDS at 169.254.169.254, and (1.26.2 only) GitHub Actions OIDC tokens for audiences api://AzureADTokenExchange and https://management.azure.com/. Whether tokens were successfully issued is unconfirmed (static analysis only).

Exfiltration: data (plus hostname, username, working directory, command line, timestamp) is JSON-serialized, zlib-compressed (level 9), base64-encoded and sent as one POST (Content-Type application/octet-stream) to 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). The endpoint is stored base64-encoded in the code (_ENC). No second stage and no retry logic were found. webhook.site is a legitimate public service, so a connection alone does not prove exfiltration.

Attribution: no source names a threat actor. Severity HIGH and the FINANCIAL/UNKNOWN motivation question are analyst judgements; motivation is recorded as UNKNOWN.

## MITRE ATT&CK

- T1195.002 Compromise Software Supply Chain
- T1078 Valid Accounts
- T1059.006 Python
- T1546 Event Triggered Execution
- T1036.005 Match Legitimate Resource Name or Location
- T1027 Obfuscated Files or Information
- T1552.001 Credentials In Files
- T1552.005 Cloud Instance Metadata API
- T1528 Steal Application Access Token
- T1082 System Information Discovery
- T1005 Data from Local System
- T1119 Automated Collection
- T1560.002 Archive via Library
- T1132.001 Standard Encoding
- T1567 Exfiltration Over Web Service

## Free detection (Splunk SPL, Microsoft KQL, Sigma)

**agent-framework PyPI Compromise - Malicious .pth Startup Hook Written to site-packages** (`TL-2026-7173-SPL-001`)

TL-2026-7173: detects creation of a .pth file inside a Python site-packages/dist-packages directory. Known-IOC branch matches agent_framework_meta.pth (agent-framework 1.26.1) and af_runtime_diag.pth (1.26.2), the hooks whose 'import' line makes Python's site module run the credential stealer on every interpreter start, even if the package is never imported. A second branch flags .pth files seen on 2 or fewer hosts as a behavioural hunting signal for look-alike hooks. The known-IOC branch is high fidelity; the rare-name branch needs tuning.

- **Languages:** Splunk SPL, Microsoft KQL, Sigma
- **ATT&CK:** T1195.002, T1546, T1059.006, T1036.005
- **Data sources:** sysmon, sysmon_file_create_eventcode_11, defender_for_endpoint_DeviceFileEvents
- **Severity:** high
- **Confidence:** high

### Splunk SPL

```spl
index=sysmon sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11 earliest=-24h (TargetFilename="*site-packages*" OR TargetFilename="*dist-packages*") TargetFilename="*.pth"
| eval pth_rel=lower(replace(TargetFilename,"^.*(site|dist)-packages",""))
| stats count min(_time) as firstTime max(_time) as lastTime dc(host) as host_count values(host) as hosts values(Image) as writer_process values(TargetFilename) as pth_path by pth_rel
| eval known_ioc=if(match(pth_rel,"(agent_framework_meta|af_runtime_diag)[.]pth$"),1,0)
| where known_ioc=1 OR (host_count<=2 AND NOT match(pth_rel,"(distutils-precedence|_virtualenv|easy-install|pywin32|nspkg|matplotlib|ruamel|google)"))
| eval signal=if(known_ioc=1,"TL-2026-7173 known malicious startup hook","rare .pth startup hook (hunt)")
| convert ctime(firstTime) ctime(lastTime)
| table signal pth_rel hosts writer_process pth_path count firstTime lastTime
```

### Microsoft KQL

```kql
let KnownHooks = dynamic(["agent_framework_meta.pth","af_runtime_diag.pth"]);
let RarePth = toscalar(
    DeviceFileEvents
    | where Timestamp > ago(7d)
    | where FileName endswith ".pth" and FolderPath has_any ("site-packages","dist-packages")
    | summarize Devices=dcount(DeviceId) by FileName
    | where Devices <= 2
    | summarize make_set(FileName));
DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileCreated","FileModified","FileRenamed")
| where FileName endswith ".pth" and FolderPath has_any ("site-packages","dist-packages")
| extend KnownIoc = FileName in~ (KnownHooks)
| where KnownIoc or (set_has_element(RarePth, FileName) and not(FileName has_any ("distutils-precedence","_virtualenv","easy-install","pywin32","nspkg","matplotlib","ruamel","google")))
| project Timestamp, DeviceName, ActionType, FolderPath, FileName, SHA256, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessParentFileName, InitiatingProcessAccountName, KnownIoc
```

### Sigma

```yaml
title: Malicious agent-framework .pth Startup Hook Created in Python Site-Packages
id: 7c1e9a52-3b4d-4f86-9a17-5d2e8b0c4a11
status: experimental
description: Detects creation of agent_framework_meta.pth (agent-framework 1.26.1) or af_runtime_diag.pth (1.26.2). These .pth files contain an import line that Python's site module executes at every interpreter start, launching a credential stealer. TL-2026-7173.
references:
    - https://www.elastic.co/security-labs/threat-command/we-caught-the-agent-framework-pypi-compromise-six-minutes-after-it-published
    - https://www.stepsecurity.io/blog/microsoft-agent-framework-pypi-package-compromised
    - https://aikido.dev/blog/two-malicious-agent-framework-releases-hit-pypi-in-33-minutes
author: Threadlinqs Team
date: 2026-12-01
tags:
    - attack.persistence
    - attack.t1546
    - attack.initial-access
    - attack.t1195.002
    - attack.execution
    - attack.t1059.006
    - attack.defense-evasion
    - attack.t1036.005
logsource:
    category: file_event
detection:
    selection:
        TargetFilename|endswith:
            - 'agent_framework_meta.pth'
            - 'af_runtime_diag.pth'
    condition: selection
falsepositives:
    - Unlikely. These file names are specific to the malicious agent-framework 1.26.1 and 1.26.2 releases.
level: high
```

**Known false positives:**

- Legitimate Python packages that ship their own .pth file (namespace packages, editable installs, pywin32) will appear in the rare-name branch on first install; the known-IOC branch is not affected.
- Developers building or testing custom .pth hooks in a virtual environment.

**Tuning notes:** Alert on known_ioc=1 immediately and treat the host as compromised (rotate secrets readable by the Python user). For the rare-name branch, extend the allowlist regex with .pth names common in your fleet, or raise the host_count threshold on large estates. Sysmon must log EventCode 11 for site-packages paths; on Linux use Sysmon for Linux or an EDR file-create feed and adjust index/sourcetype. Virtualenv and container image build hosts are the usual noise sources.

### 8 more detection rules (Splunk SPL, Microsoft KQL, Sigma), unlock with TL Creds

- agent-framework Malicious Versions 1.26.1 / 1.26.2 Installed via Package Manager Command Line (locked: unlock with TL Creds)
- agent-framework Stealer - Python Requesting Azure IMDS or GitHub Actions OIDC Tokens (locked: unlock with TL Creds)
- agent-framework Stealer Exfiltration - Python Process Connecting to [indicator] (locked: unlock with TL Creds)
- agent-framework Malicious Wheel Downloaded Through Web Proxy or Package Mirror (locked: unlock with TL Creds)
- agent-framework Stealer Module Files Dropped ([indicator] and [indicator]) (locked: unlock with TL Creds)
- agent-framework Stealer Exfiltration - DNS Resolution of [indicator] (locked: unlock with TL Creds)
- agent-framework Stealer - Python Process Reading Multiple Credential Files (Linux auditd) (locked: unlock with TL Creds)
- agent-framework Stealer Exfiltration - POST to [indicator] Endpoint or Known User-Agents (Web Proxy) (locked: unlock with TL Creds)

Sign up free to unlock the detection rules: https://threadlinqs.com/?modal=signup

## Sample indicators (3 of 20)

Defanged, TLP:CLEAR.

- Domain: `webhook[.]site`
- File hash: `d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110`
- File hash: `3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9`

Full set of 20 indicators unlocks with TL Creds: https://threadlinqs.com/tl-creds

## Sources

- [We caught the agent-framework PyPI compromise six minutes after it published](https://www.elastic.co/security-labs/threat-command/we-caught-the-agent-framework-pypi-compromise-six-minutes-after-it-published)
- [Microsoft agent-framework PyPI package compromised (StepSecurity)](https://www.stepsecurity.io/blog/microsoft-agent-framework-pypi-package-compromised)
- [Two malicious agent-framework releases hit PyPI in 33 minutes (Aikido)](https://aikido.dev/blog/two-malicious-agent-framework-releases-hit-pypi-in-33-minutes)
- [Microsoft's agent-framework PyPI package compromised to steal credentials (BleepingComputer)](https://bleepingcomputer.com/news/security/microsofts-agent-framework-pypi-package-compromised-to-steal-credentials)
- [Attackers hijack Microsoft's agent-framework package to steal Azure and CI credentials (CSO Online)](https://www.csoonline.com/article/4250156/attackers-hijack-microsofts-agent-framework-package-to-steal-azure-and-ci-credentials.html)
- [Microsoft Agent Framework source repository](https://github.com/microsoft/agent-framework)
- [Elastic supply-chain monitor](https://github.com/elastic/supply-chain-monitor)
- [Elastic detection-rules repository (Defend rules for package install ancestry and IMDS requests)](https://github.com/elastic/detection-rules)
- [PyPI release history: agent-framework 1.26.1](https://pypi.org/project/agent-framework/1.26.1/#history)

## Full data

The other 8 detection rules (Splunk SPL / Microsoft KQL / Sigma) unlock with TL Creds; a free account includes daily creds: https://threadlinqs.com/?modal=signup
Indicator values unlock with TL Creds, at a lower price on Red and Purple; AI agents can query rules and IOCs through the Threadlinqs MCP server (Purple and Gold in full, 2 calls a day on a free account): https://intel.threadlinqs.com/mcp

Canonical: https://intel.threadlinqs.com/threat/TL-2026-7173
