P.K. SHARMA

Cyber security intelligence, AI governance, practitioner analysis

LiteLLM supply chain attack poisons official PyPI and Docker builds with Python startup backdoor

Open-source AI gateway LiteLLM has suffered a critical software supply chain compromise after threat actors stole maintainer GitHub CLI OAuth tokens, executed a build against a malicious typosquatted fork, and pushed backdoored release 1.107.0 to PyPI and Docker Hub.

By · LinkedIn · · 14 min read

Correction, 26 October 2026: the Docker window, the token detail, the hashes and the stealer code were corrected

An audit on 26 October checked this briefing against LiteLLM's two incident posts, the PyPI registry and the security vendors' write ups, and corrected it in place. The incident is real and the overall account stands. What changed: the Docker Hub window is now 11:46:56 to 14:20 UTC (it was given as ending near 13:45); the stolen tokens are described as LiteLLM describes them, one from an organization owner and two from engineers with maintainer privileges, taken on 10 October; the exfiltration request is plain HTTP, not HTTPS, and the address is defanged; the hashes are labelled by platform because the Windows wheels differ; the earlier days count between the two compromises is 211, not 215; and the code block labelled as extracted from the package, which this site had reconstructed, was removed. The clean-up commands now follow LiteLLM's and StepSecurity's wording, and the GDPR paragraph, which no source supported, was removed. LiteLLM's canonical root cause post of 23 October is now cited. A different briefing on this incident, published earlier, was withdrawn because it carried invented figures and indicators.

LiteLLM supply chain attack poisons official PyPI and Docker builds with Python startup backdoor

Open-source AI proxy and gateway framework LiteLLM has suffered a severe software supply chain compromise after threat actors weaponised stolen GitHub CLI OAuth tokens belonging to project maintainers. The attackers bypassed repository branch protections, triggered an automated release pipeline from a malicious typosquatted fork (Berri-AI/litellm, diverging from the legitimate BerriAI/litellm repository by a single hyphen), and distributed a backdoored package version (1.107.0) across official public distribution channels on the Python Package Index (PyPI), Docker Hub, and the GitHub Container Registry (GHCR).

Update, 27 October 2026: LiteLLM published a root cause post on 23 October 2026 that postdates this briefing. It says the first token came from an exposed master key for its Agent Platform, committed to a public repository on 27 May and never revoked, and not from the theft of tokens from three maintainers as described below. The newer briefing on this site, litellm-supply-chain-attack-exposed-master-key, reads that post in full and sets out the timeline. Where this briefing and the root cause post differ, follow the root cause post.

LiteLLM serves as critical routing infrastructure for modern artificial intelligence applications, proxying API requests across dozens of large language model providers, including OpenAI, Anthropic, Google Gemini, AWS Bedrock, and local deployment frameworks. Because LiteLLM acts as a centralised credential vault and routing switch, the poisoned release carried catastrophic implications for enterprise AI environments, developer workstations, and automated continuous integration pipelines worldwide.

Audit of verified technical disclosures versus deployment assumptions

Evaluating the operational exposure generated by the LiteLLM supply chain compromise requires a rigorous demarcation between facts confirmed by vendor incident reports and threat intelligence teams versus assumptions regarding downstream deployment models.

Audit of verified technical disclosures in LiteLLM Post-Mortem and Datadog Threat Research versus operational assumptions

Incident DimensionExplicitly Verified by BerriAI, Datadog, & StepSecurityUnverified or Dependent on Downstream Architecture
Initial Intrusion VectorTheft of three GitHub CLI OAuth tokens, one belonging to a GitHub organization owner and two to engineers with maintainer privileges. LiteLLM says the owner token was read from an internal agent service that the attacker reached with a master key committed to a public repository on 27 May 2026 (LiteLLM root cause post, 23 Oct 2026).Whether other secrets were taken. LiteLLM says it now assumes every token, key and authenticator belonging to its organization was exfiltrated (LiteLLM root cause post, 23 Oct 2026).
Pipeline ManipulationExecution of official GitHub Actions release workflow against lookalike fork Berri-AI/litellm.Whether other unreleased branches or repository secrets were accessed during the maintenance account compromise.
Exposure WindowsPyPI wheels live from 11:39:51 to 13:23 UTC on 21 October 2026 (about 103 minutes, derived); Docker Hub tags pointed to the compromised image from 11:46:56 to 14:20 UTC (about 153 minutes, derived); GHCR tags were unavailable by 13:51 UTC (LiteLLM incident post, 21 Oct 2026).The precise global count of downstream automated CI builds and developer machines that fetched the poisoned release within those windows.
Execution MechanismAutomatic execution via cook.pth on Python interpreter startup; persistent hourly loop via sitecustomize.py.Whether any second stage was ever delivered. Datadog reports the dead-drop file only held test values and that no second-stage payload was observed in the wild; StepSecurity says the file was empty at release.
Targeted CredentialsLiteLLM database credentials table, cloud IAM tokens (AWS, GCP, Azure), SSH/GPG keys, developer environment variables.The total quantity of API secrets successfully received by the attacker C2 endpoint (www.litellm[.]dev/healthcheck).
Prior Compromise HistorySecond supply chain attack on LiteLLM in 2026, following the compromise of versions 1.82.7 and 1.82.8 that LiteLLM dates to 24 March 2026 (211 days earlier, derived).Whether the threat actor behind the October incident is identical to or affiliated with the March intrusion actor.

