/

CVE-2026-22874

Severity:

CRITICAL RISK

(9.6)

SSRF Weakness (CWE-918) in Gitea Webhooks and Migrations

CVE-2026-22874

Deferred

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Network Pivot and Data Exfiltration via SSRF

Severity:

CRITICAL RISK

(9.6)

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

Incomplete server-side request forgery (SSRF) protection in Gitea's webhook and migration URL allow-list filtering can let crafted URLs bypass intended network access controls.

When exposed instances allow user-controlled webhook targets or migration sources, an attacker may coerce Gitea into making internal network requests that it should not perform.

Affected context

The vulnerability appears in Gitea deployments where users can configure webhook endpoints or repository migration sources, and where those features rely on an IP or hostname allow-list for protection.

It becomes relevant when Gitea has network reachability to internal services, metadata endpoints, or restricted HTTP interfaces, and when URL validation and filtering do not fully handle edge cases such as redirects, alternate encodings, or non-standard host representations.

Exploit preconditions

  • Attack surface: HTTP(S) endpoints that accept user-controlled URLs for webhooks or repository migrations.
  • Required access: Ability to create or modify webhooks, or initiate/import repository migrations (often available to authenticated users or project maintainers).
  • Trigger point: Submitting a crafted URL that passes allow-list checks but ultimately resolves to an internal or otherwise restricted target when Gitea performs the outbound request.
  • Why exploitation is possible: The URL and network filtering logic is incomplete, allowing certain hostnames, IP formats, or redirect patterns to evade the allow-list and reach unintended network locations.

Why this happens

This issue stems from partial and brittle SSRF protections that rely on imperfect URL and host validation.

While an allow-list is present, it does not account for all ways an attacker can express or redirect a URL to internal infrastructure, such as through alternate DNS names, encoded IPs, redirects, or other transformations.

Conceptually, this maps to CWE-918: Server-Side Request Forgery (SSRF), where a server component performs outbound requests based on untrusted input without robustly constraining destination addresses and protocols.

Potential impact

  • Coerced connections to internal HTTP services that are not directly reachable from the internet.
  • Access to cloud or container metadata services, which could expose credentials or configuration secrets.
  • Interaction with internal administrative panels or APIs, potentially influencing state or extracting sensitive data.
  • Use of Gitea as a pivot point to map internal networks or test for reachable services.
  • Indirect assistance in chaining with other vulnerabilities (e.g., exploiting internal services that trust Gitea's traffic).

General mitigation guidance

Effective mitigation typically focuses on hardening both URL validation logic and the surrounding network environment:

  • Enforce strict, canonicalized validation of outbound URLs, including normalization of hostnames, IP addresses, and ports before applying allow-lists.
  • Prefer positive security models that explicitly enumerate allowed hosts, networks, and protocols, rejecting everything else by default.
  • Isolate application servers with egress controls (for example, firewall rules or service mesh policies) that prevent direct access to sensitive internal services and metadata endpoints.
  • Limit who can configure outbound webhooks or initiate repository migrations, and separate high-privilege administrative URLs from general user features.
  • Consider design patterns where untrusted URL callbacks are delegated to specialized, sandboxed components with constrained network access.

How teams detect issues like this

Detection generally involves both code-level and operational approaches:

  • Static analysis and code review checks aimed at identifying outbound HTTP clients that accept user-controlled URLs, particularly in webhook and migration code paths.
  • Review of URL normalization and allow-list logic, looking for gaps such as unhandled redirects, lack of canonicalization, or missing checks for private and loopback address ranges.
  • Application-level logging of outbound requests, including resolved destination IPs and hostnames, so anomalous or unexpected internal targets can be identified.
  • Security testing and automated scanning (including SSRF-focused test cases) against webhook and migration endpoints to surface bypasses in allow-list implementations.

Sources

SourceLink
blog.gitea.comblog.gitea.com/release-of-1.26.3-and-1.26.4/
github.comgithub.com/go-gitea/gitea/pull/38059
github.comgithub.com/go-gitea/gitea/pull/38173
github.comgithub.com/go-gitea/gitea/releases/tag/v1.26.3
github.comgithub.com/go-gitea/gitea/security/advisories/GHSA-2r5c-gw76-rh3w

Frequently asked

questions

Yes, in typical deployments it can be exploited remotely by users who can configure webhooks or initiate repository migrations, provided Gitea can reach internal or restricted network targets.

Usually, an attacker needs at least authenticated access sufficient to create or edit webhooks or to start repository migrations, which are often available to project maintainers or equivalent roles.

The most robust pattern is to combine strict URL canonicalization and allow-listing with network-level egress controls that prevent Gitea from reaching sensitive internal services, ensuring outbound requests are confined to explicitly trusted targets.

Future prevention hinges on treating all user-supplied URLs as untrusted, centralizing outbound request handling behind hardened utilities or services, and integrating SSRF-focused reviews and tests into regular development, security review, and CI/CD workflows.

Find out what's already
exploitable in your codebase.