Arbitrary Command Injection Affecting @hoppscotch/cli package, versions <0.8.0


Severity

0.0
high
0
10

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.04% (9th 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-HOPPSCOTCHCLI-6672898
  • published 24 Apr 2024
  • disclosed 22 Apr 2024
  • credit oskar-zeinomahmalat-sonarsource, mufeedvh

How to fix?

Upgrade @hoppscotch/cli to version 0.8.0 or higher.

Overview

@hoppscotch/cli is an A CLI to run Hoppscotch test scripts in CI environments.

Affected versions of this package are vulnerable to Arbitrary Command Injection due to the improper handling of user-supplied input in the vm module context. An attacker can execute arbitrary system commands on the victim's machine by crafting a malicious pre-request script that escapes the sandbox environment.

Note

This is only exploitable if the victim downloads and runs a malicious Hoppscotch collection with the CLI tool.

Workaround

This vulnerability can be mitigated by using alternative safe JavaScript sandboxing libraries or by introducing an --enable-scripting flag for the CLI and disabling scripting by default.

PoC


outside = pw.constructor.constructor('return this')()

outside.process.mainModule.require('child_process').execSync('id > /tmp/pwnd')

References

CVSS Scores

version 3.1
Expand this section

Snyk

8.3 high
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    High
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    Required
  • Scope (S)
    Changed
  • Confidentiality (C)
    High
  • Integrity (I)
    High
  • Availability (A)
    High