Supply chain compromise architecture: token theft, typosquatted fork, and build hijacking

The compromise of LiteLLM represents a sophisticated software supply chain attack targeting the continuous integration and release pipeline rather than source code repositories. The attackers did not alter the legitimate codebase on GitHub; the official source repository tag v1.107.0 remained completely untampered. Instead, the threat actor exploited stolen credentials to manipulate release artifact provenance, constructing backdoored binary wheels and Docker container images directly within official publishing channels.

The multi-stage supply chain compromise of LiteLLM: from maintainer GitHub CLI OAuth token abuse and typosquatted build execution to Python startup backdoor persistence and cloud credential exfiltration.

The attack sequence proceeded through four coordinated phases:

  1. Maintainer Token Exfiltration: The attacker obtained three GitHub CLI OAuth tokens on 10 October 2026: one belonging to a GitHub organization owner, read from an internal agent service reached with a leaked master key, and two belonging to engineers with maintainer privileges, taken by throwaway CI branches that posted repository secrets to an attacker-controlled endpoint (LiteLLM root cause post, 23 Oct 2026). LiteLLM adds that GitHub CLI tokens are issued after two-factor authentication and are not subject to the re-authentication GitHub asks for on sensitive organization actions.

  2. Typosquatted Repository Forking: The release source was a lookalike repository, Berri-AI/litellm, whose name differs from BerriAI/litellm by one hyphen. StepSecurity reports that ten attacker commits on it added the payload files and a Maturin build setting that bundles a directory named cook, and that the official v1.107.0 tag contains neither. Separately, at 10:08:34 UTC on 21 October the owner's token overrode branch protection on BerriAI/project-releaser, the private release repository, so the release workflow could take its source from the lookalike (LiteLLM root cause post, 23 Oct 2026).

  3. Release Workflow Trigger and Approval: At 10:46:39 UTC the owner's token dispatched a staging run with the source set to Berri-AI/litellm, and at 11:11:18 UTC a second maintainer's token approved the production gate. LiteLLM says it had relaxed its release controls earlier that week so that any two engineers could trigger and approve a release (LiteLLM root cause post, 23 Oct 2026).

  4. Public Registry Distribution and Audit Tampering: LiteLLM's own release pipeline then built, signed and published version 1.107.0 to PyPI, Docker Hub and GHCR, so the artifacts carried build provenance that named the lookalike repository as the source (Datadog Security Labs; StepSecurity). Between 11:53:49 and 11:54:01 UTC a third maintainer's token deleted the production and staging workflow run records, which limited the logs available to investigators (LiteLLM incident post, 21 Oct 2026).

Technical anatomy of Python .pth startup hooks: why pip uninstall re-triggers the backdoor

The defining technical feature of the LiteLLM attack is its abuse of Python path configuration (.pth) files. In standard Python runtime architecture, the site module is imported automatically when the Python interpreter initializes. During this startup routine, the site module scans all site-packages directories for files bearing the .pth extension. While originally designed to append additional directories to sys.path, Python's implementation contains a legacy feature: any line starting with import is executed as arbitrary Python code.

The malicious wheel package dropped three files directly into the root of the target Python environment's site-packages folder: cook.pth, cook.py, and sitecustomize.py. The contents of cook.pth consisted of a single instruction: import cook. This design yielded extraordinary operational stealth and execution persistence.

python
# File: /site-packages/cook.pth
# Standard Python path file executing arbitrary code upon interpreter initialization
import cook

