GHSA-jm78-9fvv-mhgr: High severity pip/GitPython vulnerability

Published Aug 7, 2026
·
Updated

Summary GitPython's config-name validator only neutralizes CR/LF/NUL for the "option" label; it does not reject =, #, ;, [, ], or whitespace in an option name. writesection writes the option name verbatim into the config file, so an option name such as sshCommand = touch <cmd> # is written as \tsshCommand = touch <cmd> # = <value>, which git parses as core.sshCommand = touch <cmd> (the trailing # comments out the intended value). This forges arbitrary config directives (core.sshCommand, core.hooksPath, alias.) → RCE on the next git operation. This is a distinct field (option name, not section name) and distinct character class (=/#/space, not newline/bracket) from GHSA-3rp5-jjmw-4wv2 (section-name bracket injection) and GHSA-mv93-w799-cj2w / GHSA-v87r-6q3f-2j67 (newline injection).

Root Cause assureconfignamesafe(name, label) (git/config.py:897) applies the bracket/quote state machine ONLY when label == "section"; for the "option" label it falls through with just the UNSAFECONFIGCHARSRE = [\r\n\x00] regex. writesection then writes the option name verbatim into "\t%s = %s\n" (config.py:702).

Impact Arbitrary git-config directive injection → remote code execution via core.sshCommand (fires on any ssh git operation, no staged file needed) or core.hooksPath (with a staged hook). Requires the embedding application to forward a caller-influenced OPTION NAME into the config writer (name-control model, the same name-control model accepted by the related published advisories GHSA-3rp5-jjmw-4wv2 and GHSA-mv93-w799-cj2w). Default configuration.

Proof of Concept python with repo.configwriter() as cw: cw.setvalue("core", "sshCommand = touch /tmp/RCE #", "x") git config --get core.sshCommand -> touch /tmp/RCE

Attack Chain 1. Entry: app calls config writer with attacker-controlled OPTION name: setvalue("core", "sshCommand = touch /tmp/RCE #", "x"). 2. Check: assureconfignamesafe(option, "option") @ config.py. Guard: regex matches only [\r\n\x00]; bracket/quote state machine is gated on label=="section". Bypass proof: =,#,space pass → no ValueError. 3. Sink: writesection writes "\tsshCommand = touch /tmp/RCE # = x\n" (config.py:702). 4. Impact: git parses core.sshCommand=touch /tmp/RCE → arbitrary code execution on next git op.

Bypass Evidence Independently reproduced (gate harness): setvalue('core','sshCommand = touch <RCE> #','x') → no ValueError; file line sshCommand = touch <RCE> # = x; git config --get core.sshCommand → touch <RCE> (rc=0). Also verified core.hooksPath via both GitConfigParser and repo.configwriter(). Fix-commit read: bracket/quote checks are inside if label == "section"; the "option" label is not covered.

Affected Versions GitPython <= 3.1.57 (validator present verbatim on the latest release tag).

Suggested Fix Apply the section-name safety checks (reject =, #, ;, [, ], whitespace) to the "option" label as well, or validate the fully-rendered config line after substitution.

--- Reported by zx (Jace) — GitHub: @manus-use

Affected Software

1 affected componentFixes available
pip/GitPython<=3.1.57
3.1.58

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/GitPython to a version that resolves this vulnerability.

    Fixed in 3.1.58
  2. Configuration

    Update GitPython’s config writer validation so that `_assure_config_name_safe(..., "option")` applies the same safety checks described for section names (reject `=`, `#`, `;`, `[`, `]`, and whitespace) to the option name as well, or alternatively validates the fully-rendered config line after substitution to prevent directive injection into lines written by `write_section`.

    GitPython (config.py) config name validation _assure_config_name_safe(name, label) safety checks = Apply section-name safety checks (reject `=`, `#`, `;`, `[`, `]`, whitespace) to the "option" label as well, or validate the fully-rendered config line after substitution.

Event History

Aug 7, 2026
Advisory Published
via GitHub·03:46 PM
Data Sourced
via GitHub·03:46 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of GHSA-jm78-9fvv-mhgr?

The severity of GHSA-jm78-9fvv-mhgr is high, with a CVSS score of 8.8.

2

How do I fix GHSA-jm78-9fvv-mhgr?

To fix GHSA-jm78-9fvv-mhgr, update GitPython to the latest version where this vulnerability has been addressed.

3

What is the risk associated with GHSA-jm78-9fvv-mhgr?

GHSA-jm78-9fvv-mhgr presents a risk level of 79, indicating a high potential for exploitation.

4

What types of input are not sanitized in GHSA-jm78-9fvv-mhgr?

GHSA-jm78-9fvv-mhgr does not sanitize input characters such as '=', '#', ';', '[', ']', or whitespace in option names.

5

Which software is affected by GHSA-jm78-9fvv-mhgr?

GHSA-jm78-9fvv-mhgr affects the GitPython library used in Python packages installed via pip.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203