Vulnérabilité dans GitPython (CVE-2026-76218)
Résumé
Vulnérabilité dans GitPython (CVE-2026-76218). L'exploitation peut entraîner la prise de contrôle totale du système. Exploitable via allow_unsafe_options. Atténuation : mise à jour vers 3.1.58 ou plus.
Description d'origine
La description telle que publiée par la source (souvent en anglais).
Summary
Repo.init() forwards **kwargs verbatim to git init with no unsafe-option guard and no allow_unsafe_options parameter. git init --template= copies /hooks/* into the new repo's .git/hooks, so an attacker-controlled template kwarg plants a hook that executes on the next git operation → arbitrary code execution. --template is already recognized as unsafe for clone (it is on unsafe_git_clone_options, and GHSA-6p8h-3wgx-97gf covers the clone path), but Repo.init is a distinct method that never received a guard and needs an independent fix.
Root Cause
Repo.init(path, mkdir, odbt, expand_vars, **kwargs) is a bare git.init(**kwargs) (git/repo/base.py:1435) with no check_unsafe_options and no allow_unsafe_options.
Impact
Arbitrary code execution (hook fires on next git op) at the privileges of the host process. Two preconditions raise attack complexity (AC:H): the app must forward a template= kwarg (KEY control) AND the attacker must stage an executable hook directory at a known path — the same profile GHSA-6p8h-3wgx-97gf accepted as HIGH for the clone path. Default allow_unsafe_options is irrelevant here because Repo.init has no guard at all.
Proof of Concept
# attacker stages /evil/hooks/post-commit (executable)
from git import Repo
Repo.init(path, template="/evil")
# next commit runs /evil/hooks/post-commit -> ACE
Attack Chain
- Entry: attacker stages
/evil/hooks/post-commit(executable) and gets the app…
Source: NIST National Vulnerability Database NVD GitHub Advisory
Résumé généré automatiquement
Assemblé par SecPulse à partir des données sources (CVSS, CWE, versions affectées) à l'aide de modèles, sans IA. Vérifiez la description d'origine et les références ci-dessous.
Une vulnérabilité référencée CVE-2026-76218 a été découverte dans GitPython.
Des attaquants peuvent cibler un point d'entrée spécifique comme allow_unsafe_options à distance pour détourner le produit.
L'exploitation peut entraîner la prise de contrôle totale du système. Score CVSS : 7.5/10.
Action : mettez à jour GitPython vers 3.1.58 ou supérieur.
En cas de doute, contactez votre service informatique ou cherchez « GitPython CVE-2026-76218 » sur le site de l'éditeur.
CVE-2026-76218 (GitPython) — CWE-88 / CVSS v3 7.5
Vecteur d'attaque : distant (réseau) / sans interaction utilisateur
Surface d'attaque : allow_unsafe_options / template / unsafe_git_clone_options / Repo.init
Correctif : 3.1.58 — appliquer immédiatement
Plan : 1) Audit SBOM, 2) Mise à jour staging→prod, 3) Surveillance WAF/proxy sur les endpoints affectés, 4) Recherche d'IOC dans les logs.
Réfs : voir GHSA / avis éditeur / version corrigée liés sur cette page.
Une vulnérabilité (CWE-88) affecte GitPython. Les attaquants atteignent le code vulnérable via allow_unsafe_options.
Consultez l'avis de l'éditeur pour les versions affectées de GitPython. Surface d'attaque : allow_unsafe_options / template / unsafe_git_clone_options / Repo.init.
Gravité : Élevée (CVSS 7.5/10). L'exploitation peut entraîner la prise de contrôle totale du système.
Mettre à jour vers 3.1.58.
En attendant le correctif : désactivez la fonctionnalité concernée, appliquez des règles WAF, ou restreignez l'accès par ACL réseau.
Recherchez dans les logs des requêtes correspondant aux IOC connus de cette CVE. Auditez les SBOM/dépendances.
Actions de réponse
Étapes concrètes et exemples de commandes que les équipes SOC/SRE doivent exécuter dans l'ordre
-
1Identify exposure identify
grep -r 'GitPython' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
GitPythonを grep し、稼働しているサービス・バージョンを把握する。 -
2Apply patch patch
Upgrade GitPython to 3.1.58ステージング環境で 3.1.58 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。
-
3Post-deployment verification verify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Paquets affectés
Références
- web github.com
- web vulncheck.com
- web nvd.nist.gov
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com