Mercurial has released version 7.2.6 to fix four vulnerabilities that attackers could chain into code execution on client machines and remote code execution on hosting servers. The project calls it a critical security release and tells all users to upgrade immediately.
The 7.2.6 release notes are dated December 3, 2026. No CVE IDs have been assigned, and neither the advisories nor the release notes mention attacks in the wild.

How an attack works
An attacker needs no credentials. The victim only has to clone, pull or unbundle a repository, bundle or clone bundle that the attacker crafted.
Everyday commands also open the door. hg archive, hg cat --output, hg export and hg diff can trigger the bugs when run on a malicious revision.
Servers are exposed when untrusted users can push to them, and an unpatched server can pass poisoned data on to every user who clones from it. Attackers already use public repositories to deliver malware; one recent campaign pushed MopsStealer through fake Claude Code skills on GitHub.
Two of the four flaws reach every Mercurial version, so every release before 7.2.6 carries at least two of them.
The four advisories
Each issue has an entry on the project’s security advisories page.
HG-SA-2026-001: code execution via archive and other commands
Changesets that hold .hg/ paths, or that write through symlinks, could be exported and exchanged. That allowed configuration injection or file writes outside the working copy.
All versions are affected. Taylor Campbell of the NetBSD project reported it.
HG-SA-2026-002: integrity check bypass through cache poisoning
A bug introduced in 7.1 let a crafted bundle poison an in-memory cache, so Mercurial used content it had never validated, for example during hg clone or hg pull -u. Versions 7.1 through 7.2.5 are affected. Pierre-Yves David of the Mercurial project found it.
HG-SA-2026-003: symlink write during parallel update
A race in symlink auditing across parallel workers let a malicious changeset write through a symlink, and the project says it could be exploited reliably.
It affects 2.6 through 7.2.5. Thomas Chauchefoin of Trail of Bits reported it. Version 7.2.6 now creates symlinks in several independent batches.
HG-SA-2026-004: config injection through a malformed .hgsub
Line breaks in subrepository URLs inside .hgsub could inject configuration into secondary repositories. A plain hg log --patch was enough to set it off, with no checkout needed.
The fix also covers a clone or share vector that uses a malicious local or default path. Every version is affected, and the attack works fully on Windows. Özgün Kültekin of WakeField reported it.
What to do now
Upgrade to 7.2.6 or to a patched distribution package. Older series will get no new upstream releases, but distributions can ask for backported patches.
Debian lists all four issues under temporary IDs in its mercurial package tracker. Trixie and sid are fixed. Forky still shows all four open and bookworm three.
Server operators should turn off web.archivesubrepos even after upgrading and leave it off until a later, narrower security release, the 7.2.6 announcement says. CI and build servers that clone code with no human review face similar exposure; build pipelines were also the target in a recent TeamCity flaw that let attackers hijack build agents.
Upgrading does not clean up archives of untrusted repositories made before 7.2.6, so hg should not be run inside them. Patches from untrusted changesets belong in hg import, not GNU patch.
After the upgrade, an abort reading path contains illegal component: .hg/ means the repository already holds a malicious changeset accepted earlier. Any repository that triggers it needs review.
Workarounds before patching
Teams that cannot upgrade yet have settings for each flaw. For 001, avoid hg archive and hg cat --output on untrusted revisions, and disable web.allow-archive on servers that untrusted users can push to.
For 002, set storage.revlog.validate-delta-base = yes, run hg pull and hg update as separate commands, and consider ui.clonebundles = no.
For 003, set experimental.merge.checkpathconflicts = yes and turn off parallel updates with worker.enabled = no.
For 004, set subrepos.hg:allowed = no and check that scripts never pass paths containing line breaks to hg clone or hg share.