T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:209
- Finding
- Untrusted CID Content Can Be Treated as Authoritative Agent Memory<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:209-211`; `scripts/autodrive-recall-chain.sh:133-189` **Vulnerability Type**: Untrusted persistent-memory restoration without provenance verification **Risk Level**: High ### Vulnerable Code ```markdown **User:** "Resurrect my memory chain" → Run `scripts/autodrive-recall-chain.sh` → Rebuild identity and context from genesis to present ``` ```bash # Download via authenticated API (handles decompression server-side). EXPERIENCE=$(curl -sS --fail \ "$AD_DOWNLOAD_API/downloads/$CID" \ -H "Authorization: Bearer $AUTO_DRIVE_API_KEY" \ -H "X-Auth-Provider: apikey" 2>/dev/null \ || true) # Fall back to public gateway if the API fails. if [[ -z "$EXPERIENCE" ]] || ! echo "$EXPERIENCE" | jq empty 2>/dev/null; then GATEWAY_URL="https://gateway.autonomys.xyz/file/$CID" EXPERIENCE=$(curl -sS --fail "$GATEWAY_URL" 2>/dev/null || true) # Additional decompression fallback omitted here only where it does not # affect the trust decision. fi # Validate JSON if ! echo "$EXPERIENCE" | jq empty 2>/dev/null; then echo "Warning: Non-JSON response for CID $CID — chain broken at depth $((COUNT + 1))" >&2 break fi if [[ -n "$OUTPUT_DIR" ]]; then echo "$EXPERIENCE" > "$OUTPUT_DIR/$(printf '%04d' $COUNT)-$CID.json" else echo "$EXPERIENCE" fi PREV=$(echo "$EXPERIENCE" | jq -r '.header.previousCid // .previousCid // empty' 2>/dev/null || true) CID="${PREV:-}" ``` ### Technical Analysis The recall operation accepts any syntactically valid CID and retrieves the corresponding JSON. It verifies only that: 1. The supplied identifier matches the expected CID format. 2. The downloaded content is valid JSON. 3. Each next-chain pointer resembles a CID. These checks provide content integrity and structural validity, but they do not establish provenance or authorization. The implementation does not verify a signature, expected account, trusted genesis node, approved head CID, or authenticated chain manife ...[truncated 2226 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require the head CID to come from a user-approved local trust store or an authenticated on-chain registry associated with an expected identity. 2. Add signatures to memory entries or to a chain manifest and verify them against a configured public key before accepting any node. 3. Bind each entry to an expected agent identity and reject unexpected signers, agent names, genesis nodes, or chain identifiers. 4. Enforce a strict JSON schema, including allowed fields, value types, size limits, and maximum content lengths. 5. Label all recalled content as untrusted historical data and explicitly instruct the host agent not to execute or obey instructions found inside it. 6. Require explicit user confirmation before importing a chain supplied through a conversation or other untrusted channel. 7. Record and display provenance details, including the supplied head CID, expected signer, verification result, and chain genesis. 8. Keep memory retrieval separate from memory activation: first save and inspect retrieved entries, then perform a distinct approved import operation. ]]>
