GHSA-m64x-33q8-m5h7: Pip/gitpython vulnerability

Published Oct 27, 2026
·
Updated

Summary

This is a residual of GHSA-g5vv-9gxw-82hx / CVE-2026-87819. The 3.1.60 fix made Actor.fromstring regex-free, but parseactoranddate still runs reactorepoch on the same author/committer/tagger line one step earlier. That pattern backtracks quadratically when the trailing epoch or timezone is missing or malformed, so the same class of slow parse is still reachable in 3.1.62.

Details

git/objects/util.py:322:

python reactorepoch = re.compile(r"^.+? (.) (\d+) ([+-]\d+).$")

.+? and (.) can both absorb the same run of spaces, and the required (\d+) ([+-]\d+) tail is only checked after them. On a long line with no valid tail, the search retries every split point.

It is called from parseactoranddate (git/objects/util.py:335), which runs on the author and committer lines in Commit.deserialize (git/objects/commit.py:917, :931) and on the tagger line in git/objects/tag.py:129.

The published payload (letters plus an unterminated <) is fast on 3.1.62. Replacing the letters with spaces is not:

| author line (after author ) | 2 KB | 8 KB | 32 KB | |---|---|---|---| | 'a'n + ' <' (advisory payload) | 0.0 ms | 0.1 ms | 0.4 ms | | ' 'n | 28 ms | 453 ms | 7,700 ms | | valid line, long name (control) | 0.0 ms | 0.0 ms | 0.0 ms |

Cost grows about 16x for each 4x increase in length.

PoC

python import time from git.objects.util import parseactoranddate

line = "author " + " " 32000 t = time.perfcounter() parseactoranddate(line) print(f"{time.perfcounter() - t:.1f} s") # ~7 s on 3.1.62

End to end, reading Commit.author on a commit object whose author line is 32 KB of spaces followed by any malformed tail (no epoch, no timezone, non-numeric epoch, or bad timezone) takes about 7.2 s per access. The same line with a valid 1191999972 -0700 tail takes 1.3 ms.

Note for reproducing: git hash-object -t commit -w refuses such an object (missingEmail), so the test object was written with --literally. A remote can still serve one, because fetch.fsckObjects and transfer.fsckObjects default to false. This is the same delivery model as CVE-2026-87819 ("craft a commit object with a malformed author field").

Impact

CPU exhaustion (CWE-1333) in any application that uses GitPython to read commits or tags from an untrusted repository: CI tooling, repository scanners, code-hosting integrations. Each access to Commit.author, Commit.committer or TagObject.tagger on a crafted object costs seconds, and a repository can contain many such objects.

Suggested fix

Match the leading field name with .[^ ] instead of .+?. Both stop at the first space after the first character, but .[^ ] cannot overlap the following (.), so the backtracking disappears:

python reactorepoch = re.compile(r"^.[^ ] (.) (\d+) ([+-]\d+).$") reonlyactor = re.compile(r"^.[^ ] (.)$")

Verification on current main (73a72c9):

- Differential over 368 actor lines (real-world shapes plus edge cases): 0 differences in match groups for either regex. - ' 'n at 64 KB: 32,170 ms before, 0.98 ms after. Valid lines are unchanged (0.01 ms). - The existing test suite gives the same pass/fail set with and without the change - The new regression test, testparseactoranddatemalformedlineislinear, fails on the old pattern (8.4 s) and passes with the fix (0.5 s).

The full patch (fix plus regression test) is attached below.

diff diff --git a/git/objects/util.py b/git/objects/util.py index a68d701f..d8c0594d 100644 --- a/git/objects/util.py +++ b/git/objects/util.py @@ -319,8 +319,11 @@ def parsedate(stringdate: Union[str, datetime]) -> Tuple[int, int]: # Precompiled regexes -reactorepoch = re.compile(r"^.+? (.) (\d+) ([+-]\d+).$") -reonlyactor = re.compile(r"^.+? (.)$") +# The leading field name ("author", "committer", "tagger") is matched with .[^ ] rather than +# .+?: both stop at the first space after the first character, but .[^ ] cannot overlap the +# following (.), so a line with no valid trailing epoch/offset no longer backtracks quadratically. +reactorepoch = re.compile(r"^.[^ ] (.) (\d+) ([+-]\d+).$") +reonlyactor = re.compile(r"^.[^ ] (.)$") def parseactoranddate(line: str) -> Tuple[Actor, int, int]: diff --git a/test/testutil.py b/test/testutil.py index cf4299d5..e1631420 100644 --- a/test/testutil.py +++ b/test/testutil.py @@ -22,6 +22,7 @@ from git.cmd import dashify from git.objects.util import ( altztoutctzstr, fromtimestamp, + parseactoranddate, parsedate, tzoffset, utctztoaltz, @@ -571,6 +572,30 @@ class TestUtils(TestBase): Actor("name last another", "some-very-long-email@example.com"), ) + def testparseactoranddatemalformedlineislinear(self): + # A long author line whose trailing epoch/offset is missing or malformed used to make + # reactorepoch backtrack quadratically: ~7 s per Commit.author access for a 32 KB line. + # The parse result must be unchanged; only the time spent reaching it should move. + for tail in ("", " notanumber -0700", " 1191999972", " -0700", " 1191999972 xx"): + line = "author " + " " 32000 + tail + start = time.perfcounter() + actor, epoch, offset = parseactoranddate(line) + self.assertLess(time.perfcounter() - start, 1.0) + self.assertEqual(epoch, 0) + self.assertEqual(offset, 0) + + # Well-formed lines, including one with a long name, still parse exactly as before. + actor, epoch, offset = parseactoranddate( + "author Tom Preston-Werner <tom@mojombo.com> 1191999972 -0700" + ) + self.assertEqual(actor, Actor("Tom Preston-Werner", "tom@mojombo.com")) + self.assertEqual(epoch, 1191999972) + self.assertEqual(offset, 25200) + + actor, epoch, offset = parseactoranddate("author " + "a " 16000 + "<a@b> 1 -0700") + self.assertEqual(actor.email, "a@b") + self.assertEqual(epoch, 1) + @ddt.data( ("name", ""), ("name", "prefix"),

Found with AI assistance (Claude) and verified by hand.

Brian Willows

Affected Software

1 affected componentFixes available
pip/gitpython<=3.1.62
3.2.0

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.2.0
  2. Upgrade

    Upgrade GitPython to a version that resolves this vulnerability.

    Patch 73a72c9

Event History

Oct 27, 2026
Advisory Published
via GitHub·03:26 PM
Data Sourced
via GitHub·03:26 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

Which parsing paths can reach the expensive regular expression?

The expression is evaluated when GitPython deserializes commit author and committer lines, and when it parses a tagger line in an annotated tag. Workflows that parse commits or tags containing attacker-controlled or otherwise untrusted object data are therefore relevant.

2

What input characteristics are needed to trigger the slow parsing behavior?

The actor line must be long and lack a valid trailing epoch and timezone, or contain malformed values there. Long runs of spaces are significant because two parts of the expression can consume the same spaces; the published letters-plus-unterminated-"<" payload is reported as fast on 3.1.62.

3

Did the earlier 3.1.60 change fully remove this class of slow parse?

No. The 3.1.60 change made Actor._from_string regex-free, but parse_actor_and_date still applies _re_actor_epoch earlier while processing the same actor line. The residual path is stated to remain reachable in 3.1.62.

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