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


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.04% (11th 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 Arbitrary Command Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-HOPPSCOTCHCLI-6672898
  • published24 Apr 2024
  • disclosed22 Apr 2024
  • creditoskar-zeinomahmalat-sonarsource, mufeedvh

Introduced: 22 Apr 2024

CVE-2024-34347  (opens in a new tab)
CWE-77  (opens in a new tab)

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