{"id":"CVE-2022-1884","aliases":["CVE-2022-1884","GHSA-958j-443g-7mm7","GO-2022-0749"],"related":[],"kind":"vulnerability","state":"published","title":"Remote Command Execution in gogs/gogs","summary":"A remote command execution vulnerability exists in gogs/gogs versions <=0.12.7 when deployed on a Windows server. The vulnerability arises due to improper validation of the `tree_path` parameter during file uploads. An attacker can set `tree_path=.git.` to upload a file into the .git directory, allowing them to write or rewrite the `.git/config` file. If the `core.sshCommand` is set, this can lead to remote command execution.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"A remote command execution vulnerability exists in gogs/gogs versions <=0.12.7 when deployed on a Windows server. The vulnerability arises due to improper validation of the `tree_path` parameter during file uploads. An attacker can set `tree_path=.git.` to upload a file into the .git directory, allowing them to write or rewrite the `.git/config` file. If the `core.sshCommand` is set, this can lead to remote command execution.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nThe malicious user is able to upload a crafted `config` file into repository's `.git` directory with to gain SSH access to the server. All Windows installations with [repository upload enabled (default)](https://github.com/gogs/gogs/blob/f36eeedbf89328ee70cc3a2e239f6314f9021f58/conf/app.ini#L127-L129) are affected.\n\n### Patches\n\nRepository file uploads are prohibited to its `.git` directory. Users should upgrade to 0.12.8 or the latest 0.13.0+dev.\n\n### Workarounds\n\n[Disable repository files upload](https://github.com/gogs/gogs/blob/f36eeedbf89328ee70cc3a2e239f6314f9021f58/conf/app.ini#L128-L129).\n\n### References\n\nhttps://www.huntr.dev/bounties/9cd4e7b7-0979-4e5e-9a1c-388b58dea76b/\n\n### For more information\n\nIf you have any questions or comments about this advisory, please post on #6968.","format":"markdown","source":"ghsa"},{"lang":"en","text":"OS Command Injection in gogs in gogs.io/gogs","format":"markdown","source":"go"},{"lang":"es","text":"Existe una vulnerabilidad de ejecución remota de comandos en las versiones de gogs/gogs &lt;=0.12.7 cuando se implementan en un servidor Windows. La vulnerabilidad surge debido a una validación incorrecta del parámetro `tree_path` durante la carga de archivos. Un atacante puede configurar `tree_path=.git.` para cargar un archivo en el directorio .git, lo que le permite escribir o reescribir el archivo `.git/config`. Si se configura `core.sshCommand`, esto puede provocar la ejecución remota de comandos.","source":"nvd"}],"published":"2022-06-02T20:50:21.000Z","modified":"2026-06-17T04:23:16.700Z","severity":{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},"severities":[{"scorer":"@huntr_ai","scheme":"CVSS:3.0","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.0","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"}],"cwes":["CWE-77","CWE-78"],"affected":[{"ranges":[{"type":"custom","introduced":"unspecified","lastAffected":"latest","status":"affected"}],"vendor":"gogs","product":"gogs/gogs","source":"cvelist"},{"ranges":[{"type":"custom","introduced":"0","lastAffected":"0.12.7","status":"affected"}],"vendor":"gogs","product":"gogs","cpe":"cpe:2.3:a:gogs:gogs:*:*:*:*:*:*:*:*","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.12.8"}],"ecosystem":"Go","package":"gogs.io/gogs","purl":"pkg:golang/gogs.io/gogs","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.12.8"}],"ecosystem":"Go","package":"gogs.io/gogs","purl":"pkg:golang/gogs.io/gogs","source":"go"},{"ranges":[{"status":"affected","lastAffected":"0.12.7"}],"vendor":"gogs","product":"gogs","cpe":"cpe:2.3:a:gogs:gogs:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://huntr.com/bounties/9cd4e7b7-0979-4e5e-9a1c-388b58dea76b","tags":["exploit","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/gogs/gogs/security/advisories/GHSA-958j-443g-7mm7","tags":["advisory","web"],"sources":["ghsa","go"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-1884","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/gogs/gogs/issues/6968","tags":["web"],"sources":["ghsa","go"]},{"url":"https://github.com/gogs/gogs/pull/6970","tags":["web"],"sources":["ghsa","go"]},{"url":"https://github.com/gogs/gogs","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/gogs/gogs/blob/f36eeedbf89328ee70cc3a2e239f6314f9021f58/conf/app.ini#L127-L129","tags":["web"],"sources":["ghsa","go"]},{"url":"https://github.com/gogs/gogs/releases/tag/v0.12.8","tags":["web"],"sources":["ghsa","go"]},{"url":"https://www.huntr.dev/bounties/9cd4e7b7-0979-4e5e-9a1c-388b58dea76b","tags":["web"],"sources":["ghsa","go"]}],"credits":[],"assigner":"@huntr_ai","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2024-11-15T19:13:14.910Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-1884","url":"https://www.cve.org/CVERecord?id=CVE-2022-1884","licence":"CVE Terms of Use","modified":"2024-11-15T19:15:02.353Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-958j-443g-7mm7","url":"https://github.com/advisories/GHSA-958j-443g-7mm7","licence":"CC-BY-4.0","modified":"2024-11-15T18:01:29.000Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2022-0749","url":"https://pkg.go.dev/vuln/GO-2022-0749","licence":"CC-BY-4.0","modified":"2026-03-03T04:50:50.536Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-1884","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-1884","licence":"Public domain","modified":"2026-06-17T04:23:16.700Z"}],"updatedAt":"2026-11-25T22:58:20.051Z","epss":{"score":0.01825,"percentile":0.79436,"date":"2026-12-01T12:00:22.000Z"}}