Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-70357 Overview
CVE-2026-70357 is a Server-Side Request Forgery (SSRF) vulnerability in Gitea's repository migration feature. Gitea validates migration hostnames against configured network allow and block lists before invoking Git. The Git subprocess then independently resolves the hostname when it establishes its connection. An attacker who can initiate a migration and control the destination's DNS can change the resolved address between validation and connection. This time-of-check to time-of-use (TOCTOU) gap enables access to blocked internal addresses through the Git clone operation. The flaw is tracked under CWE-918 and was addressed in Gitea v28.0.0.
Critical Impact
Authenticated users with migration permissions can bypass network allow and block lists to reach internal services via DNS rebinding during Git clone operations.
Affected Products
- Gitea versions prior to v28.0.0
- Repository migration HTTP client and Git subprocess invocation path
- Self-hosted Gitea deployments relying on network allow/block list enforcement
Discovery Timeline
- 2026-10-06 - CVE-2026-70357 published to NVD
- 2026-10-07 - Last updated in NVD database
- Patch released in Gitea v28.0.0 via Pull Request #39426
Technical Details for CVE-2026-70357
Vulnerability Analysis
Gitea's migration workflow performs hostname validation inside the migration HTTP client's dialer. The dialer checks the resolved IP against configured allow and block lists before any request leaves the server. The validation path and the Git subprocess invocation path are decoupled. When Gitea spawns Git to clone the remote repository, Git performs its own DNS resolution independently. An attacker who controls the authoritative DNS server for the target hostname can return a safe public IP during Gitea's validation lookup, then return an internal IP such as 127.0.0.1, 169.254.169.254, or an RFC1918 address during Git's subsequent lookup. The Git subprocess connects to the attacker-chosen internal address with Gitea's network privileges. The flaw bypasses the SSRF protections intended by the allow/block list configuration.
Root Cause
The root cause is a TOCTOU race between hostname validation in Gitea's HTTP dialer and independent DNS resolution performed by the Git subprocess. Validation and connection do not share a resolved IP address or a pinned socket.
Attack Vector
An authenticated attacker with permission to start a repository migration submits a URL pointing to a hostname they control. The attacker's DNS server returns short time-to-live (TTL) records that alternate between a public IP and a blocked internal IP. Gitea validates the public response and invokes Git, which resolves the hostname again and connects to the internal target. The vulnerability is described in GitHub Security Advisory GHSA-p3pc-g8m5-hrrr.
Detection Methods for CVE-2026-70357
Indicators of Compromise
- Repository migration jobs targeting hostnames whose authoritative DNS returns rapidly changing or dual-answer records
- Outbound Git connections from the Gitea host to internal RFC1918 addresses or cloud metadata endpoints such as 169.254.169.254
- Migration audit log entries referencing external hostnames paired with unexpected internal socket activity
Detection Strategies
- Correlate Gitea migration events with network flow logs to identify Git subprocess connections that do not match the validated destination IP
- Alert on DNS lookups from the Gitea server that return internal addresses for externally submitted hostnames
- Monitor the Gitea process tree for git subprocesses initiating TCP sessions to loopback, link-local, or RFC1918 ranges
Monitoring Recommendations
- Enable verbose logging on the Gitea migration subsystem and ship logs to a central analytics platform
- Capture DNS query/response pairs issued by the Gitea host for post-incident reconstruction
- Track access attempts to the cloud instance metadata service from any application host that is not expected to call it
How to Mitigate CVE-2026-70357
Immediate Actions Required
- Upgrade Gitea to v28.0.0 or later as published in the Gitea 28.0.0 release announcement
- Restrict repository migration permissions to trusted users until patching is complete
- Enforce egress firewall rules that block outbound connections from the Gitea host to internal management ranges and cloud metadata endpoints
Patch Information
The fix is included in Gitea v28.0.0 via Pull Request #39426. The patch aligns hostname validation with the actual connection path so the Git subprocess cannot reach a destination different from the one approved by the allow/block list dialer.
Workarounds
- Place the Gitea server behind an egress proxy that enforces destination IP policy for all outbound Git traffic
- Disable repository migration via the [migrations] configuration or by removing migration permissions from untrusted users
- Block the Gitea host from reaching the cloud instance metadata service and internal administrative subnets at the network layer
# Example egress restriction using iptables on the Gitea host
iptables -A OUTPUT -m owner --uid-owner git -d 169.254.169.254 -j REJECT
iptables -A OUTPUT -m owner --uid-owner git -d 10.0.0.0/8 -j REJECT
iptables -A OUTPUT -m owner --uid-owner git -d 172.16.0.0/12 -j REJECT
iptables -A OUTPUT -m owner --uid-owner git -d 192.168.0.0/16 -j REJECT
iptables -A OUTPUT -m owner --uid-owner git -d 127.0.0.0/8 -j REJECT
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

