Rapid7 Vulnerability & Exploit Database

Sourcegraph gitserver sshCommand RCE

Back to Search

Sourcegraph gitserver sshCommand RCE



A vulnerability exists within Sourcegraph's gitserver component that allows a remote attacker to execute arbitrary OS commands by modifying the core.sshCommand value within the git configuration. This command can then be triggered on demand by executing a git push operation. The vulnerability was patched by introducing a feature flag in version 3.37.0. This flag must be enabled for the protections to be in place which filter the commands that are able to be executed through the git exec REST API.


  • Altelus1
  • Spencer McIntyre




cmd, x86, x64


Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/linux/http/sourcegraph_gitserver_sshcmd
msf exploit(sourcegraph_gitserver_sshcmd) > show targets
msf exploit(sourcegraph_gitserver_sshcmd) > set TARGET < target-id >
msf exploit(sourcegraph_gitserver_sshcmd) > show options
    ...show and set options...
msf exploit(sourcegraph_gitserver_sshcmd) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security