T09 · Insecure Skill Coding Practices
- Location
SETUP-PROMPT.md:38- Finding
Setup Instructions Unconditionally Destroy Existing CRM Data
- Content
View full analysis
data/relationship-buddy/data/contacts.json echo '[]' > data/relationship-buddy/data/interactions.json echo '[]' > data/relationship-buddy/data/reminders.json echo '[]' > data/relationship-buddy/data/gifts.json echo '[]' > data/relationship-buddy/data/relationship-health.json ``` ### Technical Analysis The setup instructions use the shell redirection operator `>` to initialize every CRM data file unconditionally. If any target file already exists, the shell truncates it before writing the empty JSON array. The setup process does not: - Detect an existing installation. - Check whether the files contain user records. - Ask for confirmation before resetting data. - Create a backup. - Distinguish first-time installation from upgrade or repair. - Provide rollback or recovery behavior. Consequently, the documented installer is not idempotent. Repeating an otherwise legitimate setup operation can erase all locally stored contacts, interactions, reminders, gift history, and cached relationship-health information. ### Attack Path 1. A user has an existing Relationship Buddy installation containing personal CRM records. 2. The user or an AI agent is induced to rerun the documented setup prompt, for example during troubleshooting, reinstallation, repair, or an upgrade. 3. The setup reaches the five `echo '[]' > ...` commands. 4. Each existing JSON file is immediately truncated and replaced with an empty array. 5. Because no backup is created, the prior records cannot be restored through the Skill. No elevated system privilege is required. The commands operate with the current user's legitimate write access to the Skill data directory. ### Impact Assessment Successful exploitation causes loss of all Relationship Buddy records accessible to the current ...[truncated 640 chars]- Remediation
View remediation
"$file" chmod 600 "$file" else echo "Preserving existing data file: $file" fi } initialize_json_file data/relationship-buddy/data/contacts.json initialize_json_file data/relationship-buddy/data/interactions.json initialize_json_file data/relationship-buddy/data/reminders.json initialize_json_file data/relationship-buddy/data/gifts.json initialize_json_file data/relationship-buddy/data/relationship-health.json ``` Additional hardening should include: 1. Detect and clearly report an existing installation before making changes. 2. Separate normal installation and upgrade operations from an explicit reset operation. 3. Require informed user confirmation before any reset. 4. Create timestamped, permission-restricted backups before modifying existing files. 5. Validate existing JSON rather than replacing malformed or unexpected content automatically. 6. Abort safely if a destination is a symbolic link or is not a regular file. 7. Document a restoration procedure and retain backups until setup verification succeeds. ]]>
