Published Jul 24, 2026HIGHCWE-74PythonAI-written code was flawedIncomplete remediation
How AI contributed
Incomplete remediation
AI tried to fix this, but did not reject an unquoted closing bracket in a section name.
In GitPython <= 3.1.52, the config writer neutralizes only CR, LF, and NUL in configuration names, but writes section names into the [...] header with no other escaping. A section/subsection name that contains ] [ " closes the intended header and opens a second same-line section, injecting an arbitrary config directive — with no newline required. Because a submodule name is attacker-controlled data (it comes from a repository's .gitmodules, or from an application that lets a user name a submo...
Only the highlighted steps are this advisory. The first card is the earlier flaw the AI tried, and failed, to close.
Original flaw
Earlier advisory · CVE-2026-42215
A malicious Git config section name could inject newline-delimited configuration after value-only validation.
--- a/git/config.py+++ b/git/config.py@@ -897,6 +897,22 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder): def _assure_config_name_safe(self, name: "cp._SectionName", label: str) -> None: if isinstance(name, str) and UNSAFE_CONFIG_CHARS_RE.search(name): raise ValueError("Git config %s names must not contain CR, LF, or NUL" % label)+ if label == "section" and isinstance(name, str):+ in_quotes = False+ escaped = False+ for index, char in enumerate(name):+ if escaped:+ escaped = False+ elif in_quotes and char == "\\":+ escaped = True+ elif char == '"':+ if not in_quotes and (index == 0 or name[index - 1] not in " \t"):+ raise ValueError("Git config quoted subsection names must begin after whitespace")+ in_quotes = not in_quotes+ elif char == "]" and not in_quotes:+ raise ValueError("Git config section names must not contain an unquoted closing bracket")+ if in_quotes:+ raise ValueError("Git config section names must not contain an unterminated quote") @needs_values @set_dirty_and_flush_changes