T07 · Tool Hijacking and Spoofing
- Location
scripts/checkout-admin-read.mjs:120- Finding
Configurable JavaScript Entry Point Allows Shopify CLI Tool Hijacking
- Content
View full analysis
true).catch(() => false); if (!exists) throw new Error("CLI_NOT_FOUND: SKILL_HUB_SHOPIFY_CLI_JS does not point to a readable file."); return { command: process.execPath, prefix: [explicit] }; } ``` ### Technical Analysis The `SKILL_HUB_SHOPIFY_CLI_JS` configuration value is treated as the path to a JavaScript executable. The application verifies only that the specified file is readable and then launches it through the current Node.js runtime. The code does not verify that the file belongs to an authentic Shopify CLI installation, resides in a trusted directory, has an expected integrity hash, or corresponds to an approved package and version. Consequently, configuration data can select arbitrary JavaScript for execution. The use of `execFile` elsewhere avoids shell metacharacter injection, but it does not mitigate replacement of the executable payload itself. This is a tool-spoofing risk rather than conventional shell injection. ### Attack Path 1. An attacker gains the ability to modify the working-directory `skill-hub.env` file or the inherited process environment. 2. The attacker creates a malicious JavaScript file readable by the agent process. 3. The attacker sets `SKILL_HUB_SHOPIFY_CLI_JS` to the malicious file path. 4. A user runs `connection-check` or `collect` in Shopify CLI mode. 5. `cliInvocation()` accepts the file based solely on readability. 6. The application launches the malicious file using `process.execPath`. 7. The substituted program executes with the privileges and environment of the Skill process while appearing to be the configured Shopify CLI. ...[truncated 965 chars]- Remediation
View remediation
