High severity · published Feb 18, 2022
CVE-2022-23642
Code Injection in Sourcegraph
8.8
CVSS
74.3%
EPSS
No
On KEV
Description
Sourcegraph is a code search and navigation engine. Sourcegraph prior to version 3.37 is vulnerable to remote code execution in the `gitserver` service. The service acts as a git exec proxy, and fails to properly restrict calling `git config`. This allows an attacker to set the git `core.sshCommand` option, which sets git to use the specified command instead of ssh when they need to connect to a remote system. Exploitation of this vulnerability depends on how Sourcegraph is deployed. An attacker able to make HTTP requests to internal services like gitserver is able to exploit it. This issue is patched in Sourcegraph version 3.37. As a workaround, ensure that requests to gitserver are properly protected.
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Attack vector
Network
Complexity
Low
Privileges
Low
User interaction
None
Confidentiality
High
Integrity
High
Availability
High
Scope
Unchanged
Exploitation
Is it being used?
Exploit prediction (EPSS)74.3% · higher than 99% of CVEs
Exploited in the wildNo evidence yet
CISA KEVNot listed
Ransomware campaign useNot known
Affected products
Which versions
SO
sourcegraph · sourcegraph
< 3.37 · source: vendor, NVD
References
NVD
https://nvd.nist.gov/vuln/detail/CVE-2022-23642
CVE.org
https://www.cve.org/CVERecord?id=CVE-2022-23642
Exploit
http://packetstormsecurity.com/files/167506/Sourcegraph-Gitserver-3.36.3-Remote-Code-Execution.html
Exploit
http://packetstormsecurity.com/files/167741/Sourcegraph-gitserver-sshCommand-Remote-Command-Execution.html
Patch
https://github.com/sourcegraph/sourcegraph/pull/30833
Patch
https://github.com/sourcegraph/sourcegraph/security/advisories/GHSA-qcmp-fx72-q8q9
More from sourcegraph
7.8
CVE-2022-41942
Sourcegraph vulnerable to Comand Injection via gitserver
7.2
CVE-2022-41943
Incorrect default permissions found in Sourcegraph
7.2
CVE-2022-29171
Remote Code Execution in sourcegraph
6.5
CVE-2022-23643
Side-channel attack in Sourcegraph Code Monitors
6.5
CVE-2021-43823
Side-channel attack in Sourcegraph
