TeamPCP supply chain attack — malicious PyPI packages compromising developer environments in 2026
Threat Intelligence

TeamPCP Supply Chain Attack: How Malicious PyPI Packages Hit Your Pipeline

Three widely-used packages — LiteLLM, Telnyx, and Trivy — were compromised in the same week. Here's exactly how it happened, what the malicious code does, and how to analyze package files without alerting the attackers.

Aprensec Research
March 29, 202617 min read
Supply Chain AttackPyPInpmLiteLLMTeamPCPMalware AnalysisFile ScannerCI/CD SecurityThreat IntelligenceOPSEC

What Is the TeamPCP Campaign?

The week of March 19–27, 2026, three open-source packages used by hundreds of thousands of developers were quietly compromised in a coordinated supply chain campaign tracked as TeamPCP. Trivy — the container security scanner from Aqua Security — was the first to fall on March 19. LiteLLM, one of the most widely used Python packages for routing calls to large language model APIs, followed on March 25 (versions 1.82.7 and 1.82.8). Telnyx's Python SDK (versions 4.87.1 and 4.87.2) was compromised in the same window.

The attack surface is significant. LiteLLM has been integrated into thousands of AI-enabled applications and internal developer toolchains. Security teams and DevOps engineers use Trivy as a first-line container scanning step in CI/CD pipelines. Telnyx is embedded in communications platforms across fintech and SaaS. If you ran pip install on any project referencing these packages between March 19 and the point at which each version was pulled from PyPI, your environment likely executed attacker-controlled code during installation.

This is not a theoretical risk. TeamPCP is an active, confirmed campaign with documented samples and a clear operational pattern. The detection window — the time between package compromise and takedown — was measured in days. For organizations running automated dependency updates or unattended CI/CD builds, that window is more than enough for a full credential-exfiltration chain to execute silently.

The Compromised Packages: A Timeline

Three packages were hit in rapid succession across a nine-day window. Understanding the timeline matters because it establishes this as a deliberate, coordinated campaign rather than isolated opportunistic attacks.

Trivy — March 19, 2026

Aqua Security's open-source container and filesystem vulnerability scanner. Trivy is used by security engineers to scan container images for known CVEs before deployment — it is standard tooling in security-conscious DevOps pipelines. The irony is pointed: a security tool designed to detect supply chain vulnerabilities in other software became the first victim in a supply chain attack. The compromise involved a malicious variant published under a namespace crafted to appear legitimate to automated dependency resolvers.

LiteLLM — March 25, 2026

Versions 1.82.7 and 1.82.8 of the LiteLLM Python SDK were found to contain malicious code injected into the package's build process. LiteLLM is a proxy layer that lets developers call 100+ LLM APIs — OpenAI, Anthropic, Cohere, Azure, and others — through a unified interface. Its wide adoption in AI development toolchains makes it a high-value target: compromising LiteLLM means executing code in environments that almost certainly hold OPENAI_API_KEY, ANTHROPIC_API_KEY, and cloud credentials alongside access to development infrastructure.

Telnyx — March 25–27, 2026

Telnyx's Python SDK versions 4.87.1 and 4.87.2 were compromised in the same window. Telnyx provides programmable voice, SMS, and real-time communications APIs. Applications using the SDK frequently handle payment flows and user authentication data — making it an attractive target for credential-harvesting payloads beyond API keys.

PackageCompromised VersionsDate DetectedEcosystemAttack Vector
Trivy (Aqua Security)Malicious namespace variantMarch 19, 2026PyPITyposquatting / dependency confusion
LiteLLM1.82.7, 1.82.8March 25, 2026PyPIMaintainer account compromise
Telnyx Python SDK4.87.1, 4.87.2March 25–27, 2026PyPIMaintainer account compromise

filescanner.online

Scan Any File — Privately.

Deep binary analysis, YARA rules, AI summary, and PDF reports. Up to 2 GB. No account required.

PE/ELF Binary ParsingYARA Scanning (17 rules)70+ API Pattern DetectionThreat IntelligenceAI False-Positive AnalysisPDF Report Export
Try FileScanner.online

How the Malicious Code Was Constructed

Understanding the technical construction of these packages explains both why they evaded initial detection and what structural analysis can reveal — even without executing the code.

The install hook as an execution primitive

