---
id: "CVE-2026-60004"
kind: "vulnerability"
aliases: ["CVE-2026-60004"]
title: "Gitea before 1.27.1 allows remote code execution via the diffpatch API through Git hook installation"
severity: "critical"
cvss: 9.8
epss: null
exploited: true
status: "open"
category: "package"
products: [{"name": "Gitea Gitea", "fixed": [], "affected": "", "ecosystem": "vendor"}, {"name": "gitea", "fixed": ["1.27.1"], "affected": ">= 1.17.0, < 1.27.1", "ecosystem": "go"}, {"name": "gitea", "fixed": ["1.27.1"], "affected": ">= 1.17.0, < 1.27.1", "ecosystem": "vendor"}]
ecosystems: ["go", "vendor"]
tags: ["exploited", "git", "gitea", "package", "rce", "self-hosted"]
not_affected_if: ["managed-hosting", "no-repo-write-access-for-untrusted-users", "patched-1.27.1"]
published_at: "2026-08-25T00:00:00+00:00"
first_seen_at: "2026-10-23T19:11:51+00:00"
updated_at: "2026-10-23T23:44:52+00:00"
sources: [{"source": "kev", "url": "https://www.cisa.gov/known-exploited-vulnerabilities-catalog?search_api_fulltext=CVE-2026-60004", "first_seen_at": "2026-10-23T19:11:51+00:00"}, {"source": "analyst", "url": null, "first_seen_at": "2026-10-23T21:41:23+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-60004", "first_seen_at": "2026-10-23T23:44:52+00:00"}]
---

# Gitea before 1.27.1 allows remote code execution via the diffpatch API through Git hook installation

Gitea's diffpatch endpoint can be abused to install a Git hook (hooks/post-index-change) in the temporary bare clone. Submitting the same patch twice triggers an add/add collision, and git apply -3 checks the file out into GIT_DIR. Any user with repo write access can run shell commands as the Gitea OS user. With default open registration, an anonymous visitor can register, create a repo and exploit it. CVSS 9.8. Exploited in the wild (CISA KEV, crypto-mining payloads reported).

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- vendor:Gitea Gitea affected ? fixed ?
- go:gitea affected >= 1.17.0, < 1.27.1 fixed 1.27.1
- vendor:gitea affected >= 1.17.0, < 1.27.1 fixed 1.27.1

## How to check

Check the Gitea version: 'gitea --version', or Site Administration > Dashboard, or GET /api/v1/version. Versions >= 1.17.0 and < 1.27.1 are vulnerable. Then check whether open registration is on (DISABLE_REGISTRATION=false in app.ini [service]). To look for compromise, search for unexpected branches or commits holding command output, unfamiliar new accounts and repos, and unknown processes such as miners running as the Gitea user. CISA requires forensic triage.

## Fix

Upgrade to Gitea 1.27.1 or later. Gitea Cloud is already upgraded automatically. If you cannot patch right away, the advisory gives no workaround. Reduce exposure by setting DISABLE_REGISTRATION=true and restricting access to the instance (my suggestion, not from the vendor). Rotate secrets and tokens held on the host if you suspect compromise.

## Timeline

- 2026-10-23T19:11:51+00:00 kev https://www.cisa.gov/known-exploited-vulnerabilities-catalog?search_api_fulltext=CVE-2026-60004
- 2026-10-23T21:41:23+00:00 analyst — Read Gitea GHSA-rcr6-4jqh-j84m (affected >=1.17, <1.27.1; fixed 1.27.1), BleepingComputer (CISA KEV 2026-08-25, crypto-miner exploitation reported), Gitea Cloud post (Cloud auto-upgraded). Advisory mentions an attached PoC but I found no public PoC link; no workaround stated. No X discussion worth saving.
- 2026-10-23T23:44:52+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-60004

## Documents

- [advisory] Gitea GHSA-rcr6-4jqh-j84m: RCE via diffpatch Git Hook Installation https://github.com/go-gitea/gitea/security/advisories/GHSA-rcr6-4jqh-j84m
- [describes] BleepingComputer: Hackers now exploit critical Gitea flaw https://www.bleepingcomputer.com/news/security/hackers-now-exploit-critical-gitea-flaw-in-code-injection-attacks/
- [fix] Gitea v1.27.1 for Cloud is released https://about.gitea.com/blog/gitea-cloud-release-1-27-1/

## From the sources

Gitea contains a code injection vulnerability that allows an attacker with repository write access to send a malicious patch to the diffpatch API endpoint to plant an executable Git hook and run shell commands as the Gitea service account.

CISA required action: Apply mitigations in accordance with vendor instructions, ensuring compliance with CISA’s BOD 26-04 Prioritizing Security Updates Based on Risk (see URL in Notes) guidance and CISA’s “Forensics Triage Requirements” (see URL in Notes). Follow applicable BOD 26-04 guidance for cloud services or discontinue use of the product if mitigations are unavailable. Stakeholders are responsible for evaluating each asset's internet exposure and ensuring adherence to BOD 26-04 patching guidelines.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
