T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:22
- Finding
- Plaintext Storage and Duplication of Sensitive Financial Records<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:22`, `SKILL.md:150-151`, `SKILL.md:164`, and `SKILL.md:175` **Vulnerability Type**: Plaintext sensitive-data storage **Risk Level**: Medium ### Vulnerable Code Snippets `SKILL.md:22`: ```markdown 2. **Maintain a local JSON ledger** at `./data/ledger.json`. Create it if it doesn't exist. ``` `SKILL.md:150-151`: ```markdown ledger.json # Main ledger (append-only pattern) ledger.backup.json # Auto-backup before any write ``` `SKILL.md:164`: ```markdown 1. **Always backup** — Before writing to ledger.json, copy current state to ledger.backup.json ``` `SKILL.md:175`: ```markdown - **Ledger is plaintext JSON.** Remind users not to store this in public repos. ``` ### Technical Analysis The Skill explicitly directs the Agent to persist financial records in an unencrypted JSON file under the current working directory. The documented schema includes transaction amounts, currencies, vendors, dates, descriptions, invoice states, due dates, tags, and notes. These fields can reveal confidential personal or business activity. The required backup procedure duplicates the same information into another plaintext file. This increases the number of sensitive artifacts that must be protected and can preserve historical records after the primary ledger changes. The append-only and soft-deletion design can also retain data longer than a user expects. Using project-relative paths provides no assurance that the files receive restrictive permissions or remain outside source-control repositories, synchronized folders, shared workspaces, or broadly readable directories. The warning not to commit the ledger does not technically enforce confidentiality. ### Attack Path 1. A user invokes the Skill and submits invoice or expense information. 2. The Agent writes the transaction to `./data/ledger.json`. 3. Before a later update, the Agent copies the existing ledger to `./data/ledger.backup.json`. 4. T ...[truncated 1422 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Store ledgers in a user-specific private application-data directory rather than inside the project working directory. 2. Create ledger, backup, and export files with owner-only permissions, such as mode `0600`, and create containing directories with mode `0700` where supported. 3. Encrypt sensitive ledger and backup contents at rest using an established authenticated-encryption implementation. 4. Store encryption keys in the operating system's credential store or keychain rather than alongside the ledger. 5. Add `data/`, `exports/`, ledger filenames, backups, and temporary files to `.gitignore` and equivalent packaging exclusions. 6. Detect whether the destination resides inside a source repository or shared directory and require explicit confirmation before writing. 7. Obtain explicit consent before persisting financial information and clearly document the storage location and retention policy. 8. Provide secure deletion and configurable retention for backups instead of indefinitely retaining all historical records. 9. Avoid making a plaintext backup before every write. Use encrypted, permission-restricted backups and atomic file replacement. 10. Minimize collected data and reject unnecessary secrets, payment-card data, bank-account numbers, government identifiers, or credentials. 11. Add startup checks that verify file ownership and permissions, refusing to operate when sensitive files are accessible to unintended users. ]]>
