T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:163
- Finding
- Unprotected Plaintext Persistence of Sensitive Portfolio Data## Vulnerability Details **File Location**: `SKILL.md`, line 163 **Vulnerability Type**: Plaintext storage of sensitive financial data **Risk Level**: Medium **Complete Code Snippet**: ```text Each time Trade Actions are produced, save the portfolio snapshot to ~/.openclaw/memory/portfolio.json. On the next invocation, read it first and use it as the position baseline. If the file does not exist, ask the user to provide the initial portfolio. ``` ### Technical Analysis The Skill requires portfolio snapshots to be persisted across sessions in a predictable local JSON file. The stored information may include securities, share counts, cost bases, current values, profit or loss, and allocation percentages. No controls are specified for explicit user consent, file permissions, encryption, data minimization, retention, deletion, schema validation, ownership verification, or safe atomic updates. Consequently, the file may expose sensitive financial information to other local users or processes when default permissions are permissive. The integrity of future recommendations also depends on this file. If a process with access to the user's account can modify the JSON content, it may manipulate the portfolio baseline used by subsequent analyses. The Skill does not require validation of numeric ranges, ticker formats, file ownership, or unexpected fields before using stored state. ### Attack Path 1. The user invokes the Skill and receives Trade Actions. 2. The Skill writes a portfolio snapshot to the predictable path `~/.openclaw/memory/portfolio.json`. 3. A local user or process that already has sufficient filesystem access discovers the file. 4. For a confidentiality attack, the party reads the file and obtains portfolio holdings and related financial information. 5. For an integrity attack, the party modifies holdings, costs, capital, or allocation data. 6. During a later invocation, the Skill reads the altered snapshot as its po ...[truncated 788 chars]
- Remediation
- ## Remediation Suggestions 1. Make persistent portfolio storage opt-in and obtain explicit user consent before the first write. 2. Default to session-only state when persistence is unnecessary. 3. Store only the minimum fields needed for subsequent analysis and exclude account identifiers or unrelated metadata. 4. Use platform-managed secure storage where available. If a local file is necessary, create the directory and file with owner-only permissions, such as `0700` for the directory and `0600` for the file. 5. Verify file ownership and reject symbolic links, unexpected file types, or files writable by other users. 6. Validate stored content against a strict schema, including permitted fields, ticker formats, finite numeric values, nonnegative share counts, and reasonable value limits. 7. Use atomic writes through a securely created temporary file in the same protected directory, followed by an atomic rename. 8. Apply integrity protection or authenticated encryption when supported by platform key management. 9. Define a retention period and provide user-facing commands to inspect, replace, export, and delete stored portfolio data. 10. If ownership, permissions, integrity, or schema validation fails, do not use the file for financial recommendations; request a fresh portfolio confirmation from the user.
