Share
## https://sploitus.com/exploit?id=A75FDED4-BAAB-54BD-B2B5-17CBAA08D285
# ๐จ CVE-2026-60004 - RCE
### Critical Remote Code Execution in Gitea via `diffpatch` Git Hook
*A critical Remote Code Execution (RCE) vulnerability allowing arbitrary command execution through the `diffpatch` API endpoint by abusing Git hook execution.*
---
# ๐ Overview
**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.
---
# ๐ฅ Severity
| 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 |
---
# ๐ฏ Affected Products
- Gitea **1.17**
- Gitea **1.18**
- Gitea **1.19**
- Gitea **1.20**
- Gitea **1.21**
- Gitea **1.22**
- Gitea **1.23**
- Gitea **1.24**
- Gitea **1.25**
- Gitea **1.26**
- Gitea **1.27.0**
---
# โ
Fixed Version
```
Gitea 1.27.1
```
---
# โก Vulnerability Summary
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.
---
# ๐ Attack Requirements
An attacker typically requires:
- Authenticated account
- Ability to create or modify a repository
- Write permission to the repository
> โ ๏ธ Instances with public user registration enabled are at significantly higher risk.
---
# ๐ฅ Potential Impact
Successful exploitation may allow attackers to:
- Execute arbitrary operating system commands
- Completely compromise the Gitea server
- Access private repositories
- Steal SSH keys
- Obtain CI/CD secrets
- Extract API tokens
- Access deployment credentials
- Move laterally across internal infrastructure
---
# ๐ Exploitation Flow
```text
Attacker
โ
โผ
Craft malicious diff patch
โ
โผ
POST /api/v1/repos/.../diffpatch
โ
โผ
Git applies patch
โ
โผ
Malicious Git Hook installed
โ
โผ
Git executes hook
โ
โผ
Arbitrary Command Execution
```
---
# ๐ Attack Surface
```
Internet
โ
โผ
Authenticated User
โ
โผ
diffpatch API
โ
โผ
Temporary Git Repository
โ
โผ
Git Hook Execution
โ
โผ
Remote Code Execution
```
---
# ๐ก Mitigation
Immediately:
- Upgrade to **Gitea 1.27.1** or newer.
- Disable public registration if unnecessary.
- Restrict repository creation.
- Limit repository write permissions.
- Monitor unusual `diffpatch` requests.
- Audit Git repositories for unauthorized hooks.
- Rotate exposed credentials if compromise is suspected.
---
# ๐ Indicators of Compromise
Investigators should look for:
- Unexpected Git hook files
- Suspicious child processes spawned by Gitea
- Unknown shell executions
- Unusual API calls to `/diffpatch`
- Unauthorized repository modifications
- Unexpected outbound network connections
---
# ๐ Risk Assessment
| Category | Rating |
|----------|---------|
| Exploitability | ๐ด Very High |
| Impact | ๐ด Critical |
| Complexity | ๐ข Low |
| Public Exposure | ๐ High |
| Patch Availability | โ
Yes |
---
# ๐ Technical Details
| Property | Value |
|----------|-------|
| CWE | Improper Control of Code Execution Through Git Hooks |
| Component | `diffpatch` API |
| Exploitation | Remote |
| Authentication | Required |
| RCE | โ
Yes |
| Public PoC | โ
Available |
---
# ๐จ Security Recommendations
โ Upgrade immediately.
โ Monitor API logs.
โ Restrict repository permissions.
โ Disable unused registration features.
โ Rotate secrets if compromise is suspected.
โ Continuously monitor Git hook integrity.
---
# ๐ Disclaimer
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.
---
### โ ๏ธ Patch Immediately โ Internet-Accessible Gitea Instances May Be at Significant Risk
โญ Stay updated with the latest security advisories and keep your software patched.