CSIRTS // UNIFIED SECURITY ADVISORY FEEDSYS ● ONLINE · POWERED BY INTELFUSIONS.COM

CVE-2026-52797

highCVSS 8.5covered by 1 sourcefirst seen 2026-06-16
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: 1. https://github.com/gogs/gogs/blob/b7372b1f32cd0bb40984debfb049e3fc04efaee4/internal/route/repo/editor.go#L307 — on this line, instead of the treePath variable, which comes directly from the user unchanged, we should first filter and then pass the entry variable. 2. To filter the treePath variable, it is better to use the preexisting pathutil.Clean function instead of path.Clean from the standard Go library. Exploitation A Positive Technologies researcher discovered that the user has the ability to preview their changes when editing a file in the repository. The POST /:user/:repo/_preview/:branch/:path_to_file method is responsible for displaying the changes. The problem is how the POST /:user/:repo/_preview/:branch/:path_to_file method processes the value passed to the :path_to_file (see Listing 1). Listing 1. _preview method processor func DiffPreviewPost(c *context.Context, f form.EditPreviewDiff) { // В treePath попадает значение из :path_to_file treePath := c.Repo.TreePath // Проверка, что файл существует в репозитории entry, err := c.Repo.Commit.TreeEntry(treePath) -cut- // Значение, полученное от пользователя, передается в функцию в обход фильтра diff, err := c.Repo.Repository.GetDiffPreview(c.Repo.BranchName, treePath, f.Content) -cut- The first problem to solve is to make the TreeEntry function think that the value passed in is a file that actually exists in the repository. To do this, we must consider how the TreeEntry function actually makes this decision (see Listing 2). Listing 2. Path checking and cleaning function

⚡ Watch CVE-2026-52797

Get an email if CVE-2026-52797 is added to CISA KEV, gains public exploit code, or a new advisory cites it — max one per day, one-click unsubscribe.

Exploitation outlook

Advisory coverage (1)

External references

NVD record for CVE-2026-52797

CVE.org record

Embed the live status

CVE-2026-52797 live status badge — this badge updates automatically when the KEV or exploit status changes. How to embed it →

[![CVE-2026-52797 status](https://www.csirts.com/badge/CVE-2026-52797)](https://www.csirts.com/cve/CVE-2026-52797)