CVE-2022-30781
Description
Gitea before 1.16.7 does not escape git fetch remote.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Gitea before 1.16.7 does not escape git fetch remote, allowing remote code execution via crafted repository URLs.
Vulnerability
CVE-2022-30781 is a remote code execution vulnerability in Gitea, a self-hosted Git service. The bug resides in the handling of git fetch remote URLs; the software fails to escape or sanitize the remote parameter before passing it to the underlying Git command. This allows an attacker who can create or modify repository remotes to inject arbitrary Git arguments. The issue affects Gitea versions prior to 1.16.7 [1][3].
Exploitation
An attacker must have the ability to create or edit a repository, or to control a remote URL used in a fetch operation (for example, by configuring a malicious remote in a repository they have write access to). No user interaction is required beyond the fetch operation being triggered (e.g., by a repository mirror or manual fetch). The attacker crafts a remote URL containing special characters or Git command options. When Gitea executes git fetch with this unescaped remote, the injected options are interpreted by Git, enabling arbitrary command execution [1][3].
Impact
Successful exploitation allows the attacker to achieve remote code execution (RCE) on the Gitea server, with the privileges of the Gitea process. This can lead to full compromise of the Git data, sensitive information disclosure, and potentially lateral movement within the hosting environment [1][4].
Mitigation
The vulnerability is fixed in Gitea version 1.16.7, released on 2022-05-16 [1][3][4]. The fix escapes the remote parameter before passing it to the Git fetch command. Users running Gitea versions prior to 1.16.7 should upgrade immediately. There is no known workaround for unpatched installations. CVE-2022-30781 is not currently listed in CISA's Known Exploited Vulnerabilities catalog.
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
code.gitea.io/giteaGo | < 1.16.7 | 1.16.7 |
Affected products
3- Gitea/Giteadescription
- osv-coords2 versions
< 1.16.7+ 1 more
- (no CPE)range: < 1.16.7
- (no CPE)range: < 1.16.7
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
8- github.com/advisories/GHSA-p5f9-c9j9-g8qxghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-30781ghsaADVISORY
- packetstormsecurity.com/files/168400/Gitea-1.16.6-Remote-Code-Execution.htmlghsaWEB
- packetstormsecurity.com/files/169928/Gitea-Git-Fetch-Remote-Code-Execution.htmlghsaWEB
- blog.gitea.io/2022/05/gitea-1.16.7-is-releasedghsaWEB
- github.com/go-gitea/gitea/pull/19487ghsaWEB
- github.com/go-gitea/gitea/pull/19490ghsaWEB
- blog.gitea.io/2022/05/gitea-1.16.7-is-released/mitre
News mentions
0No linked articles in our index yet.