CVE-2022-27313

7.5 HIGH

📋 TL;DR

CVE-2022-27313 is an arbitrary file deletion vulnerability in Gitea that allows attackers to delete the configuration file, causing a Denial of Service. This affects Gitea v1.16.3 installations where attackers can exploit the vulnerability to disrupt service availability.

💻 Affected Systems

Products:
  • Gitea
Versions: v1.16.3
Operating Systems: All platforms running Gitea
Default Config Vulnerable: ⚠️ Yes
Notes: All Gitea v1.16.3 installations are vulnerable regardless of configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service disruption requiring manual restoration of configuration files and potential data corruption if other critical files are deleted.

🟠

Likely Case

Temporary service outage until configuration file is restored from backup, causing downtime for users.

🟢

If Mitigated

Minimal impact with proper access controls, monitoring, and backup procedures in place.

🌐 Internet-Facing: HIGH - Internet-facing Gitea instances are directly exposed to potential attackers.
🏢 Internal Only: MEDIUM - Internal instances still vulnerable to insider threats or compromised internal systems.

🎯 Exploit Status

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

Exploitation requires some level of access to the Gitea instance, though specific authentication requirements are not detailed in available references.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: v1.16.4 and later

Vendor Advisory: https://github.com/go-gitea/gitea/pull/19072

Restart Required: Yes

Instructions:

1. Backup your Gitea configuration and data. 2. Stop Gitea service. 3. Update to Gitea v1.16.4 or later. 4. Restart Gitea service. 5. Verify service is running correctly.

🔧 Temporary Workarounds

Restrict file permissions

linux

Set strict file permissions on configuration files to prevent deletion

chmod 600 /path/to/gitea/config/app.ini
chown gitea:gitea /path/to/gitea/config/app.ini

Network segmentation

all

Restrict network access to Gitea instance to trusted sources only

🧯 If You Can't Patch

  • Implement strict access controls and monitoring for configuration file access
  • Maintain regular backups of configuration files and test restoration procedures

🔍 How to Verify

Check if Vulnerable:

Check Gitea version: if running v1.16.3, the system is vulnerable.

Check Version:

gitea --version

Verify Fix Applied:

Verify Gitea version is v1.16.4 or later and test that configuration file cannot be deleted via the vulnerability.

📡 Detection & Monitoring

Log Indicators:

  • Unauthorized file deletion attempts in Gitea logs
  • Configuration file modification or deletion events in system logs

Network Indicators:

  • Unusual API calls to file deletion endpoints from unexpected sources

SIEM Query:

source="gitea.log" AND ("delete" OR "remove") AND "config"

🔗 References

📤 Share & Export