# Execution sequence:
# 1. Any Python binary launches (python3, pip, pytest, ansible, uvicorn)
# 2. Python core imports standard library module 'site.py'
# 3. site.py parses all .pth files in site-packages
# 4. 'import cook' is executed in the root namespace before user script runs
# 5. cook.py starts the credential stealer on a background thread; sitecustomize.py is imported separately by the site module and forks the hourly loader (StepSecurity)
Structure of the cook.pth startup hook demonstrating automatic execution upon Python interpreter initialization.

Because the execution hook is bound to the interpreter rather than the litellm module, the malware does not depend on an enterprise application executing import litellm. If an automated CI/CD pipeline or developer machine installed the package as an indirect dependency, every subsequent Python invocation triggered the payload. Crucially, when administrators attempted to diagnose or remediate the compromise by running pip show litellm or pip uninstall litellm, pip itself (being a Python script) initialized the site module, read cook.pth, and executed the payload afresh.

The credential harvesting engine: targeting LiteLLM database keys and cloud secrets

Once invoked by cook.pth, the primary payload cook.py functions as an aggressive, specialised information stealer. Threat analysis by Datadog Security Labs revealed that the malware specifically targeted the unique operating model of AI proxies and development environments.

When deployed in production, LiteLLM manages access control and upstream API routing by storing provider secrets (including OpenAI, Anthropic, Gemini, AWS Bedrock, and Mistral keys) inside a backing PostgreSQL database table designated LiteLLM_CredentialsTable. StepSecurity reports that, when DATABASE_URL is set, cook.py starts a child Python process that connects with the proxy's own database client and runs two queries limited to 500 rows each, one on LiteLLM_CredentialsTable and one on LiteLLM_ProxyModelTable, which hold upstream provider credentials and model configurations.

Beyond AI gateway secrets, cook.py systematically harvested general infrastructure credentials across the host:

• Cloud Provider Tokens: AWS credentials and config files (~/.aws/credentials), Google Cloud Application Default Credentials, and Azure CLI profile tokens. • Developer Environment Secrets: .env files up to two levels deep under the home and working directories, and shell and database history files such as bash, zsh and fish history (StepSecurity). • Cryptographic Identities: SSH private keys (~/.ssh/id_rsa, ~/.ssh/id_ed25519) and GPG keyring files. • Package Manager Credentials: npm authentication tokens (~/.npmrc), PyPI API tokens (~/.pypirc), and Git credential caches. • Modern AI Tool State: Configuration databases and session tokens from emerging developer AI utilities, including Claude Desktop, Cursor editor state databases, and GitHub Copilot configuration profiles.

C2 infrastructure, hourly loader loop, and dead-drop persistence

Data exfiltration and remote command execution operated via a multi-tiered infrastructure designed to evade domain reputation filters and endpoint monitoring. Harvested credentials were compiled into an encrypted JSON payload and posted over plain HTTP to www.litellm[.]dev/healthcheck with a static X-Token header; StepSecurity, Socket and JFrog all print the URL with the http scheme. StepSecurity reports that litellm.dev was registered on 13 October 2026 and sits behind Cloudflare, and describes the domain as a lookalike of the real LiteLLM domains.

For persistent remote access on Linux and macOS environments, the third injected file, sitecustomize.py, established a background loader daemon. To prevent duplicate executions from consuming host resources, the daemon created a lock file located at /tmp/remote_code_loader.lock. The loader entered an hourly polling loop that queried a remote dead-drop file hosted on an external GitHub repository (letters9813/pythonclient-test/main/domain.txt).

When the dead-drop file names a domain, the loader fetches Python source from hxxp://domain/codepy and runs it with exec (StepSecurity; JFrog). Datadog says the file only ever held test values, so no second-stage payload was observed in the wild, and StepSecurity says it was empty when the release went out. This site's inference: the loader is a standing remote code channel that whoever controls the dead-drop path could arm.

Forensic taxonomy of verified indicators of compromise

Security operations and forensic investigation units can inspect container registries, host filesystems, and network perimeter logs against verified indicators of compromise documented during threat analysis.

Verified Forensic Indicators of Compromise for LiteLLM Version 1.107.0 Supply Chain Incident

