CVE-2024-56731: Gogs.io/gogs Gogs Allows Deletion Of Internal Vulnerability
CRITICALCVE-2024-56731 is a CRITICAL (CVSS 10.0) gogs allows deletion of internal vulnerability (CWE-552: Files or Directories Accessible to External Parties) affecting Gogs.io/gogs libraries in the Go ecosystem. The issue involves gogs allows deletion of internal files which leads to remote command execution. Remediation is available by upgrading affected packages to version 0.13.3.
CVE-2024-56731 at a Glance
Security Impact
CVSS: 10.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2024-56731
To remediate this vulnerability, upgrade all affected Gogs.io/gogs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade gogs.io/gogs to 0.13.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for gogs.io/gogs
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-56731, inspect your project dependencies for Gogs.io/gogs:
inspect dependencies for gogs.io/gogs
Analyze the terminal output to locate any version of Gogs.io/gogs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.13.3), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-552: Files or Directories Accessible to External Parties, where the product makes files or directories accessible to unauthorized actors, even though they should not be. In Gogs.io/gogs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-56731 Affected Gogs.io/gogs Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
gogs.io/gogs
|
Go |
< 0.13.3
|
0.13.3
|
References
Frequently Asked Questions
What is CVE-2024-56731?
Which Gogs.io/gogs versions are affected?
What version fixes CVE-2024-56731?
Is gogs.io/gogs affected?
What is the CVSS score of CVE-2024-56731?
What CWE is associated with CVE-2024-56731?
How can I check Go dependencies for CVE-2024-56731?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-wj44-9vcg-wjq7",
"modified" : "2025-06-24T19:00:21Z",
"published" : "2025-06-24T19:00:20Z",
"aliases" : [ "CVE-2024-56731" ],
"summary" : "Gogs allows deletion of internal files which leads to remote command execution",
"details" : "### Summary\nDue 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.\n\n### Details\nIn the patch for CVE-2024-39931, the following check is added:\nhttps://github.com/gogs/gogs/commit/77a4a945ae9a87f77e392e9066b560edb71b5de9\n\n```diff\n+\t// 🚨 SECURITY: Prevent uploading files into the \".git\" directory\n+\tif isRepositoryGitPath(opts.TreePath) {\n+\t\treturn errors.Errorf(\"bad tree path %q\", opts.TreePath)\n+\t}\n```\n\n\nWhile 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.\n\n### Impact\nUnprivileged 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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "gogs.io/gogs"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.13.3"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.13.2"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/gogs/gogs/security/advisories/GHSA-wj44-9vcg-wjq7"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-56731"
}, {
"type" : "WEB",
"url" : "https://github.com/gogs/gogs/commit/77a4a945ae9a87f77e392e9066b560edb71b5de9"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-ccqv-43vm-4f3w"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/gogs/gogs"
}, {
"type" : "WEB",
"url" : "https://github.com/gogs/gogs/releases/tag/v0.13.3"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-552" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2025-06-24T19:00:20Z",
"nvd_published_at" : "2025-06-24T04:15:45Z"
}
}