T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/people_memory.py:80
- Finding
- Personal Memory Database Is Stored Without Enforced Restrictive Permissions## Vulnerability Details **File Location**: `scripts/people_memory.py`, lines 11 and 80-84 **Vulnerability Type**: Plaintext sensitive-data storage with permissions determined by the host environment **Risk Level**: Medium ### Vulnerable Code ```python PEOPLE_FILE = os.path.expanduser("~/.clawdbot/people-memory.json") ``` ```python def save_store(data): os.makedirs(os.path.dirname(PEOPLE_FILE), exist_ok=True) with open(PEOPLE_FILE, "w", encoding="utf-8") as f: json.dump(data, f, ensure_ascii=False, indent=2) ``` ### Technical Analysis The database contains names, personal notes, preferences, birthdays, anniversaries, note sources, and timestamps. It is written as unencrypted JSON under the user's home directory. The code does not explicitly set the `~/.clawdbot` directory to owner-only mode (`0700`) or the database to owner-only mode (`0600`). For a newly created path, effective permissions depend on the process umask. If the host uses an insufficiently restrictive umask, other local accounts or services may be able to traverse the directory or read the database. If the file already exists with permissive permissions, opening it with mode `"w"` does not tighten those permissions. The documentation describes the memory vault as “short-lived,” but the implementation provides no expiration or deletion mechanism. Consequently, sensitive records remain in the database indefinitely unless the user removes them through some external mechanism. ### Attack Path 1. A user records a personal note through the CLI or voice integration. 2. `add_note()` adds the name, note, source, tags, and possible event metadata to the in-memory store. 3. `save_store()` creates or overwrites `~/.clawdbot/people-memory.json` without enforcing owner-only permissions. 4. On a system with a permissive umask, permissive pre-existing file mode, shared backup, or another local service with filesystem access, an unauthorized local ...[truncated 653 chars]
- Remediation
- ## Remediation Suggestions - Create `~/.clawdbot` with mode `0700` and explicitly verify or correct its mode when it already exists. - Create the database with mode `0600`, and correct permissions on an existing database before reading or writing it. - Use an atomic write strategy: write to an owner-only temporary file in the same directory, flush and synchronize it, then replace the destination atomically. - Consider encryption at rest when the threat model includes backups, administrative services, or offline access. - Implement configurable expiration and secure deletion commands so the documented “short-lived” behavior matches the implementation. - Document the storage location, plaintext format, retention period, and local-access assumptions.
