CVE-2008-2942: Mercurial Path Traversal Vulnerability
MODERATECVE-2008-2942 is a MODERATE path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Mercurial libraries in the PyPI ecosystem. The issue involves mercurial directory traversal vulnerability. Remediation is available by upgrading affected packages to version 1.0.2.
CVE-2008-2942 at a Glance
How to Fix CVE-2008-2942
To remediate this vulnerability, upgrade all affected Mercurial 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 mercurial>=1.0.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show mercurial
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2008-2942, inspect your installed packages using pip:
pip show mercurial
Analyze the terminal output to locate any version of Mercurial in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.2), your application is affected.
Note: The pip show mercurial command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Mercurial, 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
CVE-2008-2942 Affected Mercurial Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
mercurial
|
PyPI |
< 1.0.2
|
1.0.2
|
References
Frequently Asked Questions
What is CVE-2008-2942?
Which Mercurial versions are affected?
What version fixes CVE-2008-2942?
Is mercurial affected?
What CWE is associated with CVE-2008-2942?
How can I check PyPI dependencies for CVE-2008-2942?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-v2gw-x5jf-pgwv",
"modified" : "2023-09-22T22:26:38Z",
"published" : "2022-05-01T23:55:06Z",
"aliases" : [ "CVE-2008-2942" ],
"summary" : "Mercurial Directory traversal vulnerability",
"details" : "Directory traversal vulnerability in patch.py in Mercurial before 1.0.2 allows user-assisted attackers to modify arbitrary files via \"..\" (dot dot) sequences in a patch file.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "mercurial"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.0.2"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2008-2942"
}, {
"type" : "WEB",
"url" : "https://exchange.xforce.ibmcloud.com/vulnerabilities/43551"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/dscho/hg"
}, {
"type" : "WEB",
"url" : "https://issues.rpath.com/browse/RPL-2633"
}, {
"type" : "WEB",
"url" : "http://lists.opensuse.org/opensuse-security-announce/2008-07/msg00006.html"
}, {
"type" : "WEB",
"url" : "http://secunia.com/advisories/31108"
}, {
"type" : "WEB",
"url" : "http://secunia.com/advisories/31110"
}, {
"type" : "WEB",
"url" : "http://secunia.com/advisories/31167"
}, {
"type" : "WEB",
"url" : "http://security.gentoo.org/glsa/glsa-200807-09.xml"
}, {
"type" : "WEB",
"url" : "http://wiki.rpath.com/Advisories:rPSA-2008-0211"
}, {
"type" : "WEB",
"url" : "http://www.openwall.com/lists/oss-security/2008/06/30/1"
}, {
"type" : "WEB",
"url" : "http://www.openwall.com/lists/oss-security/2008/07/01/1"
}, {
"type" : "WEB",
"url" : "http://www.securityfocus.com/archive/1/493881/100/0/threaded"
}, {
"type" : "WEB",
"url" : "http://www.securityfocus.com/bid/30072"
}, {
"type" : "WEB",
"url" : "http://www.selenic.com/hg/rev/87c704ac92d4"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-09-22T22:26:38Z",
"nvd_published_at" : "2008-06-30T20:41:00Z"
}
}