T09 · Insecure Skill Coding Practices
Warning
- Location
- memory-manager.sh:21
- Finding
- Automatic Plaintext Retention of Sensitive Conversation Data## Vulnerability Details **File Location**: `SKILL.md:27-39`; `memory-manager.sh:21-25`, `memory-manager.sh:77-109`, and `memory-manager.sh:207-225` **Vulnerability Type**: Plaintext sensitive-data storage with insufficient access-control hardening **Risk Level**: Medium The Skill explicitly instructs the Agent to collect personal information, infrastructure details, server addresses, and API keys: ```markdown Automatically extract and store memories whenever the user shares: - **Preferences**: "I prefer dark mode", "I like Python over JavaScript" - **Personal facts**: names, locations, roles, team members, project names - **Decisions**: "We decided to use PostgreSQL", "Let's go with the microservice approach" - **Instructions**: "Always run tests before committing", "Never deploy on Fridays" - **Important dates**: deadlines, birthdays, recurring events - **Technical context**: stack details, repo URLs, server addresses, API keys (stored locally only) - **Corrections**: "Actually, my name is spelled with a K" (update existing memory) ``` The storage locations are ordinary local JSON files: ```bash MEMORY_DIR="${OPENCLAW_MEMORY_DIR:-$HOME/.openclaw/smart-memory}" MEMORIES_FILE="$MEMORY_DIR/memories.json" ARCHIVE_FILE="$MEMORY_DIR/archive.json" STATS_FILE="$MEMORY_DIR/stats.json" CONFIG_FILE="$MEMORY_DIR/config.json" ``` Initialization creates the directory and files without explicitly enforcing restrictive permission modes: ```bash cmd_init() { mkdir -p "$MEMORY_DIR" if [ ! -f "$MEMORIES_FILE" ]; then echo '{"memories":[],"version":"1.0.0","created":"'"$(now_iso)"'"}' | jq . > "$MEMORIES_FILE" info "Created memories store: $MEMORIES_FILE" fi if [ ! -f "$ARCHIVE_FILE" ]; then echo '{"archived":[],"version":"1.0.0"}' | jq . > "$ARCHIVE_FILE" info "Created archive: $ARCHIVE_FILE" fi if [ ! -f "$STATS_FILE" ]; then cat > "$ ...[truncated 3306 chars]
- Remediation
- ## Remediation Suggestions 1. Prohibit storage of passwords, API keys, session tokens, private keys, recovery codes, and authentication headers. 2. Add secret-detection rules before persistence and reject or redact values matching known credential formats and high-entropy token patterns. 3. Require explicit user opt-in before retaining personal, technical, or otherwise sensitive information; do not infer consent from ordinary conversation. 4. Create the storage directory with `install -d -m 0700` or an equivalent operation and enforce `0600` on every JSON and lock file. 5. Set a restrictive `umask`, such as `umask 077`, at script startup. 6. Offer encryption at rest using an operating-system key store or another appropriately protected key source. Do not store the encryption key beside the data. 7. Apply the same controls to archived values, update history, exports, and backups. 8. Warn users that exports contain sensitive memory content and avoid sending exports to logs or shared output channels.
