CVE-2022-23642

HIGH

Sourcegraph gitserver sshCommand RCE

Title source: metasploit

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.

Exploits (3)

exploitdb WORKING POC
by Altelus · pythonremotemultiple
https://www.exploit-db.com/exploits/50964
nomisec WORKING POC 7 stars
by Altelus1 · poc
https://github.com/Altelus1/CVE-2022-23642
metasploit WORKING POC EXCELLENT
by Altelus1, Spencer McIntyre · rubypocunix
https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/http/sourcegraph_gitserver_sshcmd.rb

Scores

CVSS v3 8.8
EPSS 0.8528
EPSS Percentile 99.4%
Attack Vector NETWORK
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Details

CWE
CWE-862 CWE-94
Status published
Products (1)
sourcegraph/sourcegraph < 3.37
Published Feb 18, 2022
Tracked Since Feb 18, 2026