CVE-2022-1986:
OS Command Injection in file editor in Gogs
9.8
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.94526%
CWE
Published
6/8/2022
Updated
1/27/2023
KEV Status
No
Technology
Go
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
gogs.io/gogs | go | < 0.12.9 | 0.12.9 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from improper path sanitization in the isRepositoryGitPath
function. The original implementation used string(os.PathSeparator)
which could be bypassed by using mixed path separators. The patch explicitly checks for both '/'
and '\'
separators, indicating the previous implementation failed to properly validate paths across different OS environments. This allowed attackers to manipulate .git
directory contents (like SSH
authorized_keys
or hooks
), leading to OS command injection through subsequent Git
operations.