/

CVE-2026-20736

Severity:

HIGH RISK

(7.5)

Improper Access Control in Gitea Repositories

CVE-2026-20736

Modified

Vulnerability type

Category:

Improper Access Control

CWE:

CWE-284

Impact:

Unauthorized Data Deletion

Severity:

HIGH RISK

(7.5)

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

Gitea contains an improper access control issue where the repository context is not correctly verified when deleting attachments.

A user who once uploaded an attachment to a repository may still be able to delete that attachment after losing access to the original repository by issuing the delete request through a different repository they can still access.

Affected context

This vulnerability affects Gitea instances where users can upload attachments associated with repositories (for example, to issues, pull requests, or other repository-scoped objects).

The problem occurs when the attachment deletion logic authorizes the action based on the user's access to some repository rather than confirming that the user currently has permission on the specific repository that owns the attachment.

It is most relevant in multi-repository environments where user access to projects changes over time (e.g., revocation of collaborator or team membership).

Exploit preconditions

  • Attack surface: HTTP/REST interface or web UI endpoints responsible for attachment deletion.
  • Required access:
  • The attacker must have previously uploaded an attachment to a repository.
  • The attacker must currently have access to at least one other repository on the same Gitea instance.
  • The attacker must no longer have access to the original repository that owns the attachment.
  • Trigger point: A crafted attachment deletion request made via a repository where the attacker still has permissions, referencing an attachment belonging to a repository they no longer can access.
  • Why exploitation is possible: The authorization logic fails to enforce a strict binding between an attachment and its owning repository, allowing attachment deletion to be authorized based on generic repository access rather than repository-specific ownership or access checks.

Why this happens

The core issue is an improper access control pattern where the system makes authorization decisions without validating all necessary context.

In this case, the deletion endpoint allows a user to delete an attachment if they can perform the operation in the context of any repository they can access, instead of checking:

  • whether the user currently has access to the repository that owns the attachment, and
  • whether their role permits deletion of that specific attachment.

This maps to CWE-284: Improper Access Control, where missing or incomplete authorization checks allow actions on resources that should be restricted based on the current user's relationship to the resource.

Potential impact

  • Unauthorized deletion of attachments in repositories the user no longer has access to.
  • Loss of issue or pull-request related evidence, such as logs, screenshots, or documents.
  • Disruption of audit trails and historical context tied to project discussions.
  • Potential weakening of compliance or review processes that rely on preserved attachments.
  • Erosion of trust between project maintainers and contributors due to unexpected data loss.

General mitigation guidance

Effective mitigation focuses on enforcing resource-scoped authorization that considers the true ownership of each attachment:

  • Ensure that every attachment is tightly bound to a specific repository (or owning entity) and that authorization checks always validate the user's current permissions on that exact repository before allowing deletion.
  • Apply object-level access control rules so that operations on attachments reuse the same authorization logic used for other repository-scoped resources (e.g., issues, pull requests).
  • Centralize permission checks for repository resources to reduce the chance of context mix-ups or duplicated, inconsistent authorization code.
  • Design APIs so that attachment identifiers are not sufficient by themselves to perform operations; require explicit repository context that must match the attachment's owner.
  • Adopt least-privilege defaults by limiting who can delete attachments and by tying deletion rights to specific roles or ownership where appropriate.

How teams detect issues like this

Detection typically involves examining how access control is implemented around repository-scoped resources:

  • Static analysis and code review:
  • Look for attachment deletion handlers that do not retrieve and verify the attachment's owning repository against the current user's permissions.
  • Flag code paths where authorization is checked only at a high level (e.g., "user can delete attachments somewhere") instead of at the specific resource level ("user can delete this repository's attachments").
  • Identify any endpoints where a resource ID (attachment ID) is accepted without cross-checking its parent repository or project.
  • Policy and test-based detection:
  • Add authorization-focused unit and integration tests that simulate users losing access to repositories and confirm that all associated resources (like attachments) become non-deletable for them.
  • Use security testing tools or automated QA scripts to attempt cross-repository operations on attachments (e.g., delete from repo B an attachment owned by repo A).
  • Operational monitoring:
  • Monitor logs for attachment deletions where the user performing the action is not a current collaborator or member on the owning repository.
  • Implement anomaly detection rules for high volumes of unexpected deletions or deletions performed by users with recent permission changes.

Sources

SourceLink
blog.gitea.comblog.gitea.com/release-of-1.25.4/
github.comgithub.com/go-gitea/gitea/pull/36320
github.comgithub.com/go-gitea/gitea/releases/tag/v1.25.4
github.comgithub.com/go-gitea/gitea/security/advisories/GHSA-jr6h-pwwp-c8g6
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-20736
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2432205
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-20736.json

Frequently asked

questions

Exploitation is limited to users who previously had access to a repository and uploaded attachments there, and who still retain access to at least one other repository on the same instance. It is not a fully anonymous or unauthenticated attack, but it can be abused by regular users in shared environments.

The attacker needs authenticated access to the Gitea instance and permission to interact with at least one repository. They must also know or be able to reference the identifiers of attachments they previously uploaded to repositories from which their access has been revoked.

Apply strict, resource-scoped authorization: every attachment operation should first load the attachment, determine its owning repository, and then verify that the current user has the appropriate permissions on that specific repository before proceeding with deletion or modification.

Adopt a consistent authorization model that centralizes permission checks, enforce object-level access control for all repository-scoped resources, and complement this with automated tests and code review guidelines that explicitly validate authorization behavior whenever endpoints act on resource IDs.

Find out what's already
exploitable in your codebase.