Skip to main content

Microsoft PyPI Hack: Agent Framework Stole Credentials

TechorCoffee
TechorCoffee
Editorial Team

Published (Updated )

Microsoft PyPI Hack: Agent Framework Stole Credentials

Microsoft's agent-framework is an open-source toolkit for building AI agents in Python. It is a legitimate, widely used package, and that is exactly what made this incident so serious. Attackers did not need to trick developers into installing a fake package with a misspelled name. The malicious code arrived inside the real package, under the real name, from the real project.

On November 17, 2026, version 1.26.1 of agent-framework appeared on PyPI carrying a credential-stealing payload. When that version was quarantined, a second rigged version, 1.26.2, followed almost immediately. Both were removed the same evening, but the window in which they were available was long enough for automated tooling β€” and some real users β€” to pick them up.

The incident is a textbook software supply-chain attack: instead of targeting individual developers or companies directly, the attacker compromised a trusted distribution channel and let the normal update process do the work.

The quick answer

  • On November 17, 2026, two versions of Microsoft's official agent-framework Python package on PyPI β€” 1.26.1 and 1.26.2 β€” were published carrying a credential-stealing payload.
  • These were not typosquats or lookalike packages. They came through the project's real publishing identity on PyPI.
  • The malicious code was live for roughly 40 to 55 minutes before both versions were quarantined and removed.
  • The payload did not wait for anyone to import the library. It ran every time Python started in an affected environment.
  • It harvested cloud tokens, API keys, secrets and credential files, then sent them to a remote endpoint in a single compressed request.
  • The real-world impact appears limited so far, but anyone who installed version 1.26.1 or 1.26.2 must treat their credentials as exposed and rotate them.
  • Version 1.26.0, published on November 12, is the last clean release and is still the current version on PyPI.

What happened

Microsoft's agent-framework is an open-source toolkit for building AI agents in Python. It is a legitimate, widely used package, and that is exactly what made this incident so serious. Attackers did not need to trick developers into installing a fake package with a misspelled name. The malicious code arrived inside the real package, under the real name, from the real project.

On November 17, 2026, version 1.26.1 of agent-framework appeared on PyPI carrying a credential-stealing payload. When that version was quarantined, a second rigged version, 1.26.2, followed almost immediately. Both were removed the same evening, but the window in which they were available was long enough for automated tooling β€” and some real users β€” to pick them up.

The incident is a textbook software supply-chain attack: instead of targeting individual developers or companies directly, the attacker compromised a trusted distribution channel and let the normal update process do the work.

The timeline, minute by minute

The speed of the attack and the response is one of the most striking parts of this story. Everything happened inside a single hour on the evening of November 17, 2026, in UTC time.

  • 20:35 UTC, November 17 β€” Version 1.26.1 was uploaded to PyPI. It was distributed as a wheel only, with no source distribution.
  • 21:06 UTC β€” PyPI quarantined version 1.26.1, roughly 31 minutes after it appeared.
  • 21:08 UTC β€” Version 1.26.2 was uploaded, just two minutes after the first version was quarantined.
  • 21:16 UTC β€” PyPI quarantined version 1.26.2, eight minutes after it appeared.
  • Around 21:30 UTC β€” Both malicious versions were gone from PyPI.

That puts the total exposure window at roughly 40 to 55 minutes across the two versions. It sounds short, and in one sense it was. But in the world of automated dependency management, 40 minutes is a long time.

Dependency bots move fast. Renovate, the automated dependency-update tool, was opening upgrade pull requests within six minutes of version 1.26.1 appearing.

How the Payload Worked

The technical detail that sets this attack apart is how the malicious code ran. Most malicious Python packages hide their payload in the code that executes when the package is imported. This one did something sneakier.

Each rigged wheel placed a .pth file inside the Python site-packages directory:

  • Version 1.26.1 used a file called agent_framework_meta.pth.
  • Version 1.26.2 used a file called af_runtime_diag.pth.

