GHSA-rjvx-x5h2-6px5: Gitea API Fork Endpoint Authorization Bypass Vulnerability

MODERATE
CWE-863
Published
Advisory Summary

GHSA-rjvx-x5h2-6px5 is a MODERATE api fork endpoint authorization bypass vulnerability (CWE-863: Incorrect Authorization) affecting Gitea libraries in the Go ecosystem. The issue involves api fork endpoint authorization bypass allows organization members to bypass repository creation restrictions. Remediation is available by upgrading affected packages to version 1.26.0.

GHSA-rjvx-x5h2-6px5 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-rjvx-x5h2-6px5
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-863: Incorrect Authorization
Affected Product Gitea
Package Ecosystem Go
Published Date
Last Updated

How to Fix GHSA-rjvx-x5h2-6px5

To remediate this vulnerability, upgrade all affected Gitea dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

code.gitea.io/gitea fixed: 1.26.0
Upgrade code.gitea.io/gitea to 1.26.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for code.gitea.io/gitea

How to Check if You Are Affected

To determine whether your application is affected by GHSA-rjvx-x5h2-6px5, inspect your project dependencies for Gitea:

inspect dependencies for code.gitea.io/gitea

Analyze the terminal output to locate any version of Gitea in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.26.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-863: Incorrect Authorization, where the product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. In Gitea, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The API endpoint used to fork repositories into organizations performs a weaker authorization check than the corresponding web UI and other repository creation endpoints. When a repository is forked into an organization through the API, the endpoint only verifies that the user is an organization member (`IsOrgMember()`), but does not verify whether the user is allowed to create repositories in that organization (`CanCreateOrgRepo()`). As a result, organization members belonging to teams with `can_create_org_repo=false` can still create repositories inside the organization by using the fork API. ### Details Affected endpoint: ``` POST /api/v1/repos/{owner}/{repo}/forks ``` In `routers/api/v1/repo/fork.go`, the endpoint performs the following authorization check: ```go if !ctx.Doer.IsAdmin { isMember, err := org.IsOrgMember(ctx, ctx.Doer.ID) if !isMember { ctx.APIError(http.StatusForbidden, ...) return } } ``` The equivalent web UI implementation uses the stronger permission check: ```go isAllowedToFork, err := organization.OrgFromUser(ctxUser). CanCreateOrgRepo(ctx, ctx.Doer.ID) ``` The same `CanCreateOrgRepo()` authorization check is also used by: * CreateOrgRepo API endpoint * GenerateRepository API endpoint The fork endpoint appears to be the only repository creation path that relies solely on organization membership. ### Proof of Concept Tested on Gitea 1.23.7. 1. Create an organization. 2. Create a team with `can_create_org_repo=false`. 3. Add a test user to that team. 4. Verify that normal repository creation is denied: ```http POST /api/v1/orgs/target-org/repos ``` Result: ```http 403 Forbidden ``` 5. Fork a repository into the organization: ```http POST /api/v1/repos/admin/public-repo/forks Content-Type: application/json { "organization": "target-org" } ``` Result: ```http 202 Accepted ``` The repository is successfully created despite repository creation permissions being disabled. ### Impact Users who are organization members but are intentionally prevented from creating repositories can bypass that restriction through the API. This allows unauthorized repository creation inside the organization and may expose additional attack surface depending on the organization's Actions, runner, and workflow configuration. The vulnerability represents an authorization bypass because API behavior is less restrictive than both the web UI and other repository creation endpoints.

GHSA-rjvx-x5h2-6px5 Affected Gitea Versions

1 component(s)
Fixed Versions:
1.26.0
Product / Package Ecosystem Affected Versions Fixed Version
code.gitea.io/gitea
Go
< 1.26.0
1.26.0

References

Frequently Asked Questions

