GHSA-JP7C-WJ6Q-3QF2
Vulnerability from github – Published: 2026-02-06 18:16 – Updated: 2026-02-06 19:07Summary
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
- Log in to Gogs as a user with write access to a repository wiki.
- Intercept the
POSTrequest to/repo/wiki/edit. - Modify the
old_titleparameter to../../../../tmp/target_file. - Submit the request.
- Observe that
/tmp/target_file.mdis deleted from the server.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 0.13.3"
},
"package": {
"ecosystem": "Go",
"name": "gogs.io/gogs"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.13.4"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-24135"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": true,
"github_reviewed_at": "2026-02-06T18:16:25Z",
"nvd_published_at": "2026-02-06T18:15:57Z",
"severity": "HIGH"
},
"details": "### Summary\nA Path Traversal vulnerability exists in the `updateWikiPage` function of Gogs. The vulnerability allows an authenticated user with write access to a repository\u0027s wiki to delete arbitrary files on the server by manipulating the `old_title` parameter in the wiki editing form.\n\n### Vulnerability Deatils\nThe 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.\n\nCode snippet from `internal/database/wiki.go`:\n```go\n// Line 114\nos.Remove(path.Join(localPath, oldTitle+\".md\"))\n```\n\nIf 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\u0027s 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.\n\n### Impact\n- **Denial of Service**: Deletion of critical configuration files or data (if they match the extension or via other tricks).\n- **Data Loss**: Deletion of other users\u0027 wiki pages or documentation.\n\n### Remediation\nSanitize 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.\n\n```go\n// Recommended Fix\nif oldTitle != \"\" {\n oldTitle = ToWikiPageName(oldTitle)\n}\n```\n\n### Reproduction Steps\n1. Log in to Gogs as a user with write access to a repository wiki.\n2. Intercept the `POST` request to `/repo/wiki/edit`.\n3. Modify the `old_title` parameter to `../../../../tmp/target_file`.\n4. Submit the request.\n5. Observe that `/tmp/target_file.md` is deleted from the server.",
"id": "GHSA-jp7c-wj6q-3qf2",
"modified": "2026-02-06T19:07:01Z",
"published": "2026-02-06T18:16:25Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/gogs/gogs/security/advisories/GHSA-jp7c-wj6q-3qf2"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-24135"
},
{
"type": "PACKAGE",
"url": "https://github.com/gogs/gogs"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "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",
"type": "CVSS_V4"
}
],
"summary": "Gogs vulnerable to arbitrary file deletion via Path Traversal in wiki page update"
}
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.