CVE-2024-56731 — Vulnerability in gogs.io/gogs — CVE Details
Gogs allows deletion of internal files which leads to remote command execution
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (2.24%). Schedule for your next planned update.
Does your project use an affected gogs.io/gogs version?
Paste your go.sum to check it for CVE-2024-56731 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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.
Advisory Timeline
- First published June 24, 2025 (520 days ago).
- Last revised July 28, 2025 — 34 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
go get gogs.io/gogs@v0.13.3
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: Go (1).
| Package | Fixed In |
|---|---|
| gogs.io/gogs Go · Affected: All versions | 0.13.3 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-552
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 10.0 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
References
- https://github.com/gogs/gogs/security/advisories/GHSA-wj44-9vcg-wjq7WEB
- https://nvd.nist.gov/vuln/detail/CVE-2024-56731ADVISORY
- https://github.com/gogs/gogs/commit/77a4a945ae9a87f77e392e9066b560edb71b5de9WEB
- https://github.com/advisories/GHSA-ccqv-43vm-4f3wADVISORY
- https://github.com/gogs/gogsPACKAGE
- https://github.com/gogs/gogs/releases/tag/v0.13.3WEB
Frequently Asked Questions
- What is CVE-2024-56731?
- Gogs allows deletion of internal files which leads to remote command execution. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 10.0/10).
- How do I check if my project is affected by CVE-2024-56731?
- CVE-2024-56731 affects gogs.io/gogs. It has a 2.2% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-56731 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Maximum impact if exploited, often with little effort or access required.
This places it in the top quartile of EPSS-scored vulnerabilities — 83.5% of tracked vulnerabilities score at or below it, so it is more likely to be exploited than most of the tracked corpus.
Also Known As
Related CVEs
- CVE-2022-1986CRITICAL
OS Command Injection in file editor in Gogs
- CVE-2026-52811CRITICAL
Gogs: UploadRepoFiles writes outside repo working tree via committed parent sym
- CVE-2026-52806CRITICAL
Gogs vulnerable to RCE via git rebase --exec argument injection in pull request merge
- CVE-2024-39930CRITICAL
Gogs has an argument Injection in the built-in SSH server
- CVE-2024-55947HIGH
Path Traversal in file update API in gogs
- CVE-2024-54148HIGH
Remote Command Execution in file editing in gogs
- CVE-2026-26022HIGH
Gogs: Stored XSS via data URI in issue comments
- CVE-2026-52816MEDIUM
Gogs's Unauthenticated Jupyter Notebook (ipynb) Sanitizer allows arbitrary data: URIs leading to XSS