{"id":"CVE-2021-32546","aliases":["EUVD-2022-5932","GHSA-56j7-2pm8-rgmx","GO-2022-0471"],"status":"published","title":"OS Command Injection in gogs","description":"Missing input validation in internal/db/repo_editor.go in Gogs before 0.12.8 allows an attacker to execute code remotely. An unprivileged attacker (registered user) can overwrite the Git configuration in his repository. This leads to Remote Command Execution, because that configuration can contain an option such as sshCommand, which is executed when a master branch is a remote branch (using an ssh:// URI). The remote branch can also be configured by editing the Git configuration file. One can create a new file in a new repository, using the GUI, with \"\\\" as its name, and then rename this file to .git/config with the custom configuration content (and then save it).","severity":{"version":"3.1","score":8.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","level":"high","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-11","score":0.022,"percentile":0.82751,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-78"],"published":"2022-05-31T21:21:18Z","modified":"2026-10-20T10:54:41Z","fixes":[{"ecosystem":"Go","package":"gogs.io/gogs","fixed_in":["0.12.8"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"Go","package":"gogs.io/gogs","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.12.8"}]}]},{"source":"osv","ecosystem":"Go","package":"gogs.io/gogs","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.12.8"}]}]},{"source":"osv","ecosystem":"Go","package":"gogs.io/gogs","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.12.8"}]}]}],"products":[{"vendor":"gogs","product":"gogs"}],"references":[{"url":"https://github.com/gogs/gogs/releases","tags":["x_refsource_MISC","x_transferred","Release Notes","Third Party Advisory","advisory","web"]},{"url":"https://github.com/gogs/gogs/security/advisories/GHSA-56j7-2pm8-rgmx","tags":["x_refsource_MISC","x_transferred","Issue Tracking","Third Party Advisory","report","web","advisory"]},{"url":"https://github.com/gogs/gogs/issues/6555","tags":["web"]},{"url":"https://github.com/gogs/gogs/pull/6986","tags":["web"]},{"url":"https://github.com/gogs/gogs/blob/f36eeedbf89328ee70cc3a2e239f6314f9021f58/conf/app.ini#L127-L129","tags":["web"]},{"url":"https://github.com/gogs/gogs/releases/tag/v0.12.8","tags":["web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-32546","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-56j7-2pm8-rgmx"},{"url":"https://github.com/gogs/gogs","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2021-32546","description":"Missing input validation in internal/db/repo_editor.go in Gogs before 0.12.8 allows an attacker to execute code remotely. An unprivileged attacker (registered user) can overwrite the Git configuration in his repository. This leads to Remote Command Execution, because that configuration can contain an option such as sshCommand, which is executed when a master branch is a remote branch (using an ssh:// URI). The remote branch can also be configured by editing the Git configuration file. One can create a new file in a new repository, using the GUI, with \"\\\" as its name, and then rename this file to .git/config with the custom configuration content (and then save it).","status":"published","published":"2022-05-31T21:21:18Z","modified":"2024-08-03T23:25:30.533Z","updated_at":"2026-11-02T14:33:07.014772Z"}],"euvd":[{"id":"EUVD-2022-5932","description":"Missing input validation in internal/db/repo_editor.go in Gogs before 0.12.8 allows an attacker to execute code remotely. An unprivileged attacker (registered user) can overwrite the Git configuration in his repository. This leads to Remote Command Execution, because that configuration can contain an option such as sshCommand, which is executed when a master branch is a remote branch (using an ssh:// URI). The remote branch can also be configured by editing the Git configuration file. One can create a new file in a new repository, using the GUI, with \"\\\" as its name, and then rename this file to .git/config with the custom configuration content (and then save it).","status":"published","published":"2022-05-31T21:21:18Z","modified":"2024-08-03T23:25:30Z","updated_at":"2026-11-03T03:24:36.41075Z"}],"ghsa":[{"id":"GHSA-56j7-2pm8-rgmx","title":"OS Command Injection in gogs","description":"### Impact\n\nThe malicious user is able to update a crafted `config` file into repository's `.git` directory with to gain SSH access to the server. All 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 updates are prohibited to its `.git` directory. Users should upgrade to 0.12.8 or the latest 0.13.0+dev.\n\n### Workarounds\n\nN/A\n\n### References\n\nN/A\n\n### For more information\n\nIf you have any questions or comments about this advisory, please post on #6555.\n","status":"published","published":"2022-06-02T20:52:23Z","modified":"2023-01-27T05:08:04Z","cwes":["CWE-78"],"updated_at":"2026-11-02T14:36:22.592333Z"}],"nvd":[{"id":"CVE-2021-32546","description":"Missing input validation in internal/db/repo_editor.go in Gogs before 0.12.8 allows an attacker to execute code remotely. An unprivileged attacker (registered user) can overwrite the Git configuration in his repository. This leads to Remote Command Execution, because that configuration can contain an option such as sshCommand, which is executed when a master branch is a remote branch (using an ssh:// URI). The remote branch can also be configured by editing the Git configuration file. One can create a new file in a new repository, using the GUI, with \"\\\" as its name, and then rename this file to .git/config with the custom configuration content (and then save it).","status":"published","published":"2022-06-02T14:15:28.587Z","modified":"2026-06-17T03:53:08.963Z","cvss":[{"version":"3.1","score":8.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","level":"high","assessor":"primary"},{"version":"2.0","score":6.5,"vector":"AV:N/AC:L/Au:S/C:P/I:P/A:P","level":"medium","assessor":"primary"}],"updated_at":"2026-11-02T14:07:06.501652Z"}],"osv":[{"id":"CVE-2021-32546","description":"Missing input validation in internal/db/repo_editor.go in Gogs before 0.12.8 allows an attacker to execute code remotely. An unprivileged attacker (registered user) can overwrite the Git configuration in his repository. This leads to Remote Command Execution, because that configuration can contain an option such as sshCommand, which is executed when a master branch is a remote branch (using an ssh:// URI). The remote branch can also be configured by editing the Git configuration file. One can create a new file in a new repository, using the GUI, with \"\\\" as its name, and then rename this file to .git/config with the custom configuration content (and then save it).","status":"published","published":"2022-06-02T14:15:28.587Z","modified":"2026-10-20T10:54:41.648441795Z","cvss":[{"version":"3.1","score":8.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T15:44:19.793849Z"},{"id":"GHSA-56j7-2pm8-rgmx","title":"OS Command Injection in gogs","description":"### Impact\n\nThe malicious user is able to update a crafted `config` file into repository's `.git` directory with to gain SSH access to the server. All 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 updates are prohibited to its `.git` directory. Users should upgrade to 0.12.8 or the latest 0.13.0+dev.\n\n### Workarounds\n\nN/A\n\n### References\n\nN/A\n\n### For more information\n\nIf you have any questions or comments about this advisory, please post on #6555.\n","status":"published","published":"2022-06-02T20:52:23Z","modified":"2026-07-08T06:27:32.376981629Z","cwes":["CWE-78"],"updated_at":"2026-11-02T15:46:37.864461Z"},{"id":"GO-2022-0471","title":"OS Command Injection in gogs in gogs.io/gogs","description":"OS Command Injection in gogs in gogs.io/gogs","status":"published","published":"2024-08-21T15:11:33Z","modified":"2026-03-03T04:50:25.941676Z","updated_at":"2026-11-02T15:47:00.918515Z"}]}}
