CVE-2025-68939

8.2 HIGH

📋 TL;DR

This vulnerability in Gitea allows attackers to bypass file extension restrictions by manipulating attachment names through the attachment API. Attackers can upload files with normally forbidden extensions, potentially enabling malicious file execution or storage. All Gitea instances running versions before 1.23.0 are affected.

💻 Affected Systems

Products:
  • Gitea
Versions: All versions before 1.23.0
Operating Systems: All platforms running Gitea
Default Config Vulnerable: ⚠️ Yes
Notes: Affects all Gitea deployments regardless of configuration. The vulnerability is in the attachment API functionality.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers could upload executable files (like .php, .sh) that get executed on the server, leading to remote code execution, data theft, or complete system compromise.

🟠

Likely Case

Attackers upload malicious files (like HTML with XSS, malware) that get served to users, enabling client-side attacks, phishing, or malware distribution.

🟢

If Mitigated

With proper file validation and execution restrictions, impact is limited to storage of unauthorized file types without execution capability.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires API access, which typically requires authentication. The vulnerability is straightforward to exploit once authenticated.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.23.0

Vendor Advisory: https://blog.gitea.com/release-of-1.23.0/

Restart Required: Yes

Instructions:

1. Backup your Gitea instance and database. 2. Download Gitea 1.23.0 or later from https://github.com/go-gitea/gitea/releases. 3. Stop the Gitea service. 4. Replace the Gitea binary with the new version. 5. Restart the Gitea service. 6. Verify the version shows 1.23.0 or higher.

🔧 Temporary Workarounds

Disable Attachment API

all

Temporarily disable the attachment API endpoint to prevent exploitation

Modify Gitea configuration to remove or restrict attachment API access

Web Application Firewall Rules

all

Add WAF rules to block attachment name manipulation attempts

Add rules to detect and block requests with modified attachment names in API calls

🧯 If You Can't Patch

  • Implement strict file upload validation at the reverse proxy/load balancer level
  • Restrict attachment API access to trusted users only using authentication and authorization controls

🔍 How to Verify

Check if Vulnerable:

Check if Gitea version is below 1.23.0 using the version command or web interface

Check Version:

./gitea --version

Verify Fix Applied:

Confirm Gitea version is 1.23.0 or higher and test that forbidden file extensions cannot be uploaded via attachment API

📡 Detection & Monitoring

Log Indicators:

  • API requests to attachment endpoints with unusual file extensions
  • Failed file upload attempts with normally blocked extensions suddenly succeeding

Network Indicators:

  • Unusual spikes in attachment API traffic
  • Uploads of files with executable extensions

SIEM Query:

source="gitea.log" AND ("attachment" OR "upload") AND (extension="php" OR extension="sh" OR extension="exe")

🔗 References

📤 Share & Export