Python packages support arbitrary code execution at install time through setup.py post-install hooks and pyproject.toml build hooks. Legitimate packages use these mechanisms for tasks like compiling C extensions or generating configuration files. In the TeamPCP campaign, malicious code was injected into these hooks so that running pip install immediately executes attacker-controlled Python before any application code is ever touched.

The hook pattern is particularly dangerous against automated pipelines: CI/CD systems running pip install -r requirements.txt at build time execute the hook without any human review, with the same privileges as the build process — often elevated in cloud build environments with access to production credentials.

Staged delivery: small first stage, remote second stage

The malicious payloads in TeamPCP used a two-stage architecture. The first stage, embedded directly in the install hook, is intentionally minimal: a small Python stub that reaches out to an attacker-controlled URL to fetch the real payload at runtime. This architecture serves two purposes. First, it keeps the visible malicious code small enough to pass basic size-threshold heuristics. Second, the final payload can be swapped by the attacker without publishing a new package version — meaning even if the first stage is detected, the second-stage capability can be upgraded silently.

Static analysis of captured first-stage stubs reveals consistent structural indicators: base64-encoded strings that decode to C2 URLs or IP addresses, calls to urllib.request or requests.get inside install hooks (legitimate packages almost never initiate network connections at install time), and subprocess invocations that execute the downloaded content as a shell command or Python script.

Second-stage capabilities observed in the wild

Documented second-stage payloads attributed to TeamPCP include: environment variable harvesting targeting cloud and LLM API credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY, GITHUB_TOKEN); credential file exfiltration targeting /.aws/credentials, /.ssh/id_rsa, browser profile data, and stored authentication tokens; and in some variants, a persistent reverse shell that survives beyond the installation session.

What entropy analysis reveals without executing anything

Shannon entropy is one of the most reliable static indicators of obfuscated or packed content. Normal Python source code exhibits entropy in the 4.0–5.5 bits/byte range due to the repetitive structure of human-readable text. Base64-encoded payloads, encrypted blobs, and obfuscated strings produce significantly elevated entropy — typically 6.0–7.5 bits/byte. Automated entropy analysis on the malicious LiteLLM and Telnyx packages surfaced anomalously high-entropy segments in the install hook code that were structurally inconsistent with the packages' documented build requirements — a reliable flag for investigation even before any signature exists.

The Broader Pattern: Lazarus Group and State-Sponsored PyPI Poisoning

TeamPCP does not exist in isolation. It is one of several concurrent campaigns targeting the same supply chain trust model — some attributed directly to state-sponsored threat actors with significantly larger resources and longer operational patience.

Lazarus Group's parallel npm and PyPI campaign

Concurrent with TeamPCP, North Korea's Lazarus Group (APT38) was executing a structurally similar but separately operated campaign targeting npm and PyPI ecosystems. The delivery mechanism differed: Lazarus operators posted fabricated cryptocurrency job offers on LinkedIn and developer job boards, then directed candidates to clone GitHub repositories containing malicious packages as part of a staged "technical assessment." The packages installed credential-stealing RATs and persistent backdoors targeting developer workstations with access to cryptocurrency and DeFi infrastructure.

The dYdX npm package compromise, documented in February 2026, followed this pattern. Lazarus specifically targeted DeFi developers because compromising a single developer machine with access to deploy scripts can yield theft at the protocol level — a significantly higher return than individual credential harvesting at scale.

Why package managers are now primary attack surfaces

Package managers occupy a uniquely privileged position in the software supply chain. They are trusted by developers to resolve and install dependencies automatically, with local system privileges. They execute code at install time without sandboxing. They are queried millions of times daily by unattended CI/CD pipelines. And unlike binary software distribution, the barrier to publishing is low — PyPI and npm have no mandatory security review for new or updated packages, and the window between publication and indexing is seconds.

Sonatype's 2026 State of Software Supply Chain Security report documented a 156% year-over-year increase in malicious package publications across npm and PyPI. The attack vector is not novel — the Codecov breach (2021) and the SolarWinds compromise (2020) established the template — but automation has made it accessible to threat actors well below the nation-state tier.

What distinguishes state-sponsored packages from criminal ones

Criminal supply chain attacks typically optimize for rapid, high-volume credential harvesting with immediate monetization. State-sponsored campaigns like those attributed to Lazarus show different operational priorities: persistent access over credential volume, targeting of specific high-value industries (AI development, DeFi, defense contractors), and coverage of developer machines rather than end users.

