Skip to content
Medium 5.3

isomorphic-git: Path traversal via a ".." tree-entry name writes files outside the working directory on clone/checkout

CVE-2026-63478 First seen on SecPulse

Affected packages

PackageAffected → Fixed
isomorphic-gitisomorphic-git —
npmisomorphic-git
< 1.38.6→ 1.38.6
Original description The description as published by the source.

Summary

isomorphic-git's tree parser (src/models/GitTree.js) validates each entry name only against the path separators / and \. It does not reject the standalone reserved name .., so a malicious repository can, on a single clone/checkout, write files outside the working
directory
(unbounded depth). Works on any host-backed fs provider.

Details

The guard is:

// src/models/GitTree.js
if (path.includes('\\') || path.includes('/')) {
  throw new UnsafeFilepathError(path)
}

The standalone string .. passes. isomorphic-git assembles the full path incrementally across tree levels, so nesting .. trees yields ../escaped.txt, ../../escaped.txt, … with unbounded depth (each level is a separate tree object that passes the per-entry guard). On checkout mkdir(workdir/..) hits EEXIST (ignored) and the file is written above the working directory. Depth is chosen to reach the home dir, /etc, /tmp, etc.; overwriting a shell rc / config / startup file can escalate to code execution.

Canonical git behavior (divergence)

git rejects this via verify_path(): git read-tree fails with error: invalid path '../escaped.txt' and git fsck flags warning … hasDotdot: contains '..'. (git's verify_path also rejects . and .git, the latter flagged by fsck as hasDotgit — see the fix note below.) GitHub runs fsck on push, so such a tree can't be hosted there; reach is limited to a self-hosted/Smart-HTTP remote or a MitM.

PoC

`https…

Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details