Mercurial 7.2.6 fixes four chained flaws enabling client and server code execution (HG-SA-2026-001 to 004)
The Mercurial project released Mercurial 7.2.6 as a "critical security release" fixing four chained flaws, HG-SA-2026-001 to HG-SA-2026-004. They allow code execution on clients and remote code execution on servers. No credentials are needed, but the victim must clone, pull or unbundle attacker-crafted data (a repository, bundle or clone bundle), or an attacker must be able to push to a server. The article reports no exploitation in the wild and no CVE IDs; Debian tracks the flaws under temporary IDs. This record is based on the article alone, because no web research was run, so the project's own advisory was not checked.
Entenda a falha
A vulnerabilidade
Mercurial 7.2.6 fixes four chained flaws, HG-SA-2026-001 to 004, with no CVE IDs assigned (Debian uses temporary IDs). They allow code execution on clients and remote code execution on servers. No credentials are needed, but the victim must clone, pull or unbundle attacker-crafted data (a repository, bundle or clone bundle), or the attacker must be able to push to a server. 001 (all versions): changesets with .hg/ paths or symlink writes allow configuration injection or writes outside the working copy. 004 (all versions, including Windows): line breaks in .hgsub URLs inject configuration. 003 (2.6 to 7.2.5): a race in symlink checks. 002 (7.1 to 7.2.5): a crafted bundle poisons a cache. Fixed in 7.2.6.
Como funciona
The victim, or a server, receives attacker-crafted data such as a repository, bundle, clone bundle or pushed changeset. Mercurial processes it by writing files into the working copy, reading a cache, checking symlinks during parallel updates, or parsing .hgsub subrepository URLs. The flaw appears at that step: paths into .hg/ or through symlinks get written, a poisoned cache is trusted, a race lets a write pass through a symlink, or line breaks in a URL add configuration. Injected configuration can then lead to code execution, even from read-only commands such as hg archive, hg cat, hg diff or hg log --patch. Unpatched servers may also relay malicious data to their users.
Por que é vulnerável
The articles describe the causes only briefly: missing validation of data coming from repositories, bundles and changesets. Specifically, .hg/ paths and symlink writes are not blocked (001), cached content from a bundle is used without validation (002), symlink checks are subject to a race during parallel updates (003), and line breaks in .hgsub URLs are not handled, allowing configuration injection (004). The articles do not detail the code-level fix, but after upgrading Mercurial reports the error 'path contains illegal component: .hg/' when it meets a malicious changeset.
Como foi descoberta
The issues were reported by Taylor Campbell (NetBSD), Pierre-Yves David (Mercurial), Thomas Chauchefoin (Trail of Bits) and Ozgun Kultekin (WakeField). The Mercurial project disclosed them in the 7.2.6 release announcement, calling it a critical security release. The articles say nothing about how the flaws were found. No exploitation in the wild has been reported.
Explicação gerada por IA a partir da matéria e dos artigos, em 04/12/2026 10:19.
Detalhes técnicos
- HG-SA-2026-001 (all versions): changesets with
.hg/paths or symlink writes allow configuration injection or writes outside the working copy. - HG-SA-2026-002 (7.1 to 7.2.5): a crafted bundle poisons a cache, so Mercurial uses unvalidated content.
- HG-SA-2026-003 (2.6 to 7.2.5): a race in symlink checks during parallel updates lets a malicious changeset write through a symlink.
- HG-SA-2026-004 (all versions, including Windows): line breaks in
.hgsubURLs inject configuration, even throughhg log --patch. - Read-only commands such as
hg archive,hg catandhg diffcan also expose users. - Unpatched servers may relay malicious data to their users.
- Reporters: Taylor Campbell (NetBSD), Pierre-Yves David (Mercurial), Thomas Chauchefoin (Trail of Bits) and Ozgun Kultekin (WakeField).
Remediação
- Upgrade to Mercurial 7.2.6 or your distribution's patched package. Older series get no new releases, but distributions can request backports. Debian has already fixed its trixie package.
- Turn off
web.archivesubreposon servers, even after upgrading. - Do not run
hginside archives of untrusted repositories made before 7.2.6. - Apply untrusted patches with
hg import, notpatch. - After upgrading, treat the error "path contains illegal component: .hg/" as a sign that a repository already holds a malicious changeset, and review that repository.
Linha do tempo
-
Mercurial 7.2.6 fixes four chained flaws enabling client and server code execution (HG-SA-2026-001 to 004)
ler a análise desta fonte ocultar
The Mercurial project released Mercurial 7.2.6 as a "critical security release" fixing four chained flaws, HG-SA-2026-001 to HG-SA-2026-004. They allow code execution on clients and remote code execution on servers. No credentials are needed, but the victim must clone, pull or unbundle attacker-crafted data (a repository, bundle or clone bundle), or an attacker must be able to push to a server. The article reports no exploitation in the wild and no CVE IDs; Debian tracks the flaws under temporary IDs. This record is based on the article alone, because no web research was run, so the project's own advisory was not checked.
Technical Details
- HG-SA-2026-001 (all versions): changesets with
.hg/paths or symlink writes allow configuration injection or writes outside the working copy. - HG-SA-2026-002 (7.1 to 7.2.5): a crafted bundle poisons a cache, so Mercurial uses unvalidated content.
- HG-SA-2026-003 (2.6 to 7.2.5): a race in symlink checks during parallel updates lets a malicious changeset write through a symlink.
- HG-SA-2026-004 (all versions, including Windows): line breaks in
.hgsubURLs inject configuration, even throughhg log --patch. - Read-only commands such as
hg archive,hg catandhg diffcan also expose users. - Unpatched servers may relay malicious data to their users.
- Reporters: Taylor Campbell (NetBSD), Pierre-Yves David (Mercurial), Thomas Chauchefoin (Trail of Bits) and Ozgun Kultekin (WakeField).
Remediation
- Upgrade to Mercurial 7.2.6 or your distribution's patched package. Older series get no new releases, but distributions can request backports. Debian has already fixed its trixie package.
- Turn off
web.archivesubreposon servers, even after upgrading. - Do not run
hginside archives of untrusted repositories made before 7.2.6. - Apply untrusted patches with
hg import, notpatch. - After upgrading, treat the error "path contains illegal component: .hg/" as a sign that a repository already holds a malicious changeset, and review that repository.
- HG-SA-2026-001 (all versions): changesets with