GHSA-wj44-9vcg-wjq7

Suggest an improvement
Source
https://github.com/advisories/GHSA-wj44-9vcg-wjq7
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/06/GHSA-wj44-9vcg-wjq7/GHSA-wj44-9vcg-wjq7.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-wj44-9vcg-wjq7
Aliases
  • CVE-2024-56731
Published
2025-06-24T19:00:20Z
Modified
2025-06-24T20:12:11.571508Z
Severity
  • 10.0 (Critical) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H CVSS Calculator
Summary
Gogs allows deletion of internal files which leads to remote command execution
Details

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

+   // 🚨 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.

Database specific
{
    "nvd_published_at": "2025-06-24T04:15:45Z",
    "cwe_ids": [
        "CWE-552"
    ],
    "severity": "CRITICAL",
    "github_reviewed": true,
    "github_reviewed_at": "2025-06-24T19:00:20Z"
}
References

Affected packages

Go / gogs.io/gogs

Package

Name
gogs.io/gogs
View open source insights on deps.dev
Purl
pkg:golang/gogs.io/gogs

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.13.3

Database specific

{
    "last_known_affected_version_range": "<= 0.13.2"
}