/

CVE-2026-70357

Severity:

HIGH RISK

(7.5)

SSRF (CWE-918) in Gitea Repository Migration Workflow

CVE-2026-70357

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Unauthorized network access to internal or restricted 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's repository migration flow validates a destination hostname against network allow and block lists before starting a Git clone, but the Git subprocess resolves and connects independently. If an attacker can initiate a migration and control the destination's DNS, they may redirect the connection after validation to a blocked internal address.

Gitea's repository migration flow validates a destination hostname against network allow and block lists before starting a Git clone, but the Git subprocess resolves and connects independently. If an attacker can initiate a migration and control the destination's DNS, they may redirect the connection after validation to a blocked internal address.

Affected context

The issue can arise in deployments that:

  • Allow users or integrations to start repository migrations
  • Validate migration destinations before invoking Git
  • Permit the Git subprocess to perform its own hostname resolution
  • Rely on hostname-based network allow and block lists without enforcing the same policy at connection time

Risk depends on the permissions available to migration initiators and the network reachability of the process running Git.

The issue can arise in deployments that:

  • Allow users or integrations to start repository migrations
  • Validate migration destinations before invoking Git
  • Permit the Git subprocess to perform its own hostname resolution
  • Rely on hostname-based network allow and block lists without enforcing the same policy at connection time

Risk depends on the permissions available to migration initiators and the network reachability of the process running Git.

Exploit preconditions

  • Attack surface: Repository migration and Git clone functionality
  • Required access: Permission to initiate a repository migration
  • Attacker capability: Control over the destination hostname's DNS responses
  • Trigger point: Git connects to the migration destination after preliminary validation
  • Why exploitation is possible: The validation component and Git subprocess resolve the hostname independently, creating a time-of-check-to-time-of-use gap that can allow a later connection to a restricted address
  • Attack surface: Repository migration and Git clone functionality
  • Required access: Permission to initiate a repository migration
  • Attacker capability: Control over the destination hostname's DNS responses
  • Trigger point: Git connects to the migration destination after preliminary validation
  • Why exploitation is possible: The validation component and Git subprocess resolve the hostname independently, creating a time-of-check-to-time-of-use gap that can allow a later connection to a restricted address

Why this happens

The vulnerability is caused by applying network policy checks to one connection path while allowing a separate subprocess to resolve and connect to the destination independently.

This creates a DNS-based time-of-check-to-time-of-use condition: the address considered safe during validation may differ from the address used by Git. The behavior maps to CWE-918: Server-Side Request Forgery, because attacker-influenced destination handling can cause the server to make requests to unintended internal or restricted network locations.

The vulnerability is caused by applying network policy checks to one connection path while allowing a separate subprocess to resolve and connect to the destination independently.

This creates a DNS-based time-of-check-to-time-of-use condition: the address considered safe during validation may differ from the address used by Git. The behavior maps to CWE-918: Server-Side Request Forgery, because attacker-influenced destination handling can cause the server to make requests to unintended internal or restricted network locations.

Potential impact

  • The application may connect to internal services that were intended to be blocked.
  • An attacker could potentially access metadata endpoints or administrative interfaces reachable from the migration worker.
  • Internal service information could be disclosed through migration errors, responses, or side effects.
  • Network segmentation controls may be weakened for the process performing the Git operation.
  • The application may connect to internal services that were intended to be blocked.
  • An attacker could potentially access metadata endpoints or administrative interfaces reachable from the migration worker.
  • Internal service information could be disclosed through migration errors, responses, or side effects.
  • Network segmentation controls may be weakened for the process performing the Git operation.

General mitigation guidance

Mitigation generally focuses on enforcing destination policy at the actual connection boundary rather than only during preliminary hostname validation.

Common defensive patterns include:

  • Resolve and validate destinations using a trusted, controlled networking layer.
  • Ensure the Git operation uses the same validated address and policy context as the initial check.
  • Revalidate connections after redirects, redirects-equivalent transitions, and DNS changes where applicable.
  • Prefer explicit destination allowlists and reduce reliance on mutable hostname resolution.
  • Block private, loopback, link-local, and other restricted address ranges at egress controls.
  • Run migration workers with minimal network reachability and least-privilege permissions.

Mitigation generally focuses on enforcing destination policy at the actual connection boundary rather than only during preliminary hostname validation.

Common defensive patterns include:

  • Resolve and validate destinations using a trusted, controlled networking layer.
  • Ensure the Git operation uses the same validated address and policy context as the initial check.
  • Revalidate connections after redirects, redirects-equivalent transitions, and DNS changes where applicable.
  • Prefer explicit destination allowlists and reduce reliance on mutable hostname resolution.
  • Block private, loopback, link-local, and other restricted address ranges at egress controls.
  • Run migration workers with minimal network reachability and least-privilege permissions.

How teams detect issues like this

Organizations can look for SSRF and validation-bypass risks through:

  • Static analysis rules identifying hostname validation followed by independent subprocess or library connections.
  • Code review checks for DNS resolution performed separately by validators and network clients.
  • Tests that exercise DNS changes between validation and connection without relying on fixed destination assumptions.
  • Egress policy monitoring for migration workers connecting to private, link-local, loopback, or management network ranges.
  • Runtime logging that correlates requested hostnames, resolved addresses, and actual connection targets.

Automated security review tools may help identify mismatched validation and connection paths, but network-level telemetry remains important for confirmation.

Organizations can look for SSRF and validation-bypass risks through:

  • Static analysis rules identifying hostname validation followed by independent subprocess or library connections.
  • Code review checks for DNS resolution performed separately by validators and network clients.
  • Tests that exercise DNS changes between validation and connection without relying on fixed destination assumptions.
  • Egress policy monitoring for migration workers connecting to private, link-local, loopback, or management network ranges.
  • Runtime logging that correlates requested hostnames, resolved addresses, and actual connection targets.

Automated security review tools may help identify mismatched validation and connection paths, but network-level telemetry remains important for confirmation.

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-p3pc-g8m5-hrrr

Frequently asked

questions

It may be exploitable through the repository migration interface when that interface is exposed to an attacker who can start migrations. The attacker generally also needs influence over the destination hostname's DNS behavior.

Usually, the relevant migration permission is required. The practical access requirement depends on how Gitea exposes and authorizes repository migration operations.

Enforce network restrictions at the connection layer used by Git, ensuring that the address actually contacted is validated against the same policy as the requested destination.

Keep hostname resolution, policy evaluation, and connection establishment within one controlled path, combine this with restrictive egress rules, and test for DNS changes between validation and use.

It may be exploitable through the repository migration interface when that interface is exposed to an attacker who can start migrations. The attacker generally also needs influence over the destination hostname's DNS behavior.

Usually, the relevant migration permission is required. The practical access requirement depends on how Gitea exposes and authorizes repository migration operations.

Enforce network restrictions at the connection layer used by Git, ensuring that the address actually contacted is validated against the same policy as the requested destination.

Keep hostname resolution, policy evaluation, and connection establishment within one controlled path, combine this with restrictive egress rules, and test for DNS changes between validation and use.

Find out what's already
exploitable in your codebase.