> ## Content Index
> Fetch the complete content index at: https://globalfeed.ai/llms.txt
> Use this file to discover other available public pages before exploring further.

# One line that runs when Python starts: what was inside the agent-framework package?
- URL: https://globalfeed.ai/en/one-line-that-runs-when-python-starts-what-was-inside-the-agent-framework-package/
- Published: 2026-11-18T12:54:22.000Z
- Updated: 2026-11-18T12:54:22.000Z
- Description: Two releases of Microsoft's open source agent-framework package, 1.26.1 and 1.26.2, uploaded to PyPI on November 17, collected credentials through a .pth file that runs at every Python start. What happened, how to check and what to do, based on OpenSSF, OpenSourceMalware and Socket records.
- Author: GlobalFeed Editor
- Tags: security, Python, PyPI, supply chain, Open Source, dil-en, elle

On a Python developer's machine, the interpreter starts hundreds of times a day: a test, a script, a notebook cell. Few people think about what runs at that moment. Two package releases uploaded to PyPI on the evening of November 17 used exactly that moment, through a one-line file, to do their work unnoticed. The package is [agent-framework](https://osv.dev/vulnerability/MAL-2026-20101?ref=globalfeed.ai), the open source library Microsoft publishes for building AI agents, and the releases are 1.26.1 and 1.26.2.

The incident is recorded with the same details in three separate places. OpenSSF Malicious Packages, the open source database of malicious packages, lists both releases as MAL-2026-20101; according to the record they were caught by Amazon Inspector and OX Security, and analysed by independent researcher Kamil Małkowski (kam193). The [OpenSourceMalware](https://opensourcemalware.com/blog/agent-framework-pypi-compromised?ref=globalfeed.ai) and [Socket](https://socket.dev/blog/agent-framework-pypi-package-compromised-with-credential-stealer?ref=globalfeed.ai) research teams published their own analyses. On the [PyPI project page](https://pypi.org/project/agent-framework/?ref=globalfeed.ai), the latest release today is 1.26.0 from November 12; the two affected releases have been removed.

## What happened: the timeline

According to the OSV record, 1.26.1 was uploaded on November 17 at 20:35 UTC as a wheel only, and 1.26.2 followed 33 minutes later at 21:08\. OpenSourceMalware's analysis says both came from the official Microsoft-associated PyPI publisher account, so this was not a typosquat: the package name, the publisher and the earlier clean releases all looked normal. The same analysis says 1.26.2 appeared after PyPI quarantined 1.26.1, which is why PyPI quarantined the publisher account. The OSV record does not attribute the incident to a known campaign. How many people installed the two releases is not public; OpenSourceMalware specifically notes that the project's overall download figures should not be read as a victim count.

## How a .pth file works

Every time Python starts, it looks in site-packages, the folder where packages are installed, and reads any file ending in .pth. These files normally tell Python to add extra folders to its search path. But if a line starts with "import", Python runs it. Think of a bell wired to a building's front door: it does not matter which room you are heading to, the bell rings the moment the door opens.

That is how the affected releases worked. In 1.26.1, a file named agent\_framework\_meta.pth called a helper module inside the package. In 1.26.2 the files were renamed af\_runtime\_diag.pth and af\_runtime\_diag.py, names that suggest a harmless runtime diagnostics tool. According to OpenSourceMalware, the .pth file is a single 23-byte line. The result: someone who installed the package never had to import agent\_framework. Whenever Python started in that environment, the code launched in the background as a separate process and silently swallowed its errors. The rest of the package matched 1.26.0, so applications kept working normally.

## What the code collected

The three technical write-ups give the same list. The code read environment variables whose names contain words such as TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB and OPENAI; Azure CLI, pip, npm, Git, Docker and Hugging Face configuration files; .env files; and the environment variables of other processes on the same machine. It also went a step further and requested fresh access tokens from Azure managed identity, Azure DevOps and, in 1.26.2, GitHub Actions. The collected data was compressed, encoded and sent to a single address on webhook.site. According to OpenSourceMalware, the code downloads no further software, takes no remote commands and leaves no persistence such as a service or scheduled task; it runs as long as its files sit in site-packages.

## How to check your own machine

The check takes a few minutes. First, look at the installed version: if `pip show agent-framework` shows 1.26.1 or 1.26.2 on the "Version" line, the environment is affected. If you use uv or Poetry, search uv.lock, poetry.lock or your requirements files for those two versions. Second, the site-packages folder: `python -c "import site; print(site.getsitepackages())"` prints its location, and you only need to check whether a file named agent\_framework\_meta.pth or af\_runtime\_diag.pth is there. Teams using continuous integration can check build logs from the evening of November 17 onward for installs of these versions. Because the OSV record is published, tools such as osv-scanner also flag the two versions in lock files.

If you were affected, the steps are clear: remove the package, delete the virtual environment, and install 1.26.0 with a pinned version in a clean environment. Then rotate every credential reachable from that machine or build environment: Azure, GitHub, Hugging Face, npm, PyPI and Docker credentials, and CI secrets. All the sources make the same point: even after the package is replaced with a clean version, keys that were read at install time are only safe once they are rotated.

## Two habits worth keeping

The first is version pinning with hash checking. `pip-compile --generate-hashes` or uv's lock file records which version of each package, and which file hash, will be installed. Installing with `pip install --require-hashes -r requirements.txt` means a new release that is not in the lock file cannot slip in on its own. The second is giving new releases a short waiting period. In this case the bad releases were detected and removed within hours; options such as uv's `--exclude-newer` keep releases uploaded in the last few days out of automatic updates. Both habits are free and can be set up today with existing tools.

The good news in this story is the speed: about an hour and a half after the first release was uploaded, the OSV record was out, and the open source security community, from Amazon to independent researchers, had reached the same details the same night.

Sources: [OSV / OpenSSF MAL-2026-20101](https://osv.dev/vulnerability/MAL-2026-20101?ref=globalfeed.ai), [OpenSourceMalware](https://opensourcemalware.com/blog/agent-framework-pypi-compromised?ref=globalfeed.ai), [Socket](https://socket.dev/blog/agent-framework-pypi-package-compromised-with-credential-stealer?ref=globalfeed.ai), [PyPI agent-framework](https://pypi.org/project/agent-framework/?ref=globalfeed.ai), [kam193](https://bad-packages.kam193.eu/pypi/campaign/2026-11-compr-agent-framework?ref=globalfeed.ai)