The Gitea diffpatch-to-git-hook chain is a trust boundary collapse, not merely a code injection flaw. The diffpatch API was built to safely parse untrusted user-submitted code diffs—input you explicitly cannot trust. Git hooks were built to let repository administrators persist server-side code that executes on git operations. These two features should never have been composable, yet the vulnerability chains them: a user with repository access submits a crafted patch that installs a git hook rather than applying a code change. The hook then executes server-side on every subsequent git operation against that repository.
What makes this severe beyond its 9.8 CVSS score is the persistence mechanism. Unlike a memory corruption bug that vanishes on process restart, a successfully installed hook survives version upgrades. Patching Gitea closes the exploitation vector but leaves the artifact behind—an attacker who compromised an account last month could have planted hooks that remain dormant, waiting for legitimate users to push code. An organization that upgrades without auditing existing repositories for malicious hooks remains exposed indefinitely.
The blast radius also extends laterally. The initial attacker needs repository access, but once a hook is installed, it executes in the server's context on operations from any user cloning, pulling, or pushing to that repository. Compromised accounts can be suspended, the diffpatch API can be patched—but the hook persists and detonates through innocent collaborators who had no role in the original compromise.
For remediation: upgrade Gitea immediately, but treat this as necessary and insufficient. Audit every repository on the instance for unexpected files in .git/hooks/ and for any hook configurations in the Gitea database that weren't explicitly created by administrators. The question of whether this was a regression introduced in a specific version or existed since the hook feature's original implementation matters for determining how far back you need to search for artifacts—this detail should be tracked as Gitea publishes patch specifics.
The pattern of a safe parser feeding a privileged executor has appeared repeatedly in CVE history—file upload handlers becoming PHP execution vectors, markdown renderers escaping to command injection. Treat this as a class of vulnerability, not an isolated flaw. Similar self-hosted git platforms (Forgejo, GitLab, Gogs) likely contain analogous interaction surfaces between parsing code and privileged operations that warrant proactive review.