/

CVE-2026-34966

Severity:

HIGH RISK

(7.6)

Server-Side Request Forgery (CWE-918) in Gitea Fetch

CVE-2026-34966

Deferred

Vulnerability type

Category:

Server-Side Request Forgery

CWE:

CWE-918

Impact:

Unauthorized access to internal services, sensitive data disclosure, and credential exposure

Severity:

HIGH RISK

(7.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

Gitea contains a server-side request forgery vulnerability in HTTP fetch operations used by migration and OAuth avatar workflows. An authenticated attacker may provide crafted URLs to reach internal services, cloud metadata endpoints, or local files, with retrieved content potentially persisted as migration release assets.

Affected context

The vulnerability can occur in Gitea deployments that use affected migration or OAuth avatar code paths to fetch attacker-influenced URLs. These operations rely on Go's default HTTP client behavior without a custom network dialer that restricts destinations, so requests may reach network locations that should not be accessible from the server.

Exploit preconditions

  • Attack surface: HTTP fetch operations in repository migration and OAuth avatar workflows
  • Required access: An authenticated Gitea account with access to a feature that accepts or processes attacker-controlled URLs
  • Trigger point: Processing release asset download URLs, pull-request patch URLs, or OAuth avatar endpoints
  • Why exploitation is possible: The fetch logic does not consistently enforce destination restrictions through a custom DialContext, allowing server-side requests to attacker-selected internal or local targets

Why this happens

The underlying flaw is insufficient validation and network-level enforcement for server-side URL fetching. Using a default HTTP client without a restricted dialing policy allows application-controlled requests to resolve and connect to destinations such as private network services or cloud metadata endpoints. This behavior maps to CWE-918: Server-Side Request Forgery, because attacker-influenced URLs are fetched from the application's network context without adequate destination controls.

Potential impact

  • Internal services may be probed or accessed from the Gitea server
  • Cloud instance metadata and temporary credentials could be disclosed
  • Local application files may be read where supported by the fetch path
  • Database credentials, signing secrets, or other configuration data could be exposed
  • Retrieved content may be persisted as migration release assets for later retrieval
  • Internal network reconnaissance or follow-on compromise could occur

General mitigation guidance

Mitigation generally focuses on reducing trust in user-supplied URLs and enforcing outbound network boundaries.

Common defensive patterns include:

  • Use an HTTP client with a restrictive dialer and explicit destination allowlist
  • Reject loopback, link-local, private, multicast, and reserved address ranges after hostname resolution
  • Restrict or disable unsupported URL schemes and avoid file-oriented fetch behavior
  • Revalidate destinations across redirects and prevent DNS-rebinding bypasses
  • Separate URL retrieval from sensitive service networks through egress controls
  • Avoid persisting fetched content unless its origin and purpose have been validated
  • Run the application with minimal network and filesystem privileges

How teams detect issues like this

Organizations can identify SSRF risks through:

  • Static analysis rules for HTTP requests constructed from user-controlled URLs
  • Code review checks for default clients used without restricted dialing or redirect policies
  • Review of migration, avatar, webhook, import, and asset-fetching features
  • Runtime monitoring for outbound connections to loopback, private, link-local, and metadata addresses
  • Egress firewall policies and proxy logs that flag unexpected internal or cloud-control-plane access
  • Automated security review tools that identify missing URL validation and network-boundary enforcement

Sources

SourceLink
github.comgithub.com/go-gitea/gitea
github.comgithub.com/go-gitea/gitea/commit/b969123b7fac51c88daab5cb64e5b2f4abd53288
github.comgithub.com/go-gitea/gitea/security/advisories/GHSA-2wm4-vwp6-v7xc
vulncheck.comvulncheck.com/advisories/gitea-prior-to-ssrf-via-migration-uri-fetch-bypass

Frequently asked

questions

It may be exploitable through Gitea's network-facing features, but exploitation generally requires an authenticated user who can influence one of the affected URL-fetching operations.

The key prerequisite is authenticated access with sufficient ability to submit or trigger a release asset, pull-request patch, migration, or OAuth avatar URL that the server will fetch.

Use a restricted HTTP client that validates schemes, resolves destinations safely, blocks private and metadata address ranges, limits redirects, and applies explicit outbound network policies.

Treat all user-supplied URLs as untrusted, enforce egress filtering, monitor outbound requests, minimize application privileges, and review every server-side fetch path for consistent destination controls.

Find out what's already
exploitable in your codebase.