CVE-2022-23642
HighPublic exploitSourcegraph 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.
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
Exploited in the wild
No known
Not in a known-exploited catalog
Public exploit code
Available
Proof-of-concept or weaponized module
Get the full CVE-2022-23642 brief as a PDF
Every affected product and fixed release, exploitation status and a first 24 hours response checklist, emailed within minutes.
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 ('Code Injection')
- CWE-862 Missing Authorization
References
- patchhttps://github.com/sourcegraph/sourcegraph/pull/30833
- patchhttps://github.com/sourcegraph/sourcegraph/security/advisories/GHSA-qcmp-fx72-q8q9
- exploithttp://packetstormsecurity.com/files/167506/Sourcegraph-Gitserver-3.36.3-Remote-Code-Execution.html
- exploithttp://packetstormsecurity.com/files/167741/Sourcegraph-gitserver-sshCommand-Remote-Command-Execution.html
- 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 Running On Your Attack Surface?
Brandefense maps vulnerabilities like this one to your internet-facing assets and tells you exactly where to patch.
Request A Demo