T08 · Insecure Dependencies
Error
- Location
- SKILL.md:14
- Finding
- Documented commands execute an undeclared package through npx<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:14-18`, `README.md:28-46`, `package.json:22-28` **Vulnerability Type**: Unsafe runtime dependency resolution **Risk Level**: High ### Vulnerable Code ```bash cd {baseDir} npx ts-node scripts/client.ts <command> [args] # Borrower commands npx ts-node scripts/lp.ts <command> [args] # LP commands ``` The README repeats this pattern for all financial operations: ```bash npx ts-node scripts/client.ts status npx ts-node scripts/client.ts borrow 5 npx ts-node scripts/client.ts repay all npx ts-node scripts/client.ts bridge 10 arc base npx ts-node scripts/lp.ts pool-status npx ts-node scripts/lp.ts deposit 100 npx ts-node scripts/lp.ts withdraw all ``` However, `ts-node` is not declared in the package manifest: ```json "dependencies": { "@circle-fin/adapter-viem-v2": "^1.4.0", "@circle-fin/bridge-kit": "^1.5.0", "dotenv": "^17.2.4", "ethers": "^6.16.0" }, "devDependencies": { "tsx": "^4.21.0", "typescript": "^5.9.3" } ``` ### Technical Analysis The Skill instructs users and agents to execute `npx ts-node`, but `ts-node` is neither a direct dependency nor represented as the intended local executable in the reviewed manifest. When no local binary is available, `npx` may resolve, download, and execute a package from the configured npm registry at invocation time. This bypasses the reviewed lockfile as the authoritative source for the command runner. It creates a mutable supply-chain execution path inside a process that is explicitly expected to have access to `WALLET_PRIVATE_KEY`. The project already defines local scripts using the locked `tsx` dependency: ```json "scripts": { "client": "npx tsx scripts/client.ts", "lp": "npx tsx scripts/lp.ts" } ``` Therefore, retrieving a separate runner at invocation time is not necessary for the declared functionality. ### Attack Path 1. A user exports `WALLET_PRIVATE_KEY` as required by the Skill. 2. The user or AI ag ...[truncated 1381 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace all documented `npx ts-node` commands with scripts that execute the installed, lockfile-controlled runner: ```bash npm run client -- status npm run client -- borrow 5 npm run lp -- pool-status ``` 2. Avoid invoking `npx` from within package scripts. Define the scripts as: ```json "scripts": { "client": "tsx scripts/client.ts", "lp": "tsx scripts/lp.ts" } ``` npm automatically resolves binaries from `node_modules/.bin`. 3. Install dependencies using `npm ci` so versions and integrity hashes come from `package-lock.json`. 4. Pin security-sensitive dependencies to exact versions instead of permissive caret ranges where operationally feasible. 5. If `ts-node` is intentionally required, add an exact version to `devDependencies`, regenerate the lockfile, and execute only the local binary. 6. Run transaction tooling in a constrained environment with minimal filesystem and network access. Do not expose production-value keys to package installation or dependency-resolution processes. ]]>
