# Microsoft agent-framework PyPI package compromised with .pth credential stealer (versions 1.26.1, 1.26.2)

> Socket Research reports that agent-framework 1.26.1 and 1.26.2 on PyPI shipped malicious .pth startup hooks that harvest credential-related environment variables, config/credential files and Azure/CI/GitHub Actions OIDC tokens, then POST them (zlib + Base64) to a webhook.site endpoint. The article states the payloads do not download or execute further code; PyPI shows both releases as quarantined.

- **Published:** 2026-11-18T02:25:16Z
- **Last reviewed:** 2026-11-18T03:15:30.300Z
- **Canonical:** https://intel.threadlinqs.com/threat/TL-2026-6280
- **ID:** TL-2026-6280
- **Severity:** HIGH
- **Category:** SUPPLY_CHAIN
- **Status:** ACTIVE
- **Detections:** 9 (1 shown free below) · **IOCs:** 31 (3 shown free below)

## Description

Socket Research (published 2026-11-17) reports that agent-framework versions 1.26.1 and 1.26.2 on PyPI were compromised on November 17 and contain Python startup hooks that collect credentials and cloud identity tokens and send them to an attacker-controlled webhook.site endpoint. Python's site module processes .pth files at interpreter startup, so the code runs whenever any Python process starts in an environment where the package is installed, without the package ever being imported by the victim's code. The PyPI project page (maintainers listed as 'microsoft' and 'vibiret', described as Microsoft Agent Framework for building AI agents in Python) shows 1.26.1 and 1.26.2 both dated Nov 17, 2026 and marked 'Release quarantined', with 1.26.0 (Nov 12, 2026) as the most recent non-quarantined release. The article does not say how the publishing access was obtained.

Version 1.26.1 chain: agent_framework_meta.pth imports agent_framework_meta/__init__.py (a 'diagnostic hook' that calls _telemetry._start() inside a try/except that suppresses errors), which loads _telemetry.py. _start() sets an environment-variable guard (_AF_TEL) inherited by child processes; on Unix it calls os.fork() and setsid() to detach, and on platforms without fork it uses a daemon thread. No persistent on-disk execution marker is written, so new process trees can trigger collection again. Version 1.26.2 chain: af_runtime_diag.pth contains a single import line that loads af_runtime_diag.py, which starts collection on import. In 1.26.2 the legitimate agent_framework_meta/__init__.py was restored byte-for-byte, so inspecting only that file misses the payload.

Collection uses substring-based environment-variable matching (both versions: TOKEN, SECRET, KEY, AZURE, AWS, GITHUB, OPENAI, HF_, FOUNDRY, TENANT, CLIENT, MANAGED; 1.26.2 adds ACTIONS, OIDC, RUNNER, ARM_) and reads /proc/*/environ of other processes filtered for TOKEN, SECRET, PASSWORD, KEY=, SYSTEM_ACCESSTOKEN, IDENTITY_HEADER (1.26.2 adds ACTIONS_ID_TOKEN). It actively requests fresh Azure managed-identity tokens (IDENTITY_ENDPOINT / IMDS) and CI federation tokens (Azure DevOps SYSTEM_ACCESSTOKEN / SYSTEM_OIDCREQUESTURI) for Azure management, AI/ML, Cognitive Services, Storage, Key Vault, Search, Microsoft Graph, Container Registry, Azure DevOps and Azure AD token-exchange audiences. Version 1.26.2 adds GitHub Actions OIDC token requests (ACTIONS_ID_TOKEN_REQUEST_URL/TOKEN, fallback ACTIONS_RUNTIME_TOKEN; audiences api://AzureADTokenExchange and https://management.azure.com/) and runner paths (/home/runner/work/_temp/*, /home/runner/.azure). File targets include ~/.azure JSON, Azure DevOps agent .credentials files (several _work and vss-agent locations), pip.conf, .npmrc, .netrc, .git-credentials, Docker config.json, Hugging Face tokens, Foundry config, ~/.config/*/token*.json and application .env/.json files under /app and /workspace.

Collected data is serialized as JSON, zlib-compressed, Base64-encoded and POSTed to the webhook.site URL (stored Base64-encoded as _ENC in both payloads) with query ?t=telemetry, using User-Agents runtime-diagnostics/1 (1.26.1) and af-runtime-diagnostics/1 (1.26.2) as listed by Socket. Attribution and malware family name are not stated in the source, and Socket does not link the incident to other campaigns. The mechanism (.pth startup hook credential stealers in AI/ML PyPI packages) resembles other 2026 PyPI incidents reported by third parties (e.g. LiteLLM in March 2026), but no link to this incident is claimed by any source. The targeting of Azure managed identity, Azure DevOps and GitHub Actions OIDC suggests the collector is designed for cloud CI/CD runners and Azure-hosted AI workloads. Independent corroboration beyond Socket and the PyPI quarantine marker was not found at time of research.

