{"id":"CVE-2024-56731","aliases":["CVE-2024-56731","GHSA-wj44-9vcg-wjq7","GO-2025-3776"],"related":[],"kind":"vulnerability","state":"published","title":"Gogs deletion of internal files allows remote command execution","summary":"Gogs is an open source self-hosted Git service. Prior to version 0.13.3, it's still possible to delete files under the .git directory and achieve remote command execution due to an insufficient patch for CVE-2024-39931. Unprivileged user accounts can execute arbitrary commands on the Gogs instance with the privileges of the account specified by RUN_USER in the configuration. Allowing attackers to access and alter any users' code hosted on the same instance. This issue has been patched in version 0.13.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Gogs is an open source self-hosted Git service. Prior to version 0.13.3, it's still possible to delete files under the .git directory and achieve remote command execution due to an insufficient patch for CVE-2024-39931. Unprivileged user accounts can execute arbitrary commands on the Gogs instance with the privileges of the account specified by RUN_USER in the configuration. Allowing attackers to access and alter any users' code hosted on the same instance. This issue has been patched in version 0.13.3.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Gogs allows deletion of internal files which leads to remote command execution in gogs.io/gogs","format":"markdown","source":"go"},{"lang":"es","text":"Gogs es un servicio Git autoalojado de código abierto. Antes de la versión 0.13.3, aún era posible eliminar archivos del directorio .git y ejecutar comandos de forma remota debido a un parche insuficiente para CVE-2024-39931. Las cuentas de usuario sin privilegios pueden ejecutar comandos arbitrarios en la instancia de Gogs con los privilegios de la cuenta especificada por RUN_USER en la configuración. Esto permite a los atacantes acceder y modificar el código de cualquier usuario alojado en la misma instancia. Este problema se ha corregido en la versión 0.13.3.","source":"nvd"}],"published":"2025-06-24T03:37:42.327Z","modified":"2026-06-17T08:12:51.593Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"}],"cwes":["CWE-552"],"affected":[{"ranges":[{"version":"< 0.13.3","status":"affected"}],"vendor":"gogs","product":"gogs","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.13.3"}],"ecosystem":"Go","package":"gogs.io/gogs","purl":"pkg:golang/gogs.io/gogs","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.13.3"}],"ecosystem":"Go","package":"gogs.io/gogs","purl":"pkg:golang/gogs.io/gogs","source":"go"},{"ranges":[{"status":"affected","fixed":"0.13.3"}],"vendor":"gogs","product":"gogs","cpe":"cpe:2.3:a:gogs:gogs:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/gogs/gogs/security/advisories/GHSA-wj44-9vcg-wjq7","tags":["advisory","patch","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/gogs/gogs/commit/77a4a945ae9a87f77e392e9066b560edb71b5de9","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/gogs/gogs/releases/tag/v0.13.3","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-56731","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/advisories/GHSA-ccqv-43vm-4f3w","tags":["advisory","web"],"sources":["ghsa","go"]},{"url":"https://github.com/gogs/gogs","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"total","date":"2025-06-24T15:25:08.585Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-56731","url":"https://www.cve.org/CVERecord?id=CVE-2024-56731","licence":"CVE Terms of Use","modified":"2025-06-25T12:43:04.424Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-wj44-9vcg-wjq7","url":"https://github.com/advisories/GHSA-wj44-9vcg-wjq7","licence":"CC-BY-4.0","modified":"2025-07-28T20:42:04.801Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2025-3776","url":"https://pkg.go.dev/vuln/GO-2025-3776","licence":"CC-BY-4.0","modified":"2026-03-03T04:57:20.223Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-56731","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-56731","licence":"Public domain","modified":"2026-06-17T08:12:51.593Z"}],"updatedAt":"2026-11-25T22:58:52.759Z","epss":{"score":0.01266,"percentile":0.70572,"date":"2026-12-01T12:00:22.000Z"}}