/

CVE-2026-20897

Severity:

CRITICAL RISK

(9.1)

Broken Access Control in Gitea Repositories

CVE-2026-20897

Modified

Vulnerability type

Category:

Broken Access Control

CWE:

CWE-284, CWE-639

Impact:

Unauthorized Modification of Repository Assets

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A broken authorization check in Gitea's Git LFS lock handling allows users with write access to one repository to delete LFS locks that belong to other repositories.

Under certain conditions, this can enable unauthorized modification of large file workflows across projects, potentially disrupting builds, releases, or collaboration processes.

Affected context

This vulnerability arises in Gitea instances that:

  • Use Git LFS (Large File Storage) and rely on LFS locks to coordinate changes to large files
  • Allow users write access on one or more repositories
  • Use shared Gitea infrastructure hosting multiple repositories for different projects or teams

The issue manifests when the application fails to correctly enforce that an LFS lock deletion request targets a lock belonging to the same repository as the requesting user's authorized scope.

Exploit preconditions

  • Attack surface: Gitea HTTP/HTTPS API or UI endpoints responsible for Git LFS lock management.
  • Required access: Valid account on the Gitea instance with write permissions to at least one repository that uses Git LFS.
  • Trigger point: Submission of a lock deletion request that references an LFS lock associated with a different repository than the one the attacker legitimately controls.
  • Why exploitation is possible: The server-side authorization logic checks that the user has sufficient privileges to delete some lock, but does not strictly bind the lock to the repository for which the user has write access, leading to a cross-repository authorization bypass (CWE-284, CWE-639).

Why this happens

The root cause is incomplete authorization enforcement on LFS lock deletion endpoints.

Instead of verifying both:

  1. The user's permission on the specific repository, and
  2. The association of the LFS lock with that same repository,

the implementation only partially validates access.

This matches CWE-284: Improper Access Control and CWE-639: Authorization Bypass Through User-Controlled Key, where identifiers or resource references (e.g., lock IDs) can be manipulated to operate on resources outside the intended authorization scope.

In abstract terms, the system trusts a client-supplied identifier for a protected resource without re-checking that the resource belongs to the context (repository) for which the user is authorized.

Potential impact

  • Attackers with write access to one repository could delete LFS locks belonging to unrelated repositories.
  • Disruption of workflows where LFS locks are used to coordinate exclusive edits to large files.
  • Potential data integrity issues if teams rely on locks to prevent concurrent modifications or conflicting updates.
  • Interference with CI/CD pipelines or release processes that depend on predictable LFS lock states.
  • Erosion of separation between projects or tenants hosted on the same Gitea instance.

General mitigation guidance

Mitigations generally focus on tightening authorization boundaries and validating resource ownership:

  • Ensure that every LFS lock operation (create, list, update, delete) enforces repository-scoped authorization checks, verifying that the lock belongs to the repository on which the user is acting.
  • Use server-side lookups of locks by ID in combination with repository context, instead of trusting client-supplied identifiers alone.
  • Apply a consistent access-control layer around Git LFS endpoints that mirrors the permission model for repositories (e.g., owner, collaborator with write access).
  • Limit overly broad permissions and avoid granting write access where read-only access is sufficient.
  • Where possible, apply defense-in-depth controls such as audit logging and rate limiting on sensitive operations like lock deletions.

How teams detect issues like this

Organizations can detect this class of vulnerability and its potential abuse using:

  • Static analysis: Rules or patterns looking for authorization checks that validate user permissions but not resource ownership (e.g., operations using a global ID without accompanying repository or tenant checks).
  • Code review: Manual reviews of LFS-related handlers or controllers to confirm that each action uses repository-scoped queries and permission checks, and does not rely solely on client-supplied identifiers.
  • Logging and monitoring: Enable detailed logs of LFS lock operations including acting user, repository, lock ID, and lock's actual repository; alert when the acting repository context and lock's repository differ.
  • Automated policy enforcement: Integrate security checks into CI pipelines to flag new endpoints that perform state-changing actions on shared or cross-tenant resources without explicit scope validation.

Sources

SourceLink
blog.gitea.comblog.gitea.com/release-of-1.25.4/
github.comgithub.com/go-gitea/gitea/pull/36344
github.comgithub.com/go-gitea/gitea/pull/36349
github.comgithub.com/go-gitea/gitea/releases/tag/v1.25.4
github.comgithub.com/go-gitea/gitea/security/advisories/GHSA-rrq5-r9h5-pc7c
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-20897
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2432204
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-20897.json

Frequently asked

questions

Yes. Any authenticated user with network access to the Gitea instance and write permissions to at least one repository can potentially exploit it via the web UI or API, assuming the vulnerable code path is present and LFS is in use.

The attacker must have a valid Gitea account and write access to at least one repository that uses Git LFS. No administrative or direct server access is required; abuse occurs within the normal authenticated user model.

The most robust fix is to enforce strict, repository-scoped authorization on all LFS lock operations. The server should resolve the lock by ID, confirm that it belongs to the target repository, and then verify that the user has sufficient privileges on that same repository before proceeding.

Adopt a standardized authorization layer that always combines user identity, action type, and resource scope (repository, project, tenant) for every operation. During development, treat all client-supplied identifiers as untrusted, require server-side resolution and ownership checks, and include automated tests to cover cross-repository and cross-tenant access attempts.

Find out what's already
exploitable in your codebase.