Skip to content

fix: Remove cwd-based binary discovery from icp CLI wrapper - #781

Merged
adamspofford-dfinity merged 2 commits into
mainfrom
zvuln_fix_579ccaed
Sep 16, 2026
Merged

adamspofford-dfinity merged 2 commits into
mainfrom
zvuln_fix_579ccaed

Conversation

@zeropath-ai

@zeropath-ai zeropath-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

The icp CLI wrapper locates the platform-specific native executable by checking a hardcoded sequence of paths. The final fallback path is constructed using path.join(process.cwd(), 'node_modules', packageName, 'bin', binaryName). If the intended binary is not found in the earlier paths (which can happen frequently under package managers like pnpm that heavily utilize symlinks, or if optional dependencies failed to install), the CLI wrapper falls back to resolving the executable relative to the current working directory.

This creates an untrusted search path vulnerability (analogous to including . in the PATH environment variable). If an attacker convinces a victim to execute the globally installed icp command from within a malicious repository containing a planted binary at node_modules/@icp-sdk/icp-cli-<platform>-<arch>/bin/icp, the wrapper will silently execute the attacker-controlled binary with the victim's privileges.

Copilot AI balanced review requested due to automatic review settings September 15, 2026 19:39
@zeropath-ai
zeropath-ai Bot requested a review from a team as a code owner September 15, 2026 19:39
@adamspofford-dfinity adamspofford-dfinity changed the title Remove cwd-based binary discovery from icp CLI wrapper fix: Remove cwd-based binary discovery from icp CLI wrapper Sep 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@adamspofford-dfinity
adamspofford-dfinity enabled auto-merge (squash) September 16, 2026 14:06
@adamspofford-dfinity
adamspofford-dfinity merged commit 3a5e90f into main Sep 16, 2026
33 checks passed
@adamspofford-dfinity
adamspofford-dfinity deleted the zvuln_fix_579ccaed branch September 16, 2026 14:07
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.

2 participants