isomorphic-gitにシンボリックリンクを使った任意のファイル書き込みの脆弱性、1.38.6で修正
Summary
悪意のあるリポジトリを使うと、チェックアウト時に作業ツリーの外へファイルを書き込まれ、ホストのファイル改ざんや任意のコード実行につながるおそれがあります。影響するのは1.38.6より前のisomorphic-gitで、修正版は1.38.6です。Node.jsのfsをLinuxやmacOSで使う環境では特に注意が必要です。
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
悪意のあるリポジトリを使うと、チェックアウト時に作業ツリーの外へファイルを書き込まれ、ホストのファイル改ざんや任意のコード実行につながるおそれがあります。影響するのは1.38.6より前のisomorphic-gitで、修正版は1.38.6です。Node.jsのfsをLinuxやmacOSで使う環境では特に注意が必要です。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| isomorphic-gitisomorphic-git | — | Not listed |
| npmisomorphic-git |
< 1.38.6→ 1.38.6 |
1.38.6 |
Original description The description as published by the source.
Summary
git.checkout writes working-tree files through a directory symlink without checking the leading path, so a malicious repository can write outside the intended working directory. The defect is in isomorphic-git's checkout logic itself and is therefore independent of the fs provider. The impact depends on the configured filesystem; worst case is arbitrary file write on the host, e.g. injecting an attacker key into ~/.ssh/authorized_keys → remote login / code execution.
Details
A single git tree can't hold a name as both a symlink and a directory, so the attack uses two states:
Commit N: config (mode 120000, symlink → ../.ssh)
Commit N+1: config/ (mode 040000, tree)
authorized_keys (mode 100644, attacker public key)
Checking out commit N writes config as a directory symlink. Checking out commit N+1 sees config/authorized_keys as a new path: isomorphic-git mkdirs the parent (config, already a symlink → EEXIST, ignored) then writeFiles the file, which the OS resolves through the symlink to outside the working directory. A file-level symlink swap is caught (the 120000→100644 mode change triggers an rm), but the directory-level variant is not — the payload is always a new child path, a plain create, so the parent symlink is never removed.
The symlink target is attacker-chosen. Besides ~/.ssh, pointing it at the repo's own control directory — hooks → .git/hooks then `…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- advisory nvd.nist.gov
- package github.com
- REDHAT Red Hat
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com