The targeting of LiteLLM — a package embedded in AI development workflows — suggests the campaign was specifically interested in environments holding enterprise AI infrastructure credentials and the API keys that control it. The practical detection implication is that state-sponsored packages are often more carefully constructed, use more sophisticated obfuscation, and may contain dormant components that activate only under specific environmental conditions — making them harder to catch with signature-based scanning alone.

Why Standard Detection Fails for New Malicious Packages

The standard security response to malware discovery — submit the file to a multi-engine scanner, check the hash against threat intelligence feeds — fails systematically for supply chain attacks targeting new package versions.

Hash-based detection has no signal during the zero-day window

Threat intelligence feeds and signature databases work by cataloging known-bad files. A malicious package version published to PyPI for the first time has never been cataloged. Its SHA-256 hash does not appear in any feed. VirusTotal, Hybrid Analysis, and similar platforms return zero detections until antivirus vendors manually acquire and analyze the sample and update their signature databases — a process that typically takes 24–72 hours after initial public exposure, and longer for novel obfuscation patterns.

For TeamPCP, the most dangerous window is precisely this gap: the hours or days between when a malicious version is published and when it acquires any signal in signature databases. Automated pipelines that run dependency updates will install and execute the package during this window with no detection.

The VirusTotal burn risk: you're alerting the attacker

Submitting a suspicious package to VirusTotal's free or standard tier adds the sample to a publicly searchable corpus. Threat actors running active campaigns — particularly state-sponsored operators — actively monitor VirusTotal and Hybrid Analysis for new submissions matching their tooling. The moment a new hash belonging to their active package appears in the public corpus, it is a signal that their campaign has been discovered.

Documented responses to detection via public scanners include: immediate rotation of the C2 URLs embedded in first-stage stubs, publication of new malicious versions with different obfuscation to evade signatures being written, and in some cases, activation of dormant second-stage payloads before defenders have time to respond. In practical incident response terms, submitting to a public scanner can burn the investigation while it is still active.

Why behavioral analysis works when signatures don't

The characteristics that reliably identify malicious packages are behavioral and structural — present in the code regardless of whether that specific hash has ever been seen before. Network calls initiated from install hooks, anomalously high entropy in setup code, subprocess execution of downloaded content, environment variable harvesting patterns, and IOC patterns in decoded string content are all detectable through static analysis on first contact.

YARA rules targeting these behavioral patterns provide detection coverage during the zero-day window where hash lookups return nothing. Entropy analysis of install hook sections surfaces obfuscated payloads before any signature exists. Import analysis flags Python packages calling network and subprocess libraries in contexts where no legitimate package has a reason to do so.

This is the gap that behavioral file scanning fills: structural and pattern-based analysis that works on first sight, without requiring prior cataloging of the specific sample.

Detection MethodCoverage During Zero-Day WindowCore Limitation
Hash lookup (VirusTotal, ThreatFox)NoneNo signal until signatures written; 24–72h lag minimum
Signature-based AVNoneSame lag; depends on vendor acquisition and analysis turnaround
pip-auditPartial — known CVEs onlyDoes not detect novel malicious code in new package versions
Behavioral / structural analysis (YARA)Yes — pattern-based, hash-independentRequires a scanner with YARA + entropy + import inspection
Shannon entropy analysisYes — flags obfuscated install hooksNeeds baseline context; high entropy ≠ always malicious
IOC extraction from decoded stringsYes — surfaces C2 URLs and IPsReduced effectiveness against fully staged loaders

filescanner.online

Scan Any File — Privately.

Deep binary analysis, YARA rules, AI summary, and PDF reports. Up to 2 GB. No account required.

PE/ELF Binary ParsingYARA Scanning (17 rules)70+ API Pattern DetectionThreat IntelligenceAI False-Positive AnalysisPDF Report Export
Try FileScanner.online

How to Analyze a Suspicious Package File Privately

The correct workflow for analyzing a suspicious package — before installing it, or retroactively on a machine where it has already run — requires a private analysis environment that performs behavioral and structural inspection without publishing results to any searchable corpus.

Step 1: Retrieve the package archive without executing it

PyPI packages are available as .whl (wheel) or .tar.gz (source distribution) archives directly from the PyPI file index, without triggering install hooks. Use pip download --no-deps litellm==1.82.7 -d ./suspect_pkg/ to pull a specific version to a local directory without installing it. Run this in a throwaway environment — a fresh VM or container with no credentials present — to contain any risk from the retrieval process itself.

