Vulnerability record · PyPI
PYSEC-2026-3835
Description
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.
GitHacker rebuilds a remote .git/ by fetching files into temp_dst. Two functions derived filesystem paths from server-controlled content:
add_head_file_tasks reads the downloaded .git/HEAD, parses ref: <ref-path>, and joins the raw ref-path onto temp_dst/.git/logs/ before reading the resulting file.add_hashes_parsed 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, 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.
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:
/etc/shadow, /root/.ssh/id_rsa, /home/<user>/.git-credentials, build artifacts under /tmp/).Not…
Manual fix · PyPI
pip install --upgrade "githacker>=1.1.8"Sources