Indicator TypeIdentifier / PathCryptographic Hash / ValueForensic Threat Context
Malicious Filesite-packages/cook.pthLinux and macOS wheels: 7f191632e7320705d154b85204f1ae546b543acbd7e8861229b76f5042b92bdb. Windows wheel: 84dc8c82c0a4a4a62552ef826b49fcc86d1a5c4a5d0f2c06665723f93d129d7d (StepSecurity)Path configuration startup hook triggering automatic import of cook.py upon Python initialization.
Malicious Filesite-packages/cook.pyLinux and macOS wheels: 9dd0a3926f96a37eb86cf1ee2310d9be93139cc4ebef3ef9e2efe9531390be25. Windows wheel: 03ac2a8b752605d1d7710979c17ff18b03dd978203ba23ba97fd8ce3d6f897ea (StepSecurity)Primary info-stealer harvesting LiteLLM DB credentials, cloud IAM tokens, SSH keys, and .env files.
Malicious Filesite-packages/sitecustomize.pyLinux and macOS wheels: 34bef04fe88ac9d0aae0475630b1738681d15b94f233ac8aa46eacf5968305fa. Windows wheel: b6122440d0d9cb1eb1ade9933f49214da8c31288de7710c076c2680dfa528465 (StepSecurity)Background loader daemon establishing hourly dead-drop check and in-memory RAT execution.
Runtime Lockfile/tmp/remote_code_loader.lockFilesystem MarkerProcess locking artifact created by sitecustomize.py background daemon on Linux and macOS hosts.
C2 Endpointhxxp://www[.]litellm[.]dev/healthcheckDomain registered 13 October 2026, behind Cloudflare (StepSecurity)Lookalike domain used for exfiltration of harvested credentials by plain HTTP POST with the static header X-Token (StepSecurity; Socket; JFrog).
C2 Dead Dropletters9813/pythonclient-testGitHub Repository (domain.txt)Dead-drop resolver utilized by the background loader to fetch dynamic secondary C2 server addresses.
Docker Image Digestghcr.io/berriai/litellm:v1.107.0sha256:1bbcb1443bc962e45f5aad53fe3d2c30600e0379715fb6c664cdd3ac126c339eCompromised image index for Docker Hub and the GHCR litellm image; tags v1.107.0, latest, main-latest and main-stable pointed to it, and the GHCR litellm-database and litellm-non_root images have their own index digests (LiteLLM incident post, 21 Oct 2026).

Incident response protocol and detection engineering playbook

Organizations identifying version 1.107.0 within their package manifests, container images, or CI/CD build caches must execute immediate incident containment. Because of the automatic execution characteristics of .pth files, remediation must follow a strict non-interactive procedure.

Phase 1: Safe Filesystem Purging (Non-Python Tooling) Do NOT execute pip uninstall litellm or python -m pip. Instead, use system shell utilities (such as find, rm, or PowerShell) to locate and eradicate the malicious files directly from the site-packages directory: rm -f /path/to/site-packages/cook.pth rm -f /path/to/site-packages/cook.py rm -f /path/to/site-packages/sitecustomize.py also delete any cook and sitecustomize .pyc files in the python cache folder next to those files (StepSecurity)

Phase 2: Process Termination Inspect the operating system process table for active background loaders and terminate them immediately: lsof /tmp/remote_code_loader.lock, then kill the process id it prints; fuser also works (StepSecurity describes finding the holder of the lock this way) rm -f /tmp/remote_code_loader.lock

Phase 3: Package Pinning and Downgrade Rebuild all affected environments from clean, uncompromised virtual environments, strictly pinning the library to 1.106.2, the version LiteLLM and Datadog name as safe: pip install litellm==1.106.2 --force-reinstall

Phase 4: Mandatory Enterprise Secret Invalidation Any system that ran version 1.107.0 must be treated as completely compromised. Security teams must invalidate and rotate all exposed secrets from an external, clean workstation: • Invalidate all OpenAI, Anthropic, Gemini, Azure OpenAI, and AWS Bedrock API keys stored in LiteLLM or environment variables. • Rotate all AWS IAM access keys, GCP service account keys, and Azure service principal secrets present on affected hosts. • Cycle all SSH private keys, GitHub/GitLab personal access tokens, and npm publish credentials.

yaml
title: Malicious Python .pth File Creation in Site-Packages
id: e89a41b2-7c34-4b91-9e23-99b8214f8a12
status: experimental
description: Detects file creation events for suspicious .pth path configuration files in Python site-packages directories associated with supply chain persistence.
references:
  - https://docs.litellm.ai/blog/security-incident-oct-21-2026
  - https://securitylabs.datadoghq.com/articles/litellm-compromised-pypi-docker/
