# isomorphic-git: Arbitrary file write outside of working tree via directory symlink during checkout (potential RCE)

isomorphic-git checkout follows a directory symlink planted in commit N, so commit N+1's child file writes outside the working tree, enabling SSH key injection and RCE.

- Payout: Research
- Severity: high
- Program: isomorphic-git
- Found by: spiceoverflow
- Disclosed: 2026-11-09
- CVE: CVE-2026-63395
- Write-up quality: 8/10
- Original: https://github.com/advisories/GHSA-9qw7-j9xw-fv9c
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-9qw7-j9xw-fv9c
- Tags: area:oss domain:oss impact:integrity impact:rce kind:research platform:ghsa sev:high tech:nodejs technique:chained technique:source-review vuln:path-traversal vuln:rce

**Target:** git checkout logic in the isomorphic-git npm library (any fs provider)
**Root cause:** checkout mkdirs the parent of a new path and ignores EEXIST when that parent is an attacker-planted directory symlink, then writeFile resolves through the symlink; no has_symlink_leading_path equivalent check. File-level symlink swaps are caught by the 120000→100644 mode-change rm, directory-level ones are not.
**Steps:**
1. Commit N: add `config` as mode 120000 symlink → `../.ssh`
2. Commit N+1: replace with tree `config/` (mode 040000) containing `authorized_keys` (mode 100644, attacker public key)
3. Victim clones commit N (symlink written to disk), then pulls commit N+1
4. checkout mkdirs `config` (EEXIST ignored) and writeFile `config/authorized_keys`, resolved through symlink to `~/.ssh/authorized_keys`
5. Attacker logs in with matching private key
**How found:** Reasoned that a single tree can't hold a name as both symlink and directory, so split across two commits; noticed file-level symlink swap is caught by mode-change rm but a new child path under a directory symlink is a plain create that never removes the parent symlink. Compared against git's has_symlink_leading_path hardening from CVE-2021-21300/CVE-2024-32002.
**Exploitation:** Malicious repo served to victim; clone+pull (or single clone if app reads/writes into tree) plants directory symlink then writes child file through it. Target `~/.ssh` for key injection, or `hooks → .git/hooks` / `x → .git` to overwrite `.git/config` (core.hooksPath, alias, core.fsmonitor) for RCE on next native git command without needing ~/.ssh.
**Escalation:** Chose `.git/` targets (hooks, config) so exploitation works in a fresh clone regardless of whether ~/.ssh exists; impact scales with fs provider (Node fs on POSIX = host arbitrary write).
**Insight:** When auditing checkout/extract logic, test symlink-to-directory transitions across commits: a new child path under an existing symlinked parent is a create, not a replace, so mode-change guards never fire. Also target `.git/` itself (hooks, config) rather than home-dir paths for reliable RCE in fresh clones.

## Proof of concept (copied exactly from the original report)

**Malicious two-commit tree layout for symlink escape**

```
Commit N:    config            (mode 120000, symlink → ../.ssh)
Commit N+1:  config/           (mode 040000, tree)
               authorized_keys (mode 100644, attacker public key)
```

