Home › Intelligence › Brief
BREACH BRIEF🟠 High ThreatIntel

Supply Chain Compromise of LiteLLM 1.107.0 Enables Credential Theft via Python Startup Hooks

A malicious LiteLLM 1.107.0 release on PyPI executed hidden startup code that harvested developer, cloud and browser credentials whenever Python started. The incident highlights the need for verifiable software‑supply‑chain controls and audit‑ready evidence of dependency integrity.

LiveThreat™ Intelligence · 📅 November 18, 2026· 📰 microsoft.com
🟠
Severity
High
TI
Type
ThreatIntel
🎯
Confidence
High
🏢
Affected
3 sector(s)
✅
Actions
2 recommended
📰
Source
microsoft.com

Supply Chain Compromise of LiteLLM 1.107.0 Enables Credential Theft via Python Startup Hooks

What Happened — On 21 Oct 2026 a malicious version of the open‑source LiteLLM 1.107.0 package was published to PyPI and to official container images. The package contained hidden .pth and sitecustomize.py files that execute automatically whenever the Python interpreter starts, even if LiteLLM is never imported. The embedded payload harvested developer, cloud, browser and SSH credentials, encrypted the data and exfiltrated it to an attacker‑controlled endpoint. The code also installed a Unix‑specific loader capable of pulling and running additional Python modules on demand.

On October 21 2026 a malicious version of LiteLLM 1.107.0 was uploaded to the Python Package Index and propagated through the official container images. The compromised wheel placed three startup files—cook.pth, cook.py and sitecustomize.py—in the Python library directory, outside the normal LiteLLM application folder, so that merely launching the interpreter in an environment that had the package installed would trigger the payload without any explicit import of LiteLLM.

Microsoft’s investigation identified two independent execution routes. The first, driven by the single line “import cook” in cook.pth, loaded cook.py, which decoded a Base64‑zlib‑compressed script labelled “PRIVCOLLECT” and started a daemon thread that harvested credentials. The second route, via sitecustomize.py, provided a Unix‑focused loader capable of fetching and executing additional Python code from a remote host, although that behavior was never observed in the wild. The collector scraped authentication material from developer tools, AI assistants, cloud environments, browsers, SSH keys, environment variables and LiteLLM’s own database records, then encrypted the data and posted it to an attacker‑controlled endpoint. A separate module attempted to read selected credential and model‑configuration entries from the LiteLLM proxy.

Endpoint telemetry on Windows and macOS matched the collector’s discovery, encryption and outbound‑connection patterns. In one Windows case a routine python -m pip install of an unrelated dependency launched the collector, demonstrating that running Python or pip in a suspect environment is not a safe detection method. Microsoft cautioned that “removing the package or a release tag is not sufficient recovery,” and advised organizations to cleanse the entire Python environment, terminate any lingering processes, and rotate any credentials the compromised identity could have accessed.

LiteLLM is typically deployed as a gateway between applications and large‑language‑model providers, giving it access to API keys, database connection strings, workload identities and routing policies. The maintainers disclosed that attackers used stolen GitHub credentials to hijack the release workflow, redirecting it to a look‑alike repository Berri‑AI/litellm instead of the legitimate BerriAI/litellm. A second compromised developer credential was then employed to satisfy a production‑approval step. Microsoft has not independently verified how the adversary initially breached the upstream environment or obtained those credentials.

Technical analysis showed that during installation the three malicious files were copied into the interpreter’s site‑initialization path. cook.pth caused an import of cook.py, which set the environment variable PRIVCOLLECT_ACTIVE to prevent duplicate collection, attempted an HTTP 200 upload, and tried to write a marker file at /tmp/.pc_once_72129118c59f5636c0bb. The marker was only a duplicate‑suppression hint, not a guarantee that collection succeeded, because a short‑lived process could exit before the thread finished. The sitecustomize.py path, while not confirmed in practice, contained logic to retrieve and run further Python code on Unix systems, extending the potential attack surface beyond active LiteLLM gateways to any system that started Python with the compromised package present.

