Safeguard
Vulnerability Analysis•

CVE-2026-67326: High Config Injection in GitPython config_writer

GitPython up to 3.1.49 does not validate newlines in the config_writer section argument, which can lead to code execution via hooks. Upgrade to 3.1.50.

Safeguard Security Team
4 min read

CVE-2026-67326 is a high severity (CVSS 7.0) input validation flaw in GitPython. Versions up to 3.1.49 do not check newlines in the section argument of config_writer, so an attacker who controls it can inject config sections. Upgrade to GitPython 3.1.50 or later.

What's affected

The record says GitPython before 3.1.50 is affected. The GitHub advisory (GHSA-mv93-w799-cj2w) lists affected versions as 3.1.49 and earlier and the patched version as 3.1.50. The two sources agree, and both rate it High.

The advisory frames this as a bypass of the fix for an earlier CVE (CVE-2026-42215). That earlier patch, shipped in 3.1.49, validated newlines in the value argument of set_value, but the section and option arguments still went to the config parser unchecked.

The weakness only matters if untrusted data can reach the section argument of config_writer. That is an application design question, not a flaw in every program that imports GitPython.

How to check if you're exposed

pip show gitpython
pip freeze | grep -i gitpython

Run these inside each virtual environment and container image you ship, because the system Python and the application environment are often different.

Then check how your code calls the config writer:

grep -rn "config_writer" .

For each call, trace where the section name comes from. A constant in your source is fine. A value taken from a repository name, a request, a file or a user form is the case to fix. Check CI runners and build tools too, since GitPython often sits inside tooling that handles repositories you do not own.

A quicker route for a whole project is the free in-browser dependency scan at Gold. Paste a manifest or lockfile and it matches each dependency against known CVEs, including ones pulled in indirectly.

What to do now

  1. Upgrade GitPython to 3.1.50 or later. Later releases also close a related issue, see the 3.1.53 note below.
  2. Audit every call to config_writer and note where its section argument comes from.
  3. Reject newlines and other control characters in any value you pass as a config section or option name.
  4. Make sure tooling that runs git hooks on cloned repositories runs in a sandbox with limited permissions.
  5. Do not stop at 3.1.50. A separate section name injection, CVE-2026-69097, is fixed in 3.1.53.

Reachability analysis helps with ordering the work. Knowing whether your code actually calls the affected path tells you which services to patch first.

Why it matters

The class is CWE-20, improper input validation. The record describes how the injected text could create a forged core section pointing the hooks path at a directory the attacker controls, so that git runs attacker-chosen scripts the next time a hook fires. That turns a file write into code execution.

The pattern is common. A previous fix checked one parameter, and the same hole stayed open on the neighbouring ones. When a patch covers one argument of a function, check the others. The record does not mark this CVE as known exploited.

Try it yourself

GitPython is often a transitive dependency of build and automation tools. This demo shows how an inventory surfaces where it sits.

Click through it at your own pace, or open it full screen.

Quick check

Does every GitPython user have to worry?

Only code that lets untrusted input reach the section argument of config_writer is exposed, but upgrading is cheap and the version range is clear.

Is 3.1.50 the last fix I need?

No. CVE-2026-69097 is fixed in 3.1.53, so aim for that or later.

Sources

Last reviewed: 18 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.