Threat Advisory

Python Startup Hooks in LiteLLM Steal Cloud AI Proxy Credentials

Threat: Supply Chain Attacks
Targeted Region: Global
Targeted Sector: Technology & IT
Criticality: High
[subscribe_to_unlock_form]

EXECUTIVE SUMMARY:

A malicious build of a popular Python library for managing large language model interfaces was distributed through standard package repositories and container registries. The compromised release included hidden startup hooks that execute automatically whenever any Python interpreter launches in an affected environment, regardless of whether the specific application is running. This delivery method bypasses normal application import checks, meaning even basic system inspection commands can trigger the payload. The risk is severe because the software typically holds sensitive provider keys, cloud identities, and database connection strings, placing all associated credentials at immediate risk of theft.

The attack mechanism relies on a single configuration change that places three specific files into the Python library directory during installation. These files leverage interpreter startup routines to run a hidden collector before the main application loads. The collector gathers extensive data, including cloud credentials, browser histories, private keys, and environment variables, while specifically querying the proxy database for stored provider keys. It encrypts this data using advanced cryptographic methods and exfiltrates it to a remote endpoint disguised as a health check. Additionally, a persistent loader detaches from the main process to periodically fetch and execute remote code from a mutable pointer file, allowing operators to update the payload without republishing the package.[/subscribe_to_unlock_form]

EXECUTIVE SUMMARY:

A malicious build of a popular Python library for managing large language model interfaces was distributed through standard package repositories and container registries. The compromised release included hidden startup hooks that execute automatically whenever any Python interpreter launches in an affected environment, regardless of whether the specific application is running. This delivery method bypasses normal application import checks, meaning even basic system inspection commands can trigger the payload. The risk is severe because the software typically holds sensitive provider keys, cloud identities, and database connection strings, placing all associated credentials at immediate risk of theft.

The attack mechanism relies on a single configuration change that places three specific files into the Python library directory during installation. These files leverage interpreter startup routines to run a hidden collector before the main application loads. The collector gathers extensive data, including cloud credentials, browser histories, private keys, and environment variables, while specifically querying the proxy database for stored provider keys. It encrypts this data using advanced cryptographic methods and exfiltrates it to a remote endpoint disguised as a health check. Additionally, a persistent loader detaches from the main process to periodically fetch and execute remote code from a mutable pointer file, allowing operators to update the payload without republishing the package.[emaillocker id="1283"]

The incident highlights the critical vulnerability of relying on floating tags and unpinned dependencies in software supply chains. Deployments that automatically pull the latest version were exposed without explicitly selecting the compromised release, demonstrating how a single bad build can propagate widely. The use of a lookalike repository owner in the build provenance further complicates attribution and verification. Defensively, organizations must pin container images by digest and verify build provenance against reviewed source revisions. Treating packaging configuration as code and alerting on new startup hooks in third-party dependencies are essential steps to prevent similar supply chain compromises.

THREAT PROFILE:

Tactic Technique Id Technique Sub-technique
Initial Access T1195.002 Compromise Software Supply Chain -

MBC MAPPING:

Objective Behavior ID Behavior
Collection E1056 Input Capture
Discovery E1082 System Information Discovery
Discovery E1083 File and Directory Discovery
Collection E1560 Archive Collected Data
Cryptography Micro-objective C0027 Encrypt Data
Data Micro-objective C0024 Compress Data
Communication Micro-objective C0002 HTTP Communication
Exfiltration E1020 Automated Exfiltration
Execution E1203 Exploitation for Client Execution
Process Micro-objective C0017 Create Process
Process Micro-objective C0042 Create Mutex
Defense Evasion F0005 Hidden Files and Directories

REFERENCES:

The following reports contain further technical details:

[/emaillocker]
crossmenu