The malicious module begins by sweeping a range of locally stored secrets. It probes source‑control directories for Git credentials, package‑manager configs, selected .env files and private‑key extensions, limiting the walk to shallow depths and imposing file‑size caps. It then reads cloud‑workload caches for AWS, Azure CLI and Google Cloud, extracts Kubernetes service‑account files, Docker configs and any mounted secrets, and even attempts to pull credentials from AWS and GCP metadata services. Browser data are also harvested, targeting Chromium‑family and Firefox credential stores, browsing histories, and histories of shells, database clients and interactive tools, with password decryption varying by platform and format. On Linux it enumerates its own environment and any other process environments visible through /procfs, while also seeking readable SSH keys, GPG material, TLS certificates, CI/CD tokens, Vault entries and other infrastructure‑tool configurations. When its prerequisites are met, the code launches a Python child via Prisma to query two proxy database tables, capping each result set at 500 rows.

After gathering data, the collector serializes the findings and host metadata into JSON, then generates a fresh 32‑byte AES key and a 16‑byte IV for each run. The payload is encrypted with AES‑256‑CBC; the AES key is wrapped with a 4,096‑bit RSA public key using OAEP, first trying SHA‑256 and falling back to SHA‑1. The encrypted blob, the wrapped key and a plaintext envelope are placed into a gzip‑compressed tar archive containing data.bin, key.bin and hdr.json. The archive is posted to hxxp://www.litellm.dev/healthcheck as application/octet‑stream with a static browser‑like User‑Agent and an X‑SHA256 header holding a body checksum. The upload routine retries until it receives an HTTP 200 response. Temporary staging directories prefixed with .pc_e_ are created by the OpenSSL backend and removed after use.

In parallel, the compromised package drops a Unix‑oriented loader inside sitecustomize.py. When Python starts, the loader acquires an exclusive lock on /tmp/remote_code_loader.lock to ensure a single instance per host, then daemonises. Each cycle fetches a domain.txt file from a GitHub‑hosted domain; this file acts as a mutable pointer to an attacker‑controlled server. If the file resolves to a reachable address, the loader requests /codepy from that server, compiles the returned Python code and executes it within the compromised environment, allowing the attacker to swap in new second‑stage payloads without republishing the LiteLLM package. At the time researchers inspected the file, it was empty and no secondary code execution was observed, but the mechanism remains a re‑armable remote‑code execution vector.

Microsoft’s response advises organizations that installed or built images with LiteLLM 1.107.0 to locate every copy—including in uv and pip caches, internal mirrors, lock files, build artefacts and container images—by matching the hashes listed in the indicators of compromise. Affected environments should be isolated, Python processes stopped, and evidence collected with trusted tools from a clean system. Rebuilding from verified artefacts is recommended, ensuring that cook.pth, cook.py and sitecustomize.py are removed from the library path. All reachable credentials—model‑provider keys, cloud and workload tokens, CI/CD secrets, source‑control and registry tokens, SSH/GPG keys, AI‑tool tokens and browser sessions—must be rotated from a known‑clean machine, and active sessions revoked. Microsoft also urges correlation of file hashes, process ancestry, the .pc_e_ staging artefacts, network destinations and subsequent cloud activity before declaring compromise, tighter dependency controls with hash‑pinned lock files and container digests, restriction of outbound HTTP traffic, and deployment of Microsoft Defender for Endpoint with real‑time and cloud‑delivered protection. The company notes that its Defender XDR detections now flag the behaviours described.

As of 22 October 2026, Microsoft Defender Antivirus and Defender for Endpoint began flagging activity tied to the malicious LiteLLM 1.107.0 distribution. The suite of signatures includes Trojan:PyPI/Stealer.SA, Trojan:PyPI/LiteLlmSupplyChain A and B, and Backdoor:PyPI/LiteLlmSupplyChain C, all of which trigger blocks on the initial malicious components and surface related suspicious scripts and network connections. Defender for Endpoint also surfaces alerts labeled “Suspicious script launched” and “Suspicious network connection observed,” while Defender for Cloud reports OpenSSL activity linked to the compromise and DNS lookups of a known malicious domain. Microsoft notes that detection names and coverage may evolve as the protection stack is updated.

