Command Injection Affecting libvcs package, versions [,0.11.1)


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.46% (77th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Command Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-LIBVCS-2421204
  • published14 Mar 2022
  • disclosed11 Mar 2022
  • creditAlessio Della Libera of Snyk Research Team

Introduced: 11 Mar 2022

CVE-2022-21187  (opens in a new tab)
CWE-78  (opens in a new tab)
First added by Snyk

How to fix?

Upgrade libvcs to version 0.11.1 or higher.

Overview

libvcs is a vcs abstraction layer.

Affected versions of this package are vulnerable to Command Injection via argument injection. When calling the update_repo function (when using hg), the url parameter is passed to the hg clone command. By injecting some hg options it was possible to get arbitrary command execution.

PoC

from libvcs.shortcuts import create_repo

r = create_repo(url='--config=alias.clone=!touch ./HELLO', vcs='hg', repo_dir='./')

r.update_repo()

CVSS Scores

version 3.1