CVE-2024-34347: @hoppscotch/cli Remote Code Execution Vulnerability
HIGHCVE-2024-34347 is a HIGH (CVSS 8.3) remote code execution vulnerability (CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')) affecting @hoppscotch/cli libraries in the npm ecosystem. The issue involves @hoppscotch/cli affected by sandbox escape in @hoppscotch/js-sandbox leads to rce. Remediation is available by upgrading affected packages to version 0.8.0.
CVE-2024-34347 at a Glance
Security Impact
CVSS: 8.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H).
How to Fix CVE-2024-34347
To remediate this vulnerability, upgrade all affected @hoppscotch/cli dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @hoppscotch/cli@0.8.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @hoppscotch/cli
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-34347, inspect your project dependencies using npm:
npm ls @hoppscotch/cli
Analyze the terminal output to locate any version of @hoppscotch/cli in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.8.0), your application is affected.
Note: The npm ls @hoppscotch/cli command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where the product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. In @hoppscotch/cli, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-34347 Affected @hoppscotch/cli Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@hoppscotch/cli
|
npm |
≥ 0.5.0
< 0.8.0
|
0.8.0
|
References
Frequently Asked Questions
What is CVE-2024-34347?
Which @hoppscotch/cli versions are affected?
What version fixes CVE-2024-34347?
Is @hoppscotch/cli affected?
What is the CVSS score of CVE-2024-34347?
What CWE is associated with CVE-2024-34347?
How can I check npm dependencies for CVE-2024-34347?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qmmm-73r2-f8xr",
"modified" : "2025-06-10T15:33:54Z",
"published" : "2024-04-22T18:38:11Z",
"aliases" : [ "CVE-2024-34347" ],
"summary" : "@hoppscotch/cli affected by Sandbox Escape in @hoppscotch/js-sandbox leads to RCE",
"details" : "### Observations\n\nThe Hoppscotch desktop app takes multiple precautions to be secure against arbitrary JavaScript and system command execution. It does not render user-controlled HTML or Markdown, uses Tauri instead of Electron, and sandboxes pre-request scripts with a simple yet secure implementation using web workers.\n\nUnfortunately, web workers are not available in a pure Node.js application like Hoppscotch CLI. That is why the [@hoppscotch/js-sandbox](https://github.com/hoppscotch/hoppscotch/tree/main/packages/hoppscotch-js-sandbox) package also provides a Javascript sandbox that uses the Node.js `vm` module. However, the `vm` module is not safe for sandboxing untrusted Javascript code, as stated [in the documentation](https://nodejs.org/api/vm.html#vm-executing-javascript). This is because [code inside the vm context can break out](https://thegoodhacker.com/posts/the-unsecure-node-vm-module/) if it can get a hold of any reference to an object created outside of the vm.\n\nIn the case of @hoppscotch/js-sandbox, multiple references to external objects are passed into the vm context to allow pre-request scripts interactions with environment variables and more. But this also allows the pre-request script to escape the sandbox.\n[packages/hoppscotch-js-sandbox/src/pre-request/node-vm/index.ts](https://github.com/hoppscotch/hoppscotch/blob/faab1d20fde9a6be660db40fc73dcf28f9038008/packages/hoppscotch-js-sandbox/src/pre-request/node-vm/index.ts#L23-L31)\n```js\nconst { pw, updatedEnvs } = getPreRequestScriptMethods(envs)\n\n// Expose pw to the context\ncontext.pw = pw\ncontext.atob = atob\ncontext.btoa = btoa\n\n// Run the pre-request script in the provided context\nrunInContext(preRequestScript, context)\n```\n\n### Exploitation\n\nAn attacker can use the exposed `pw` object reference to escape the sandbox and execute arbitrary system commands using the `child_process` Node.js module. This PoC pre-request script executes the `id > /tmp/pwnd` system command as soon as a request is sent.\n```js\noutside = pw.constructor.constructor('return this')()\noutside.process.mainModule.require('child_process').execSync('id > /tmp/pwnd')\n```\nAn attacker who wants to run arbitrary code on the machine of a victim can create a Hoppscotch collection containing a request with a malicious pre-request script and share it with a victim, using the JSON export feature. The victim then has to run the collection with the Hoppscotch CLI. Then the malicious pre-request script executes.\n\n### Impact\n\nThis attack gives an attacker arbitrary command execution on the machine of a victim Hoppscotch CLI user. For the attack to succeed, an attacker has to lure the victim into downloading a malicious Hoppscotch collection and running it with the Hoppscotch CLI.\n\nThis issue does not impact Hoppscotch Web or Desktop, as they use the safe web worker sandboxing approach.\n\n### Recommendations\n\nHoppscotch CLI and other tools that rely on @hoppscotch/js-sandbox but don't have access to a browser cannot use the web worker sandbox. For these, you can look into other safe JavaScript sandboxing libraries. We think that [isolated-vm](https://github.com/laverdet/isolated-vm) looks promising. We discourage the use of [vm2](https://github.com/patriksimek/vm2), which is deprecated because it has arbitrary bypasses. Alternatively, you can introduce an `--enable-scripting` flag for the CLI and disable scripting by default. Or you can change the threat model and educate users that they should not run untrusted collections as it can lead to RCE.\n\n\n### Differences from existing CVEs\n- [nvd.nist.gov/vuln/detail/CVE-2023-37466](https://nvd.nist.gov/vuln/detail/CVE-2023-37466) : This CVE is regarding an escape of vm2 which we do not even use.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@hoppscotch/cli"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.5.0"
}, {
"fixed" : "0.8.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/hoppscotch/hoppscotch/security/advisories/GHSA-qmmm-73r2-f8xr"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-34347"
}, {
"type" : "WEB",
"url" : "https://github.com/hoppscotch/hoppscotch/commit/22c6eabd133195d22874250a5ae40cb26b851b01"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/hoppscotch/hoppscotch"
}, {
"type" : "WEB",
"url" : "https://www.sonarsource.com/blog/scripting-outside-the-box-api-client-security-risks-part-2"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-77" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-04-22T18:38:11Z",
"nvd_published_at" : "2024-05-08T15:15:11Z"
}
}