Credential‑theft behavior is observed after the malicious package stages password‑like data within the Python runtime and then initiates outbound traffic to a public address. Defender for Endpoint flags “Possible theft of passwords and other sensitive web‑browser information” alongside a “Suspicious OpenSSL command launch.” In Azure App Service and Kubernetes workloads, Defender for Cloud generates alerts for OpenSSL usage tied to the LiteLLM breach and for DNS queries to the attacker‑controlled domain. The same platform’s Vulnerability Management pane lists the affected devices under the identifier TVM‑2026‑0003, enabling administrators to prioritize remediation.

Microsoft’s XDR threat‑analytics team supplies a set of advanced‑hunting queries to help investigators locate the various stages of the attack. One query normalizes URL and hostname observations to match the collector domain (e.g., www.litellm.dev or litellm.dev) while requiring process context. A second query hunts for known startup‑file hashes— 9dd0a3926f96a37eb86cf1ee2310d9be93139cc4ebef3ef9e2efe9531390be25, 03ac2a8b752605d1d7710979c17ff18b03dd978203ba23ba97fd8ce3d6f897ea, 34bef04fe88ac9d0aae0475630b1738681d15b94f233ac8aa46eacf5968305fa, b6122440d0d9cb1eb1ade9933f49214da8c31288de7710c076c2680dfa528465, 7f191632e7320705d154b85204f1ae546b543acbd7e8861229b76f5042b92bdb, 84dc8c82c0a4a4a62552ef826b49fcc86d1a5c4a5d0f2c06665723f93d129d7d—covering both LF and CRLF variants. Additional queries target processes whose command lines contain the “.pc_e_” prefix and encryption flags such as “‑aes‑256‑cbc,” “pkeyutl,” or “rsautl,” labeling the operation as either AES packaging or RSA wrapping. A cloud‑specific query isolates OpenSSL executions in temporary directories that include “/tmp/.pc_” and contain the “‑encrypt ‑pubin” arguments, indicating key‑wrapping before potential exfiltration. Finally, a posture‑check query flags any device reporting CVE TVM‑2026‑0003, signaling possible exposure to the compromised LiteLLM component.

Microsoft maps the observed behaviors to several MITRE ATT&CK techniques. Initial access is classified as T1195.001 (Compromise Software Dependencies and Development Tools), reflecting the malicious wheels and container images shipped with LiteLLM 1.107.0. Persistence is tied to T1546.018 (Event‑Triggered Execution: Python Startup Hooks), where the attacker drops cook.pth and sitecustomize.py to run during interpreter initialization. Execution follows T1059.006 (Command and Scripting Interpreter: Python), as the collector runs inside the interpreter and spawns an inline child that performs database queries. Defense‑evasion techniques include T1027.013 (Obfuscated Files or Information: Encrypted/Encoded File), with the collector source embedded as Base64‑encoded, zlib‑compressed data, and T1140 (Deobfuscate/Decode Files or Information), where cook.py decodes and decompresses the payload at runtime. Microsoft emphasizes that some of these behaviors were inferred from the recovered components and may not have been directly observed in every victim environment.

The malicious Python loader harvested a broad set of credentials. It read authentication and configuration files used by developers, AI platforms, and cloud services (T1552.001), extracted private SSH, GPG and TLS keys (T1552.004), and queried the AWS and GCP instance‑metadata endpoints for temporary credentials (T1552.005). Although the metadata calls were observed, Microsoft telemetry could not verify that any cloud credentials were actually returned. In addition, the loader copied browser password stores, pulling Chromium‑based databases on Windows (T1555.003) to enable later password recovery.

Once on the host, the loader performed basic discovery. It invoked systeminfo to gather OS details (T1082) and ran ipconfig, route, arp and netstat to map network configuration (T1016). It then collected local artefacts such as command histories, environment variables and configuration files (T1005) for later exfiltration.

