# CVE-2026-58420: Gitea Local File Inclusion in Migration Restore

Source: https://junglewise.ai/threats/cve-2026-58420-gitea-local-file-inclusion-in-migration-restore  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-21. Updated: 2026-07-21  
License: CC BY 4.0 with a link back

CVE-2026-58420 · Severity: medium · CVSS 4 · Published 2026-07-21

Gitea, a popular self-hosted Git service, is vulnerable to a security flaw in its repository restoration feature. An attacker with administrative or operator access can use a specially crafted backup file to trick the server into reading sensitive files from its own storage, such as database passwords, private encryption keys, and system configuration files. This could lead to a full compromise of the server's data and connected services.

Technologies: [Gitea](https://junglewise.ai/threats/technologies/gitea), [gitea.dev (Go)](https://junglewise.ai/threats/technologies/gitea-dev). Vendors: [Gitea](https://junglewise.ai/threats/vendors/gitea), [Go](https://junglewise.ai/threats/vendors/go).

## Quick answers

**Is CVE-2026-58420 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-58420 being exploited in the wild.

**How severe is CVE-2026-58420?** Medium severity, with a CVSS score of 4, published 21 July 2026.

**Which products and versions are affected?** Gitea < 1.27.0; gitea.dev (Go) < 1.27.0, SEMVER:introduced=0,fixed=1.27.0.

**Is there a fix for CVE-2026-58420?** Yes. gitea.dev (Go): upgrade to 1.27.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-58420 attacked?** It is attacked with local access, in a network appliance.

**Am I affected by CVE-2026-58420?** Check whether you run Gitea or gitea.dev (Go) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- gitea.dev (Go): upgrade to 1.27.0 or later

  ```sh
  go get gitea.dev@v1.27.0
  ```


## Technical details

A Local File Inclusion (LFI) vulnerability exists in Gitea's 'restore-repo' command due to insufficient scheme validation in the URI processing logic. The 'DownloadURL' field within a user-supplied 'release.yml' file is passed to the 'uri.Open()' function, which supports the 'file://' scheme via 'os.Open()'. An attacker with the ability to execute the restoration command or provide a malicious archive to an administrator can exfiltrate sensitive files (e.g., 'app.ini', SSH keys) by mapping them as release attachments. The vulnerability is rooted in 'services/migrations/gitea_uploader.go' and 'modules/uri/uri.go'. A fix is available in version 1.27.0 which restricts allowed URI schemes.

## Affected products

- Gitea Gitea < 1.27.0

## Identifiers

- CVE-2026-58420
- GHSA-5ggr-2f2h-jmvm
- GO-2026-6032

## Timeline

- 2026-07-13: disclosed: Initial disclosure to vendor
- 2026-07-21: advisory: GitHub Advisory published

## References

- [https://api.github.com/users/isa0-gh](https://api.github.com/users/isa0-gh)
- [https://github.com/isa0-gh](https://github.com/isa0-gh)
- [https://api.github.com/users/isa0-gh/gists%7B/gist_id%7D](https://api.github.com/users/isa0-gh/gists%7B/gist_id%7D)
- [https://api.github.com/users/isa0-gh/repos](https://api.github.com/users/isa0-gh/repos)
- [https://avatars.githubusercontent.com/u/240864963?v=4](https://avatars.githubusercontent.com/u/240864963?v=4)
- [https://api.github.com/users/isa0-gh/events%7B/privacy%7D](https://api.github.com/users/isa0-gh/events%7B/privacy%7D)

## Related threats

- [Gitea account takeover via OAuth2 auto-linking](https://junglewise.ai/threats/cve-2026-120263-when-oauth2-client-account-linking-is-set-to-auto-not-the)
- [Gitea limited-visibility profile disclosure via public-only token](https://junglewise.ai/threats/cve-2026-119627-the-web-profile-and-rss-atom-feed-routes-of-users-and)
- [Gitea token scope bypass in web routes](https://junglewise.ai/threats/cve-2026-119625-the-username-web-route-accepted-personal-access-tokens-over-http)
- [Gitea project boards information disclosure of private pull requests](https://junglewise.ai/threats/cve-2026-119533-repository-and-organization-project-boards-listed-the-pull)
- [Gitea API token scope bypass in repository deletion](https://junglewise.ai/threats/cve-2026-119441-delete-api-v1-orgs-org-repos-deletes-all-repositories-of-an)
