{"schema_version":"1.7.3","id":"GHSA-wj44-9vcg-wjq7","published":"2025-06-24T19:00:20Z","modified":"2025-07-28T20:42:04.801588Z","aliases":["CVE-2024-56731","GO-2025-3776"],"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.","affected":[{"package":{"name":"gogs.io/gogs","ecosystem":"Go","purl":"pkg:golang/gogs.io/gogs"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.13.3"}]}],"database_specific":{"last_known_affected_version_range":"<= 0.13.2","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/06/GHSA-wj44-9vcg-wjq7/GHSA-wj44-9vcg-wjq7.json"}}],"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"],"github_reviewed":true,"github_reviewed_at":"2025-06-24T19:00:20Z","nvd_published_at":"2025-06-24T04:15:45Z","severity":"CRITICAL"},"severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"}]}