Gitea: Remote code execution via repository auto-init race condition (CVE-2026-125423)
A race condition in Gitea's repository auto-initialization process allows an authenticated attacker to perform remote code execution by overwriting a server-side Git hook via a malicious symlink.
CVE search metadata
CVE search record: CVE-2026-125423. KEV: no. Product: Gitea. Brief: Gitea: Remote code execution via repository auto-init race condition (CVE-2026-125423). Brief link: https://feed.craftedsignal.io/briefs/2026-11-gitea-rce-cve-2026-125423/
Triage facts
Revision 1- Applicability
- Gitea
- Evidence
- Unknown
- Severity
- High
- Action
- Immediate escalation
- Sources
- 5 public sources
- Freshness
- Revision 1Nov 16, 11:46 UTC
- Vulnerabilities
- 1 CVE
- Source quality
- A1Very likely
Overview
CVE-2026-125423 is a race condition vulnerability in Gitea's auto-initialization feature. A repository with auto-init enabled could accept pushes before initialization was finalized. An attacker could exploit this timing window to push a specially crafted Git tree containing a symbolic link named README.md, which pointed to a server-side Git hook file. When Gitea's internal process performed the initial commit, it followed the symlink and overwrote the hook file with repository content, including attacker-controlled shell commands. The subsequent execution of the Git hook runs the injected commands as the Gitea system service user. The vulnerability has been addressed in Gitea 28.4.0.
Attack Chain
- Attacker calls the Gitea API to create a new repository with
auto_init=true. - Attacker initiates a push to the new repository during the window before the server-side auto-initialization is complete.
- Attacker pushes a custom Git tree where
README.mdis a symlink pointing to the internal server-side Git hook path (e.g.,post-receive.d/gitea). - Gitea's
auto-initprocess performs a checkout of the repository, creating the symlink on the filesystem. - Gitea automatically writes default README content, which follows the symlink and overwrites the intended Git hook with attacker-supplied code contained in the repository description.
- The internal initialization process triggers a push, causing the Git post-receive hook to execute the injected shell commands as the Gitea service user.
Impact
Successful exploitation grants the attacker remote code execution capabilities on the server running the Gitea service with the privileges of the Gitea system user. This does not provide root access or container escape unless the service itself is running with elevated privileges.
Recommendation
Upgrade all Gitea installations to version 28.4.0 or later immediately. Note that disabling Actions or the internal hook editor does not mitigate this vulnerability. Organizations should perform an immediate audit of repository creation logs to identify suspicious auto-init activity.
Immediate actions
Upgrade Gitea to version 28.4.0 or later on all internet-facing instances.
Threat Hunt
Investigate Gitea repository creation events where auto-init is enabled, specifically identifying API-based repository creation followed by immediate pushes or modifications to server-side hook directories.
Data: Gitea server access logs, Gitea repository creation audit logs, Filesystem integrity logs for gitea-repositories/ hooks directories
Mitigations
Patch Gitea to 28.4.0.
CVE-2026-125423