CVE-2026-50024: Path Traversal

Published Sep 9, 2026
·
Updated

Summary

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 tempdst. Two functions derived filesystem paths from server-controlled content:

- addheadfiletasks reads the downloaded .git/HEAD, parses ref: <ref-path>, and joins the raw ref-path onto tempdst/.git/logs/ before reading the resulting file. - addhashesparsed scans any file it reads for 40-character hex substrings and emits GET .git/objects/<sha[0:2]>/<sha[2:]> for each one — onto the attacker's server and into the local output tree.

Pre-fix, addheadfiletasks did not validate the ref segments. A malicious .git/HEAD of

ref: ../../../../../../etc/passwd

caused addheadfiletasks to traverse out of tempdst and read /etc/passwd. The bytes flowed into addhashesparsed, which emitted one outbound HTTP request per 40-char-hex match — observable on the attacker's logs.

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/idrsa, /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.

Scoping note: no write-side primitive in 1.1.7

A working write-side primitive (attacker drops content outside tempdst via addfolder / addtask) 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:

1. addfolder anchors every derived path on self.url + '.git/', so the first path component after the urllength strip is always .git. os.path.join's absolute-path short-circuit never fires. 2. Python's str.replace("..", "") is greedy non-overlapping; ....// collapses to //, ......// to ///, etc. No literal .. survives into addtask.

5f2a8ba is still the correct fix for the read-side primitive and additionally hardens addtask as defense in depth against future regressions — for example, if a later caller removes the .git/ anchor in addfolder or wires a new server-controlled segment source into addtask.

Fix

Commit 5f2a8ba introduces issafepathsegment as a single trust boundary: every segment about to be joined onto tempdst or appended to an outgoing URL is validated against an allowlist before addtask accepts it. Empty / . / .. / separators / NUL / control characters are rejected; the brittle replace("..", "") filter is removed.

The fix also tightens adjacent surfaces preemptively:

- addfolder switches to urlparse-based scheme + netloc + path comparison. - constructurlfrompathcomponents percent-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/testrefvalidation.py (commit 16fcd81) pin the PoC and six bypass variants (extra-depth, mid-path, NUL, absolute path, leading-dot, .lock-suffix).

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/testrefvalidation.py - https://githacker.pages.dev/security - https://github.com/justinsteven/advisories - https://drivertom.blogspot.com/2021/08/git.html

Affected Software

1 affected componentFixes available
pip/githacker<=1.1.7
1.1.8

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/githacker to a version that resolves this vulnerability.

    Fixed in 1.1.8
  2. Upgrade

    Upgrade GitHacker to a version that resolves this vulnerability.

    Fixed in 1.1.8Patch 5f2a8ba
  3. Configuration

    Do not point GitHacker at any URL whose contents are not under your control, since a malicious server can coerce it into reading arbitrary local files (via existence oracle / hex-fragment exfiltration behaviors).

    GitHacker Target URL selection = Only point GitHacker at URLs whose contents are under your control
  4. Compensating control

    Run GitHacker inside a disposable container (avoid running it directly on sensitive hosts).

Event History

Sep 9, 2026
Advisory Published
via GitHub·06:00 PM
Data Sourced
via GitHub·06:00 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Who can exploit this issue?

A malicious server targeted by GitHacker can exploit it. No authentication or user interaction is required according to the supplied CVSS vector.

2

What data can be exposed?

The attacker can cause GitHacker to read arbitrary local files through traversal in a server-controlled HEAD reference. File contents are not returned wholesale, but any 40-character hexadecimal substrings found during processing are converted into outbound HTTP GET requests, creating an existence oracle and exposing those fragments.

3

Which versions are affected?

GitHacker versions through 1.1.7 are affected.

4

How could I identify a possible exploitation attempt?

Look for GitHacker making unexpected requests to the remote server for paths of the form .git/objects/<two hexadecimal characters>/<38 hexadecimal characters>. Such requests may correspond to 40-character hexadecimal strings found in local files read through a malicious HEAD reference.

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