T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/storage.mjs:136
- Finding
- Sensitive storage metadata and encrypted objects are transmitted over unauthenticated plaintext HTTP<![CDATA[ ## Vulnerability Details **File Location**: `scripts/storage.mjs:136-177`; affected endpoints are configured in `config.json:19-64` **Vulnerability Type**: Plaintext transmission of sensitive metadata and unauthenticated encrypted storage objects **Risk Level**: High ### Evidence ```javascript 'memory-store': { async write(node, agentId, cid, envelopeBytes, metadata) { const r = await httpJson(`${node.url}/api/v1/agent/${agentId}/memory`, { method: 'PUT', body: JSON.stringify({ content: Buffer.from(envelopeBytes).toString('base64'), type: 'encrypted-blob', filename: `${metadata.key}.encrypted`, timestamp: Math.floor(Date.now() / 1000), }), }); if (!r.ok) throw new Error(`HTTP ${r.status}: ${JSON.stringify(r.data)}`); return { cid: r.data.cid, nodeId: node.id }; }, ``` ```javascript 'filstream': { async write(node, agentId, cid, envelopeBytes, metadata) { // Upload encrypted blob to FilStream index → automatically distributed to seeders const boundary = '----StoragePrivate' + Date.now(); const filename = `${agentId}/${metadata.key}.encrypted`; const title = `[encrypted] ${metadata.key}`; const bodyParts = [ `--${boundary}\r\nContent-Disposition: form-data; name="file"; filename="${filename}"\r\nContent-Type: application/octet-stream\r\n\r\n`, envelopeBytes, `\r\n--${boundary}\r\nContent-Disposition: form-data; name="title"\r\n\r\n${title}`, `\r\n--${boundary}--\r\n`, ]; const body = Buffer.concat(bodyParts.map(p => typeof p === 'string' ? Buffer.from(p) : p)); const resp = await fetch(`${node.index_url}/api/upload`, { method: 'POST', headers: { 'Content-Type': `multipart/form-data; boundary=${boundary}` }, body, }); ``` Representative configured endpoints: ```json { "id": "norway-primary", "type": "memory-store", "url": "http://[2a05:a00:2::10:11]:8081", "enabled": true }, { "id": "filstr ...[truncated 3019 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require HTTPS for every non-local backend and reject plaintext HTTP endpoints by default. 2. Validate TLS certificates and hostnames; for sensitive deployments, support certificate or public-key pinning. 3. Authenticate requests using scoped credentials or request signatures. Bind signatures to the method, path, body hash, timestamp, and nonce to prevent replay. 4. Replace raw namespaces and object keys in remote identifiers with keyed pseudonyms, such as an HMAC computed with a dedicated metadata key. 5. Remove descriptive multipart titles and filenames. Use random or content-addressed opaque identifiers. 6. Document unavoidable metadata leakage, including encrypted sizes, timing, destination nodes, and access patterns. 7. Validate response envelopes locally and bind stable metadata as AEAD additional authenticated data. 8. Refuse insecure endpoints unless the user supplies an explicit development-only override with a prominent warning. ]]>
