Cyber Resilience

CVE-2022-23642

RCE in Sourcegraph ≤ 3.37

Public PoCHigh EPSSRCEAccess Control
Published
18 February 2022
Modified
21 November 2024
Patch / advisory
CVSS Score v3.1 8.8
Click a component to see what it means
Raw vectorCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS Score 0.74 99.4th percentile
Risk Priority 87 floored blend · peak EPSS

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.

The strongest mitigations our analysis identified map to AC-3 (Access Enforcement) and SC-7 (Boundary Protection) — see the control section below for these in your framework.

Deeper analysis AI-assisted summary

Synthesised by an AI model from the NVD description and linked references — a reading aid, not an authoritative source.

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.

OWASP Top 10 for Web (2025)

EU & UK References

Vulnerability Data

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

Likely ATT&CK TechniquesAI

Techniques this vulnerability likely enables, inferred from its description, weakness type, and attributed-actor tradecraft. Confidence is per-technique.

T1190 Exploit Public-Facing Application Initial Accessconfidence: HIGH
The vulnerability allows remote code execution via the publicly reachable gitserver HTTP endpoint without proper authentication.
T1059 Command and Scripting Interpreter Executionconfidence: HIGH
Arbitrary command execution is achieved by abusing git config to override sshCommand and run attacker-supplied commands.
T1071.001 Web Protocols Command And Controlconfidence: MEDIUM
The attacker interacts with the vulnerable service over its HTTP API to deliver the malicious configuration.
inferred from description + CWE · MITRE ATT&CK Enterprise v19.0

CVEs Like This One

CVE-2024-40671Shared CWE-862, CWE-94
CVE-2024-13420Shared CWE-862, CWE-94
CVE-2026-42851Shared CWE-862, CWE-94
CVE-2022-4223Shared CWE-862, CWE-94
CVE-2024-37901Shared CWE-862, CWE-94
CVE-2024-6936Shared CWE-94
CVE-2026-34965Shared CWE-94
CVE-2026-41414Shared CWE-94
CVE-2026-25856Shared CWE-94
CVE-2025-33251Shared CWE-94

Affected Assets

sourcegraph
sourcegraph
≤ 3.37

Mitigating Controls

Control response

Prevent
Stop it (NIST 800-53)
  • AC-3 Access Enforcement
  • SC-7 Boundary Protection
  • AC-6 Least Privilege
Detect
Catch it (NIST detect / respond)

Harden
Shrink the surface (DISA STIG)
  • 5 hardening rules · 3 OS baselines
Validate
Prove the fix (OWASP ASVS)
  • V1.3.1

Mitigating Controls (NIST 800-53 r5) AI

prevent

Enforces access restrictions on the gitserver HTTP endpoint so unauthorized callers cannot invoke the unrestricted git config command.

prevent

Applies boundary protection and network segmentation to block external or untrusted reachability to the internal gitserver service.

prevent

Limits the gitserver proxy to only the minimal git operations required, preventing abuse of git config to set core.sshCommand.

Mitigating Controls (NIST CSF 2.0) AI

Derived directly from the weakness types (CWEs) cited in the NVD entry via our AI-authored CWE→CSF cross-walk (authority under review) — links open the control.

PR.AA-05 full match
prevents

Explicitly requires defining, enforcing, and reviewing authorizations and least privilege, directly preventing missing authorization checks.

PR.PS-06 mostly match
prevents

PR.PS-06's SDLC practices directly target injection flaws via secure coding and testing (mostly), yet as a single broad outcome it leaves many code-generation specifics unaddressed (partial).

PR.DS-10 none match
prevents

PR.DS-10 protects runtime data confidentiality/integrity but has no bearing on neutralizing externally influenced input during code generation, so neither direction shows any preventive effect.

Mitigating Controls (ISO/IEC 27001:2022 Annex A) AI

Derived directly from the weakness types (CWEs) cited in the NVD entry via our AI-authored CWE→ISO cross-walk (authority under review) — links open the control.

prevents

Requiring authentication and credentials before any access occurs eliminates the absence of authorization checks that would otherwise allow an unauthenticated actor to reach protected resources.

prevents

Requiring formal authorization of every access request before rights are granted ensures that checks for required permissions are performed, preventing missing authorization checks from being introduced.

prevents

Mandatory authorization checks and central records of granted rights ensure that every access attempt is preceded by an explicit decision rather than relying on missing checks.

mitigates

Segregating the approval of access rights from their implementation provides an independent check that reduces the impact of missing authorization checks in the resulting system configuration.

detects

By requiring competent outsiders to verify that every function enforces the need-to-know principle, the control lowers the likelihood that missing authorization checks persist undetected.

prevents

Defining authorization responsibilities and reviewing risk-treatment progress throughout the project lifecycle catches missing authorization checks before the system is deployed.

References