/

CVE-2026-22555

Severity:

HIGH RISK

(8.1)

Authorization Bypass (CWE-284) in Gitea Org Fork API

CVE-2026-22555

Deferred

Vulnerability type

Category:

Improper Access Control

CWE:

CWE-284

Impact:

Unauthorized Access to Organization Repositories and Secrets

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

An authorization flaw in Gitea allows API users to fork repositories into organizations without passing the intended CanCreateOrgRepo permission check.

Under certain configurations, this missing access control can expose organization-level secrets and internal project data to unauthorized users.

Affected context

This vulnerability appears in Gitea deployments where:

  • API access is enabled for users who can fork repositories
  • Organizations host repositories with restricted access or sensitive secrets
  • The API endpoint handling repository forks into organizations fails to enforce the CanCreateOrgRepo permission check

It is most relevant in multi-tenant environments or instances where organizations rely on fine-grained permissions to protect internal code and configuration.

Exploit preconditions

  • Attack surface: Gitea HTTP(S) API endpoint responsible for forking repositories into organizations
  • Required access: Valid Gitea user account with general ability to fork repositories, but without explicit permission to create repositories in the target organization
  • Trigger point: Calling the fork-to-organization API endpoint and specifying a target organization where the user should not be able to create repositories
  • Why exploitation is possible: The API path lacks a strict enforcement of the CanCreateOrgRepo authorization check, allowing repository creation in an organization context without confirming the user's rights for that organization

Why this happens

The underlying issue is an improper access control implementation where authorization checks are incomplete or inconsistently applied for a specific API workflow.

The code path that processes repository forks into organizations does not reliably invoke or enforce the CanCreateOrgRepo check, meaning it trusts the request's parameters instead of validating the caller's organization-level permissions.

This aligns with CWE-284: Improper Access Control, in which security-critical operations are exposed without proper verification that the actor has the necessary privileges for the target resource.

Potential impact

  • Unauthorized creation of repositories inside organizations where the user should not have repository creation rights
  • Exposure of organization secrets or configuration stored in repository content, hooks, or CI/CD configuration
  • Leakage of internal source code and intellectual property to users with lower privilege levels
  • Expansion of an attacker's foothold within a Gitea instance by gaining visibility into private organizational projects

General mitigation guidance

Mitigation generally centers on enforcing consistent authorization for every path that creates or modifies organization resources.

Common defensive patterns include:

  • Ensuring all repository creation flows call a central permission-check function that validates organization-level rights (such as CanCreateOrgRepo)
  • Avoiding duplicate or ad hoc authorization logic for web UI and API, instead consolidating checks into reusable, testable modules
  • Applying defense-in-depth by verifying permissions both at the controller/handler layer and within lower-level service functions
  • Designing organization-level policies so that default permissions are restrictive, limiting collateral exposure if a check is missed
  • Logging and monitoring permission-sensitive operations, such as repository creation within organizations, to detect misuse patterns

How teams detect issues like this

Detection efforts can focus on both code-level and operational signals:

  • Static analysis or code review rules that flag resource-creation endpoints missing explicit authorization checks
  • Architectural reviews that verify organization operations (create, fork, transfer) all traverse shared authorization routines
  • Runtime monitoring of API calls that create repositories, correlating them with the caller's known organization permissions to spot anomalies
  • Periodic audits of organization repositories and membership, checking for unexpected repositories or owners that may indicate abuse

Automated security review tools and policy-as-code frameworks can help enforce that all API handlers performing organization-scoped actions declare and invoke the required permission checks.

Sources

SourceLink
blog.gitea.comblog.gitea.com/release-of-1.26.0/
github.comgithub.com/go-gitea/gitea/pull/36950
github.comgithub.com/go-gitea/gitea/releases/tag/v1.26.0
github.comgithub.com/go-gitea/gitea/security/advisories/GHSA-fhx7-m96w-mv29

Frequently asked

questions

Yes. Any remote user with network access to the Gitea API and a legitimate account capable of forking repositories can potentially exploit this issue, provided the instance configuration allows it.

The attacker needs a valid Gitea user account and the ability to fork repositories in general, but not necessarily any special permissions in the target organization; the flaw lies in how the organization-level creation check is skipped.

The safest pattern is to centralize authorization logic and ensure that all routes capable of creating or modifying organization resources call a common permission-checking routine that enforces organization-level policies consistently.

Prevention strategies include adopting a strict policy that every security-sensitive operation requires an explicit authorization decision, using shared authorization middleware, adding automated tests for permission boundaries, and running static or architectural checks that verify all endpoints affecting organizations invoke the appropriate permission checks.

Find out what's already
exploitable in your codebase.