CVE-2022-23642Sourcegraph Code Injection
Sourcegraph prior to version 3.37 is vulnerable to remote code execution in the gitserver service.
Published Feb 18, 2022 · Updated Apr 22, 2025
Key Facts
Patch immediately- CVE-2022-23642 is a high-severity vulnerability (CVSS 8.8 v3.1) affecting Sourcegraph.
- It is not listed in any known-exploited vulnerabilities catalog. Public exploit code is available.
- EPSS estimates a 74% probability of exploitation in the next 30 days.
- Fixed versions are available, including Sourcegraph 3.37.
- Brandefense priority: patch immediately, because it is very likely to be exploited soon.
Scores
CVSS v3.1
8.8
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS (30-day exploit likelihood)
74%
Higher than 99.4% of all scored CVEs
Exploit maturity
Weaponized
ATLAS score
61/100
Publication score, see How it works
Exploitation Verdict
KEV listed
Not listed
Federal due date
None
No federal due date
Ransomware use
Not reported
Attributed actors
None named
Exploit & Defence Guidance
Exploit maturity
Weaponized
Public exploit code
4
Proof-of-concept links
In-the-wild evidence
0
Reports of active use
Advisories And Exploit References
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.
Affected Products
2 affected entries in total| Product | Affected versions | Fixed in |
|---|---|---|
| SourcegraphSourcegraph | < 3.37 | 3.37 |
Patched Releases
Sourcegraph
3.37
Timeline
Publicly disclosed
Feb 18, 2022
Last updated
Apr 22, 2025
Weakness Type
- CWE-94 Improper Control of Generation of Code
- CWE-862 Missing Authorization
References
- patchgithub.com · 30833
- patchgithub.com · GHSA-qcmp-fx72-q8q9
- exploitpacketstormsecurity.com · Sourcegraph-Gitserver-3.36.3-Remote-Code-Execut…
- exploitpacketstormsecurity.com · Sourcegraph-gitserver-sshCommand-Remote-Command…
- exploitMSF sourcegraph_gitserver_sshcmd.rb
FAQ
Common Questions.
Sourcegraph is a code search and navigation engine.
Affected: Sourcegraph versions < 3.37. The full list is in the CVE brief.
It is not listed in any known-exploited vulnerabilities catalog.
No, it is not currently listed in the CISA Known Exploited Vulnerabilities catalog.
Public exploit code is available.
Fixed versions are available, including Sourcegraph 3.37.
Brandefense priority: patch immediately, because it is very likely to be exploited soon.
Is CVE-2022-23642 On Your Attack Surface?
Brandefense matches it against the products discovered on your perimeter and opens a finding the day a CVE like this is listed.
Request A Demo