Malicious Code Embedded in ctx Package

ctx Updated 02 Oct 2025

Summary

02/06/2022
CRITICAL
No i
Critical
Not published

GHSA-67r3-h899-9w95: Embedded Malicious Code in ctx. Affects ctx versions >= 0.1.2-1. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The ctx package is a Python library available on PyPI that provides a context manager for managing multiple contexts. It allows developers to easily handle resources and ensure their proper cleanup. The package is widely used in various Python projects.

Vulnerability Detail

The ctx package hosted on PyPI was compromised due to a user account compromise. The attacker replaced the legitimate package with a malicious version that contained embedded runtime code. This code collected the content of os.environ.items() when creating Ctx objects. This vulnerability allows the attacker to gather sensitive information from the environment variables of the affected system. The impact of this vulnerability can be severe, as it can lead to unauthorized access, data leakage, and potential compromise of the entire system.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

There is no specific workaround mentioned for this vulnerability. However, as a general security practice, it is recommended to regularly update packages and dependencies to their latest secure versions. Additionally, monitoring and auditing the usage of third-party packages can help identify any suspicious or compromised versions.

Conclusion

The ctx package hosted on PyPI was compromised, leading to the distribution of a malicious version containing embedded runtime code. This vulnerability allows an attacker to collect sensitive information from the environment variables of the affected system. To mitigate this issue, users should update to the latest secure version of ctx and review the security of user accounts. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for ctx →

Share this vulnerability

FAQ

The impact of this vulnerability can be severe, as it allows an attacker to collect sensitive information from the environment variables of the affected system. This can lead to unauthorized access, data leakage, and potential compromise of the entire system.

You can use Vulert's playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Vulert analyzes Pipfile.lock to identify and alert in real-time for open-source vulnerabilities in software.

Yes, the maintainers of the ctx package have addressed the issue and released a secure version. It is recommended to update to the latest version of ctx (after the compromised version) to fix this vulnerability.

To prevent future compromises of user accounts, it is important to follow security best practices such as using strong and unique passwords, enabling two-factor authentication, and regularly monitoring account activity for any suspicious behavior.

If your application is affected by this vulnerability, it is recommended to update the ctx package to a non-compromised version as soon as possible. Additionally, review the security of user accounts and take necessary measures to prevent future compromises.

Related vulnerabilities

Recent vulnerabilities recorded for ctx.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback