Skip to main content

CVE-2024-56731 — Vulnerability in gogs.io/gogs — CVE Details

CRITICAL

Gogs allows deletion of internal files which leads to remote command execution

Published June 24, 2025Updated July 28, 2025Source: OSV

What Should I Do?

Address in Next Maintenance Window

Low exploitation probability (2.24%). Schedule for your next planned update.

Does your project use an affected gogs.io/gogs version?

Paste your go.sum to check it for CVE-2024-56731 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my go.sum

Summary

Summary

Due to the insufficient patch for the CVE-2024-39931, it's still possible to delete files under the .git directory and achieve remote command execution.

Details

In the patch for CVE-2024-39931, the following check is added: https://github.com/gogs/gogs/commit/77a4a945ae9a87f77e392e9066b560edb71b5de9

+	// 🚨 SECURITY: Prevent uploading files into the ".git" directory
+	if isRepositoryGitPath(opts.TreePath) {
+		return errors.Errorf("bad tree path %q", opts.TreePath)
+	}

While the above code snippet checks if the specified path is a .git directory, there are no checks for symbolic links in the later steps. So, by creating a symbolic link that points to the .git directory, an attacker can still delete arbitrary files in the .git directory and achieve remote command execution.

Impact

Unprivileged user accounts can execute arbitrary commands on the Gogs instance with the privileges of the account specified by RUN_USER in the configuration. It allows attackers to access and alter any users' code hosted on the same instance.

Advisory Timeline

  • First published June 24, 2025 (520 days ago).
  • Last revised July 28, 2025 — 34 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Go
Update gogs.io/gogs to 0.13.3 or later
go get gogs.io/gogs@v0.13.3

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: Go (1).

PackageFixed In
gogs.io/gogs Go · Affected: All versions0.13.3

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 10.0 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

Frequently Asked Questions

What is CVE-2024-56731?
Gogs allows deletion of internal files which leads to remote command execution. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 10.0/10).
How do I check if my project is affected by CVE-2024-56731?
CVE-2024-56731 affects gogs.io/gogs. It has a 2.2% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-56731 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
10.0

Maximum impact if exploited, often with little effort or access required.

EPSS Score (30-day exploit probability)
2.24%
EPSS percentile: 83.5

This places it in the top quartile of EPSS-scored vulnerabilities — 83.5% of tracked vulnerabilities score at or below it, so it is more likely to be exploited than most of the tracked corpus.

Also Known As

GHSA-wj44-9vcg-wjq7
GO-2025-3776

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my go.sum