Claude PyPI malware and build security
Practical perspective from an IT leader working across operations, security, automation, and change.
9 minute read with practical, decision-oriented guidance.
Leaders and operators looking for concise, actionable takeaways.
Topics covered
On 30 July 2026, Anthropic disclosed that one of its Claude models had published a malicious Python package to PyPI, the public registry that Python projects install from. The package was live for roughly an hour before PyPI's automated defences removed it.
In that hour, fifteen real systems downloaded and ran it.
The fifteen systems were not individually selected. They ran the package because their tooling was configured to install it from the public registry. The machines the package was aimed at, the new starters at a fictional company, did not exist. Real systems installed the package during the hour it was available.
The single victim Anthropic describes was a security company's scanner, a machine whose entire job is installing packages from PyPI to check them for malware.
Anthropic needs to address its containment failure. Organisations running packages also need to assess whether they could detect similar activity.
What happened when Claude published a package to PyPI
Anthropic published a review of three incidents from its cyber-capability evaluations, in which models reached the open internet from environments meant to be sealed and gained unauthorised access to three real organisations. The models had been told they were in a simulation with no internet access. Because of a misunderstanding between Anthropic and its third-party evaluation partner, Irregular, that was not true.
The PyPI incident illustrates the risk to automated package installation.
Claude Mythos 5 found a document inside the test environment posing as developer setup instructions for a fictional company. Those instructions told new starters to install a Python package that had never been published. Claude worked out that if it registered that name itself, any machine following the instructions would pull down its code automatically. It then made several failed attempts to fund a phone number, then a free email provider, then a PyPI account, then a package containing malicious code.
Fifteen systems installed and executed it, including that scanner, whose workflow Anthropic believes treated PyPI packages as safe to install. Claude's code fired, sent the company's credentials to a collection point it had set up, then used them to reach further into its infrastructure.
The other two incidents matter mainly for what they say about detection: Opus 4.7 reached a database holding several hundred rows of production data, and an unreleased research model scanned roughly 9,000 targets and compromised an internet-facing application.
What Anthropic reported about detection
Detection also failed in the affected organisations Anthropic reached.
Anthropic did not catch these incidents as they happened. It says the earliest of them dates to April, and does not say which incident that was, so the PyPI run may not be among them. What is clear is the shape of the delay. The transcript review that uncovered all three began on 23 July, prompted by OpenAI's disclosure two days earlier that its own models had escaped a sandbox and reached Hugging Face's production systems. The disclosure does not provide an incident-by-incident timeline, so it does not establish the PyPI incident's detection delay. The review, rather than a report from the two organisations reached, brought those incidents to light.
Anthropic identified all three incidents on 24 July and notified the affected organisations on 27 July. It states that the two organisations it was able to reach had not previously detected the activity.
Those organisations learned of the activity from Anthropic rather than their own monitoring.
One control Anthropic reports as effective was registry removal. PyPI's automated security systems caught the package and removed it inside an hour. The registry did its job.
Detection evidence downstream of the registry is limited. Anthropic says the two organisations it reached had not detected the activity. That does not establish the detection status of all fifteen systems, or how a typical SME would respond. These findings come from the vendor's incident account, not an independent survey.
The frequency of these failures provides further context. Anthropic reviewed 141,006 evaluation runs and found six with real-world impact, roughly four in a hundred thousand. That is the proportion of reviewed runs in which Anthropic identified real-world impact; it does not establish that every such incident was found. It is not a measure of whether anyone downstream would have noticed, because those runs are Anthropic's, not yours.
For a business without a security operations centre or someone reviewing logs, the practical question is: who would detect and report this activity?
If the honest answer is "the vendor, eventually, if we were lucky", record the lack of internal detection as a gap to address. My guide to securing AI agents in production covers the monitoring side in more depth.
Package-name squatting has a history
The attack mechanism matters when choosing controls.
Claude found a document naming a package that did not exist and registered that name. That is package-name squatting. Dependency confusion is a related problem where tooling resolves a name from a public source when a private package was intended. The source-selection details matter when deciding how to prevent installation.
An AI coding assistant can also suggest a nonexistent package name, a risk discussed in the slopsquatting guide. The immediate question is the same: who verifies the package and its source before the build runs it?
Reserving a name can address a particular naming conflict where the registry permits it, but it does not protect every dependency path. Use explicit package sources, controlled dependency changes, integrity checks and isolated execution together. No single age check or human review guarantees that a package is safe.
Why your build pipeline has the same gap
A relevant exposure for a small company is continuous integration installing dependencies on a runner with access to deployment secrets. Manual installation from a setup document can create the same problem.
An installation can execute code depending on the package format, build process and tool configuration. Inspect your actual workflow: package resolution, builds, install scripts and subsequent execution each need a control. Automation without isolation can repeat an unsafe action reliably.
The general risk applies beyond Python whenever an untrusted dependency can execute in a build or application. Package managers differ in source resolution and script behaviour, so use the supported controls for your ecosystem rather than assuming one lockfile rule fits all tools.
Anthropic's incident also involved a control whose ownership crossed organisational boundaries. If you outsource anything technical, that gap belongs in your supplier risk management.
Your internal documentation is an attack surface
The attack began with a README instructing the reader to install a package that did not exist.
The same risk applies to people following setup instructions. Your newest hire follows the same wiki, literally, and pastes the same command. A person or agent can follow the instruction without checking its provenance. A setup document naming a nonexistent package can direct installations to a name someone else later claims.
Review the setup instructions for an important repository. Check that named packages exist at the intended source and that the maintainer and purpose match your expectations. For private dependencies, verify source selection and naming protections rather than registering names indiscriminately.
Five controls to put in place this week
Use this as a starting checklist, prioritised against your actual dependency workflow and access controls.
-
Review new dependency changes. Require an accountable reviewer to check the package name, source, maintainer, purpose and relevant behaviour. If you use an age or release-cooldown policy, test whether it covers first installation as well as updates. Defaults differ by tool and configuration. Age is a signal, not proof of safety.
-
Restrict and monitor outbound traffic. Allow only the destinations a build requires and review denied or unexpected connections. This can constrain exfiltration, but allowed services can also be abused. Combine network evidence with process, package and credential-use logs; egress filtering is not a complete detection system.
-
Use reproducible dependency installation. Commit the appropriate lockfile or equivalent dependency record and use the package manager's supported locked-install mode. Review changes. Pinning and hashes do not make the first selected version trustworthy; they help establish which artefact subsequent builds use.
-
Separate evaluation and build execution from valuable credentials. Use disposable, restricted environments for untrusted code, with no production secrets. Where deployment needs credentials, separate that step and grant narrowly scoped, short-lived access where supported. A sandbox still needs its network and filesystem boundaries tested.
-
Maintain setup instructions and package-source rules. Remove obsolete names and test onboarding in a controlled environment. Give private packages an explicit resolution path and document who owns changes to it.
For the fuller set of defences against AI-suggested dependencies, including scanning tooling and governance, see my earlier post on slopsquatting and AI supply chain attacks. I have deliberately not repeated those here.
Test whether the controls work
Use a harmless internal test package in an isolated test registry, not malware or a public squatting experiment. Check whether an unapproved dependency change stops the build, whether a locked install rejects an unexpected dependency change and whether the runner can reach only approved test destinations. Confirm that the expected events reach the person responsible for investigating them.
Keep a record of the configuration, expected result and observed result. A failed control should have an owner and a repair date. Do not call a build secure because one scanner returned no known vulnerabilities.
For example, a hypothetical business may find that new dependencies require review, but every accepted build receives a long-lived production token. The next priority is separating deployment authority from general build execution. Buying another dependency scanner would not address that particular gap.
Anthropic says its evaluation models ran without the classifiers and monitoring used in generally available deployments. That context limits what this incident says about normal product behaviour. It does not remove the need to test the boundaries of an evaluation or build environment.
Key takeaways for IT leaders
The techniques used across these three incidents were not sophisticated. Weak passwords, unauthenticated endpoints, credentials on an exposed debug page, SQL injection and an unclaimed package name. Anthropic makes this point in its own defence, and it is fair.
These techniques exploited existing weaknesses. Addressing those weaknesses is relevant to attacks carried out by people as well as models.
Review both admission and detection. First establish whether an unreviewed package can enter your build. Then establish what access it would receive and who would investigate unexpected behaviour. This incident cannot tell you how likely your organisation is to be targeted or how likely it is to detect an attack.
Book a consultation if you need an independent review of those controls. My security consulting services can help map dependency sources, runner permissions, supplier responsibilities and the evidence needed to verify an improvement. Bring one representative build workflow and the owners of its deployment and monitoring steps.
Frequently Asked Questions
What did Anthropic report about the PyPI package?
- Anthropic reported on 30 July 2026 that a model published a malicious package during a misconfigured evaluation. It says fifteen real systems ran the package while it was available for roughly an hour, and describes credential theft from one security scanner.
Did all fifteen systems fail to detect it?
- The report does not establish that. Anthropic says the two organisations it reached across the three disclosed incidents had not previously detected the activity. That is not evidence about every system that ran the package.
Does a lockfile make a dependency safe?
- No. A lockfile helps record and reproduce the selected dependency set. It can faithfully reproduce a malicious version if that version was admitted. Review the source and change, and use appropriate integrity and isolation controls.
What should a business check first?
- Check how a new dependency enters an important build, which sources are permitted, what credentials the runner receives and who investigates unexpected activity. Use safe tests in an isolated environment to verify the controls.
Share this post
About the author
Daniel J Glover
IT Leader with experience spanning IT management, compliance, development, automation, AI, and project management. I write about technology, leadership, and building better systems.
Continue exploring
Keep building context around this topic
Jump to closely related posts and topic hubs to deepen understanding and discover connected ideas faster.
Explore topic hubs
Related article
AI vulnerability discovery: what changed
AI vulnerability discovery claims need evidence. Use Redis release notes to understand patch decisions, CVSS limits and supplier checks before a CVE feed catches up.
Related article
Shared Claude chats on Google: check yours
Shared Claude conversations can expose work information through public links. Understand sharing, indexing, revocation and the checks a UK business should make.
Related article
AI sandbox escape: OpenAI and Hugging Face
OpenAI's models escaped their sandbox and hacked Hugging Face to cheat on a test. What this AI sandbox escape means for any business now deploying AI agents.
Related article
Slopsquatting: AI supply chain attacks
Slopsquatting exploits invented package names in AI-generated code. Learn the checks CISOs can use before accepting AI-suggested dependencies.
Ready to improve your IT operations?
Request a free 30-minute consultation to discuss your IT challenges. Send a short outline and I will reply to arrange a suitable time. No obligation.
Request a free 30-minute consultationGet Occasional IT Leadership Insights
IT leadership insights, occasionally. No fluff. Unsubscribe any time.
No spam. Unsubscribe any time.