/

CVE-2026-28699

Severity:

HIGH RISK

(8.1)

OAuth2 Scope Bypass (CWE-284) in Gitea Access Control

CVE-2026-28699

Deferred

Vulnerability type

Category:

Authorization Bypass

CWE:

CWE-284, CWE-863

Impact:

Privilege Escalation / Access Control Bypass

Severity:

HIGH RISK

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

Gitea versions up to and including 1.26.1 contain an authorization flaw where OAuth2 access token scope checks can be bypassed when clients fall back to HTTP Basic authentication.

An attacker with valid but limited credentials may gain broader access than intended by avoiding proper scope enforcement, making misconfigured or multi-protocol authentication setups particularly risky.

Affected context

This vulnerability appears in Gitea deployments that:

  • Use OAuth2 for API or UI access control
  • Allow or support HTTP Basic authentication as an alternative or fallback mechanism
  • Rely on OAuth2 scopes to partition or constrain what authenticated clients can do

In such setups, different authentication paths may not consistently enforce the same scope-based restrictions, enabling a bypass under certain request flows.

Exploit preconditions

  • Attack surface: Gitea HTTP(S) endpoints accessible over network (API or web).
  • Required access: Valid credentials or an OAuth2 token with some level of access (e.g., restricted scope or account).
  • Trigger point: Sending requests via HTTP Basic authentication instead of, or after obtaining, a scoped OAuth2 access token.
  • Why exploitation is possible: The authorization logic does not consistently apply OAuth2 scope validation across all authentication mechanisms, allowing a less restricted path via Basic auth that bypasses intended scope checks.

Why this happens

The root cause is an inconsistent enforcement of authorization rules between OAuth2 and HTTP Basic authentication paths.

While OAuth2 scopes are designed to express fine-grained permissions for tokens, the backend authorization layer treats sessions authenticated via Basic auth differently, failing to apply equivalent scope constraints.

This maps primarily to CWE-284: Improper Access Control and CWE-863: Incorrect Authorization where resource access decisions depend on the authentication mechanism rather than a unified, centrally enforced authorization policy.

Potential impact

  • A user with restricted OAuth2 scopes could gain access to operations that should be outside their scope.
  • Attackers may read or modify repositories, issues, or configuration data they should not see.
  • Automation or integrations relying on scopes for least privilege could unintentionally operate with elevated capabilities.
  • Security monitoring based on expected scope limitations can be undermined, hiding unauthorized activity.

General mitigation guidance

Mitigation generally focuses on normalizing and centralizing authorization checks so that they are independent of the authentication method.

Recommended defensive patterns include:

  • Applying a single authorization layer that derives permissions from user identity and roles, not from the specific login protocol.
  • Ensuring that HTTP Basic, OAuth2, and other mechanisms all converge on the same permission evaluation logic.
  • Minimizing reliance on multiple concurrent authentication mechanisms, or explicitly constraining which endpoints accept HTTP Basic versus OAuth2.
  • Adopting least-privilege defaults, where unscoped or ambiguous authentication contexts receive minimal access until explicitly granted.
  • Documenting and reviewing how scopes, roles, and groups map to actual resource permissions to avoid hidden privilege escalation paths.

How teams detect issues like this

Detection efforts can focus on both code and runtime behavior:

  • Static analysis and code review:
  • Look for duplicated authorization logic that branches based on authentication type (e.g., Basic vs OAuth2).
  • Identify endpoints where OAuth2-specific scope checks are present but not mirrored for other auth schemes.
  • Flag controllers or handlers that rely solely on "authenticated or not" checks without verifying roles, scopes, or permissions.
  • Configuration and policy review:
  • Examine authentication configuration to ensure consistent security policies across supported mechanisms.
  • Verify that any fallback mechanisms (like Basic auth) are strictly limited or disabled where unnecessary.
  • Runtime monitoring:
  • Analyze logs for patterns where users appear to gain broader access when using different authentication methods.
  • Set up alerts when access via Basic authentication occurs in environments expected to rely mainly on OAuth2.

Automated security tools, including SAST and configuration linters, can help surface inconsistent authorization patterns early in development and deployment.

Sources

SourceLink
blog.gitea.comblog.gitea.com/release-of-1.26.2/
github.comgithub.com/go-gitea/gitea/pull/37503
github.comgithub.com/go-gitea/gitea/releases/tag/v1.26.2
github.comgithub.com/go-gitea/gitea/security/advisories/GHSA-9r5x-wg6m-x2rc

Frequently asked

questions

Yes. Any remote client that can reach exposed Gitea HTTP(S) endpoints and authenticate via HTTP Basic or OAuth2 could potentially exploit the inconsistent authorization behavior.

The attacker typically needs valid credentials or a valid OAuth2 token, even if limited in scope.

The weakness lies in escalating those limited permissions by switching to HTTP Basic authentication, not in obtaining initial access.

The most robust fix is to centralize authorization decisions so they are independent of the authentication scheme.

Every authenticated request—whether via OAuth2, HTTP Basic, or other methods—should pass through the same permission checks based on identity and roles, ensuring that scopes or equivalent constraints are always applied uniformly.

Prevent similar flaws by:

  • Designing a single, shared authorization layer used by all authentication mechanisms.
  • Keeping authentication (who you are) and authorization (what you can do) strictly separated in code.
  • Regularly reviewing and testing flows across all supported authentication types, including fallbacks.
  • Incorporating security reviews and automated tests specifically focused on scope and role enforcement consistency.
Find out what's already
exploitable in your codebase.