CVE-2026-52797: Gogs path traversal and argument injection in git diff preview

CVE-2026-52797 · Severity: high · CVSS 8.5 · Published 2026-06-24

Gogs is an open-source self-hosted Git service used by teams to manage source code. A vulnerability in the file preview feature allows an authorized user to manipulate internal commands to overwrite critical system files. This can lead to a complete service outage (Denial of Service) by corrupting the application's database or configuration files, potentially requiring manual restoration from backups.

Technologies: gogs.io/gogs (Go), Gogs. Vendors: Go, Gogs.

Quick answers

Is CVE-2026-52797 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-52797 being exploited in the wild.
How severe is CVE-2026-52797?
High severity, with a CVSS score of 8.5, published 24 June 2026.
Which products and versions are affected?
gogs.io/gogs (Go) <= 0.13.4, SEMVER:introduced=0, SEMVER:introduced=0,fixed=0.14.0; Gogs < 0.14.0, <= 0.13.4.
Is there a fix for CVE-2026-52797?
Yes. gogs.io/gogs (Go): upgrade to 0.14.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-52797 attacked?
It is attacked over the network, in a network appliance.
Am I affected by CVE-2026-52797?
Check whether you run gogs.io/gogs (Go) or Gogs at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • gogs.io/gogs (Go): upgrade to 0.14.0 or later
    go get gogs.io/gogs@v0.14.0

Technical details

A path traversal and argument injection vulnerability exists in the `DiffPreviewPost` function within `internal/route/repo/editor.go`. The application fails to properly sanitize the `:path_to_file` parameter before passing it to the `git diff` command via `exec.Command`. By exploiting specific behaviors of the Go `path.Clean` function (e.g., using `/../` sequences), an attacker can bypass repository boundary checks. This allows the injection of the `--output=<file>` flag into the Git command, enabling the attacker to overwrite arbitrary files on the host filesystem, such as `gogs.db` or `app.ini`, with the results of a diff comparison. This results in a Denial of Service (DoS). The issue is fixed in version 0.14.0 by ensuring the path is properly filtered using `pathutil.Clean` before use.

Affected products

  • Gogs Gogs < 0.14.0

Identifiers

  • CVE-2026-52797
  • GHSA-pm6v-2h4w-4rp2
  • GO-2026-5545

Timeline

  • 2026-06-03: advisory: GitHub Security Advisory published
  • 2026-06-24: disclosed: CVE published to NVD
  • 2026-06-24: patched: Fix released in version 0.14.0

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.