/

CVE-2026-22547

Severity:

CRITICAL RISK

(9.1)

Input Validation Flaw (CWE-20) in Gitea Repositories

CVE-2026-22547

Deferred

Vulnerability type

Category:

Improper Input Validation

CWE:

CWE-20

Impact:

Repository Integrity and Access Control Bypass

Severity:

CRITICAL RISK

(9.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 prior to 1.25.5 contain insufficient input validation on repository creation fields, such as length-limited templates and trust model or object format values.

An attacker who can create or manipulate repositories may abuse these unchecked fields to push Gitea into unexpected states, potentially impacting availability, data integrity, or repository security controls.

Affected context

This vulnerability appears in environments running Gitea before version 1.25.5 where users are allowed to create or configure repositories via the web UI, API, or integrations.

It is most relevant when repository templates, trust models, or object format options are exposed to end users without strict server-side constraints on allowed values and lengths.

Multi-tenant or self-service deployments, especially those integrating Gitea with automation or provisioning tools, are more likely to surface the risk if they assume these fields are always well-formed.

Exploit preconditions

  • Attack surface: Repository creation and configuration endpoints (web UI, API, or automation hooks).
  • Required access: Ability to create or edit repositories in the affected Gitea instance; this can include authenticated users, service accounts, or CI/CD tools.
  • Trigger point: Submission of crafted values in repository template fields, trust model settings, or object format parameters when creating or configuring a repository.
  • Why exploitation is possible: The server does not enforce robust validation and constraints on these fields (e.g., allowed enumerations, length limits, or format checks), allowing unexpected or inconsistent values to flow into downstream logic.

Why this happens

The underlying issue stems from improper input validation (CWE-20), where user-controlled fields related to repository creation are not sufficiently constrained.

Instead of enforcing strict, server-side checks on length, allowed value sets, and format, the application accepts arbitrary or out-of-range input for fields like repository templates, trust models, or object formats.

This lax validation can cause internal logic to operate on unsupported configurations, bypass built-in assumptions about trust and object handling, or destabilize repository metadata processing.

Potential impact

  • Repository configurations can be set to unsupported or unintended trust models, which may weaken expected security guarantees.
  • Malformed or excessively long template or object format values could lead to instability, denial of service, or data handling errors in Gitea.
  • Security and compliance tooling that relies on consistent repository metadata may be misled or bypassed.
  • Automation or integrations that assume valid repository configuration values may misbehave, potentially corrupting data or misrouting changes.

General mitigation guidance

Effective mitigation focuses on enforcing strict and centralized validation rules for all repository creation and configuration inputs.

Typical defensive patterns include:

  • Defining server-side enumerations for trust model and object format fields, rejecting any values outside the known set.
  • Applying consistent length and format constraints to template-related fields, ensuring they cannot exceed configured limits or carry malformed content.
  • Normalizing and sanitizing configuration input before it is persisted, so that downstream components only see validated and canonicalized values.
  • Implementing defense-in-depth with permission and policy checks so that only appropriate roles can modify sensitive repository trust or format settings.

How teams detect issues like this

Organizations can identify this class of issue by:

  • Applying static analysis or linting rules that flag missing validation on HTTP handlers or API endpoints handling repository creation and configuration.
  • Performing focused code reviews on input-handling paths for fields like trust model, object format, and template configuration, verifying that they use centralized validators.
  • Enforcing application-level policies that log and alert on unexpected or unsupported configuration values, such as unknown trust models or unusually long template names.
  • Utilizing automated security testing (e.g., fuzzing repository creation APIs) to surface cases where unexpected inputs are accepted without error.

Sources

SourceLink
blog.gitea.comblog.gitea.com/release-of-1.25.5/
github.comgithub.com/go-gitea/gitea/pull/36671
github.comgithub.com/go-gitea/gitea/pull/36757
github.comgithub.com/go-gitea/gitea/releases/tag/v1.25.5

Frequently asked

questions

Exploitation depends on who can create or modify repositories; in many deployments, standard authenticated users, service accounts, or automation pipelines can reach these fields, making the issue broadly exploitable within the instance.

An attacker typically needs the ability to create or configure repositories on the vulnerable Gitea instance—either through direct login, API tokens, or misconfigured automation that accepts user input.

The safest pattern is to centralize and enforce strict server-side validation for all repository configuration fields, restricting them to known-safe values, well-defined lengths, and expected formats, regardless of client behavior.

Adopt a rigorous input validation strategy: treat all configuration input as untrusted, validate at boundaries using shared validation utilities, and back this with automated tests and static analysis to ensure new endpoints cannot bypass these checks.

Find out what's already
exploitable in your codebase.