Gogs Wiki Arbitrary File Deletion via Path Traversal (CVE-2026-24135)
by reschjonas · 2026-07-05
- Severity
- High
- CVE
- CVE-2026-24135 (GHSA-jp7c-wj6q-3qf2)
- Category
- web
- Affected product
- Gogs self-hosted Git service
- Affected versions
- <= 0.13.3 (fixed in 0.13.4, 0.14.0+dev)
- Disclosed
- 2026-07-05
- Patch status
- patched
References
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-05 |
| Author / Researcher | reschjonas |
| CVE / Advisory | CVE-2026-24135 (GHSA-jp7c-wj6q-3qf2) |
| Category | web |
| Severity | High |
| CVSS Score | 7.5 |
| Status | PoC |
| Tags | gogs, path-traversal, arbitrary-file-deletion, wiki, git-service, authenticated, go |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Gogs self-hosted Git service |
| Versions Affected | <= 0.13.3 (fixed in 0.13.4, 0.14.0+dev) |
| Language / Platform | Go (Gogs backend); PoC uses plain curl |
| Authentication Required | Yes (wiki write access to a repository) |
| Network Access Required | Yes |
Summary
Gogs, a self-hosted Git service written in Go, contains a path traversal flaw in the updateWikiPage function used when editing wiki pages. The function sanitizes the new page title before writing the updated file but never sanitizes the previous (“old”) title before passing it to os.Remove(). An authenticated user with wiki write access can therefore submit a crafted old_title value containing ../ sequences in the wiki edit form to delete arbitrary .md files anywhere the Gogs process has write permission to. The PoC demonstrates the bug with a single crafted curl POST request against the wiki edit endpoint.
Vulnerability Details
Root Cause
Asymmetric input sanitization in internal/database/wiki.go: the new wiki title is normalized via ToWikiPageName() before being joined into a filesystem path, but the oldTitle value flows unsanitized from user-controlled form input directly into path.Join(localPath, oldTitle+".md") followed by os.Remove().
Attack Vector
- Authenticate to Gogs as a user with wiki write access to any repository.
- Navigate to edit an existing wiki page (or intercept the edit POST request).
- Set the
old_titleform field to a path traversal sequence, e.g.../../../../../../../tmp/target_file. - Submit the POST request to
/{owner}/{repo}/wiki/{page}?action=_edit. - The server resolves the traversal path and deletes
target_file.mdoutside the intended wiki storage directory.
Impact
Arbitrary deletion of any .md-suffixed file writable by the Gogs process, enabling denial of service, destruction of other users’ wiki content/repository data, and potential escalation when chained with other flaws.
Environment / Lab Setup
Target: Gogs <= 0.13.3 instance with wiki enabled, attacker holding wiki-write credentials
Attacker: curl (or any HTTP client capable of authenticated POST requests)
Proof of Concept
PoC Script
See
poc.shin this folder.
| |
The script sends an authenticated POST request to the wiki edit endpoint with the old_title parameter set to a traversal path, causing the server to delete target_file.md outside the wiki’s storage directory.
Detection & Indicators of Compromise
POST /owner/repo/wiki/TestPage?action=_edit old_title=../../../../tmp/...
Signs of compromise:
- Unexplained disappearance of
.mdfiles outside the wiki storage path - Wiki edit requests containing
../sequences in theold_titleform parameter - Application errors referencing missing configuration or data files with
.mdextension
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade to Gogs 0.13.4 / 0.14.0+dev, which applies ToWikiPageName() sanitization to oldTitle before use (gogs/gogs#8099) |
| Interim mitigation | Restrict wiki write access to trusted users; run the Gogs process with a restricted filesystem write scope; monitor wiki edit requests for path traversal sequences |
References
Notes
Mirrored from https://github.com/reschjonas/CVE-2026-24135 on 2026-07-05.
| |