Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-105437 — PoC and lab for CVE-2026-105437, a 32-bit integer overflow in Git's xdiff three-way merge causing a heap buffer overflow via git merge-tree and conflict-marker-size. | Kitploit
Tools/GitHubGitHub/googlesky/cve-2026-105437
Code AnalysisExploitationFuzzingBinary ExploitationLabs & Practice
GitHubgooglesky/cve-2026-105437

CVE-2026-105437

PoC and lab for CVE-2026-105437, a 32-bit integer overflow in Git's xdiff three-way merge causing a heap buffer overflow via git merge-tree and conflict-marker-size.

View Repository
4 days agoNot yet reviewed
Share

CVE-2026-105437 — Git three-way merge heap buffer overflow

CVECVE-2026-105437
ComponentGit — three-way merge machinery, xdiff/xmerge.c (xdl_fill_merge_buffer())
AffectedGit ≤ 2.56.0 (and the 2.50 – 2.55 series)
Fixed inGit 2.56.1, and 2.50.2 / 2.51.3 / 2.52.1 / 2.53.1 / 2.54.1 / 2.55.1
CWECWE-190 (integer overflow) leading to CWE-787 (out-of-bounds write)
ImpactHeap buffer overflow (out-of-bounds write) while merging attacker-controlled content
Vectorgit merge-tree --write-tree, i.e. the mergeability check of a merge request
TriggerA committed .gitattributes carrying conflict-marker-size=<huge> plus a merge that produces many conflicts

Any user who can push a branch to a repository and open a merge request can crash the hosting service's merge machinery. Git computes the size of the merge output buffer in a 32-bit int; with enough conflicts and a large conflict-marker-size attribute the accumulator wraps around, malloc() returns a buffer that is far too small, and the merge result is written past the end of it.

GitLab, which assigned the CVE, named git merge-tree as the primary attack surface — a hosting server runs it to decide whether a merge request can be merged. A user only needs to commit a .gitattributes file and push a branch.

Beyond the overflow itself, this repository documents a defect in the mitigation GitLab published with the advisory: the info/attributes workaround does not work as written and leaves the service exposed.


1. Root cause

Before writing a merge result, Git computes how large the output buffer has to be. In xdiff/xmerge.c (Git 2.56.0):

static int fill_conflict_hunk(..., int size, ..., int marker_size)
{
	...
	if (!dest) {
		size += marker_size + 1 + needs_cr + marker1_size;   /* (1) */
	} else {
		memset(dest + size, '<', marker_size);
		size += marker_size;
		...
	}
	...
	if (!dest) {
		size += marker_size + 1 + needs_cr;                    /* (2) */
	} else {
		memset(dest + size, '=', marker_size);
		...
	}
	...
	if (!dest) {
		size += marker_size + 1 + needs_cr + marker2_size;     /* (3) */
	} else {
		memset(dest + size, '>', marker_size);
		...
	}
	return size;
}

static int xdl_fill_merge_buffer(..., int marker_size)
{
	int size, i;                        /* <-- 32-bit accumulator */
	for (size = i = 0; m; m = m->next) {
		...
		size = fill_conflict_hunk(..., size, ..., marker_size);
	}
	...
}

and allocates exactly that many bytes:

/* xdl_do_merge() */
int size = xdl_fill_merge_buffer(xe1, name1, xe2, name2,
                                 ancestor_name, favor, changes, NULL, style,
                                 marker_size);
result->ptr = xdl_malloc(size);
...
/* second pass: write into the buffer */
xdl_fill_merge_buffer(xe1, name1, xe2, name2, ancestor_name, favor, changes,
                      result->ptr, style, marker_size);

The accumulator is an int (32-bit), while the addends that matter are

  • the conflict marker text, marker_size bytes per marker, and
  • three markers per conflict hunk (<<<<<<<, =======, >>>>>>>).

marker_size comes from the conflict-marker-size git attribute, read straight out of the repository's .gitattributes (merge-ll.c:ll_merge_marker_size() → strtol_i() into an int, with no upper bound other than INT_MAX).

With N conflict hunks and a marker size M the total is roughly 3 * N * M bytes. Once that exceeds INT_MAX the accumulator wraps:

  • if it wraps negative → malloc() receives a huge size_t, the allocation fails and Git reports a spurious out-of-memory error;
  • if it wraps back to a small positive value → malloc() succeeds with a buffer that is far too small, and the writing pass walks past the end of the allocation → heap buffer overflow.

