CVE-2024-55947

Gogs Path Traversal: How ../../../ Gave Hackers the Keys to the Castle

Amit Schendel
Amit Schendel
Senior Security Researcher

Jan 15, 2026·6 min read·1 visit

Executive Summary (TL;DR)

Gogs versions prior to 0.13.1 failed to sanitize file paths in the API and web editor. Authenticated attackers with write access to a repository can use directory traversal characters (`../`) to break out of the repo directory. By overwriting `~/.ssh/authorized_keys`, attackers can grant themselves SSH access to the server, resulting in full RCE.

A critical path traversal vulnerability in Gogs allows authenticated users to escape the repository sandbox and overwrite arbitrary files on the host system. This flaw typically leads to immediate Remote Code Execution (RCE) by overwriting the git user's SSH authorized_keys file.

Fix Analysis (1)

Technical Appendix

CVSS Score
8.8/ 10
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS Probability
1.60%
Top 19% most exploited

Affected Systems

Gogs (Self-Hosted Git Service)

Affected Versions Detail

Product
Affected Versions
Fixed Version
Gogs
Gogs
< 0.13.10.13.1
AttributeDetail
CWECWE-22 (Path Traversal)
CVSS v3.18.8 (Critical)
Attack VectorNetwork (Authenticated)
ImpactRemote Code Execution (RCE) via File Write
Fixed Version0.13.1
EPSS Score1.60% (High Percentile)
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.

Vulnerability Timeline

Initial bug report submitted (Issue #7582)
2023-10-27
Patch commit 9a9388a merged
2024-12-15
Gogs v0.13.1 Released
2024-12-22
CVE-2024-55947 Published
2024-12-23