T09 · Insecure Skill Coding Practices
- Location
scripts/state.sh:108- Finding
Persistent JSON State Injection Through Unescaped Hatch Parameters
- Content
View full analysis
"$STATE_FILE" <- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a local chat companion skill with disclosed local state, and the issues found are bounded usability/privacy and state-file robustness risks rather than hidden or harmful behavior.
Install only if you want passive companion reactions in chat and local state retained across sessions. Avoid passing untrusted custom names or attributes until JSON encoding is fixed, and review or delete ~/.openclaw/workspace/buddy-state.json if you want to clear retained companion data.
scripts/state.sh:108Persistent JSON State Injection Through Unescaped Hatch Parameters
The code does partially align with the description in that it reacts to chat messages and includes celebratory and error/sympathetic responses. However, the declared experience emphasizes a persistent virtual ASCII companion with hatching, cute sprite reactions, and growth over time, none of which are present in this code chunk. Instead, the script only performs keyword matching on a single message and returns a simple reaction_type|reaction_text pair. It also includes several reaction categories not mentioned in the description (greeting, thanks, snack, joke). This makes the implemented behavior materially narrower and somewhat different from the declared purpose.
The invocation rules are ambiguous, including reacting whenever a companion is mentioned and performing periodic idle presence. Poorly bounded activation conditions increase the chance that the skill will inject itself into unrelated conversations, which can lead to unintended behavior, state persistence, and interference with higher-priority tasks.
The skill reacts to very common phrases like 'hi', 'help', 'thanks', 'bug', and food words, which can cause unsolicited activation during ordinary conversation. In an agent environment, broad natural-language triggers can create prompt-hijacking of the interaction flow, unexpected state changes, and repeated output or file writes without a deliberate user command.
The skill persists conversation-derived data to '~/.openclaw/workspace/buddy-state.json' across sessions without a prominent consent or privacy notice. Even if the stored fields seem harmless, names, interaction stats, moods, and generated personality text are derived from user interactions and can create privacy, retention, and cross-session context leakage risks.
The delete branch irreversibly removes the user's buddy state file with rm and only reports deleted afterward. There is no confirmation prompt, pre-action warning, or other user disclosure at the point of this destructive operation.