GITEA.DEV · CVE-2026-125423 · Package
FIX → 28.4.0
An authenticated user who can create and push to a repository can race repository creation with auto-init so that a symlinked README overwrites a server-side Git hook. The hook then runs commands as the operating-system account running Gitea.
first public Nov 15, 2026 · 2 sources
Check it with your coding agent
It reads this page and tells you if your code or app is affected.
Teams that run a self-hosted Gitea server where regular users can create repositories and push to them. The sources say exploitation needs a race and a compatible server-side filesystem layout with symlink support, and that the default README path is required. Teams on managed hosting or on a version above 28.3.0 are not affected.
Not affected if auto-init-disabled, fixed-version, managed-hosting
Who cares git-hosting, gitea, self-hosted
gitea --version or check the Gitea server version and compare it with 28.4.0.DISABLE_GIT_HOOKS set; the sources say this setting does not close the chain.auto_init is used with the Default README template on repository creation.Upgrade to 28.4.0
An authenticated, non-administrative user who can create a repository and push to it can execute commands as the operating-system account running Gitea by racing repository creation with auto_init=true. The new repository can accept an external push before its initialization has finished. If the attacker’s ref becomes visible before Gitea clones the repository for initial-commit generation, Gitea checks out the attacker-controlled tree into a temporary directory. In the tested scenario, README.md is a Git symlink with mode 120000, pointing to the existing server-side hooks/post-receive.d/gitea file. Gitea subsequently writes the generated README using os.WriteFile, which follows the symlink and overwrites the executable delegate hook. The generated README contains the user-controlled repository description. Gitea’s internal initialization push then invokes post-receive, causing the overwritten hook to be executed. I confirmed command execution in an isolated laboratory on Gitea 28.3.0, 28.2.0, 1.27.1, 1.25.5 with SQLite, MySQL and PostgreSQL. Exploitation requires winning the race and a compatible server-side filesystem layout. It does not require an administrator account, SSH access, Actions, a runner, or permission to edit Git hooks through Gitea. I am not claiming unauthenticated exploitation, root access, container escape, or compromise of the underlying host.
The issue affects the interaction between:
The repository accepts pushes before initialization finishes CreateRepositoryDirectly creates the repository database record before calling initRepository: services/repository/create.go:254-260 - repository record creation; services/repository/create.go:276-295 - storage validation and initialization; services/repository/create.go:145-180 - bare repository, hooks, and initial-content initialization. A concurrent HTTP push is handled independently. The Git HTTP path in routers/web/repo/githttp.go loads the newly created repository and checks permissions, but does not wait for auto_init to complete before starting git receive-pack. This does not rely on push-to-create. The push happens after the repository record has been created but before initialization has finished.
Are you affected?
Ask from here. InfraStack checks the affected versions against your stack and answers in your inbox.
InfraStack checks the affected versions against your stack and answers in Slack, with the evidence and the fix.
InfraStack checks it against your stack and answers on your report, with the evidence and the fix.
28.4.0 (affected up to and including 28.3.0).The pushed tree contains a symlink as README.md
The object is constructed using Git plumbing commands, so the client operating system does not need to create a local symlink. This is a valid Git symlink entry rather than a malformed object.
Relevant locations: services/repository/create.go:80-94 - description substitution; options/readme/Default:1-3 - default README template; services/repository/create.go:99-102 - file write. Because README.md already exists as a symlink, os.WriteFile opens its target for writing and truncates it. There is no check that the existing path is a regular file and no descriptor-based protection against following symlinks. The 0644 mode does not remove permissions from an existing target. The delegate hook was previously created with its executable bit, so it remains executable after being overwritten.
The repository description becomes the hook body The default README starts with a Markdown heading such as # <repository-name> The shell treats that line as a comment. The attacker-controlled repository description appears later in the file without shell escaping. Once this content has replaced the hook, the description is interpreted as shell commands. This is not command injection into an existing shell command. The underlying problem is that user-controlled content is written through a symlink into an executable server-side file.
The internal initialization push executes the hook initRepoCommit stages the files, creates the initial commit, and pushes it to the managed repository. During this push, Git invokes post-receive. The normal dispatcher in modules/git/hooks.go iterates over executable files under hooks/post-receive.d/. At this point, however, the gitea delegate contains the overwritten README content rather than the normal gitea hook ... post-receive invocation. GITEA_INTERNAL_PUSH=true does not prevent this execution. That check belongs to the normal Go hook implementation, while the overwritten shell hook is invoked by Git before such a check could run.
Required conditions:
The current payload assumes the standard relative layout in which the temporary worktree and repository storage are located under the same application data hierarchy. Nonstandard temporary paths, repository roots, or disabled server-side symlink support may prevent this particular payload. I did not test whether those configurations are generally safe. [security].DISABLE_GIT_HOOKS=true does not by itself close this chain: the internal delegate hooks are still created and used during repository initialization.
A regular authenticated user who is permitted to create and push to a repository can cross the expected boundary between repository ownership and server-side command execution. Successful exploitation provides command execution with the privileges of the operating-system account running Gitea. Within those privileges, this can affect the confidentiality, integrity, and availability of repositories, configuration, credentials, database contents, and other resources accessible to the service. No victim interaction is required. Administrative privileges, Actions, and runner access are not required. However, exploitation depends on winning the race and on the server-side environment satisfying the conditions described above.
NVD data is provided by NIST and is public domain. Posts quoted belong to their authors.