CVE-2024-44625

8.8 HIGH

📋 TL;DR

This directory traversal vulnerability in Gogs allows attackers to read, write, or delete arbitrary files on the server by manipulating file paths in edit requests. It affects all Gogs installations running version 0.13.0 or earlier. Attackers can potentially achieve remote code execution by writing malicious files to sensitive locations.

💻 Affected Systems

Products:
  • Gogs
Versions: <= 0.13.0
Operating Systems: All operating systems running Gogs
Default Config Vulnerable: ⚠️ Yes
Notes: All Gogs installations with the vulnerable version are affected regardless of configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, and lateral movement within the network.

🟠

Likely Case

Unauthorized file access and modification, potentially leading to data leakage, service disruption, or privilege escalation.

🟢

If Mitigated

Limited impact with proper file system permissions and network segmentation, potentially only allowing file reads in restricted directories.

🌐 Internet-Facing: HIGH - Exploitable remotely without authentication, making internet-facing instances immediate targets.
🏢 Internal Only: HIGH - Even internal instances are vulnerable to insider threats or compromised internal systems.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Public technical details and proof-of-concept are available, making exploitation straightforward for attackers.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.14.0

Vendor Advisory: https://gogs.io/

Restart Required: Yes

Instructions:

1. Backup your Gogs data and configuration. 2. Download Gogs 0.14.0 or later from the official website. 3. Stop the Gogs service. 4. Replace the binary with the new version. 5. Restart the Gogs service. 6. Verify the version is updated.

🔧 Temporary Workarounds

Network Access Restriction

linux

Restrict network access to Gogs instances to only trusted IP addresses

iptables -A INPUT -p tcp --dport 3000 -s trusted_ip_range -j ACCEPT
iptables -A INPUT -p tcp --dport 3000 -j DROP

File System Hardening

all

Run Gogs with minimal file system permissions using containerization or restricted user accounts

docker run -d --name gogs -p 3000:3000 -v /path/to/gogs/data:/data gogs/gogs:latest

🧯 If You Can't Patch

  • Implement strict network segmentation and firewall rules to limit access to Gogs instances
  • Deploy web application firewall (WAF) rules to detect and block directory traversal patterns

🔍 How to Verify

Check if Vulnerable:

Check the Gogs version by accessing the web interface and viewing the footer, or run: ./gogs --version

Check Version:

./gogs --version

Verify Fix Applied:

Verify the version is 0.14.0 or higher and test file editing functionality with path traversal attempts

📡 Detection & Monitoring

Log Indicators:

  • Unusual file path patterns in edit requests
  • Failed file operations with path traversal sequences
  • Multiple edit requests to non-repository paths

Network Indicators:

  • HTTP requests containing '../' sequences in file parameters
  • Unusual file write operations to system directories

SIEM Query:

source="gogs.log" AND ("../" OR "..\" OR "%2e%2e%2f") AND ("edit" OR "POST /repo/edit")

🔗 References

📤 Share & Export