Summary
GitHacker: Path traversal in ref/hash parsing enables existence oracle and hex-fragment exfiltration via malicious .git server
GitHacker through 1.1.7 did not validate path segments parsed from attacker-controlled .git/HEAD before joining them onto its output directory. A malicious server could coerce GitHacker into reading arbitrary local files. Contents do not stream back wholesale, but the recovery loop turns any 40-character hex substring into an outbound HTTP GET, an existence oracle for arbitrary paths plus hex-fragment exfiltration of file contents.
Details
Vulnerability
GitHacker rebuilds a remote .git/ by fetching files into temp_dst. Two functions derived filesystem paths from server-controlled content:
add_head_file_tasksreads the downloaded.git/HEAD, parsesref: <ref-path>, and joins the raw ref-path ontotemp_dst/.git/logs/before reading the resulting file.add_hashes_parsedscans any file it reads for 40-character hex substrings and emitsGET .git/objects/<sha[0:2]>/<sha[2:]>for each one, onto the attacker's server and into the local output tree.
Pre-fix, add_head_file_tasks did not validate the ref segments. A malicious .git/HEAD of
ref: ../../../../../../etc/passwd
caused add_head_file_tasks to traverse out of temp_dst and read /etc/passwd. The bytes flowed into add_hashes_parsed, which emitted one outbound HTTP request per 40-char-hex match, observable on the attacker's logs.
Scoping note: no write-side primitive in 1.1.7
A working write-side primitive (attacker drops content outside temp_dst via add_folder / add_task) does not reproduce against the shipped 1.1.7 source. Empirical testing by the reporter against GitHacker-1.1.7.tar.gz (25 traversal-style payloads including ....//, %2e%2e%2f, layered foo/../../, NUL bytes, backslash variants, absolute paths) yielded 0/25 escapes. Two structural reasons:
add_folderanchors every derived path onself.url + '.git/', so the first path component after theurl_lengthstrip is always.git.os.path.join's absolute-path short-circuit never fires.- Python's
str.replace("..", "")is greedy non-overlapping;....//collapses to//,......//to///, etc. No literal..survives intoadd_task.
5f2a8ba is still the correct fix for the read-side primitive and additionally hardens add_task as defense in depth against future regressions, for example, if a later caller removes the .git/ anchor in add_folder or wires a new server-controlled segment source into add_task.
Credit
Reported and patched-prototyped by Zac Wang (@7a6163) in #65. Zac refined the impact framing from "arbitrary file read" to "existence oracle + hex-fragment exfiltration" and verified the absence of a write-side primitive against the shipped 1.1.7 sdist with a 25-payload harness.
Patches
Patched in 1.1.8 (commit 5f2a8ba; tests 16fcd81).
Workarounds
Run GitHacker inside a disposable container. Do not point GitHacker at any URL whose contents are not under your control.
Resources
- https://github.com/WangYihang/GitHacker/pull/65
- https://github.com/WangYihang/GitHacker/commit/5f2a8ba
- https://github.com/WangYihang/GitHacker/blob/main/tests/test_ref_validation.py
- https://githacker.pages.dev/security
- https://github.com/justinsteven/advisories
- https://drivertom.blogspot.com/2021/08/git.html
Impact
PR #65 originally classified this as arbitrary local file read. Joint analysis during coordinated disclosure narrowed the primitive: file contents do not stream back wholesale because the only egress channel is the 40-char-hex regex. In practice an attacker can:
- Existence oracle for any path on the GitHacker host (
/etc/shadow,/root/.ssh/id_rsa,/home/<user>/.git-credentials, build artifacts under/tmp/). - Hex-fragment exfiltration when the targeted file contains 40-char hex sequences: other git repos' refs / pack filenames, password hashes, HMAC-SHA1 outputs, some session tokens.
Not exploitable without victim action: the attacker must persuade the victim to run GitHacker against a URL they control. Project guidance has always been to run GitHacker inside a disposable container.
Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files. Typical impact: unauthorized file read or write outside the intended directory.
CVE-2026-50024 has a CVSS score of 5.3 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.1.8); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Commit 5f2a8ba introduces _is_safe_path_segment as a single trust boundary: every segment about to be joined onto temp_dst or appended to an outgoing URL is validated against an allowlist before add_task accepts it. Empty / . / .. / separators / NUL / control characters are rejected; the brittle replace("..", "") filter is removed.
The fix also tightens adjacent surfaces preemptively:
add_folderswitches tourlparse-based scheme + netloc + path comparison.construct_url_from_path_componentspercent-encodes every segment.
PR #65's two-layer defense (allowlist regex + os.path.realpath() confinement) was consolidated onto the allowlist applied at queue-time, removing the TOCTOU window an after-the-fact realpath() check leaves open and the per-call-site drift risk. PR #65 was closed in favour of the broader fix.
Regression tests in tests/test_ref_validation.py (commit 16fcd81) pin the PoC and six bypass variants (extra-depth, mid-path, NUL, absolute path, leading-dot, .lock-suffix).
Frequently Asked Questions
- What is CVE-2026-50024? CVE-2026-50024 is a medium-severity path traversal vulnerability in githacker (pip), affecting versions <= 1.1.7. It is fixed in 1.1.8. Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files.
- How severe is CVE-2026-50024? CVE-2026-50024 has a CVSS score of 5.3 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of githacker are affected by CVE-2026-50024? githacker (pip) versions <= 1.1.7 is affected.
- Is there a fix for CVE-2026-50024? Yes. CVE-2026-50024 is fixed in 1.1.8. Upgrade to this version or later.
- Is CVE-2026-50024 exploitable, and should I be worried? Whether CVE-2026-50024 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-50024 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-50024? Upgrade
githackerto 1.1.8 or later.