## MITRE ATT&CK

- T1195.001 Compromise Software Dependencies and Development Tools
- T1059.006 Python
- T1546.018 Python Startup Hooks
- T1036 Masquerading
- T1027 Obfuscated Files or Information
- T1552.001 Credentials In Files
- T1552.005 Cloud Instance Metadata API
- T1528 Steal Application Access Token
- T1005 Data from Local System
- T1119 Automated Collection
- T1560 Archive Collected Data
- T1071.001 Web Protocols
- T1132.001 Standard Encoding
- T1567.004 Exfiltration Over Webhook
- T1583.006 Acquire Infrastructure
- T1195.002 Supply Chain Compromise
- T1057 Process Discovery
- T1083 File and Directory Discovery
- T1082 System Information Discovery
- T1567 Exfiltration Over Web Service
- T1020 Automated Exfiltration

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

**agent-framework Malicious .pth Startup Hook / Payload Dropped in site-packages (TL-2026-6280)** (`TL-2026-6280-SPL-001`)

Detects creation of the malicious Python startup-hook files shipped in the compromised agent-framework 1.26.1 / 1.26.2 PyPI releases: agent_framework_meta.pth and agent_framework_meta/_telemetry.py (1.26.1), af_runtime_diag.pth and af_runtime_diag.py (1.26.2). Python's site module executes .pth import lines at every interpreter start, so the stealer runs without the package being imported. The legitimate agent_framework_meta/__init__.py is deliberately not matched because 1.26.2 restored it byte-for-byte. Maps to supply-chain compromise (T1195.001), Python startup-hook persistence (T1546.018) and masquerading as diagnostic/telemetry files (T1036).

- **Languages:** Splunk SPL, Microsoft KQL, Sigma
- **ATT&CK:** T1195.001, T1546.018, T1036, T1059.006
- **Data sources:** sysmon_for_linux (index=sysmon sourcetype=sysmon:linux, EventCode 11), sysmon_windows (XmlWinEventLog:Microsoft-Windows-Sysmon/Operational, EventCode 11), DeviceFileEvents
- **Severity:** high
- **Confidence:** high

### Splunk SPL

```spl
index=sysmon (sourcetype="sysmon:linux" OR sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational") (EventCode=11 OR EventID=11)
| eval target=lower(TargetFilename)
| where match(target, "(site|dist)-packages.agent_framework_meta[.]pth$") OR match(target, "(site|dist)-packages.af_runtime_diag[.](pth|py)$") OR match(target, "agent_framework_meta.[_]telemetry[.]py$")
| stats count min(_time) as first_seen max(_time) as last_seen values(target) as dropped_files values(Image) as writer_process values(User) as account by host
| convert ctime(first_seen) ctime(last_seen)
```

### Microsoft KQL

```kql
DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileCreated", "FileModified", "FileRenamed")
| where FileName in~ ("agent_framework_meta.pth", "af_runtime_diag.pth", "af_runtime_diag.py")
    or (FileName =~ "_telemetry.py" and FolderPath has "agent_framework_meta")
    or SHA256 in~ ("21f28e8517a10ffe431f8d68f5875c85eca4001ae6d118322b0a41873998eb5e", "325e7e9f0ec94e41ad1a1b7a3f18a6b8b5bffece2e2b97b8d3369eb967452f93", "39fa329f2a93f734b0bb8f5adb203ea3331d1ae479832a5015a54cb17aabd663", "54d885b7d7161c9ed96489c66364c4bfbf635929166843bba10d97d46b5a2e1f", "c275ccbe520ef3c0f02dc6a35389e427f9f1b4e0b12e140cd7bf7179ce143f02")
| project Timestamp, DeviceName, ActionType, FolderPath, FileName, SHA256, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountName
| order by Timestamp desc
```

### Sigma

