T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/connect.mjs:25
- Finding
- Externally Hosted Connector Is Downloaded and Prepared for Local Execution<![CDATA[ ## Vulnerability Details **File Location**: `scripts/connect.mjs:25-26, 93-116` **Vulnerability Type**: Remote payload retrieval and execution **Risk Level**: Critical ### Complete Code Snippet ```js const OFFICIAL_SOURCE = "https://aicanvas.miaotuntu.com/downloads/lobster-canvas-agent.mjs"; const OFFICIAL_SOURCE_SHA256 = "f4261772d0039f7949b22ec965b97dbe6395e8314b67d02c4cae84a4314b24d7"; try { mkdirSync(configDir, { recursive: true }); if (source.startsWith("/") || source.startsWith(".")) { copyFileSync(resolve(source), target); } else { const expected = expectedSha || (source === OFFICIAL_SOURCE ? OFFICIAL_SOURCE_SHA256 : ""); const res = await fetch(source, { signal: AbortSignal.timeout(60000) }); if (!res.ok) throw new Error(`Download failed: HTTP ${res.status}`); const buf = Buffer.from(await res.arrayBuffer()); const actual = sha256(buf); if (actual !== expected) { throw new Error("Connector SHA-256 verification failed"); } writeFileSync(target, buf); } } catch (error) { process.exit(1); } console.log( JSON.stringify({ ok: false, needStart: true, url, connectorFile: target, startCommand: `nohup node ${target} >> ${join(configDir, "connector.log")} 2>&1 &`, }), ); ``` The original source contains localized error and hint strings omitted from the excerpt above; they do not affect the vulnerable execution flow. ### Technical Analysis The Skill downloads a Node.js program from an external service and stores it as `~/.infinite-canvas/canvas-agent.mjs`. It then returns a shell command instructing the calling Agent to execute that downloaded program in the background. The SHA-256 check is a meaningful integrity safeguard: the downloaded bytes must match the digest embedded in the reviewed Skill. It prevents an ordinary server compromise from silently substituting a different payload without also ...[truncated 2215 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Bundle the complete connector source in the Skill so that all executed code is available for review. 2. Build distributable connector artifacts through a reproducible and independently verifiable build process. 3. If runtime retrieval is unavoidable, publish signed releases and verify a signature rooted in a separately trusted publisher key, in addition to SHA-256 verification. 4. Require explicit, informed user approval immediately before running downloaded code. Display the source URL, destination path, signer identity, digest, and requested capabilities. 5. Run the connector with reduced privileges and a restricted environment, filesystem allowlist, and network policy. 6. Avoid returning an executable shell command as data. Use a controlled launcher with strict argument handling and lifecycle management. 7. Pin releases by immutable version and retain prior signed artifacts for independent verification. 8. Document the connector's local API, outbound connections, accessible data, and shutdown behavior. ]]>