A .whl file is a standard ZIP archive. You can extract it with any ZIP tool to inspect its contents: Python source files, compiled .pyc bytecode, and the METADATA file. The install hook code lives in setup.py in the source distribution (.tar.gz). Both archive formats can be submitted directly to a file scanner.

Step 2: Submit the archive to a private file scanner

Drop the .whl or .tar.gz archive directly into FileScanner.online. The scanner performs static analysis on the archive contents without executing any code: Shannon entropy analysis per file and per section; YARA rule matching across 17 threat categories including network/C2 patterns, credential access, and obfuscation techniques; IOC extraction — URLs, IP addresses, domain names — from decoded string content; Python import analysis flagging suspicious library usage in install-time code; and hash-based threat intelligence lookup against CIRCL, ThreatFox, and Team Cymru MHR.

The critical property here is privacy. FileScanner.online does not publish scan results to any searchable corpus, does not share uploaded files with third parties, and creates no signal visible to the campaign operators. Analyzing a malicious LiteLLM package does not alert the TeamPCP operators that their tooling has been discovered. This is the operational security property that distinguishes private scanning from public platforms during an active investigation.

Step 3: Interpret the results for Python packages specifically

For Python package archives, the most significant indicators in scan results are: YARA matches in the network/C2 or credential-access categories — these rules detect URL construction patterns, encoding schemes, and subprocess execution structures common to first-stage loader stubs. Entropy anomalies — install hook files with entropy above 6.0 bits/byte warrant direct inspection, especially when the package's documented purpose has no reason for cryptographic or encoding operations. IOC extraction results — if the scanner surfaces IP addresses or domain names that do not correspond to the package's documented API endpoints, treat those as candidate C2 indicators worth correlating against external threat intelligence.

Step 4: Correlate extracted IOCs against threat intelligence

Any suspicious URLs or IP addresses surfaced in the IOC extraction step can be checked separately using URLScanner.online — again, privately, without the URL appearing in any public scan index. A C2 callback address that scores poorly on threat intelligence checks, resolves to infrastructure with no legitimate web presence, and was registered recently is strong corroborating evidence of malicious intent. Combined with the static indicators from the file scan, this gives you a complete picture of what the package is doing and where it is calling home.

Hardening Your Pipeline Against Supply Chain Attacks

Detection is valuable, but the stronger posture is making supply chain compromises harder to land silently in the first place. These controls address different layers of the attack surface.

Hash pinning — the highest-impact single control

Specify exact package hashes in your requirements files and enforce them with pip install --require-hashes. This ensures that even if a malicious new version is published to PyPI, your pipeline will fail visibly rather than silently installing it. Generate hash-pinned requirements with pip-compile --generate-hashes from pip-tools and commit the result. Any version update requires a deliberate hash change in your repository — creating an auditable, reviewable event. Hash pinning converts a silent compromise into a visible build failure.

pip-audit in CI for known CVEs

Run pip-audit -r requirements.txt --fail-on-vuln as a required CI step. This does not detect novel malicious code — it operates on published CVEs only — but it provides a low-friction catch for packages flagged post-discovery. Add it before merge, not as a post-deploy check.

SLSA attestations for critical dependencies

Supply-chain Levels for Software Artifacts (SLSA) allows you to verify that a published PyPI artifact was built from a specific commit using a specific, auditable build process. PyPI began supporting SLSA attestations in 2024. Packages publishing SLSA attestations allow you to verify build provenance — making account-compromise attacks that inject code post-build significantly harder to execute without detection.

Monitor PyPI for new versions of critical packages

Set up notifications for new version publications on packages your codebase depends on. PyPI provides per-package RSS feeds. Configure Dependabot or Renovate to open PRs rather than auto-applying updates, putting a human review step between a new PyPI publication and your pipeline executing it.

Private pre-install scanning in CI/CD

Integrate behavioral file scanning into your build pipeline for new dependency versions before they are installed in any environment that holds credentials. The FileScanner.online API supports automated submission and result polling, enabling a pre-install check that performs structural analysis on the package archive without executing it — and without publishing results externally. A scan that returns YARA hits in the network/C2 category or high-entropy install hook code is grounds for blocking the install pending manual review.

Isolated build environments with no credentials at install time