author: P.K. Sharma
date: 2026-10-23
logsource:
  category: file_event
  product: linux
detection:
  selection_path:
    TargetFilename|contains: '/site-packages/'
    TargetFilename|endswith: '.pth'
  selection_name:
    TargetFilename|contains:
      - '/cook.pth'
      - '/sitecustomize.py'
  condition: selection_path or selection_name
falsepositives:
  - Legitimate Python packaging tools establishing development symlinks (such as easy-install.pth or distutils.pth)
level: high
tags:
  - attack.persistence
  - attack.t1546.018
  - attack.t1195.001
Sigma detection rule for monitoring anomalous .pth and startup hook file creation events in enterprise Python environments.

Regulatory compliance implications and the systemic risk of AI gateway infrastructure

LiteLLM was compromised twice in 2026, 211 days apart by this site count from 24 March to 21 October. LiteLLM says that after the March incident it moved releases to a private repository, adopted PyPI Trusted Publishing, made Docker release tags immutable and began signing images (LiteLLM root cause post, 23 Oct 2026). StepSecurity reports that none of those controls stopped an organization owner token from changing the release workflow itself.

Key operational facts and incident verification checklist

• Affected Package and Version: LiteLLM version 1.107.0 published across PyPI, Docker Hub, and GitHub Container Registry (GHCR). • Compromise Window: PyPI wheels were live from 11:39:51 to 13:23 UTC on 21 October 2026 (about 103 minutes, derived); Docker Hub tags pointed to the compromised image from 11:46:56 to 14:20 UTC (about 153 minutes, derived), per the LiteLLM incident post. • Root Cause: Three stolen GitHub CLI OAuth tokens, one from an organization owner and two from engineers with maintainer privileges, used to override branch protection on the private release repository, run the release workflow against the lookalike repository Berri-AI/litellm, approve it and delete the run records (LiteLLM root cause post, 23 Oct 2026). • Execution Mechanism: Injected cook.pth startup hook executes automatically whenever ANY Python process initializes in that environment, requiring zero import litellm invocations. • Stealer Target Profile: LiteLLM proxy database tables holding provider credentials and model configurations (queries limited to 500 rows each, per StepSecurity), AWS/GCP/Azure cloud tokens, SSH/GPG keys, .env secrets, and AI developer session tokens. • Remote code loader: background daemon (sitecustomize.py) holding lockfile /tmp/remote_code_loader.lock and polling a GitHub dead drop every hour for a domain from which to fetch code; Datadog reports the dead drop only ever held test values, so no second stage was observed. • Remediation Directive: Manually purge cook.pth, cook.py, and sitecustomize.py using non-Python system shell commands, terminate loader processes, pin to clean release 1.106.2, and invalidate 100 percent of exposed LLM and cloud credentials.

Sources

  1. PrimaryContained: Oct 21, 2026 LiteLLM release v1.107.0 CompromisedLiteLLMaccessed 2026-10-26
  2. PrimaryThe attack chain behind the v1.107.0 LiteLLM releaseLiteLLMaccessed 2026-10-26
  3. Primarylitellm release data (latest 1.106.4; no 1.107.0 final and no 1.107.1)Python Package Indexaccessed 2026-10-26
  4. Primarylitellm 1.107.0 compromisedGitHub (BerriAI/litellm issue 47826)accessed 2026-10-26
  5. PrimaryEvent Triggered Execution: Python Startup Hooks (T1546.018)MITREaccessed 2026-10-26
  6. Reported bylitellm 1.107.0 Compromised on PyPI: Backdoored Wheels Drop a Credential Stealer and an Hourly Remote Code LoaderStepSecurityaccessed 2026-10-26
  7. Reported byLiteLLM supply chain compromise: What you need to knowDatadog Security Labsaccessed 2026-10-26
  8. Reported byLiteLLM PyPI Package and Docker Images Compromised to Steal Cloud and AI CredentialsSocketaccessed 2026-10-26
  9. Reported byLiteLLM Hijacked Again: Malicious 1.107.0 Wheels Steal Credentials and Load Remote CodeJFrog Security Researchaccessed 2026-10-26

Share this briefing

Know someone who owns this problem? Send it to them.

Related briefings

The briefing, in your inbox

Practitioner analysis of cyber and AI security news. No vendor noise.

How often

Every new briefing in one email, at 7am, or at 7am, 12:30pm and 6pm. Nothing is sent when nothing is new. Unsubscribe any time.