CVE-2022-29171 Remote Code Execution in sourcegraph

Medium 6.6 Published Updated

Site admins with Grafana access can inject commands via Gitolite integration to execute code on the underlying infrastructure.

Exploited in the wild
Not known
Login needed
An administrator
Attackable
Over the internet
Victim action needed
Not needed
Fix
None listed

What is CVE-2022-29171?

CVE-2022-29171 is a medium-severity command injection vulnerability in sourcegraph, published on 5 May 2022. An attacker needs administrator access to exploit it, with no action from the victim.

Official description

Sourcegraph is a fast and featureful code search and navigation engine. Versions before 3.38.0 are 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. The issue is patched in version 3.38.0. You may disable Gitolite code hosts. We still highly encourage upgrading regardless of workarounds.

Weakness: CWE-94, CWE-74

Which versions are affected by CVE-2022-29171?

It affects 1 product.

Products include Sourcegraph Sourcegraph.

How do I fix CVE-2022-29171?

No fix has been published for CVE-2022-29171 yet. Limit exposure of the affected software until one is available.

Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.

Is CVE-2022-29171 being exploited?

There is no known exploitation of CVE-2022-29171 in the wild and no public exploit code.

Sources

Is CVE-2022-29171 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free