Critical Gitea Remote Code Execution via Git Hooks
Score: 8/10

Critical Gitea Remote Code Execution via Git Hooks

An authenticated attacker with repository write access can achieve remote code execution by exploiting an add/add collision in Gitea's diffpatch endpoint to plant a malicious Git hook.

Executive Summary

A critical vulnerability, tracked as CVE-2026-60004 with a CVSS score of 9.8, has been identified in the Gitea self-hosted Git platform. The flaw allows users with repository write permissions to execute arbitrary shell commands as the Gitea service account. While exploitation requires authentication, Gitea's default configuration allows open registration, effectively enabling unauthenticated attackers to create accounts and execute this attack on unchanged installations.

The technical root cause involves Gitea's handling of patches in shared bare temporary clones. By submitting a specific patch twice, an attacker can trigger a three-way fallback collision that writes an executable file to the Git hooks directory. This hook is subsequently executed by the Git process during index updates, bypassing intended security controls.

Impacted organizations include any entity running Gitea versions 1.17 through 1.27.0. Successful exploitation could lead to full compromise of the Gitea instance, including access to database credentials, application secrets, and hosted source code. Upgrading to version 1.27.1 is the primary recommended mitigation.

Key Details

Threat Name

CVE-2026-60004

Affects

Gitea versions 1.17 and later before 1.27.1, Gitea >=1.17, <1.27.1

Adversary

—

Malware/Tools

None identified

Report Score

8out of 10
Quality Score
Good
IOC Quality5
TTP Details10
Detection Guidance6
Enterprise Relevance9
Clarity & Structure9
Technical Depth10

Sources