SSRF (Server-Side Request Forgery) in code.gitea.io/gitea (CVE-2026-58441)
Summary
SSRF in code.gitea.io/gitea (CVE-2026-58441). Confidential information can be exposed externally. Exploitable via GET /ssrf-proof/info/refs. Mitigation: upgrade to 1.27.0 or later.
Original description
The description as published by the source.
Summary
Gitea's restore-repo CLI command restores a repository from a dump
directory/archive. When parsing pull_request.yml from that dump, the
Head.CloneURL field is used to add a git remote and fetch from it with
no validation, because the safety check that's supposed to guard it
(CheckAndEnsureSafePR) is called with an empty commonCloneBaseURL,
which silently disables it. This lets a malicious dump make the Gitea
server execute git fetch against an attacker-chosen URL (SSRF), or
disclose a local git repository via file://. This is a different root
cause from the recently fixed path-traversal issue in the same command
(#38215), which patched DownloadURL/PatchURL but not Head.CloneURL.
Details
services/migrations/restore.go's GetPullRequests() unmarshals
pull_request.yml directly into base.PullRequest structs with no
validation of Head.CloneURL:
err = yaml.Unmarshal(bs, &pulls)
...
for _, pr := range pulls {
if pr.PatchURL != "" {
pr.PatchURL = "file://" + util.FilePathJoinAbs(r.baseDir, pr.PatchURL)
}
CheckAndEnsureSafePR(pr, "", r) // <-- empty baseURL
}
CheckAndEnsureSafePR (services/migrations/common.go) is supposed to
reject Head.CloneURL/PatchURL values that don't share a common base
URL:
func hasBaseURL(toCheck, baseURL string) bool {
if len(baseURL) > 0 && baseURL[len(baseURL)-1] != '/' {
baseURL += "/"
}
return strings.HasPrefix(toCheck, baseURL)
}
func Check…
Source: GitHub Security Advisories (Global) NVD GitHub Advisory
Auto-generated summary
Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.
A vulnerability tracked as CVE-2026-58441 has been found in code.gitea.io/gitea.
Attackers can target a specific entry point like GET /ssrf-proof/info/refs over the network to misuse the product.
Confidential information can be exposed externally. CVSS score: 6.3/10.
What to do: upgrade code.gitea.io/gitea to 1.27.0 or later.
If unsure, ask your IT team or search "code.gitea.io/gitea CVE-2026-58441" on the vendor's site.
CVE-2026-58441 (code.gitea.io/gitea) — CWE-918 / CVSS v3 6.3
Attack vector: local / unauthenticated
Attack surface: GET /ssrf-proof/info/refs / Head.CloneURL / CheckAndEnsureSafePR / commonCloneBaseURL
Patched: 1.27.0 — apply immediately
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.
SSRF (CWE-918) exists in code.gitea.io/gitea. Attackers reach the vulnerable code path via GET /ssrf-proof/info/refs without authentication.
Check the vendor advisory for the affected versions of code.gitea.io/gitea. Attack surface: GET /ssrf-proof/info/refs / Head.CloneURL / CheckAndEnsureSafePR / commonCloneBaseURL.
Severity: Medium (CVSS 6.3/10). Confidential information can be exposed externally.
Update to 1.27.0.
Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.
Search webserver/proxy logs for unusual GET /ssrf-proof/info/refs requests with malformed payloads or SQL meta-characters. Run grep -r 'code.gitea.io/gitea' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.
Response actions
Concrete steps and command examples for SOC/SRE teams to execute in order
-
1Identify exposure identify
grep -r 'code.gitea.io/gitea' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
code.gitea.io/giteaを grep し、稼働しているサービス・バージョンを把握する。 -
2Hunt for indicators of compromise detect
grep 'GET /ssrf-proof/info/refs' /var/log/nginx/access.log | grep -E '(unusual_payload|sqli_pattern)'アクセスログで
GET /ssrf-proof/info/refsへの異常なリクエスト (不正な認証ヘッダ・SQLメタ文字)を過去 30〜90日分捜索。WAF/SIEM があれば該当パスのアラート発火履歴を確認。 -
3Apply patch patch
Upgrade code.gitea.io/gitea to 1.27.0ステージング環境で 1.27.0 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスと、Step 2 で見つけた異常検知の続報チェックを含めること。
-
4Post-deployment verification verify
Replay attack against GET /ssrf-proof/info/refs on staging to confirm patch closes the vectorパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番では Step 2 と同じログクエリでアラート再発が無いか継続監視。
Affected packages
References
- package github.com
- web github.com
- web github.com
- web github.com
- web blog.gitea.com