T09 · Insecure Skill Coding Practices
- Location
scripts/run.mjs:83- Finding
Path Traversal Allows Execution of Unintended Local JavaScript Modules
- Content
View full analysis
{ const child = spawn(process.execPath, [scriptPath, ...args], { stdio: 'inherit', env: process.env, }); child.on('close', (code) => { process.exit(code ?? 0); }); child.on('error', reject); }); } ``` ### Technical Analysis The `call` command treats the user-controlled `name` argument as a path component. The code appends `.mjs` and passes the result to `join()`, but it does not reject absolute paths, directory separators, or `..` traversal components. `join()` normalizes traversal sequences. Consequently, a value such as `../../some/path/module` can resolve outside the intended `scripts` directory. The only security check is `existsSync()`, which confirms that the resolved file exists but does not verify that it belongs to the authorized endpoint directory. The resolved module is executed in a new Node.js process. That child inherits the complete parent environment through `env: process.env`, including `FX_AI_API_KEY` and any other credentials available to the Agent process. ### Attack Path 1. An attacker influences the arguments passed to `scripts/run.mjs`, directly or through prompt injection affecting an Agent invocation. 2. The attacker selects the `call` command and supplies a traversal-based ...[truncated 1208 chars]- Remediation
View remediation
