{"id":"CVE-2024-56731","aliases":["GHSA-wj44-9vcg-wjq7","GO-2025-3776"],"url":"https://o3.security/vulnerability/CVE-2024-56731","summary":"Gogs deletion of internal files allows 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.","published":"2025-06-24T03:37:42.327Z","modified":"2026-08-12T03:51:09.276366167Z","cvss":{"score":10,"severity":"CRITICAL","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"},"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"Go","name":"gogs.io/gogs","fixedVersion":"0.13.3"}],"fix":{"url":"https://github.com/gogs/gogs/commit/77a4a945ae9a87f77e392e9066b560edb71b5de9","label":"gogs/gogs@77a4a94"},"references":[{"type":"WEB","url":"https://github.com/gogs/gogs/releases/tag/v0.13.3"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/56xxx/CVE-2024-56731.json"},{"type":"ADVISORY","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":"FIX","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"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:09.276366167Z"}}