Skip to content
RCE Write-up Advanced

Your SSH Keys, API Credentials, and AI Secrets Are at Risk — The Shocking LiteLLM Backdoor Attack Explained

Two malicious versions of the LiteLLM Python package were published to PyPI after attackers compromised a security scanner used in the project's CI/CD pipeline and stole its publishing token. The malware harvested credentials such as SSH keys and cloud tokens, attempted to spread within Kubernetes clusters, and installed a persistent backdoor.

Muhammad Faisal Ishfaq Follow

Published on levelup.gitconnected.com

Hey, imagine this: You’re a developer building the next big AI app. You rely on a popular open-source library called LiteLLM to connect your code to all the big AI models — OpenAI, Anthropic, Grok, whatever.

Muhammad Faisal Ishfaq, on levelup.gitconnected.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the CI/CD pipeline used a floating version tag for the Trivy GitHub Action instead of pinning it to a specific commit, allowing a compromised tag to run and leak the PyPI publishing token.

Impact

Anyone who installed the malicious versions could have had SSH keys, cloud credentials, Kubernetes secrets, and other sensitive data stolen, with the malware also attempting to spread within clusters and maintain persistence.

What the attacker needed

Install LiteLLM version 1.82.7 or 1.82.8; run the LiteLLM proxy server

The fix

The malicious versions were removed and a security update was issued; users should pin CI/CD tools to exact commit SHAs and rotate all potentially exposed credentials.

How it was found

  1. Compromise the Trivy GitHub Action by rewriting its version tags.
  2. Wait for LiteLLM's CI/CD pipeline to run the poisoned Trivy during a regular build.
  3. The poisoned Trivy steals secrets from the GitHub environment, including the PyPI publishing token.
  4. Use the stolen token to upload malicious LiteLLM versions 1.82.7 and 1.82.8 directly to PyPI.
  5. The malicious code in the proxy server file harvests credentials, attempts lateral movement in Kubernetes, and installs a persistent backdoor.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A supply-chain attack is when someone tampers with a tool or library that many other projects rely on, rather than attacking each project directly. Here, attackers poisoned a security scanner so that when the LiteLLM project used it during an automated build, the scanner stole the project's password for publishing new versions of its package. The attackers then used that password to upload malicious versions of LiteLLM that stole secrets from anyone who installed them.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.