Gitea: Privilege Escalation via Access Token Scope Escalation in API (CVE-2026-56654)
Gitea versions prior to 1.27.0 contain a vulnerability in the API endpoint for creating Personal Access Tokens that allows privilege escalation. The API's authentication middleware incorrectly treats tokens passed in a Basic auth format as password-based authentication, bypassing intended restrictions. This flaw enables an attacker with a limited-scope token to create a new token with full privileges without knowing the account password.
AI Analysis
Technical Summary
The vulnerability arises because the Gitea API endpoint POST /users/{username}/tokens uses a middleware intended to require password-based authentication to create new Personal Access Tokens (PATs). However, when a token is supplied in the Authorization header as Basic auth with the format 'Basic base64(<token>:x-oauth-basic)', the Basic auth handler validates the token and sets the authentication method to 'basic', causing the middleware to incorrectly allow the request. The token creation handler then creates a new token with any requested scope without verifying that the requested scope is a subset of the caller's token scope. Consequently, an attacker possessing a token with restricted scope (e.g., write:user) can escalate privileges by creating a new token with full 'all' scope, gaining complete account access.
Potential Impact
An attacker with a restricted Personal Access Token can bypass authentication checks and create a new token with full privileges. This leads to full account compromise without needing the account password. The vulnerability allows scope escalation of API tokens, undermining the security model of token-based authentication in Gitea.
Mitigation Recommendations
A fix is available in Gitea version 1.27.0 and later. Users should upgrade to version 1.27.0 or newer to remediate this vulnerability. Until patched, avoid using tokens in Basic auth format for API requests that create new tokens, and restrict token scopes and usage carefully. Patch status is confirmed by the absence of affected versions from 1.27.0 onwards.
Gitea: Privilege Escalation via Access Token Scope Escalation in API (CVE-2026-56654)
Description
Gitea versions prior to 1.27.0 contain a vulnerability in the API endpoint for creating Personal Access Tokens that allows privilege escalation. The API's authentication middleware incorrectly treats tokens passed in a Basic auth format as password-based authentication, bypassing intended restrictions. This flaw enables an attacker with a limited-scope token to create a new token with full privileges without knowing the account password.
CVSS v4.0
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability arises because the Gitea API endpoint POST /users/{username}/tokens uses a middleware intended to require password-based authentication to create new Personal Access Tokens (PATs). However, when a token is supplied in the Authorization header as Basic auth with the format 'Basic base64(<token>:x-oauth-basic)', the Basic auth handler validates the token and sets the authentication method to 'basic', causing the middleware to incorrectly allow the request. The token creation handler then creates a new token with any requested scope without verifying that the requested scope is a subset of the caller's token scope. Consequently, an attacker possessing a token with restricted scope (e.g., write:user) can escalate privileges by creating a new token with full 'all' scope, gaining complete account access.
Potential Impact
An attacker with a restricted Personal Access Token can bypass authentication checks and create a new token with full privileges. This leads to full account compromise without needing the account password. The vulnerability allows scope escalation of API tokens, undermining the security model of token-based authentication in Gitea.
Mitigation Recommendations
A fix is available in Gitea version 1.27.0 and later. Users should upgrade to version 1.27.0 or newer to remediate this vulnerability. Until patched, avoid using tokens in Basic auth format for API requests that create new tokens, and restrict token scopes and usage carefully. Patch status is confirmed by the absence of affected versions from 1.27.0 onwards.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-683j-3ff6-hh2x
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-56654"]
- Ecosystems
- ["Go"]
- Database Specific Severity
- HIGH
- Cvss Version
- 4.0
Threat ID: 6a600abb9c2644c7f8fe2b72
Added to database: 07/22/2026, 00:11:39 UTC
Last enriched: 07/22/2026, 00:51:45 UTC
Last updated: 07/31/2026, 12:28:12 UTC
Views: 52
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.