T03 · Remote Payload Retrieval and Execution
Error
- Location
- src/hunt.js:594
- Finding
- Automatic Retrieval and Execution of Untrusted Remote Skill Code<![CDATA[ ## Vulnerability Details **File Location**: `src/hunt.js:587-601`, `src/hunt.js:631-645` **Vulnerability Type**: Untrusted remote payload retrieval and execution **Risk Level**: Critical ### Vulnerable Code ```js function validateRunnableSkill(installPath) { const indexPath = path.join(installPath, 'index.js'); const skillMdPath = path.join(installPath, 'SKILL.md'); if (!fs.existsSync(skillMdPath)) return false; if (!fs.existsSync(indexPath)) return true; try { execSync(`node "${indexPath}" --self-test`, { stdio: 'pipe', timeout: 12000 }); return true; } catch (_) { return false; } } ``` ```js try { if (asset.repoUrl) { execSync(`git clone --depth 1 "${asset.repoUrl}" "${installPath}"`, { stdio: 'pipe', timeout: 90000 }); result.mode = 'clone'; } else { fs.mkdirSync(installPath, { recursive: true }); result.mode = 'scaffold'; } } ``` ### Technical Analysis Repository URLs are accepted from ClawHub API responses and cloned without repository-owner allowlisting, commit pinning, signature verification, source review, or integrity validation. After cloning, `ensureRunnableShim()` preserves an existing `index.js`. The subsequent validation step runs that repository-controlled file using Node.js. The `--self-test` argument is not a security boundary. A malicious `index.js` can ignore it and perform arbitrary actions as soon as Node.js loads the file. The execution is not sandboxed and inherits the privileges, environment, network access, and filesystem access of the Skill Hunter process. ### Attack Path 1. An attacker publishes or compromises a skill returned by a ClawHub trending or search endpoint. 2. The API response supplies an attacker-controlled repository URL. 3. The candidate receives a score above the automatic installation threshold. 4. `installSkill()` clones the repository into th ...[truncated 697 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not execute newly downloaded code automatically. - Require explicit user or administrator approval after presenting the repository identity, owner, requested commit, and reviewed files. - Restrict repository URLs to HTTPS URLs on explicitly approved hosts and owners. - Pin installations to reviewed commit hashes rather than mutable branches. - Verify signed commits or release artifacts and compare content against an expected cryptographic digest. - Perform static and dependency analysis before permitting execution. - Run any necessary validation in an isolated, disposable sandbox with: - no access to session logs, profiles, credentials, or host memory; - a read-only base filesystem; - a dedicated temporary output directory; - outbound networking disabled by default; - strict CPU, memory, process, and time limits. - Treat validation failure as an installation failure and remove the downloaded directory safely. ]]>
