Get a Demo

Let's Patch It!

Book a short call with one our specialists, we'll walk you through how Endor Patches work, and ask you a few questions about your environment (like your primary programming languages and repository management). We'll also send you an email right after you fill out the form, feel free to reply with any questions you have in advance!

CVE

CVE-2026-24135

Gogs vulnerable to arbitrary file deletion via Path Traversal in wiki page update
Back to all
CVE

CVE-2026-24135

Gogs vulnerable to arbitrary file deletion via Path Traversal in wiki page update

Summary

A Path Traversal vulnerability exists in the updateWikiPage function of Gogs. The vulnerability allows an authenticated user with write access to a repository's wiki to delete arbitrary files on the server by manipulating the old_title parameter in the wiki editing form.

Vulnerability Deatils

The vulnerability is located in internal/database/wiki.go. When updating a wiki page, the application accepts an old_title parameter to identify the potential rename operation. This parameter is used directly in path.Join and os.Remove without proper sanitization.

Code snippet from internal/database/wiki.go:

// Line 114
os.Remove(path.Join(localPath, oldTitle+".md"))

If an attacker provides a path traversal sequence (e.g., ../../../../target) as old_title, the os.Remove function will resolve the path relative to the wiki's local directory and delete the target file. The vulnerability is limited to deleting files that end with .md (due to the appended extension), but depending on the filesystem and specific path.Join behavior, or if critical .md files exist (e.g. documentation, other wikis), the impact is significant. Additionally, in some contexts, the extension might be bypassed or ignored.

Impact

  • Denial of Service: Deletion of critical configuration files or data (if they match the extension or via other tricks).
  • Data Loss: Deletion of other users' wiki pages or documentation.

Remediation

Sanitize the oldTitle parameter using ToWikiPageName (or path.Clean and basename validation) before using it in file operations, similar to how the new title is currently handled.

// Recommended Fix
if oldTitle != "" {
    oldTitle = ToWikiPageName(oldTitle)
}

Reproduction Steps

  1.  Log in to Gogs as a user with write access to a repository wiki.
  2.  Intercept the POST request to /repo/wiki/edit.
  3.  Modify the old_title parameter to ../../../../tmp/target_file.
  4.  Submit the request.
  5.  Observe that /tmp/target_file.md is deleted from the server.

Package Versions Affected

Package Version
patch Availability
No items found.

Automatically patch vulnerabilities without upgrading

Fix Without Upgrading
Detect compatible fix
Apply safe remediation
Fix with a single pull request

CVSS Version

Severity
Base Score
CVSS Version
Score Vector
C
H
U
7.2
-
4.0
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
C
H
U
0
-
C
H
U
8.1
-
3.1
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H

Related Resources

No items found.

References

https://github.com/gogs/gogs/security/advisories/GHSA-jp7c-wj6q-3qf2, https://nvd.nist.gov/vuln/detail/CVE-2026-24135, https://github.com/gogs/gogs

Severity

8.1

CVSS Score
0
10

Basic Information

Ecosystem
Base CVSS
8.1
EPSS Probability
0.00055%
EPSS Percentile
0.16899%
Introduced Version
0,v0.0.0-20240219003941-3650b32ec586,v0.12.0,v0.0.0-20191024085146-01c8df01ec06,v0.0.0-20191024060317-613139e7bef8,v0.0.0-20160304142652-1ca171dbe9a0,v0.9.0,v0.0.0-20151127065038-e42fcb033d4a,v0.7.33
Fix Available
0.13.4,v0.0.0-20260122160027-1bbc36149a37,v0.13.4-rc1,v0.0.0-20260122160641-af825ff56fea

Fix Critical Vulnerabilities Instantly

Secure your app without upgrading.
Fix Without Upgrading