A recent supply chain attack has compromised the Telnyx software development kit (SDK) on the Python Package Index (PyPI), delivering credential-stealing malware hidden within WAV audio files. Security researchers at Aikido, Socket, and Endor Labs identified the malicious versions – 4.87.1, and 4.87.2 – and attributed the attack to a threat actor known as TeamPCP. This incident underscores the growing risk of software supply chain vulnerabilities, where attackers target widely used software components to compromise numerous downstream users.
The Telnyx PyPI package is a popular tool, boasting over 740,000 downloads per month, allowing developers to integrate Telnyx’s communication services – including VoIP, SMS, and fax – into their applications. The compromised versions introduce malware that, depending on the operating system, steals sensitive information like SSH keys, cloud credentials, cryptocurrency wallet data, and environment variables. This broad targeting highlights the potential for widespread impact.
TeamPCP: A Persistent Threat
This isn’t TeamPCP’s first foray into supply chain attacks. The group has been linked to several recent incidents, including breaches targeting Aqua Security’s Trivy vulnerability scanner and the open-source Python library LiteLLM. They’ve also been connected to wiper attacks specifically targeting systems in Iran, according to reports from BleepingComputer. The consistency in tactics and tools – including the exfiltration patterns and RSA key used in previous attacks – strongly points to TeamPCP’s involvement in the Telnyx compromise.
How the Attack Works
The malicious code resides within the ‘telnyx/_client.py’ file and activates upon import, allowing the SDK’s core functionality to remain operational while the malware runs in the background. On Linux and macOS systems, the payload initiates a process that downloads a second-stage component disguised as a WAV audio file, “ringtone.wav,” from a remote command-and-control (C2) server. This technique, known as steganography, cleverly conceals malicious code within the audio file’s data frames without altering the file itself.
Source: Endor Labs
The payload is then extracted using a simple XOR-based decryption routine and executed in memory, allowing it to harvest sensitive data from the infected host. For systems running Kubernetes, the malware attempts to enumerate cluster secrets and deploy privileged pods, potentially granting access to underlying host systems. On Windows, a different WAV file, “hangup.wav,” is downloaded, which extracts an executable named msbuild.exe. This executable is placed in the system’s Startup folder to ensure persistence across reboots, with a lock file preventing repeated execution within a 12-hour window.
Timeline and Initial Access
Researchers believe the attackers gained access to the Telnyx publishing account on PyPI through stolen credentials. TeamPCP initially published the compromised version 4.87.1 at 03:51 UTC, but it contained a non-functioning malicious payload. The group corrected this issue roughly an hour later, at 04:07 UTC, by releasing version 4.87.2, which contained the fully functional malware.
Mitigation and Response
Security experts strongly advise developers to immediately roll back to Telnyx SDK version 4.87.0, which is confirmed to be clean and free of malicious code. Any system that imported versions 4.87.1 or 4.87.2 should be considered compromised, and a thorough review and rotation of all credentials is recommended. The potential for data exfiltration means a swift and comprehensive response is critical.
The incident highlights the importance of robust security practices throughout the software supply chain. Developers should implement measures like dependency scanning, vulnerability monitoring, and multi-factor authentication for package registries to mitigate the risk of similar attacks. The Python community is also discussing ways to improve the security of the PyPI ecosystem, including stricter access controls and enhanced verification processes.
The ongoing investigation aims to determine the full scope of the compromise and identify any additional systems that may have been affected. Updates will be provided as more information becomes available. Developers relying on the Telnyx SDK should monitor official channels for further guidance and security advisories.
If you have utilized the Telnyx SDK, We see crucial to assess your systems and implement the recommended mitigation steps. Staying informed and proactive is key to protecting against evolving threats in the software supply chain.
