/

CVE-2026-52808

Severity:

HIGH RISK

(7.1)

Authorization Bypass (CWE-269) in Gogs Repo APIs

CVE-2026-52808

Deferred

Vulnerability type

Category:

Authorization Bypass / Privilege Management

CWE:

CWE-269, CWE-863

Impact:

Privilege Escalation to Unauthorized Repository Administration

Severity:

HIGH RISK

(7.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

Gogs exposes several repository management API endpoints that incorrectly allow write-level collaborators to perform admin-only actions such as disabling the issue tracker or wiki, changing external URLs, or triggering mirror sync operations.

When collaborators can directly call these misgated APIs, they may redirect repository visitors or manipulate project metadata beyond their intended privileges.

Affected context

This vulnerability occurs in Gogs deployments where:

  • API endpoints for repository configuration rely on weaker access checks than the corresponding web UI actions.
  • reqRepoWriter() is used to gate operations that semantically require repository admin privileges.
  • Collaborators with write-level access can interact with the REST API directly, independent of UI restrictions.

It primarily affects configuration actions on issue trackers, wikis, and mirror synchronization for individual repositories.

Exploit preconditions

  • Attack surface: Gogs HTTP API endpoints for repository management.
  • Required access: Valid authenticated account with write-level collaborator access to a target repository (AccessModeWrite).
  • Trigger point: Direct invocation of:
  • PATCH /api/v1/repos/:owner/:repo/issue-tracker
  • PATCH /api/v1/repos/:owner/:repo/wiki
  • POST /api/v1/repos/:owner/:repo/mirror-sync
  • Why exploitation is possible: These endpoints are gated by reqRepoWriter() instead of reqRepoAdmin(), allowing users who are not repository admins to perform operations that should require AccessModeAdmin.

Why this happens

The underlying issue is a mismatch between intended authorization semantics and the implementation of access checks on API endpoints.

While the web UI correctly protects sensitive repository administration actions behind reqRepoAdmin(), the corresponding API routes were wired to reqRepoWriter(), effectively broadening who can invoke them.

This maps to CWE-269 (Improper Privilege Management) and CWE-863 (Incorrect Authorization) because the system fails to enforce the proper privilege level and uses inconsistent authorization logic across different interfaces.

Potential impact

  • Collaborators may disable the native issue tracker for a repository without admin approval.
  • Collaborators may disable the built-in wiki or alter its configuration unexpectedly.
  • Collaborators can inject attacker-controlled external issue tracker or wiki URLs that redirect repository visitors to malicious or misleading sites.
  • Collaborators can trigger mirror synchronization operations, potentially affecting downstream mirrored repositories.
  • Project governance and workflow controls can be undermined when non-admin users gain effective control over key repository features.

General mitigation guidance

Effective mitigation focuses on enforcing consistent, least-privilege authorization across all interfaces:

  • Align API endpoint guards with the same access checks used by the web UI for equivalent operations, ensuring configuration changes require repository admin privileges.
  • Define clear authorization policies for repository roles and use role-based checks rather than ad hoc mode comparisons.
  • Centralize privilege checks in shared helpers so that changes to authorization semantics propagate uniformly to UI and API routes.
  • Regularly review repository management actions to confirm they are protected by the strongest appropriate access mode and avoid privilege creep.
  • Consider defense-in-depth measures such as administrative confirmation workflows for high-impact configuration changes.

How teams detect issues like this

Detection typically involves:

  • Static analysis or code-level audits to locate API handlers performing sensitive operations gated by weaker access checks (e.g., writer vs admin).
  • Comparing authorization middleware usage between web UI routes and corresponding API endpoints to find inconsistencies in role enforcement.
  • Implementing policy-based tests that assert only admin-level users can perform specific configuration changes, run as part of CI.
  • Monitoring logs for unusual configuration changes initiated by non-admin accounts, such as issue tracker or wiki settings toggled by collaborators.
  • Employing automated code review tools that flag authorization patterns deviating from established security guidelines.

Sources

SourceLink
github.comgithub.com/gogs/gogs/commit/6283462119bd8894f1599d70339b5e823f99954a
github.comgithub.com/gogs/gogs/pull/8327
github.comgithub.com/gogs/gogs/releases/tag/v0.14.3
github.comgithub.com/gogs/gogs/security/advisories/GHSA-268j-37xf-pp52

Frequently asked

questions

No. Exploitation requires an authenticated account with at least write-level collaborator access to the target repository; anonymous users cannot trigger these actions.

They do not. A user with AccessModeWrite on a specific repository can call the affected API endpoints to perform actions that should be restricted to repository admins.

The safest pattern is to ensure that all sensitive repository configuration endpoints consistently use the same admin-level authorization checks as their web UI equivalents, and to centralize authorization logic so access levels are defined and enforced in one place.

Preventive measures include establishing clear role-based access control policies, enforcing them uniformly across UI and API, adding automated tests for privilege boundaries, conducting regular access-control focused code reviews, and using tooling that flags inconsistent or overly permissive authorization checks.

Find out what's already
exploitable in your codebase.