The upstream fix (Git 2.56.1) converts the accumulator and all addends to size_t and uses checked arithmetic (st_add(), st_add5()):

288266c11d91  xdiff: use size_t for merge buffer size computations
b1313872cefe  xdiff: check for overflow when computing merge buffer size
0dc3b5c0224b  git-compat-util: add st_add5() helper to detect size_t overflow

Proof (AddressSanitizer build of Git 2.56.0)

==1386014==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7b85df1fe9fb
WRITE of size 3495254 at 0x7b85df1fe9fb thread T0
    #0 memset
    #1 fill_conflict_hunk            xdiff/xmerge.c:269
    #2 xdl_fill_merge_buffer         xdiff/xmerge.c:297
    #3 xdl_do_merge                  xdiff/xmerge.c:671
    #4 xdl_merge                     xdiff/xmerge.c:726
    #5 ll_xdl_merge                  merge-ll.c:144
    #6 ll_merge                      merge-ll.c:448
    #7 merge_3way                    merge-ort.c:2161
    #8 handle_content_merge          merge-ort.c:2260
    #9 process_entry                 merge-ort.c:4345
   #10 process_entries               merge-ort.c:4566
   #11 merge_ort_nonrecursive_internal  merge-ort.c:5288
   #12 merge_ort_internal            merge-ort.c:5390
   #13 merge_incore_recursive        merge-ort.c:5449
   #14 real_merge                    builtin/merge-tree.c:490
   #15 cmd_merge_tree                builtin/merge-tree.c:696
0x7b85df1fe9fb is located 0 bytes to the right of 109108118-byte region
SUMMARY: AddressSanitizer: heap-buffer-overflow xdiff/xmerge.c:269 in fill_conflict_hunk

2. Attack surface

GitLab's advisory names git merge-tree as the primary vector:

"GitLab, which assigned CVE-2026-105437, said code-hosting servers are most likely to be targeted through git merge-tree. A server may run that command to check whether a pull or merge request can be merged."

and:

"The conflict-marker-size attribute can be set in a .gitattributes file committed to a repository. If a server reads attributes from the repository, any user who can push branches and open a pull or merge request can trigger the flaw."

The flow:

 attacker (any user who can push)            hosting service (Gitaly)
 ─────────────────────────────────────────    ────────────────────────────────
 1. commit .gitattributes:                    4. merge request opened /
      big.txt conflict-marker-size=3495254       mergeability check
 2. push main / feature/ours / feature/theirs 5. git merge-tree --write-tree \
 3. open a merge request                          feature/ours feature/theirs
                                                 6. GIT_ATTR_SOURCE points at the
                                                    repository tree, so the
                                                    committed .gitattributes is
                                                    honoured
                                                 7. *** heap buffer overflow ***

GIT_ATTR_SOURCE is how a server running against a bare repository makes Git read .gitattributes out of the repository tree instead of a working tree — this is what Gitaly does.

Workaround published by GitLab — it does not work as written

GitLab's advisory says:

"As a workaround for this flaw, servers that cannot upgrade yet can add conflict-marker-size=7 to each repository's info/attributes file, or turn off those merge checks for untrusted repositories."

That workaround does not prevent the crash. Measured against Git 2.56.0:

info/attributes contentresult
conflict-marker-size=7 (exactly as published)still crashes (SIGSEGV)
big.txt conflict-marker-size=7 (per-path form)blocked, merge completes

The reason is how Git parses an attribute line without a path pattern. In attr.c:parse_attr_line() the text before the first blank is taken as the attribute name, so the line

conflict-marker-size=7
Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    897
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    853
  • 3

    wifit3

    derv82/wifit3

    Wifite but USB-only & cross-platform.

    668
  • 4

    jumpserver

    jumpserver/jumpserver

    JumpServer is an open-source Privileged Access Management (PAM) platform that provides DevOps and IT teams with on-demand and secure access to SSH, RDP, Kubernetes, Database and RemoteApp endpoints through a web browser.

    448
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    417
  • 6

    SafeLine

    chaitin/safeline

    Self-hosted WAF and reverse proxy that filters malicious HTTP traffic, blocks SQL injection, XSS, and bot attacks, with rate limiting and dynamic HTML/JS encryption.

    400

Explore all tools

Browse our collection of tools

View all tools →