LiteLLM published compromised PyPI packages in March and a malicious package plus container images in October. The lesson is larger than one project: production systems need safer dependency intake, narrower credentials and recovery plans built before an incident.
LiteLLM experienced two supply-chain incidents in 2026.
In March, versions 1.82.7 and 1.82.8 were published to PyPI without authorisation. LiteLLM said the incident appeared linked to a compromised Trivy dependency used in its CI/CD security-scanning workflow. The packages were available for about 40 minutes before PyPI quarantined them.
In October, attackers compromised LiteLLM’s release pipeline and published malicious version 1.107.0 to PyPI and official container registries. The package could steal credentials when Python started.
The incidents had different paths. Together, they show why software teams cannot treat an official registry, a valid signature or a security scanner as complete proof that a release is safe.
1. Stop installing brand-new versions directly into production
Fast updates are useful when they contain an urgent fix. They are risky when every new package enters production automatically.
Create a short observation period for normal dependency updates. During that time, automated checks and a small test environment can examine the release before broad deployment.
The delay should not block emergency security patches. Teams need a documented exception process for urgent fixes.
The key is intent. Production should not upgrade merely because a registry has a newer version.
2. Pin the complete artifact, not only a friendly tag
A version constraint such as >=1.0 can pull a release the team never reviewed.
A container tag such as latest can point to different content at different times.
Production deployments should use:
- exact dependency versions;
- lock files;
- verified package hashes where supported;
- immutable container digests; and
- a record of the artifact deployed to each environment.
This does not make a malicious official release safe. It limits surprise and makes exposure easier to investigate.
3. Separate dependency intake from deployment
Do not let every build download directly from the public internet.
A controlled mirror or internal registry can create a review boundary. New artifacts enter quarantine, pass policy checks and are then promoted for internal use.
The intake process can examine provenance, unexpected files, install scripts, dependency changes and differences between source and built artifacts.
This control is especially valuable for packages used in production gateways, CI systems and developer tools with access to many credentials.
4. Verify what was built
A signed package can still be malicious if an attacker controlled the build pipeline.
The October LiteLLM incident is a clear example. The malicious artifacts were published through an official path, while the public source tag did not contain the same files.
Release verification should connect the artifact to:
- the expected source repository;
- an approved commit;
- a reviewed build definition;
- an isolated build environment; and
- recorded provenance that cannot be changed by the same identity publishing the release.
Signing is still useful. It should be one control inside a verifiable chain, not the final answer.
5. Give automation its own narrow identity
LiteLLM’s October incident began with a key that was exposed in a public repository and not revoked. The attacker used it to reach an experimental agent platform and obtain a GitHub token tied to an organisation owner’s account.
An experimental service should not hold an owner’s broad token.
Bots and CI jobs need dedicated service identities with the smallest permissions required. Tokens should be short-lived where possible and restricted by repository, action and environment.
A human owner’s credential should not be the easiest way for automation to file a pull request.
6. Rotate an exposed secret immediately
Removing a secret from Git history does not make the secret invalid.
If a key may have been exposed, revoke or rotate it first. Investigation can continue with logs and metadata.
Teams should record:
- who owns each secret;
- where it is used;
- how to revoke it;
- what will break after rotation; and
- how quickly replacement can be deployed.
Practice this process. A rotation plan that has never been tested may fail during the incident.
7. Make approvals independent
Two approvals do not create safety when one attacker can steal both identities.
High-risk releases need separation between source change, build, approval and publication. Critical controls should use identities, devices or systems that cannot all be changed from the same compromised account.
The release system should alert when branch protection is disabled, a source repository changes, a workflow is force-pushed or audit records are removed.
Those actions may be legitimate. They are also important signals.
8. Reduce the secrets available to build and runtime systems
A compromised package can only steal what its process can reach.
Build jobs should not receive production credentials unless they truly need them. Runtime services should not carry source-control tokens, browser sessions or unrelated cloud access.
Use separate identities for development, testing and production. Limit network access and secret retrieval by workload.
AI gateways deserve extra attention because they often connect to several model providers, databases and internal tools.
9. Keep evidence outside the compromised system
Attackers may delete workflow runs, change history or destroy a short-lived container.
Send important audit events to a separate system with restricted deletion. Keep package installation records, image digests, deployment times and identity activity long enough to investigate.
During an incident, preserve evidence before rebuilding when it is safe to do so. Recovery and investigation need to happen together.
10. Prepare for rebuild and credential rotation
Uninstalling a malicious package is not the same as recovering a system.
Teams should be able to:
- isolate an affected environment;
- identify every deployed artifact;
- rebuild from a known-clean base;
- rotate every reachable credential;
- review activity for misuse; and
- restore service without returning the same risk.
Run this as an exercise before a real compromise.
A practical policy for small teams
Small teams do not need an expensive security platform to improve.
Start with five rules:
- Pin production dependencies and container digests.
- Wait before adopting routine new releases.
- Use separate, narrow service accounts for automation.
- Rotate any exposed secret immediately.
- Keep enough deployment and identity logs to answer what ran where.
Add an internal package mirror, stronger provenance and automated policy checks as the system grows.
The bottom line
The LiteLLM incidents are not a reason to avoid open-source software.
They are a reason to stop treating a public registry as a trusted extension of production.
Every organisation owns the final decision about which artifact runs, what credentials it can reach and how quickly the environment can be rebuilt. Those controls reduce damage even when an upstream project’s own release process is compromised.
Evidence note: LiteLLM’s official March and October incident reports. Recommendations are editorial analysis. No malware reverse engineering.