A .pth file is a startup hook. Python's site module reads and executes these files every time the interpreter starts up. That means the credential stealer ran whenever Python started in an affected environment β€” even if nothing in that environment ever imported agent-framework at all.

Illustration of a software supply chain attack with one compromised package glowing red among clean packages

What the stealer took

Once running, the payload went after the most valuable thing in a developer or CI environment: credentials. Its harvest was broad and systematic.

  • Environment variables matching patterns such as TOKEN, SECRET, KEY, AZURE, AWS, GITHUB and OPENAI, along with similar secret-looking names.
  • Other processes' environments, read through the /proc filesystem on Linux systems, so secrets belonging to neighbouring processes were also in scope.
  • Credential files for Azure CLI, pip, npm, Git, Docker and Hugging Face.
  • .env files, which commonly hold application secrets in development and deployment environments.
  • .netrc and .git-credentials files, which store login credentials for remote services and Git hosts.
  • Fresh Azure managed-identity tokens and CI federation tokens, requested on demand rather than simply copied from disk.
  • GitHub Actions OIDC tokens, added in version 1.26.2, which would let an attacker request short-lived identity tokens inside CI pipelines.

All of the stolen data was compressed, base64-encoded and sent in a single POST request to a webhook.site endpoint. Webhook.site is a legitimate service that gives users a disposable URL for inspecting incoming web requests β€” in this case it was used as a dead drop for the stolen data.

One caution matters here. StepSecurity, one of the firms that analysed the incident, has cautioned that there is no confirmation any tokens were actually issued as a result of these requests.

How many people were affected

The package itself is popular. It records roughly 190,000 to 200,000 downloads per month β€” 192,534 according to OX Security's figures, and an average of around 196,000 according to Elastic. With that many downloads, even a short exposure window could in principle have reached a large number of users.

The evidence so far, however, points to a much smaller real-world impact. Wiz, the security firm that investigated the incident, read the free-tier webhook inbox used as the exfiltration endpoint. The free tier of that service stores a maximum of 100 requests, and Wiz found 50 stored requests in the inbox.

  • 4 requests came from the attacker's own machines.
  • 29 requests came from security sandboxes β€” automated analysis environments that detonate suspicious files.
  • 17 requests were successful victim dumps, and those came from only 3 unique cases.

So the confirmed victim count, based on the data that reached the attacker's inbox, is very small: 17 successful dumps from 3 unique sources. That is genuinely reassuring, but it comes with caveats. The inbox only held what the free tier retained, and the picture could be incomplete.

The suspected root cause

How did the attacker get a malicious release published under Microsoft's real project identity? According to Wiz, the attacker "appears to have" used a compromised client certificate and private key for Microsoft ESRP, the internal Microsoft service that signs and publishes this package.

That finding must be labelled carefully. It is Wiz's assessment, not established fact, and Microsoft had not publicly confirmed this mechanism. Here is what Wiz reported about the sequence of events:

  • A first publish attempt from an AWS address was rejected by ESRP's IP filtering.
  • A second attempt, this time from Microsoft-owned IP address space, succeeded.
  • How the certificate and private key were obtained in the first place is not known.

The GitHub security advisory for the incident says the activity has not been attributed to a known campaign. Microsoft has not published its own advisory on the incident. A Microsoft spokesperson told The Register that the company made some repositories private while it investigated and would review the situation and take further action.

That response included a striking step. On November 17, Microsoft made eight repositories private, including onnxruntime, onnxruntime-genai and agent-framework itself. Wiz found no malicious code in Microsoft's own source tree β€” the attack went through the release and signing path, not Git history.

The warning signs in the malicious releases

