/

CVE-2026-104636

Severity:

HIGH RISK

(7.5)

Server-Side Request Forgery (CWE-918) in Gitea Git Client

CVE-2026-104636

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery

CWE:

CWE-918

Impact:

Unauthorized outbound requests to restricted or internal services

Severity:

HIGH RISK

(7.5)

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 did not revalidate destinations after following HTTP redirects during certain Git operations, including push mirror updates, wiki remote checks, and migrated pull request head fetches. A repository administrator could use an allowed endpoint that redirects to a blocked address, potentially causing the server to contact internal services or other destinations permitted only by the configured outbound policy.

Gitea did not revalidate destinations after following HTTP redirects during certain Git operations, including push mirror updates, wiki remote checks, and migrated pull request head fetches. A repository administrator could use an allowed endpoint that redirects to a blocked address, potentially causing the server to contact internal services or other destinations permitted only by the configured outbound policy.

Affected context

The vulnerability occurs in Gitea workflows that perform raw Git network operations after validating a remote URL. It is relevant where repository administrators can configure or influence remote endpoints and where the Git client follows HTTP redirects without applying the same destination policy to the final address. The practical impact depends on the outbound network controls and services reachable from the Gitea host.

The vulnerability occurs in Gitea workflows that perform raw Git network operations after validating a remote URL. It is relevant where repository administrators can configure or influence remote endpoints and where the Git client follows HTTP redirects without applying the same destination policy to the final address. The practical impact depends on the outbound network controls and services reachable from the Gitea host.

Exploit preconditions

  • Attack surface: Gitea Git operations involving push mirrors, wiki remotes, or migrated pull request heads
  • Required access: Repository administrator privileges or equivalent ability to configure or influence a policy-allowed remote endpoint
  • Trigger point: A Git request that follows an HTTP redirect to a different destination
  • Why exploitation is possible: The initial URL is checked, but the redirected destination is not revalidated against the outbound host policy
  • Attack surface: Gitea Git operations involving push mirrors, wiki remotes, or migrated pull request heads
  • Required access: Repository administrator privileges or equivalent ability to configure or influence a policy-allowed remote endpoint
  • Trigger point: A Git request that follows an HTTP redirect to a different destination
  • Why exploitation is possible: The initial URL is checked, but the redirected destination is not revalidated against the outbound host policy

Why this happens

The underlying bug is inconsistent validation across a multi-step network request. Gitea validated the initial remote URL but trusted the HTTP client's redirected destination without applying the same allowlist or blocklist rules again. This behavior maps to CWE-918: Server-Side Request Forgery, because attacker-influenced input can cause the server to initiate requests to destinations that should not be reachable under the configured policy.

The underlying bug is inconsistent validation across a multi-step network request. Gitea validated the initial remote URL but trusted the HTTP client's redirected destination without applying the same allowlist or blocklist rules again. This behavior maps to CWE-918: Server-Side Request Forgery, because attacker-influenced input can cause the server to initiate requests to destinations that should not be reachable under the configured policy.

Potential impact

  • Gitea may send requests to internal or otherwise restricted services
  • Internal service metadata or responses could be exposed through application behavior or logs
  • Network-level access controls could be bypassed for destinations reachable from the Gitea host
  • Sensitive services may receive unintended Git or HTTP requests
  • The impact could extend to connected systems depending on network placement and service authentication
  • Gitea may send requests to internal or otherwise restricted services
  • Internal service metadata or responses could be exposed through application behavior or logs
  • Network-level access controls could be bypassed for destinations reachable from the Gitea host
  • Sensitive services may receive unintended Git or HTTP requests
  • The impact could extend to connected systems depending on network placement and service authentication

General mitigation guidance

Mitigation generally focuses on treating every redirect destination as untrusted and enforcing outbound request policy throughout the complete request lifecycle.

Common defensive patterns include:

  • Revalidating each redirect target against an explicit destination allowlist
  • Disabling automatic redirects for security-sensitive Git operations where practical
  • Restricting outbound connectivity from Gitea to only required services and networks
  • Separating Gitea from sensitive internal management and metadata endpoints
  • Requiring explicit approval for repository remote and mirror configuration
  • Running the service with least-privilege network and identity permissions
  • Applying consistent URL parsing, DNS, IP-range, and redirect handling rules across all network clients

Mitigation generally focuses on treating every redirect destination as untrusted and enforcing outbound request policy throughout the complete request lifecycle.

Common defensive patterns include:

  • Revalidating each redirect target against an explicit destination allowlist
  • Disabling automatic redirects for security-sensitive Git operations where practical
  • Restricting outbound connectivity from Gitea to only required services and networks
  • Separating Gitea from sensitive internal management and metadata endpoints
  • Requiring explicit approval for repository remote and mirror configuration
  • Running the service with least-privilege network and identity permissions
  • Applying consistent URL parsing, DNS, IP-range, and redirect handling rules across all network clients

How teams detect issues like this

Organizations can look for SSRF risks through:

  • Static analysis of HTTP and Git client code for redirect-following behavior without destination revalidation
  • Code review checks for URL validation performed only before a network request begins
  • Tests covering redirects between public, private, loopback, link-local, and otherwise restricted address ranges
  • Network monitoring for unexpected connections from Gitea to internal services or unusual external destinations
  • Audit logging of repository remote, mirror, and migration configuration changes
  • Egress firewall and service-mesh policies that alert on or deny unauthorized destinations

Automated security review tools may help identify incomplete redirect validation and unsafe outbound request patterns.

Organizations can look for SSRF risks through:

  • Static analysis of HTTP and Git client code for redirect-following behavior without destination revalidation
  • Code review checks for URL validation performed only before a network request begins
  • Tests covering redirects between public, private, loopback, link-local, and otherwise restricted address ranges
  • Network monitoring for unexpected connections from Gitea to internal services or unusual external destinations
  • Audit logging of repository remote, mirror, and migration configuration changes
  • Egress firewall and service-mesh policies that alert on or deny unauthorized destinations

Automated security review tools may help identify incomplete redirect validation and unsafe outbound request patterns.

Sources

SourceLink
blog.gitea.comblog.gitea.com/release-of-28.0.0/
github.comgithub.com/go-gitea/gitea/pull/39426
github.comgithub.com/go-gitea/gitea/releases/tag/v28.0.0
github.comgithub.com/go-gitea/gitea/security/advisories/GHSA-g4hw-fg4c-89mq

Frequently asked

questions

Exploitability depends on the Gitea deployment and the privileges available to configure or influence remote endpoints. It is not necessarily exploitable by an unauthenticated external user.

The relevant access is typically repository administrator control over push mirrors, wiki remotes, or migration-related sources, together with a server-side network path to the redirected destination.

Apply outbound destination policy to every redirect target, or avoid automatic redirects for security-sensitive operations. Network-level egress restrictions provide an additional defensive layer.

Treat redirects, resolved IP addresses, and externally supplied URLs as untrusted; centralize request validation; test private and restricted address ranges; and monitor outbound traffic from application servers.

Exploitability depends on the Gitea deployment and the privileges available to configure or influence remote endpoints. It is not necessarily exploitable by an unauthenticated external user.

The relevant access is typically repository administrator control over push mirrors, wiki remotes, or migration-related sources, together with a server-side network path to the redirected destination.

Apply outbound destination policy to every redirect target, or avoid automatic redirects for security-sensitive operations. Network-level egress restrictions provide an additional defensive layer.

Treat redirects, resolved IP addresses, and externally supplied URLs as untrusted; centralize request validation; test private and restricted address ranges; and monitor outbound traffic from application servers.

Find out what's already
exploitable in your codebase.