For command‑and‑control, the loader fetched its C2 address from a file hosted on GitHub and used that as a dead‑drop resolver (T1102.001). A secondary endpoint at /codepy could supply additional Python code, though execution of that payload was not observed (T1105). The background process created a lock file at /tmp/remote_code_loader.lock and wrote a marker file /tmp/.pc_once_72129118c59f5636c0bb after transmitting stolen data.

Indicators of compromise include the domain www.litellm.dev used for exfiltration, a health‑check URL http://www.litellm.dev/healthcheck, and a dead‑drop file at https://raw.githubusercontent.com/letters9813/pythonclient-test/main/domain.txt. Multiple malicious payload hashes were identified: cook.py (SHA‑256 9dd0a3926f96a37eb86cf1ee2310d9be93139cc4ebef3ef9e2efe9531390be25) and its Windows wheel variant (03ac2a8b752605d1d7710979c17ff18b03dd978203ba23ba97fd8ce3d6f897ea); sitecustomize.py (34bef04fe88ac9d0aae0475630b1738681d15b94f233ac8aa46eacf5968305fa) and its Windows wheel variant (b6122440d0d9cb1eb1ade9933f49214da8c31288de7710c076c2680dfa528465); cook.pth (7f191632e7320705d154b85204f1ae546b543acbd7e8861229b76f5042b92bdb) and a variant (84dc8c82c0a4a4a62552ef826b49fcc86d1a5c4a5d0f2c06665723f93d129d7c). The compromised LiteLLM 1.107.0 wheel files are also listed with their SHA‑256 values for macOS, many‑linux, musl‑linux and Windows builds. The incident was contained by LiteLLM on 21 October 2026, and Microsoft’s Threat Intelligence team referenced the Python Software Foundation’s site‑specific configuration hook in its analysis. The full scope of credential theft—whether any of the harvested keys or passwords were actually exfiltrated—remains unconfirmed, and further investigation is needed to determine any downstream abuse.

Why It Matters for Trust & Control Assurance — The incident shows that without verifiable supply‑chain controls, a single compromised third‑party library can bypass normal application boundaries and steal privileged secrets across development, CI/CD and production environments.

Who Is Affected — AI/ML platform vendors, software development teams, cloud‑native enterprises that rely on Python packages for model‑gateway or CI/CD pipelines.

Recommended Actions

  • Inventory every instance of LiteLLM 1.107.0 (including pip caches, internal mirrors and container images) and remove the compromised files.
  • Rebuild affected environments from verified, hash‑pinned artifacts; avoid mutable tags.
  • Rotate all credentials that could have been accessed (API keys, cloud tokens, SSH/GPG keys, browser sessions).
  • Harden your software‑supply‑chain process: enforce signed packages, immutable digests, and continuous monitoring of third‑party dependencies.

Technical Notes — The malicious code leveraged Python’s startup mechanism via a cook.pth file that imports cook.py, which launches a daemon thread to collect credentials. A separate sitecustomize.py loader on Unix systems can fetch additional code from a remote host. Exfiltration uses AES‑256‑CBC encryption wrapped with a 4096‑bit RSA key, sent via HTTP POST to a hard‑coded endpoint. Detection signatures are available in Microsoft Defender (e.g., Trojan:PyPI/Stealer.SA). Source: https://www.microsoft.com/en-us/security/blog/2026/10/23/inside-the-litellm-1-107-0-supply-chain-compromise-credential-theft-through-python-startup-hooks/

📰 Original Source
https://www.microsoft.com/en-us/security/blog/2026/10/23/inside-the-litellm-1-107-0-supply-chain-compromise-credential-theft-through-python-startup-hooks/ ↗

This LiveThreat Intelligence Brief is an independent analysis. Read the original reporting at the link above.

From the Verisq platform · Trust Operations

Every gap like this maps to a control you can evidence.

The Verisq AI Trust Operations platform maps incidents to your control framework and collects the evidence continuously — so your Trust Center shows proof, not promises, when a buyer or auditor asks.

Explore the Verisq AI Trust Operations platform →