Skip to content

About

Git LFS <=3.8.0: newRequestForRetry dropped only Authorization on host change and always copied Cookie — a cross-origin redirect leaks the victim's session Cookie to the attacker host. Real redirect handler v3.8.0 vs v3.8.1: Cookie forwarded on vuln, dropped on new origin (sameOrigin) on fixed.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

CVE-2026-69261 — Git LFS: Cookie header forwarded to a different origin on HTTP redirect

License: MIT Research status: validated

CVE CVE-2026-69261
Component Git LFS — lfshttp/client.go (newRequestForRetry)
Affected 0.5.0 – 2.13.3 and 3.0.0 – 3.8.0
Fixed in 3.8.1 — commit 12c92e05 (GHSA-x7xj-4j4f-88xr)
CWE CWE-200 (Exposure of Sensitive Information), CWE-522 (Insufficiently Protected Credentials)
Impact After an HTTP redirect to a different origin, Git LFS forwards the victim's Cookie header (session tokens) to the redirect target, even though Authorization is correctly withheld — a malicious or compromised LFS endpoint can steal session credentials
Vector Network — a malicious/compromised LFS endpoint issuing a cross-origin redirect
Trigger redirect https://origin.example/... → https://attacker.example/...

The vulnerable redirect handler dropped only Authorization when the host changed and copied every other header:

// v3.8.0, newRequestForRetry()
sameHost := req.URL.Host == newReq.URL.Host
for key := range req.Header {
    if key == "Authorization" {
        if !sameHost { continue }
    }
    newReq.Header.Set(key, req.Header.Get(key))   // Cookie always copied
}

The fix drops both credentials on any new origin:

// v3.8.1 (commit 12c92e05)
sameOrigin := req.URL.Scheme == newReq.URL.Scheme && req.URL.Host == newReq.URL.Host
for key := range req.Header {
    if !sameOrigin && (key == "Authorization" || key == "Cookie") { continue }
    newReq.Header.Set(key, req.Header.Get(key))
}

1. Root cause

When an LFS request is redirected, newRequestForRetry() rebuilds it for the new location and selectively strips sensitive headers. In 3.8.0 the strip condition covered only Authorization, and only on a host change (sameHost). Cookie was unconditionally copied, so a redirect to a different host — or even an HTTP→HTTPS upgrade on the same host, or a different port — carried the victim's session cookie to the new target. Authorization was withheld on host changes but still leaked on scheme/port changes. The fix computes a full sameOrigin (scheme + host) and drops both Authorization and Cookie whenever the origin changes.

2. Reproduction environment

service image role
lfs4-vuln cve-2026-69261:vuln Git LFS v3.8.0
lfs4-fixed cve-2026-69261:fixed Git LFS v3.8.1 (vendor fix)
poc cve-2026-69261-poc:local stdlib-only Python driver

An in-package Go test binary calls the real newRequestForRetry() with a request carrying Authorization and Cookie, and reports which headers survive on the redirected request. Both sides differ only in the Git LFS version.

3. Running the environment

./run-lab.sh build     # builds both tags with Go 1.25
./run-lab.sh up        # cve69261lab network: lfs4-vuln / lfs4-fixed
./run-lab.sh sweep
./run-lab.sh down

4. The PoC

poc/poc.py (stdlib only):

  • check — exit 1 when the Cookie survives a cross-origin redirect, 0 when dropped; 3 no worker, 2 unreachable.
  • exploit — narrated stages: victim cookie → malicious redirect → credential received by the attacker origin.
  • probe — origin matrix: cross-host, same-host (legit), HTTP→HTTPS upgrade, cross-port.
  • mitigation — 3.8.1 / commit 12c92e05.

A standalone full-chain exploit ships at exploit/exploit.py:

python3 exploit/exploit.py --host=lfs4-vuln
# exit 1 on confirmed Cookie disclosure, 0 on a safe target

5. Expected results

redirect case lfs4-vuln (3.8.0) Cookie lfs4-fixed (3.8.1) Cookie
cross-host session=SECRET_COOKIE forwarded dropped
same-host (legit) forwarded (correct) forwarded (correct)
HTTP→HTTPS upgrade forwarded dropped
cross-port forwarded dropped

Authorization is withheld on host changes in both builds; the fixed build also withholds it on scheme/port changes.

Captured runs: evidence/check-*-run.txt, evidence/exploit-*-run.txt, evidence/probe-*-run.txt, evidence/mitigation-*-run.txt, evidence/exploit-standalone-run.txt, evidence/exploit-standalone-fixed-run.txt, evidence/versions.txt, evidence/0day-sweep.txt.

6. Environment preconditions

  • Podman (or Docker); bounded containers on the isolated cve69261lab network.
  • Real-world exploitation requires the victim's LFS endpoint to issue (or be made to issue) a redirect to an attacker-controlled origin, and the client to hold a sensitive Cookie for the original endpoint.

7. Additional findings (0-day sweep on the fixed line)

The fixed line drops Authorization and Cookie whenever the redirect changes scheme, host or port (sameOrigin). Cross-host, HTTP→HTTPS upgrade and cross-port redirects no longer carry credentials; same-origin redirects still forward them (correct). No credential-leak path remains.

8. Repository layout

README.md             this write-up
run-lab.sh            environment driver (build / up / sweep / down)
Makefile              convenience targets
poc/poc.py            the PoC (check / exploit / probe / mitigation)
exploit/exploit.py    standalone full-chain exploit
lab/lab.Dockerfile    builds both upstream tags
lab/harness/          in-package Go test calling newRequestForRetry
lab/service.py        HTTP wrapper (POST /redirect)
evidence/             captured runs of every mode on both sides
TRACKING.md           excluded (working record)

9. References

About

Git LFS <=3.8.0: newRequestForRetry dropped only Authorization on host change and always copied Cookie — a cross-origin redirect leaks the victim's session Cookie to the attacker host. Real redirect handler v3.8.0 vs v3.8.1: Cookie forwarded on vuln, dropped on new origin (sameOrigin) on fixed.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages