T08 · Insecure Dependencies
Warning
- Location
- scripts/search-clawhub.sh:22
- Finding
- Unpinned Third-Party ClawHub CLI Download and Execution<![CDATA[ ## Vulnerability Details **File Locations**: - `scripts/search-clawhub.sh:22-39` - `SKILL.md:28-34, 109-123, 159, 244-245` - `DEVELOPMENT.md:53-58, 146, 226-227` **Vulnerability Type**: Unpinned third-party dependency execution **Risk Level**: Medium ### Vulnerable Code `scripts/search-clawhub.sh:22-39`: ```bash if command -v clawhub &> /dev/null; then CLAWHUB_CMD="clawhub" elif command -v npx &> /dev/null; then CLAWHUB_CMD="npx clawhub" echo "[INFO] Using npx (clawhub not installed globally)" else echo "[ERROR] Neither clawhub nor npx found. Install with: npm i -g clawhub" echo "[INFO] Or install Node.js to use npx." exit 1 fi echo "[INFO] Searching ClawHub for: '$QUERY' (Limit: $LIMIT)" # Run search command set +e OUTPUT=$($CLAWHUB_CMD search "$QUERY" --limit "$LIMIT" 2>&1) EXIT_CODE=$? ``` `SKILL.md:28-34`: ```bash npm i -g clawhub ``` Or use it via npx (slower but no installation): ```bash npx clawhub search "query" ``` `DEVELOPMENT.md:53-58`: ```bash npm i -g clawhub ``` 2. **npx usage** (no installation): ```bash npx clawhub search "query" ``` ### Technical Analysis The skill instructs users and AI agents to install or execute the `clawhub` npm package without specifying a reviewed version or verifying package integrity. The helper script automatically falls back to `npx clawhub` when a globally installed executable is unavailable. Because no version is pinned, npm resolves the package version available from the configured registry at execution time. The effective executable can therefore change after this skill has been reviewed. If the package, publisher account, registry resolution, or a newly released version is compromised, `npx` can download and execute attacker-controlled code. Likewise, `npm i -g clawhub` can run package lifecycle scripts and creates a persistent, system-wide dependency whose contents may differ over time. The script also performs the npx fallback automatically rather than requestin ...[truncated 1780 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin the CLI to a specifically reviewed release: ```bash npx --yes clawhub@<reviewed-version> search "$QUERY" --limit "$LIMIT" ``` 2. Prefer a project-local dependency managed through a lockfile rather than a global installation: ```bash npm install --save-exact clawhub@<reviewed-version> ``` 3. Commit and review the generated lockfile, and use a reproducible installation command such as `npm ci`. 4. Verify package integrity and provenance before execution. Document the expected npm package name, publisher, registry URL, release version, and integrity hash or signature where supported. 5. Require explicit user approval before downloading or executing the package for the first time. Do not silently convert the absence of a local executable into remote package retrieval. 6. Avoid recommending `npm i -g` because it creates a mutable system-wide dependency. If global installation is unavoidable, pin the exact version and do not run npm with elevated privileges. 7. Execute the CLI with the minimum required filesystem, environment, and network access. Avoid exposing unrelated secrets to the subprocess. 8. Establish a dependency update process in which new versions are reviewed and tested before the pinned version is changed. ]]>
