Skip to content

fix(security): 2 improvements across 2 files#1050

Open
tomaioo wants to merge 2 commits into
AcalaNetwork:masterfrom
tomaioo:fix/security/command-injection-via-unsanitized-file-p
Open

fix(security): 2 improvements across 2 files#1050
tomaioo wants to merge 2 commits into
AcalaNetwork:masterfrom
tomaioo:fix/security/command-injection-via-unsanitized-file-p

Conversation

@tomaioo

@tomaioo tomaioo commented Jun 22, 2026

Copy link
Copy Markdown

Summary

fix(security): 2 improvements across 2 files

Problem

Severity: Critical | File: packages/chopsticks/src/utils/open-html.ts:L4

The openHtml function in open-html.ts directly interpolates a user-provided filePath into a shell command executed via execSync. The filePath parameter is not sanitized or validated, allowing an attacker to inject arbitrary shell commands. For example, a path like ; rm -rf / would be executed by the shell. This is a classic command injection vulnerability.

Solution

Use execFileSync or spawn with the file path as an argument array instead of string interpolation, or sanitize/validate the filePath using path.resolve() and ensure it doesn't contain shell metacharacters. Alternatively, use a cross-platform library like open or opn that handles this securely.

Changes

  • packages/chopsticks/src/utils/open-html.ts (modified)
  • packages/chopsticks/src/plugins/index.ts (modified)

tomaioo added 2 commits June 21, 2026 17:19
- Security: Command Injection via Unsanitized File Path in openHtml
- Security: Arbitrary Code Execution via Dynamic Script Loading in loadRpcMethodsByScripts

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
- Security: Command Injection via Unsanitized File Path in openHtml
- Security: Arbitrary Code Execution via Dynamic Script Loading in loadRpcMethodsByScripts

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant