CVE-2026-52797: Gogs: Overwriting critical files results in a denial of service
Vulnerability type: Path Traversal
Impact: DoS
Exploitation prerequisite: authorized user
Description: As an authorized user, an intruder can dictate the value which is passed to the git diff command which, together with bypassing the filtering of the passed value, allows the user to bypass the target directory and write the result of the comparison to any arbitrary path.
Researcher: Artyom Kulakov (Positive Technologies)
Mitigation:
- https://github.com/gogs/gogs/blob/b7372b1f32cd0bb40984debfb049e3fc04efaee4/internal/route/repo/editor.go#L307 — on this line, instead of the
treePathvariable, which comes directly from the user unchanged, we should first filter and then pass theentryvariable. - To filter the
treePathvariable, it is better to use the preexistingpathutil.Cleanfunction instead ofpath.Cleanfrom the standard Go library.
References
Code Behaviors & Features
Detect and mitigate CVE-2026-52797 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →