CVE-2022-23642
Published: 18 February 2022
Summary
CVE-2022-23642 is a high-severity Code Injection (CWE-94) vulnerability in Sourcegraph Sourcegraph. Its CVSS base score is 8.8 (High).
Operationally, ranked in the top 0.6% of CVEs by exploit likelihood; it is not currently listed in the CISA KEV catalog; a public proof-of-concept is referenced.
Deeper analysis
Sourcegraph is a code search and navigation engine whose gitserver service prior to version 3.37 contains a remote code execution vulnerability. The service acts as a git exec proxy but does not restrict calls to git config, allowing an attacker to set the core.sshCommand option and thereby substitute an arbitrary command for ssh when git connects to a remote system. The issue is tracked as CWE-94 and CWE-862 and carries a CVSS 3.1 score of 8.8.
An attacker who can reach the gitserver HTTP endpoint—possible when internal services are not isolated—can supply a malicious configuration value and obtain code execution on the host. Exploitation therefore depends on deployment topology; the vulnerability is reachable over the network with low attack complexity and low privileges.
The flaw is fixed in Sourcegraph 3.37. The project advisory and accompanying pull request recommend upgrading or, as a workaround, ensuring that requests to gitserver are properly authenticated and firewalled. Public exploit code has been posted to Packet Storm, and the EPSS score rose sharply from a low baseline to a peak of 0.9666, indicating that exploitation interest materialized after disclosure.
EU & UK References
- 🇪🇺 ENISA EUVD: EUVD-2022-28590
Vulnerability details
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…
more
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.
- CWE(s)
Related Threats
No named actor attribution yet. ATT&CK technique mapping in progress for this CVE.
Affected Assets
Mitigating Controls
Likely Mitigating Controls AI
Per-CVE control mapping for this CVE has not run yet; the list below is derived from the weakness types (CWEs) cited in the NVD entry.
Requiring an access control policy ensures authorization checks are defined and applied for critical functions.
Reviews of access controls detect missing authorization checks on critical functions or resources.
Documenting permitted unauthenticated actions prevents missing authorization by making all exceptions explicit and subject to organizational review.
Requiring attribute association with information prevents authorization from being performed without necessary security or privacy context.
Mandating authorization prior to allowing remote connections addresses missing authorization for remote access.
Mandating authorization before wireless connections are allowed prevents missing authorization for wireless access.
The control requires authorization before allowing mobile device connections, directly mitigating missing authorization for system access.
Requiring approvals for account creation and specifying authorizations ensures authorization is not missing for system access.