ghsa-wj44-9vcg-wjq7
Vulnerability from github
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
diff
+ // 🚨 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.
{ "affected": [ { "database_specific": { "last_known_affected_version_range": "\u003c= 0.13.2" }, "package": { "ecosystem": "Go", "name": "gogs.io/gogs" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "0.13.3" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2024-56731" ], "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" }, "details": "### Summary\nDue to the insufficient patch for the CVE-2024-39931, it\u0027s 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// \ud83d\udea8 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\u0027 code hosted on the same instance.", "id": "GHSA-wj44-9vcg-wjq7", "modified": "2025-06-24T19:00:21Z", "published": "2025-06-24T19:00:20Z", "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" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H", "type": "CVSS_V3" } ], "summary": "Gogs allows deletion of internal files which leads to remote command execution" }
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.