Skip to content

Remote Code Execution in gitserver

High
andreeleuterio published GHSA-r2m9-hfg8-4c38 May 3, 2022

Package

gomod Sourcegraph (Go)

Affected versions

< 3.38.0

Patched versions

3.38.0

Description

Impact

Sourcegraph before version 3.38.0 is vulnerable to Remote Code Execution in the gitserver service.

The Gitolite code host integration with Phabricator allows Sourcegraph site admins to specify a callsignCommand, which is used to obtain the Phabricator metadata for a Gitolite repository. An administrator who is able to edit or add a Gitolite code host and has administrative access to Sourcegraph’s bundled Grafana instance can change this command arbitrarily and run it remotely. This grants direct access to the infrastructure underlying the Sourcegraph installation.

The attack requires:

  • site-admin privileges on the instance of Sourcegraph
  • Administrative privileges on the bundled Grafana monitoring instance
  • Knowledge of the gitserver IP address or DNS name (if running in Kubernetes). This can be found through Grafana.

Patches

The issue is patched in version 3.38.0.

Workarounds

You may disable Gitolite code hosts. We still highly encourage upgrading regardless of workarounds.

For more information

If you have any questions or comments about this advisory email us at security@sourcegraph.com

Severity

High

CVE ID

CVE-2022-29171

Weaknesses