Project Chintan

Compromised LiteLLM Package Highlights AI Software Supply Chain Vulnerabilities

Malicious versions of the LiteLLM Python package were briefly available on PyPI, exposing AI software supply chain risks. Attackers aimed to harvest sensitive credentials and cloud access through compromised dependencies.

· 3 min read
Updated

Key takeaways

  • Malicious versions of the LiteLLM Python package were briefly active on PyPI, exposing AI software supply chain risks.
  • Attackers sought to steal sensitive credentials including cloud access keys and SSH keys.
  • The incident is part of a larger supply chain campaign that compromised developer tools and package registries.
  • LiteLLM has resumed operations with enhanced security measures and a redesigned CI/CD pipeline.

The security compromise of the LiteLLM Python package has intensified concerns regarding the vulnerability of software essential to artificial intelligence systems. Attackers are increasingly targeting these foundational components to gain access to credentials, cloud resources, and other technology projects.

What Happened

Two malicious versions of the LiteLLM Python package, versions 1.82.7 and 1.82.8, were published to the Python Package Index (PyPI) on March 24. These versions remained accessible for approximately 40 minutes before PyPI quarantined and subsequently deleted them. The compromised packages contained malicious code designed to steal environment variables, SSH keys, credentials for Amazon Web Services (AWS), Google Cloud, Microsoft Azure, Kubernetes tokens, and database passwords. This harvested information could then be encrypted and sent to infrastructure controlled by the attackers.

Version 1.82.7 included malicious code within LiteLLM’s proxy server. Version 1.82.8 expanded this by adding a .pth file capable of executing code upon Python's startup, potentially activating the malicious payload without the application directly importing LiteLLM. This enhanced the risk for development machines and automated build systems where the package was installed.

Background

The LiteLLM breach is connected to the broader TeamPCP software supply-chain campaign, which began on March 19 with the compromise of Aqua Security's Trivy ecosystem. This campaign exploited developer tools, GitHub Actions, and package registries, allowing credentials gained at one stage to be used to infiltrate other projects, creating a cascading effect of compromises.

LiteLLM utilized Trivy for its security scanning as part of its publishing process. The compromise of this dependency provided attackers with credentials for the release infrastructure, enabling them to bypass LiteLLM's standard continuous integration and continuous delivery (CI/CD) pipeline and publish the malicious packages directly to PyPI. The primary LiteLLM source repository itself did not contain the injected malware.

This incident underscores the risk posed by security scanners and developer utilities, which, despite their role in reducing risk, can become valuable entry points if compromised due to their privileged access within automated pipelines. Build environments often contain sensitive information like package registry tokens, GitHub credentials, and cloud secrets.

The situation also highlighted the risks associated with transitive dependencies, where applications might automatically install unpinned versions of LiteLLM, potentially exposing build servers and development environments to malicious releases without developers explicitly choosing the compromised versions.

Key Facts

  • Two malicious versions of the LiteLLM Python package, 1.82.7 and 1.82.8, were published to PyPI on March 24.
  • These malicious versions were available for approximately 40 minutes before being quarantined and deleted.
  • The malware was designed to harvest environment variables, SSH keys, cloud credentials (AWS, Google Cloud, Azure), Kubernetes tokens, and database passwords.
  • The breach is linked to the TeamPCP software supply-chain campaign, which began with the compromise of Aqua Security's Trivy ecosystem on March 19.
  • Attackers exploited LiteLLM's use of Trivy in its security scanning workflow to gain access to release infrastructure credentials.
  • This allowed attackers to bypass LiteLLM's CI/CD process and publish malicious packages directly to PyPI.
  • LiteLLM has since suspended releases, reviewed its supply chain, and resumed with version 1.83.0 on March 30, implementing a redesigned CI/CD architecture with enhanced security and PyPI Trusted Publishing.

What Happens Next

LiteLLM has resumed releases with version 1.83.0 as of March 30. The project has implemented a redesigned CI/CD architecture that separates testing and release environments, introduced stricter security gates, and adopted PyPI Trusted Publishing to enhance security. Release and validation functions have also been separated to mitigate the risk of a single compromised component gaining publishing authority.

Story by Project Chintan

Related stories