Several indicators marked the two rigged versions as different from a normal release. None of them would have been obvious to a developer running a routine install, but together they form a clear picture for investigators.

  • Both malicious wheels carried the uploader user-agent RestSharp/106.13.0.0, which is not what a normal Microsoft publish would use.
  • Both shipped without a provenance attestation, the signed record that ties a published package to the build that produced it. The clean release had one; the rigged versions did not.
  • Neither shipped a source distribution. Version 1.26.1 was wheel-only, unlike the clean release.
  • A newly created maintainer account was added to the project on November 17, according to StepSecurity.

The incident is tracked under three identifiers, which are useful if you need to look it up or check whether your own tooling has flagged it:

  • GitHub Advisory GHSA-764m-3ppc-5m73
  • PYSEC-2026-4388
  • MAL-2026-20101

Why the attack was hard to notice

One reason this incident is unsettling is how normal everything looked to the people using the package. Both rigged versions kept the genuine agent-framework-core 1.26.0 dependency, so applications built on the package kept working exactly as before. There were no crashes, no broken imports, no error messages to prompt an investigation.

That is by design. A credential stealer that breaks the host application gets noticed and removed quickly. A credential stealer that lets everything keep working can sit quietly in an environment, harvesting secrets every time Python starts, until someone spots it from the outside.

This is also why the incident matters beyond the small number of confirmed victims. It demonstrates a technique β€” abusing .pth files in a trusted package β€” that other attackers will now know works, and it shows that the signing and publishing path, not just the source code, is a target worth defending.

What to Do Now

If you use agent-framework, or you work in an environment where it might be installed, here is what to do, in order.

  • Check which version you have installed. Look for version 1.26.1 or 1.26.2 in every environment you control: your laptop, your servers, your CI runners and your containers. Check lockfiles and build logs too, not just what is installed right now.
  • If you find 1.26.1 or 1.26.2, treat every credential in that environment as exposed. That includes environment variables, cloud tokens, API keys, Git credentials and anything stored in .env files.
  • Rotate all of those credentials. Start with cloud credentials β€” Azure, AWS and GitHub β€” then move on to API keys such as OpenAI tokens, then service credentials for npm, Docker and Hugging Face. Do not just change the password and reuse the same token elsewhere.
  • Check for the .pth files. Look in site-packages for agent_framework_meta.pth and af_runtime_diag.pth. If either is present, the environment is affected even if the package itself has already been removed.
  • Remove the malicious versions completely. Uninstall the package, delete the .pth files, and reinstall the clean version, 1.26.0, from PyPI.
  • Review recent activity on the accounts those credentials protect. Look for unfamiliar logins, new API keys, unexpected repository access or unusual cloud resource creation. The payload's goal was credential theft, and stolen credentials are usually used quickly.
  • Check your CI pipelines. If a pipeline installed the latest version of agent-framework on November 17, 2026, its logs will show it. Pay special attention to pipelines that ran between 20:35 and 21:30 UTC that day.
  • Pin your dependencies. Use lockfiles and pinned versions rather than floating installs that always take the latest release. A pinned version cannot silently jump to a compromised release.

If you only ever used version 1.26.0 or earlier, and never installed 1.26.1 or 1.26.2, you do not need to rotate credentials because of this incident. But it is still worth checking your lockfiles to be sure, and worth treating this as a prompt to review how your projects handle dependency updates.

Developer rotating API keys and passwords on a credentials management dashboard

What this means for Python supply-chain security

This is not the first time a Microsoft Python package has been compromised on PyPI. Earlier in 2026, the durabletask package was compromised after a stolen PyPI token. That incident and this one share a pattern: the attacker did not need to break into Microsoft's source code. They needed access to the publishing path, and once they had it, the trust that developers place in the package name did the rest.

