Mercurial 7.2.6 critical release: RCE via crafted repos/bundles (HG-SA-2026-001..004)
Severity: critical · Patch status: patched · Since 2026-12-03
Mercurial published 7.2.6 on 2026-12-03 and calls it a critical security release that fixes four advisories. HG-SA-2026-001 allows code execution and writes outside the working copy through .hg paths and symlinks exported by commands such as hg archive, hg cat and hg export, and accepted on exchange; it affects all versions. HG-SA-2026-002 lets a crafted bundle poison in-memory cache and bypass the integrity check when unbundling, in versions 7.1 to 7.2.5. HG-SA-2026-003 is a symlink race during parallel updates that a malicious changeset can reliably exploit, in versions 2.6 to 7.2.5. HG-SA-2026-004 is configuration injection through malformed .hgsub subrepository URLs and paths given to hg clone and hg share; it affects all versions, Windows included, and Mercurial cites hg log --patch as needing no checkout. Mercurial says the flaws can be combined for arbitrary code execution on clients and remote code execution on servers. None of 001 to 004 has a CVE ID on Mercurial's security page, and no source states exploitation. Upgrade to 7.2.6 or your distribution's patched package; there are no new releases for older series, but backports are available to distributions on request.
What to do
- Upgrade Mercurial to 7.2.6, or to your distribution's patched package, on clients and servers
- If your series has no 7.2.6 build, apply the distribution's backported patches
- Limit clone, pull, unbundle, patch, share and archive operations to fully trusted sources until patched
- Audit servers that accept pushes from untrusted users and review their logs
- Avoid running hg archive, hg cat, hg export or hg log --patch on untrusted revisions
Fixed versions
Sources
All live incidents on Threat Watch