T08 · Insecure Dependencies
- Location
src/installer.js:174- Finding
<![CDATA[Untrusted Package Retrieval Without Origin, Integrity, or Size Validation]]>
- Content
View full analysis
{ const url = skill.downloadUrl; const client = url.startsWith('https:') ? https : http; const req = client.get(url, { timeout: 60000 }, (res) => { if (res.statusCode !== 200) { reject(new Error(`Download failed with status ${res.statusCode}`)); return; } const chunks = []; res.on('data', chunk => chunks.push(chunk)); res.on('end', () => { const data = Buffer.concat(chunks); fs.writeFileSync(targetDir, data); resolve(targetDir); }); }); ``` ### Technical Analysis The installer treats the registry-provided `skill.downloadUrl` as trusted. It selects either the HTTPS or HTTP client based solely on the URL prefix and then requests the destination without validating: - The URL protocol - The destination hostname or resolved IP address - Whether the destination belongs to an approved package host - Whether the destination resolves to loopback, link-local, private-network, or cloud metadata infrastructure - The package's cryptographic digest or publisher signature - The response content type or package format - The maximum response size The response is accumulated completely in memory through `Buffer.concat(chunks)` and written to disk without authenticity verification. Consequently, a malicious or compromised registry can direct the process to internal services or provide a modified package. The lack of a response-size limit also permits memory exhaustion if the remote endpoint sends a very large response. The current repository's `installer.js` is incomplete and is not exported by `src/index.js`. This reduces immediate reachability through ...[truncated 1689 chars]- Remediation
View remediation