The incident also exposes a gap that many teams have not closed. Most Python projects pin their direct dependencies but leave transitive dependencies floating, and many CI pipelines install the latest version of everything on every run. That is convenient, and it is exactly the behaviour that lets a 40-minute exposure window turn into real compromises.

  • Pin versions and use lockfiles. A locked dependency tree only changes when a human reviews and approves the change.
  • Check provenance attestations. A package published without the attestation its previous releases carried is a reason to pause, not a detail to ignore.
  • Monitor for unexpected maintainer changes. A new maintainer account appearing on a project on the same day as a release is a red flag.
  • Watch for .pth files. They are rare in legitimate packages. A new .pth file appearing in site-packages after an install deserves a look.
  • Separate secrets from build environments. Credentials that a build never needs should never be present in the environment where the build runs.

None of these measures would have stopped the attacker from publishing the malicious versions. But each of them would have reduced the chance that a given team installed them, or limited what the payload could steal if they did.

What is confirmed β€” and what is not

It is worth being precise, because this story is still developing.

  • Confirmed: versions 1.26.1 and 1.26.2 carried a credential-stealing payload, were quarantined by PyPI on November 17, 2026, and have been removed. Version 1.26.0 is the last clean release.
  • Attributed, not confirmed: Wiz's assessment that the attacker used a compromised client certificate and private key for Microsoft ESRP. Microsoft had not publicly confirmed this mechanism.
  • Not attributed: the GitHub advisory says the activity has not been attributed to a known campaign.
  • Not confirmed: whether any fresh tokens were actually issued. StepSecurity cautions there is no confirmation of this.
  • Not published: Microsoft has not published its own advisory. In its absence, the practical guidance comes from PyPI, the GitHub advisory and the security firms that analysed the incident.

The bottom line

A trusted Microsoft package was turned into a credential stealer for less than an hour, and the only reason the damage appears limited is that the window was short and the exfiltration channel was small. The technique was sophisticated β€” a .pth startup hook, a real publishing identity, a clean-looking package that kept working β€” and the target was the part of the software supply chain that developers trust most.

If you installed version 1.26.1 or 1.26.2, rotate your credentials now and check the accounts they protect. If you did not, check your lockfiles to be sure, pin your dependencies, and treat this as a reminder that the package name on PyPI is only as trustworthy as the publishing pipeline behind it.

FAQs

Which versions of agent-framework were compromised?

Versions 1.26.1 and 1.26.2, both published on PyPI on November 17, 2026. Version 1.26.0, published on November 12, is the last clean release and is still current on PyPI.

How did the malicious code run if I never imported the package?

Each rigged wheel placed a .pth startup file in site-packages, which Python's site module executes every time the interpreter starts. The stealer ran whenever Python started in an affected environment, even if nothing imported agent-framework.

What credentials were stolen?

Environment variables matching secret patterns, other processes' environments via /proc, credential files for Azure CLI, pip, npm, Git, Docker and Hugging Face, .env files, .netrc and .git-credentials, plus requests for fresh Azure managed-identity, CI federation and GitHub Actions OIDC tokens. There is no confirmation any fresh tokens were actually issued.

How do I know if I was affected?

Check every environment, lockfile and CI log for agent-framework 1.26.1 or 1.26.2, and look in site-packages for agent_framework_meta.pth or af_runtime_diag.pth. If either version or either file is present, treat the environment as affected.

What should I do if I installed a compromised version?

Uninstall it, delete the .pth files, reinstall clean version 1.26.0, and rotate every credential that was present in the affected environment β€” cloud tokens, API keys, Git credentials and service logins β€” then review recent activity on those accounts.

Has Microsoft confirmed how the attacker published the malicious versions?

No. Wiz assesses that the attacker appears to have used a compromised client certificate and private key for Microsoft ESRP, but Microsoft had not publicly confirmed this mechanism, and the activity has not been attributed to a known campaign.

Was this article helpful?

Explore Specs, Comparisons & Related Topics

TechorCoffee

Written By

TechorCoffee

Editorial Team

The TechOrCoffee Editorial Team covers consumer hardware, artificial intelligence, software engineering, and regional smartphone & laptop market analysis.

Comments (0)

Sort by:

Leave a Comment

Loading comments...

Read Next