Cyber Resilience

CVE-2022-23642

HighPublic PoCRCE

Published: 18 February 2022

Published
18 February 2022
Modified
21 November 2024
KEV Added
Patch
CVSS Score v3.1 8.8 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS Score 0.8528 99.4th percentile
Risk Priority 69 60% EPSS · 20% KEV · 20% CVSS

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

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

sourcegraph
sourcegraph
≤ 3.37

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.

addresses: CWE-862

Requiring an access control policy ensures authorization checks are defined and applied for critical functions.

addresses: CWE-862

Reviews of access controls detect missing authorization checks on critical functions or resources.

addresses: CWE-862

Documenting permitted unauthenticated actions prevents missing authorization by making all exceptions explicit and subject to organizational review.

addresses: CWE-862

Requiring attribute association with information prevents authorization from being performed without necessary security or privacy context.

addresses: CWE-862

Mandating authorization prior to allowing remote connections addresses missing authorization for remote access.

addresses: CWE-862

Mandating authorization before wireless connections are allowed prevents missing authorization for wireless access.

addresses: CWE-862

The control requires authorization before allowing mobile device connections, directly mitigating missing authorization for system access.

addresses: CWE-862

Requiring approvals for account creation and specifying authorizations ensures authorization is not missing for system access.

References