GHSA-MG4F-X9V4-6H2P
Vulnerability from github – Published: 2026-07-21 20:42 – Updated: 2026-07-21 20:42Summary
The OIDC userinfo endpoint (GET /login/oauth/userinfo) accepts Gitea API tokens as bearer credentials but does not enforce API token scopes before returning identity claims.
A personal access token scoped only to read:misc can successfully retrieve user information from the OIDC userinfo endpoint, even though the same token is denied access to user-related REST API endpoints that enforce scope checks.
As a result, identity information remains accessible through the OIDC endpoint regardless of the scopes assigned to the API token.
Details
Gitea supports scoped personal access tokens and enforces scope checks on user-related REST API endpoints.
For example, a token scoped only to read:misc is denied access to endpoints such as:
| Endpoint | Required Scope |
|---|---|
GET /api/v1/user |
read:user |
GET /api/v1/user/emails |
read:user |
GET /api/v1/user/orgs |
read:organization |
Requests to these endpoints return:
403 Forbidden
with a scope-related error.
However, the same read:misc token can be supplied as a bearer credential to:
GET /login/oauth/userinfo
Authorization: Bearer <token>
and receives a successful response containing identity claims.
Observed claims include:
emailgroups
The groups claim contains organization and team membership information associated with the authenticated user.
This behavior indicates that the OIDC userinfo endpoint accepts API tokens but does not apply scope restrictions before returning identity claims.
PoC
PoC Details
Proof-of-concept code: https://anonymous.4open.science/r/Gitea_PoC-EC93/3_poc_oidc_userinfo_scope_bypass
Reproduction Steps
- Create a personal access token with only the following scope:
read:misc
- Verify that the token cannot access user-related REST API endpoints:
GET /api/v1/user
GET /api/v1/user/emails
GET /api/v1/user/orgs
Each request returns:
403 Forbidden
- Send the same token to the OIDC userinfo endpoint:
GET /login/oauth/userinfo
Authorization: Bearer <read-misc-token>
- Observe that the request succeeds and returns identity claims, for example:
{
"email": "user@example.com",
"groups": [
...
]
}
Impact
Holders of narrowly scoped API tokens can obtain identity information through the OIDC userinfo endpoint regardless of the scopes assigned to the token.
The issue does not provide access to repositories, issues, pull requests, administrative functionality, or data belonging to other users.
Impact is limited to disclosure of identity information associated with the authenticated user. However, it weakens the authorization boundary established by API token scopes because identity claims remain accessible even when the token lacks user- or organization-related scopes.
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "code.gitea.io/gitea"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.27.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-55982"
],
"database_specific": {
"cwe_ids": [
"CWE-200"
],
"github_reviewed": true,
"github_reviewed_at": "2026-07-21T20:42:05Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "### Summary\n\nThe OIDC userinfo endpoint (`GET /login/oauth/userinfo`) accepts Gitea API tokens as bearer credentials but does not enforce API token scopes before returning identity claims.\n\nA personal access token scoped only to `read:misc` can successfully retrieve user information from the OIDC userinfo endpoint, even though the same token is denied access to user-related REST API endpoints that enforce scope checks.\n\nAs a result, identity information remains accessible through the OIDC endpoint regardless of the scopes assigned to the API token.\n\n### Details\n\nGitea supports scoped personal access tokens and enforces scope checks on user-related REST API endpoints.\n\nFor example, a token scoped only to `read:misc` is denied access to endpoints such as:\n\n| Endpoint | Required Scope |\n|----------|----------------|\n| `GET /api/v1/user` | `read:user` |\n| `GET /api/v1/user/emails` | `read:user` |\n| `GET /api/v1/user/orgs` | `read:organization` |\n\nRequests to these endpoints return:\n\n```http\n403 Forbidden\n```\n\nwith a scope-related error.\n\nHowever, the same `read:misc` token can be supplied as a bearer credential to:\n\n```http\nGET /login/oauth/userinfo\nAuthorization: Bearer \u003ctoken\u003e\n```\n\nand receives a successful response containing identity claims.\n\nObserved claims include:\n\n- `email`\n- `groups`\n\nThe `groups` claim contains organization and team membership information associated with the authenticated user.\n\nThis behavior indicates that the OIDC userinfo endpoint accepts API tokens but does not apply scope restrictions before returning identity claims.\n\n### PoC\n\n#### PoC Details\n\nProof-of-concept code: \nhttps://anonymous.4open.science/r/Gitea_PoC-EC93/3_poc_oidc_userinfo_scope_bypass\n\n#### Reproduction Steps\n\n1. Create a personal access token with only the following scope:\n\n```text\nread:misc\n```\n\n2. Verify that the token cannot access user-related REST API endpoints:\n\n```http\nGET /api/v1/user\nGET /api/v1/user/emails\nGET /api/v1/user/orgs\n```\n\nEach request returns:\n\n```http\n403 Forbidden\n```\n\n3. Send the same token to the OIDC userinfo endpoint:\n\n```http\nGET /login/oauth/userinfo\nAuthorization: Bearer \u003cread-misc-token\u003e\n```\n\n4. Observe that the request succeeds and returns identity claims, for example:\n\n```json\n{\n \"email\": \"user@example.com\",\n \"groups\": [\n ...\n ]\n}\n```\n\n### Impact\n\nHolders of narrowly scoped API tokens can obtain identity information through the OIDC userinfo endpoint regardless of the scopes assigned to the token.\n\nThe issue does not provide access to repositories, issues, pull requests, administrative functionality, or data belonging to other users.\n\nImpact is limited to disclosure of identity information associated with the authenticated user. However, it weakens the authorization boundary established by API token scopes because identity claims remain accessible even when the token lacks user- or organization-related scopes.",
"id": "GHSA-mg4f-x9v4-6h2p",
"modified": "2026-07-21T20:42:05Z",
"published": "2026-07-21T20:42:05Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/go-gitea/gitea/security/advisories/GHSA-mg4f-x9v4-6h2p"
},
{
"type": "PACKAGE",
"url": "https://github.com/go-gitea/gitea"
},
{
"type": "WEB",
"url": "https://github.com/go-gitea/gitea/releases/tag/v1.27.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Gitea: OIDC userinfo Endpoint Returns Identity Claims Without Enforcing API Token Scopes"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.