{"id":"MAL-2026-20101","summary":"Malicious code in agent-framework (PyPI)","details":"Malicious releases of the legitimate \"agent-framework\" package (Microsoft Agent Framework). Versions 1.26.1 and 1.26.2 add a credential stealer that is not present in the last clean release, 1.26.0. Both releases were published on 2026-11-17 (1.26.1 at 20:35 UTC as a wheel only, 1.26.2 at 21:08 UTC) and have since been removed from PyPI.\n\nHow it triggers: each wheel adds an executable .pth startup hook that imports a helper module. Python runs .pth files at every interpreter start, so the code executes as soon as the package is installed, without importing agent_framework. In 1.26.1 the files are agent_framework_meta.pth and agent_framework_meta/_telemetry.py, started from a hook added to agent_framework_meta/__init__.py. In 1.26.2 they are renamed to af_runtime_diag.pth and af_runtime_diag.py; agent_framework_meta/__init__.py is identical to the clean 1.26.0 and the module calls its own _start() on import, so the .pth is the only trigger. The helper detaches into a background process (os.fork, os.setsid), is guarded by the environment marker _AF_TEL, and silences all errors. The rest of the wheel matches 1.26.0 and the dependency is unchanged (agent-framework-core[all]==1.26.0).\n\nWhat it does (info stealer): it collects hostname, user, working directory and arguments; environment variables whose names contain TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB, HF_, OPENAI, NPM, PIP or CI_; the environment of other processes (/proc/*/environ); credential files (~/.azure, .npmrc, .netrc, .git-credentials, .docker/config.json, Hugging Face token, Azure DevOps agent .credentials, .env files); Azure DevOps OIDC tokens (SYSTEM_ACCESSTOKEN, SYSTEM_OIDCREQUESTURI); and Azure managed-identity tokens from the instance metadata service (169.254.169.254, IDENTITY_ENDPOINT). 1.26.2 adds theft of GitHub Actions OIDC tokens (ACTIONS_ID_TOKEN_REQUEST_URL, ACTIONS_ID_TOKEN_REQUEST_TOKEN, ACTIONS_RUNTIME_TOKEN), adds the /home/runner paths, and raises the limit on captured files from 60 to 80.\n\nExfiltration: the data is compressed with zlib, base64-encoded and sent by HTTP POST to https://webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb. The URL is stored base64-encoded (_ENC) and is identical in both releases. The User-Agent is af-runtime-diagnostics/1 in 1.26.1 and runtime-diagnostics/1 in 1.26.2.\n\nWheel sha256: 1.26.1 d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110; 1.26.2 3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9.\n\nAnyone who installed 1.26.1 or 1.26.2 should treat the environment as exposed and rotate the credentials reachable from it, including CI and GitHub Actions secrets. 1.26.0 and earlier are not affected. We have not attributed this to a known campaign.\n\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (72f7549a69d5529aca2fb787d2fbb62f94e73afd9ca1a832608687e1d185e594)\nThe wheel ships agent_framework_meta.pth containing `import agent_framework_meta`, which runs on every Python interpreter start (not just on `import agent_framework`). The imported module spawns a background thread that harvests installer-side secrets and POSTs a base64+zlib-compressed payload to https://webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb, whose URL is concealed as a base64 literal (_ENC) decoded at runtime. Collection includes: environment variables matching TOKEN/SECRET/PASSWORD/KEY/AZURE/AWS/GITHUB/OPENAI patterns; credential files ~/.azure, ~/.npmrc, ~/.netrc, ~/.git-credentials, ~/.docker/config.json, Hugging Face tokens; /proc/[0-9]*/environ scraping of other processes; Azure IMDS (169.254.169.254) and App Service IDENTITY_ENDPOINT managed-identity token requests across multiple resource audiences (management.azure.com, vault.azure.net, graph.microsoft.com, storage, etc.); and an ADO OIDC token-exchange POST using SYSTEM_ACCESSTOKEN against SYSTEM_OIDCREQUESTURI. Package metadata impersonates Microsoft and mimics the real microsoft/agent-framework README as cover. The name resembles the legitimate Microsoft package.\n\n## Source: kam193 (7170b55e6541c89d914a388534b7ccaeb303abb46def27bda667f5ad2051ed5d)\nVersions 1.26.1, 1.26.2 were compromised.\n\n\nCompromised versions use PTH file to trigger malicious actions on every Python process startup. It then exfiltrates environment variables, credential files and tokens from cloud metadata endpoints.\n\n\n---\n\nCategory: MALICIOUS - The campaign has clearly malicious intent, like infostealers.\n\n\nCampaign: 2026-11-compr-agent-framework\n\n\nReasons (based on the campaign):\n\n\n - exfiltration-env-variables\n\n\n - obfuscation\n\n\n - exfiltration-cloud-tokens\n\n\n - exfiltration-credentials\n\n\n - compromised-package\n\n\n - abuses-pth\n","modified":"2026-11-17T23:15:03.541420800Z","published":"2026-11-17T22:12:19Z","database_specific":{"malicious-packages-origins":[{"import_time":"2026-11-17T23:10:33.787225233Z","modified_time":"2026-11-17T23:04:06Z","sha256":"72f7549a69d5529aca2fb787d2fbb62f94e73afd9ca1a832608687e1d185e594","source":"amazon-inspector","versions":["1.26.1"],"id":"IN-MAL-2026-022818"},{"versions":["1.26.1","1.26.2"],"id":"pypi/2026-11-compr-agent-framework/agent-framework","import_time":"2026-11-17T23:10:36.477156957Z","modified_time":"2026-11-17T22:12:19Z","sha256":"7170b55e6541c89d914a388534b7ccaeb303abb46def27bda667f5ad2051ed5d","source":"kam193"}]},"references":[{"type":"PACKAGE","url":"https://pypi.org/project/agent-framework/1.26.2/"},{"type":"PACKAGE","url":"https://pypi.org/project/agent-framework/1.26.1/"},{"type":"WEB","url":"https://opensourcemalware.com/blog/agent-framework-pypi-compromised"},{"type":"WEB","url":"https://bad-packages.kam193.eu/pypi/campaign/2026-11-compr-agent-framework"}],"affected":[{"package":{"name":"agent-framework","ecosystem":"PyPI","purl":"pkg:pypi/agent-framework"},"versions":["1.26.2","1.26.1"],"database_specific":{"indicators":{"evidence_files":[{"tlsh":"f0d17592a94038e3d206726ccc24e61c233bfd4b2c515434becc5b594f8e5bad5b6aad","artifacts":["agent_framework-1.26.1-py3-none-any.whl"],"path":"agent_framework_meta/_telemetry.py","sha256":"39fa329f2a93f734b0bb8f5adb203ea3331d1ae479832a5015a54cb17aabd663"},{"path":"agent_framework_meta.pth","sha256":"21f28e8517a10ffe431f8d68f5875c85eca4001ae6d118322b0a41873998eb5e","artifacts":["agent_framework-1.26.1-py3-none-any.whl"]}]},"iocs":{"files":[],"ips":["169.254.169.254"],"urls":["https://webhook.site/"],"domains":["webhook.site"]},"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/pypi/agent-framework/MAL-2026-20101.json","cwes":[{"description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code","cweId":"CWE-506"}]}}],"schema_version":"1.9.2","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"},{"name":"Kamil Mańkowski (kam193)","contact":["https://github.com/kam193","https://bad-packages.kam193.eu/"],"type":"ANALYST"},{"name":"OX Security","type":"FINDER"}]}