CVE-2008-2942: Mercurial Directory Traversal Vulnerability

mercurial Updated 06 Jul 2026

Summary

02/07/2026
Yes i
Moderate
Not published

CVE-2008-2942: Mercurial Directory traversal vulnerability. Affects mercurial versions < 1.0.2. Fixed in 1.0.2. How to fix ↓

Also tracked for

The same CVE-2008-2942 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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

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

Mercurial is a distributed version control system that allows developers to manage changes to source code over time. It is known for its efficiency and scalability, making it a popular choice for both small and large projects. However, prior to version 1.0.2, Mercurial contained a directory traversal vulnerability in its patch.py file, which could be exploited by attackers to manipulate files outside the intended directory structure.

Vulnerability Detail

The directory traversal vulnerability in Mercurial arises from improper handling of file paths in patch files. Attackers can craft malicious patch files that include '..' (dot dot) sequences, allowing them to navigate the directory structure and modify arbitrary files on the system. This could lead to unauthorized access, data corruption, or system compromise, especially if the affected system has elevated privileges.

How To Fix

Latest published version: 7.2.4 as of 22 Oct 2026

pip install --upgrade "mercurial==7.2.4"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.0.2

This is the first release that contains the fix.

pip install --upgrade "mercurial==1.0.2"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, users can avoid processing untrusted patch files that may contain malicious content. Always verify the source of patch files before applying them to your Mercurial repositories.

Conclusion

The directory traversal vulnerability in Mercurial (CVE-2008-2942) poses a significant risk to users of versions prior to 1.0.2. It is crucial to update to the latest version to mitigate this risk. Additionally, users should be cautious when handling patch files from untrusted sources.

See every vulnerability recorded for mercurial →

Share this vulnerability

FAQ

A directory traversal vulnerability allows an attacker to access files and directories that are stored outside the intended directory structure, potentially leading to unauthorized file access or modification.

If you are using a version of Mercurial prior to 1.0.2, your installation is vulnerable to this issue. You can check your version by running 'hg --version' in your terminal.

Failing to fix this vulnerability can expose your system to unauthorized access, data corruption, or exploitation by malicious actors, especially if sensitive files are accessible.

Yes, Vulert can monitor your application for open-source vulnerabilities, including this one, using just your Pipfile.lock. You can check your application's status in real-time without any installation.

Yes, you can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Related vulnerabilities

Recent vulnerabilities recorded for mercurial.

How To Fix

Latest published version: 7.2.4 as of 22 Oct 2026

pip install --upgrade "mercurial==7.2.4"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.0.2

This is the first release that contains the fix.

pip install --upgrade "mercurial==1.0.2"

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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