```yaml
title: agent-framework Malicious .pth Startup Hook or Payload Dropped (TL-2026-6280)
id: 3f1b7c52-6a0e-4d3b-9b5e-8c1a2d4e6f01
status: experimental
description: Detects creation of the malicious .pth startup hooks and payload modules shipped in the compromised agent-framework 1.26.1 and 1.26.2 PyPI releases (agent_framework_meta.pth, af_runtime_diag.pth, _telemetry.py, af_runtime_diag.py).
references:
  - https://socket.dev/blog/agent-framework-pypi-package-compromised-with-credential-stealer
  - https://pypi.org/project/agent-framework/
author: Threadlinqs Team
date: 2026/11/18
tags:
  - attack.initial-access
  - attack.t1195.001
  - attack.persistence
  - attack.t1546.018
  - attack.defense-evasion
  - attack.t1036
logsource:
  category: file_event
detection:
  selection_pth:
    TargetFilename|endswith:
      - 'agent_framework_meta.pth'
      - 'af_runtime_diag.pth'
      - 'af_runtime_diag.py'
  selection_payload:
    TargetFilename|re: 'agent_framework_meta.[_]telemetry[.]py$'
  condition: 1 of selection_*
falsepositives:
  - Security researchers or sandboxes that intentionally unpack the quarantined packages
  - Mirror or package-cache scanners that extract the wheels for analysis
level: high
```

**Known false positives:**

- Researchers or sandboxes that deliberately unpack the quarantined 1.26.1/1.26.2 wheels
- Package-cache or artifact scanners that extract wheel contents on shared hosts

**Tuning notes:** Highly specific filenames, so little tuning is needed. Exclude known analysis sandboxes by host. Extend the regex if new variants of the .pth hook names appear. Pair with an inventory sweep of every site-packages directory for any .pth file containing an 'import' line, and alert on hits.

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

- Install of Compromised agent-framework 1.26.1 / 1.26.2 via Package Manager (TL-2026-6280) (locked: unlock with TL Creds)
- Python Process Burst of Azure IMDS Token Requests (TL-2026-6280) (locked: unlock with TL Creds)
- DNS Resolution of [indicator] from Servers and Build Agents (TL-2026-6280) (locked: unlock with TL Creds)
- Download of Compromised agent-framework 1.26.1 / 1.26.2 Wheel or sdist via Proxy (TL-2026-6280) (locked: unlock with TL Creds)
- Developer and Package Credential File Sweep (git, npm, pip, Docker, Hugging Face, .env) (TL-2026-6280) (locked: unlock with TL Creds)
- agent-framework Stealer Exfiltration POST: Known User-Agents and ?t=telemetry (TL-2026-6280) (locked: unlock with TL Creds)
- Python Process Sweeping Azure / Azure DevOps / CI Credential Files and [indicator] (TL-2026-6280) (locked: unlock with TL Creds)
- Python Process Connecting to [indicator] (Credential Exfiltration) (TL-2026-6280) (locked: unlock with TL Creds)

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

## Sample indicators (3 of 31)

Defanged, TLP:CLEAR.

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

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

## Sources

- [Microsoft's agent-framework PyPI package Compromised with Credential Stealer (Socket)](https://socket.dev/blog/agent-framework-pypi-package-compromised-with-credential-stealer)
- [Socket package overview: agent-framework 1.26.2](https://socket.dev/pypi/package/agent-framework/overview/1.26.2)
- [PyPI project page: agent-framework (1.26.1 and 1.26.2 marked quarantined)](https://pypi.org/project/agent-framework/)
- [Context: LiteLLM PyPI packages compromised (.pth startup-hook stealer precedent) - Help Net Security](https://www.helpnetsecurity.com/2026/03/25/teampcp-supply-chain-attacks/)
- [Context: Trojanized Microsoft SDK durabletask 1.4.1-1.4.3 deliver credential-stealing malware - Endor Labs](https://www.endorlabs.com/learn/trojanized-microsoft-sdk-durabletask-1-4-1-through-1-4-3-deliver-credential-stealing-malware)
- [Context: Malicious durabletask on PyPI: Multi-Cloud Credential Stealer - SafeDep](https://safedep.io/malicious-durabletask-pypi-supply-chain-attack/)
- [Context: TeamPCP and the Cascading AI/ML Supply Chain Campaign - Cloud Security Alliance](https://labs.cloudsecurityalliance.org/research/csa-research-note-ai-pypi-supply-chain-campaign-20260329-csa/)
- [Context: Malicious code in pantheon-agents (PyPI) - OSV MAL-2026-5299 (*-setup.pth precedent)](https://osv.dev/vulnerability/MAL-2026-5299)

## 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): https://intel.threadlinqs.com/mcp

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