CVE-2017-17458 — mercurial
CRITICALCVE-2017-17458 is a critical-severity (CVSS 9.8) OS Command Injection vulnerability in mercurial. A fix is available for mercurial — see the affected versions and patch details below.
Mercurial vulnerable to arbitrary code injection
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
mercurialReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
In Mercurial before 4.4.1, it is possible that a specially malformed repository can cause Git subrepositories to run arbitrary code in the form of a .git/hooks/post-update script checked into the repository. Typical use of Mercurial prevents construction of such repositories, but they can be created programmatically.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | mercurial | all versions | 4.4.1pip install --upgrade 'mercurial==4.4.1' |
Affected Products
debian linuxdebianmercurialmercurialDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for mercurial, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update mercurial to 4.4.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2017-17458 is resolved across your whole dependency graph.
Workarounds
Stop passing untrusted input into the interpreter or shell: call the affected binary with an argument array rather than a composed command string, reject anything outside a strict allowlist of expected values, and run the component under an account that cannot reach beyond the work it legitimately does.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
This issue affects the versions of mercurial as shipped with Red Hat Enterprise Linux 7. Red Hat Product Security has rated this issue as having Moderate security impact. A future update may address this issue. For additional information, refer to the Issue Severity Classification:…
Disable sub-repositoriesSource: Red Hat security advisory for CVE-2017-17458 (CC BY 4.0)
Frequently Asked Questions
Is CVE-2017-17458 in your dependencies?
Find it across PyPI, including transitive dependencies.