Even with detection controls in place, run pip install in containers that have no credential access, no outbound network routes to internal systems, and no sensitive environment variables present during the install phase. If malicious hook code executes, it reaches an empty environment. Mount credentials only after the install step completes and passes all scanning checks.

ControlWhat It PreventsImplementation Complexity
Hash pinningSilent installation of compromised new versionsLow — pip-tools generates pinned files automatically
pip-audit in CIKnown-CVE packages reaching productionVery low — single command added to pipeline
SLSA attestation verificationPost-build code injection into official packagesMedium — requires publisher support; not universal yet
PyPI release monitoringAutomatic dependency updates during compromise windowLow — Dependabot or RSS-based alerting
Private pre-install scanningNovel malicious code in new package versionsMedium — requires FileScanner API integration in pipeline
Isolated build environmentsCredential exfiltration if malicious hook executesMedium — containerized build setup required

urlscanner.online

Scan Any URL — In Under 2 Seconds.

8 parallel security modules: malware, SSL, DNS, phishing, WHOIS, headers, screenshots, and AI scoring. 100% private.

Google Safe Browsing · URLhausSSL/TLS Full ChainDNS EnumerationPhishing DetectionAI Safety Score (0–100)Website Screenshots
Try URLScanner.online

Frequently Asked Questions

Am I affected if I installed LiteLLM, Telnyx, or Trivy recently? If you installed LiteLLM versions 1.82.7 or 1.82.8, Telnyx 4.87.1 or 4.87.2, or the malicious Trivy variant before each was removed from PyPI, you should assume the install hook executed. Rotate any credentials that were present as environment variables or in credential files on that machine: cloud API keys (AWS, GCP, Azure), LLM provider API keys, SSH private keys, and browser-stored tokens. Audit outbound network connections from that machine during the installation window.

How do I check which version I have installed? Run pip show litellm, pip show telnyx, or pip show trivy to see the installed version. Run pip install --upgrade litellm to move to the latest clean version, but upgrading does not reverse actions the install hook has already taken — credential rotation is still required.

Why did pip execute attacker code automatically without asking? Python's packaging ecosystem allows packages to run arbitrary Python code during installation via setup.py post-install scripts and build hooks. This is a known design limitation. pip does not sandbox or restrict install-time execution — it runs whatever the package tells it to run, with your local user's permissions. The Python Packaging Authority is working on restricting this, but most packages still use the traditional hook mechanism.

Why didn't VirusTotal catch this immediately? For a newly published malicious package version, all scanner engines return clean results until they individually acquire the sample, analyze it, and update their signature databases — typically 24–72 hours after the sample enters the public corpus. Beyond the detection lag, submitting to VirusTotal makes the sample publicly visible, which can alert the campaign operators that their package has been discovered and trigger rapid C2 infrastructure rotation.

Can FileScanner.online detect malicious install hooks through static analysis? Yes, reliably for the patterns present in TeamPCP-style packages. Malicious install hooks contain structural anomalies that static analysis detects regardless of whether the specific hash has been seen before: high-entropy sections inconsistent with the package's stated purpose, network library calls in install-time code (legitimate packages almost never make outbound connections at install time), subprocess execution of downloaded content, and YARA pattern matches for encoding and C2 communication structures. The scanner does not execute the hook — it analyzes the code structure statically — but the behavioral indicators are present and detectable.

Is this a PyPI security failure? PyPI is a distribution platform, not a security scanner, and it does not review package code before publication. PyPI has implemented controls including mandatory two-factor authentication for critical packages and malware-scanning partnerships, but these are not a substitute for verifying packages before installation. The same design limitation exists in npm and RubyGems. The gap is structural to the ecosystem, not specific to PyPI.

What if a compromised version was already baked into a Docker image in production? The install hook has already run during the image build — it will not re-execute from a running container. The immediate concern is any credentials that were present as environment variables during the original build. Rebuild affected images from a clean base with clean package versions, treat all credentials that existed as environment variables during the original build as compromised and rotate them, and audit the network activity of any running instances of that image during the compromise window.

What is the single most important control to implement right now? Hash pinning. Specify exact package hashes in your requirements files using pip-compile --generate-hashes and enforce them in CI with pip install --require-hashes. This turns any compromised package version into a visible build failure rather than a silent compromise. Combined with a review gate on dependency updates, it eliminates the primary attack vector used in the TeamPCP campaign.

Related articles