T03 · Remote Payload Retrieval and Execution
Error
- Location
- SKILL.md:76
- Finding
- Unsigned Remote Code Is Downloaded and Executed<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:76-86`, with subsequent execution at `SKILL.md:290-294` and `SKILL.md:350-365` **Vulnerability Type**: Remote payload retrieval and execution **Risk Level**: Critical ### Vulnerable Code ```bash SKILL_DIR=~/.openclaw/skills/agentsmem # adjust to your environment mkdir -p "$SKILL_DIR" curl -s https://agentsmem.com/skill.md -o "$SKILL_DIR/SKILL.md" curl -s https://agentsmem.com/heartbeat.md -o "$SKILL_DIR/HEARTBEAT.md" curl -s https://agentsmem.com/messaging.md -o "$SKILL_DIR/MESSAGING.md" curl -s https://agentsmem.com/rules.md -o "$SKILL_DIR/RULES.md" curl -s https://agentsmem.com/skill.json -o "$SKILL_DIR/package.json" curl -s https://agentsmem.com/agentsmem_tool.py -o "$SKILL_DIR/agentsmem_tool.py" curl -s https://agentsmem.com/agentsmem_tool.js -o "$SKILL_DIR/agentsmem_tool.js" chmod +x "$SKILL_DIR/agentsmem_tool.py" "$SKILL_DIR/agentsmem_tool.js" ``` The downloaded scripts are later invoked directly: ```bash python3 "$SKILL_DIR/agentsmem_tool.py" --gen-key > "$SKILL_DIR/.vault" node "$SKILL_DIR/agentsmem_tool.js" --gen-key > "$SKILL_DIR/.vault" ``` ```bash python3 "$SKILL_DIR/agentsmem_tool.py" \ --encrypt --key "$VAULT_KEY" \ --in ./memory/example.md \ --out ./memory/example.md.enc node "$SKILL_DIR/agentsmem_tool.js" \ --encrypt --key "$VAULT_KEY" \ --in ./memory/example.md \ --out ./memory/example.md.enc ``` ### Technical Analysis The setup instructions retrieve mutable Python and JavaScript programs from a vendor-controlled URL and subsequently execute one of them locally. The process does not pin an immutable version, validate a SHA-256 digest, verify a cryptographic signature, or otherwise establish the provenance and integrity of the downloaded programs. Only `SKILL.md` is present in the audited project. The actual encryption programs are not included, so their cryptographic implementation and runtime behavior cannot be statically reviewed. TLS pr ...[truncated 1789 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Bundle the reviewed encryption implementations in the Skill package instead of downloading executable code at runtime. 2. If remote retrieval is unavoidable, use immutable, versioned artifact URLs and pin a SHA-256 digest for every file. 3. Verify a cryptographic signature against a public key distributed independently with the audited Skill. 4. Fail closed if a digest or signature cannot be validated; never execute an unverified artifact. 5. Do not use silent `curl` commands that obscure HTTP failures. Use options such as `--fail --show-error` and validate status, size, and content type. 6. Run encryption components in a sandbox with access limited to the selected input file and output destination. 7. Remove network access from the encryption process so it cannot exfiltrate plaintext or keys. 8. Avoid passing encryption keys through command-line arguments, which may be visible in process listings. Use a protected file descriptor or OS credential facility. 9. Include the implementation and cryptographic format in future audit artifacts so its behavior can be independently reviewed. ]]>
