
CVE-2026-60004
diffpatch Git Hook
A critical Remote Code Execution (RCE) vulnerability allowing arbitrary command execution through the diffpatch API endpoint by abusing Git hook execution.
CVE-2026-60004 is a Critical Remote Code Execution (RCE) vulnerability affecting Gitea. The flaw exists in the implementation of the diffpatch endpoint, where specially crafted patches can abuse Git's hook mechanism during patch application.
Successful exploitation allows an authenticated attacker with repository write permissions to execute arbitrary commands on the Gitea server with the privileges of the Gitea service.
Gitea 1.27.1
The vulnerability originates from the POST /api/v1/repos/{owner}/{repo}/diffpatch endpoint.
A malicious patch can introduce a Git hook into a temporary repository created during patch processing. When Git subsequently executes repository operations, the injected hook runs automatically, resulting in arbitrary command execution on the server.
An attacker typically requires:
⚠️ Instances with public user registration enabled are at significantly higher risk.
Successful exploitation may allow attackers to:
Attacker
│
▼
Craft malicious diff patch
│
▼
POST /api/v1/repos/.../diffpatch
│
▼
Git applies patch
│
▼
Malicious Git Hook installed
│
▼
Git executes hook
│
▼
Arbitrary Command Execution
Internet
│
▼
Authenticated User
│
▼
diffpatch API
│
▼
Temporary Git Repository
│
▼
Git Hook Execution
│
▼
Remote Code Execution
Immediately:
diffpatch requests.Investigators should look for:
/diffpatch| Category | Rating |
|---|---|
| Exploitability | 🔴 Very High |
| Impact | 🔴 Critical |
| Complexity | 🟢 Low |
| Public Exposure | 🟠 High |
✔ Upgrade immediately.
✔ Monitor API logs.
✔ Restrict repository permissions.
✔ Disable unused registration features.
✔ Rotate secrets if compromise is suspected.
✔ Continuously monitor Git hook integrity.
This repository is intended solely for educational, defensive, and research purposes.
The information provided here aims to help security professionals understand, detect, and mitigate the vulnerability. Do not use this information against systems without explicit authorization.
⭐ Stay updated with the latest security advisories and keep your software patched.
| Metric | Value |
|---|
| CVE | CVE-2026-60004 |
| Severity | 🔴 Critical |
| CVSS v3.1 | 9.8 |
| Attack Vector | Network |
| Privileges Required | Low (Repository Write Access) |
| User Interaction | None |
| Impact | Remote Code Execution |
| Patch Availability | ✅ Yes |
| Property | Value |
|---|
| CWE | Improper Control of Code Execution Through Git Hooks |
| Component | diffpatch API |
| Exploitation | Remote |
| Authentication | Required |
| RCE | ✅ Yes |
| Public PoC | ✅ Available |