Description
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and consequently execute arbitrary code, by using --debugger as a repository name.
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | mercurial | 4.3.1-1 | — |
| Debian 13 | mercurial | 4.3.1-1 | — |
| Debian 12 | mercurial | 4.3.1-1 | — |
| Debian 8 | mercurial | 3.1.2-2+deb8u5 | DLA-1414-1 |
| Debian 7 | mercurial | 2.2.2-4+deb7u4 | DLA-1005-1 |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 16.04 LTS | mercurial | 3.7.3-1ubuntu1.1 | — |
| Ubuntu 14.04 LTS | mercurial | 2.8.2-1ubuntu1.4 | — |
Red Hat
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| RHEL 7 | mercurial +3 | 2.6.2-7.el7_3 | RHSA-2017:1576 |
| RHEL 6 | mercurial +3 | 1.4-5.el6_9 | RHSA-2017:1576 |
SUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| SLES 12 SP2 | mercurial | 2.8.2-14.1 | SUSE-SU-2017:1606-1 |
| SLES 11 SP4 | mercurial | 2.3.2-0.17.1 | SUSE-SU-2017:1558-1 |
Oracle Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Oracle Linux 7 | mercurial +3 | 2.6.2-7.el7_3 | ELSA-2017-1576 |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
Metasploit 1 module
-
Mercurial Custom hg-ssh Wrapper Remote Code Exec
exploit/linux/ssh/mercurial_ssh_exec
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| PyPI | mercurial | < 4.1.3 | 4.1.3 | GHSA-ghjx-3jg5-h6r2 |
Advisories 6
- RHSA-2017:1576 Red Hat Security Advisory: mercurial security update Red Hat Security Advisories (RHSA) · Jun 26, 2026
- DLA-1005-1 mercurial - security update Debian Security (DSA / DLA) · Mar 9, 2026
- DLA-1414-1 mercurial - security update Debian Security (DSA / DLA) · Mar 9, 2026
- SUSE-SU-2017:1606-1 Security update for mercurial SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2017:1558-1 Security update for mercurial SUSE / openSUSE Security Updates · Feb 4, 2026
- ELSA-2017-1576 Important: mercurial security update (Oracle Linux 7) Oracle Linux Security Advisories (ELSA) · Jun 27, 2017
References
- RHSA-2017:1576 vendor-advisory
- https://www.mercurial-scm.org/repo/hg/rev/77eaf9539499
- https://www.mercurial-scm.org/wiki/WhatsNew#Mercurial_4.1.3_.282017-4-18.29
- [debian-lts-announce] 20180705 [SECURITY] [DLA 1414-1] mercurial security update mailing-list
- DSA-3963 vendor-advisory
- GLSA-201709-18 vendor-advisory
- https://bugs.debian.org/861243
- 99123 vdb-entry