CVE-2022-30781 Shell command injection in gitea

High 7.5 Published Updated

Attackers can execute arbitrary commands via unescaped git fetch remote inputs in Gitea, requiring an upgrade to secure the platform.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-30781?

CVE-2022-30781 is a high-severity command injection vulnerability in Gitea Gitea, published on 16 May 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Gitea before 1.16.7 does not escape git fetch remote.

Weakness: CWE-116

Which versions are affected by CVE-2022-30781?

4 open source packages ship an affected version, including code.gitea.io/gitea and gitea. It affects 1 product.

PackageAffectedFixed in
code.gitea.io/gitea GoAll versions1.16.7
code.gitea.io/gitea GoAll versions1.16.7
code.gitea.io/gitea GoAll versions1.16.7
gitea BitnamiAll versions1.16.7

Products include Gitea Gitea.

How do I fix CVE-2022-30781?

Upgrade code.gitea.io/gitea to 1.16.7 or later.

Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.

Is CVE-2022-30781 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-30781 exists.

Public exploit code: 1 Metasploit module, 1 Exploit-DB entry and 2 proofs of concept on GitHub.

All Gitea Gitea vulnerabilities

Sources

Also known as BIT-gitea-2022-30781, CLEANSTART-2025-TF34768, GHSA-p5f9-c9j9-g8qx, GO-2022-0450.

Is CVE-2022-30781 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free