Gogs · Gogs · CVE-2024-55947
**Name of the Vulnerable Software and Affected Versions**
Gogs versions prior to 0.13.1
**Description**
Gogs, an open-source self-hosted Git service, has a flaw that allows a malicious user to write files to arbitrary locations on the server, potentially gaining SSH access. The issue stems from improper path validation in the file update API. Exploitation involves using a crafted request to write a file, such as an SSH authorized key, to a sensitive directory. The API endpoint used for this is `/api/v1/repos/{repo}/contents/{path}`. The vulnerable parameter is the `path` within this endpoint, allowing for path traversal using sequences like `../../../../`. The `PUT` method is used to write the file.
**Recommendations**
Upgrade to Gogs version 0.13.1 or later to resolve this issue.