GHSA-4g82-3jcr-q52w: Ctx Malware Vulnerability
CRITICALGHSA-4g82-3jcr-q52w is a CRITICAL malware vulnerability (CWE-912: Hidden Functionality) affecting Ctx libraries in the PyPI ecosystem. The issue involves malware in ctx. Remediation is available in the latest vendor maintenance releases.
GHSA-4g82-3jcr-q52w at a Glance
How to Fix GHSA-4g82-3jcr-q52w
To remediate this vulnerability, upgrade all affected Ctx dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install ctx>=Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show ctx
How to Check if You Are Affected
To determine whether your Python environment is affected by GHSA-4g82-3jcr-q52w, inspect your installed packages using pip:
pip show ctx
Analyze the terminal output to locate any version of Ctx in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: The pip show ctx command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-912: Hidden Functionality, where the product contains functionality that is not documented, not part of the specification, and not accessible through an interface or command sequence that is obvious to the product's users or administrators. In Ctx, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-4g82-3jcr-q52w Affected Ctx Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
ctx
|
PyPI |
≤ 0.1.4
|
|
References
Frequently Asked Questions
What is GHSA-4g82-3jcr-q52w?
Which Ctx versions are affected?
What version fixes GHSA-4g82-3jcr-q52w?
Is ctx affected?
What CWE is associated with GHSA-4g82-3jcr-q52w?
How can I check PyPI dependencies for GHSA-4g82-3jcr-q52w?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4g82-3jcr-q52w",
"modified" : "2022-05-25T23:09:55Z",
"published" : "2022-05-25T23:09:55Z",
"aliases" : [ ],
"summary" : "Malware in ctx",
"details" : "The `ctx` hosted project on [PyPI](https://pypi.org/project/ctx/) was taken over via user account compromise and replaced with a malicious project which contained runtime code that collected the content of `os.environ.items()` when instantiating `Ctx` objects. The captured environment variables were sent as a base64 encoded query parameter to a heroku application running at `https://anti-theft-web.herokuapp.com`.\n\nIf you installed the package between May 14, 2022 and May 24, 2022, and your environment variables contain sensitive data like passwords and API keys (like `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`), we advise you to rotate your passwords and keys, then perform an audit to determine if they were exploited.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "ctx"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "0.1.4"
} ]
} ]
} ],
"references" : [ {
"type" : "PACKAGE",
"url" : "https://github.com/figlief/ctx"
}, {
"type" : "WEB",
"url" : "https://isc.sans.edu/forums/diary/ctx+Python+Library+Updated+with+Extra+Features/28678"
}, {
"type" : "WEB",
"url" : "https://portswigger.net/daily-swig/malicious-python-library-ctx-removed-from-pypi-repo"
}, {
"type" : "WEB",
"url" : "https://python-security.readthedocs.io/pypi-vuln/index-2022-05-24-ctx-domain-takeover.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-912" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2022-05-25T23:09:55Z",
"nvd_published_at" : null
}
}