What is GHSA-rjvx-x5h2-6px5?
GHSA-rjvx-x5h2-6px5 is a security vulnerability in Gitea involving API Fork Endpoint Authorization Bypass Allows Organization Members to Bypass Repository Creation Restrictions under CWE-863: Incorrect Authorization.
Which Gitea versions are affected?
Affected versions include releases prior to 1.26.0 across affected packages: code.gitea.io/gitea.
What version fixes GHSA-rjvx-x5h2-6px5?
Upgrading to 1.26.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is code.gitea.io/gitea affected?
Yes, code.gitea.io/gitea is affected in releases prior to 1.26.0. Upgrade your dependency to 1.26.0 or later.
What CWE is associated with GHSA-rjvx-x5h2-6px5?
GHSA-rjvx-x5h2-6px5 is classified under CWE-863: Incorrect Authorization (The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check.).
How can I check Go dependencies for GHSA-rjvx-x5h2-6px5?
Run the dependency tree command: 'inspect dependencies for code.gitea.io/gitea'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-rjvx-x5h2-6px5",
  "modified" : "2026-07-21T20:26:37Z",
  "published" : "2026-07-21T20:26:37Z",
  "aliases" : [ ],
  "summary" : "Gitea: API Fork Endpoint Authorization Bypass Allows Organization Members to Bypass Repository Creation Restrictions",
  "details" : "### Summary\n\nThe API endpoint used to fork repositories into organizations performs a weaker authorization check than the corresponding web UI and other repository creation endpoints.\n\nWhen a repository is forked into an organization through the API, the endpoint only verifies that the user is an organization member (`IsOrgMember()`), but does not verify whether the user is allowed to create repositories in that organization (`CanCreateOrgRepo()`).\n\nAs a result, organization members belonging to teams with `can_create_org_repo=false` can still create repositories inside the organization by using the fork API.\n\n### Details\n\nAffected endpoint:\n\n```\nPOST /api/v1/repos/{owner}/{repo}/forks\n```\n\nIn `routers/api/v1/repo/fork.go`, the endpoint performs the following authorization check:\n\n```go\nif !ctx.Doer.IsAdmin {\n    isMember, err := org.IsOrgMember(ctx, ctx.Doer.ID)\n    if !isMember {\n        ctx.APIError(http.StatusForbidden, ...)\n        return\n    }\n}\n```\n\nThe equivalent web UI implementation uses the stronger permission check:\n\n```go\nisAllowedToFork, err := organization.OrgFromUser(ctxUser).\n    CanCreateOrgRepo(ctx, ctx.Doer.ID)\n```\n\nThe same `CanCreateOrgRepo()` authorization check is also used by:\n\n* CreateOrgRepo API endpoint\n* GenerateRepository API endpoint\n\nThe fork endpoint appears to be the only repository creation path that relies solely on organization membership.\n\n### Proof of Concept\n\nTested on Gitea 1.23.7.\n\n1. Create an organization.\n2. Create a team with `can_create_org_repo=false`.\n3. Add a test user to that team.\n4. Verify that normal repository creation is denied:\n\n```http\nPOST /api/v1/orgs/target-org/repos\n```\n\nResult:\n\n```http\n403 Forbidden\n```\n\n5. Fork a repository into the organization:\n\n```http\nPOST /api/v1/repos/admin/public-repo/forks\nContent-Type: application/json\n\n{\n  \"organization\": \"target-org\"\n}\n```\n\nResult:\n\n```http\n202 Accepted\n```\n\nThe repository is successfully created despite repository creation permissions being disabled.\n\n### Impact\n\nUsers who are organization members but are intentionally prevented from creating repositories can bypass that restriction through the API.\n\nThis allows unauthorized repository creation inside the organization and may expose additional attack surface depending on the organization's Actions, runner, and workflow configuration.\n\nThe vulnerability represents an authorization bypass because API behavior is less restrictive than both the web UI and other repository creation endpoints.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "code.gitea.io/gitea"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.26.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/security/advisories/GHSA-rjvx-x5h2-6px5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/pull/36950"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/commit/686d10b7f0c26baf91171124b382cbcdfa7bf025"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/go-gitea/gitea"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/releases/tag/v1.26.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-863" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-21T20:26:37Z",
    "nvd_published_at" : null
  }
}