T09 · Insecure Skill Coding Practices
- Location
scripts/state.py:62- Finding
Private Memory Excerpts Persisted Without Restrictive File Permissions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill does what it claims, but it needs review because it reads and persists private memory-log content and converts untrusted history into automation drafts without strong boundaries.
Review before installing. Use it only if you are comfortable with it reading your OpenClaw memory logs and storing derived excerpts in state.json. Keep the state file private, avoid committing or syncing it publicly, inspect generated cron definitions and skill drafts as untrusted proposals, and do not approve automations solely from generated evidence.
scripts/state.py:62Private Memory Excerpts Persisted Without Restrictive File Permissions
scripts/report.py:90Untrusted Memory Text Propagates Into Agent-Facing Automation and Skill Drafts
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.
state.setdefault("analysis_log", [])
return state
except (json.JSONDecodeError, KeyError):
sys.stderr.write(f"Warning: Corrupt state file at {p}, starting fresh.\n")
return EMPTY_STATE.copy()
return EMPTY_STATE.copy()
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.
import argparse
parser = argparse.ArgumentParser(description="Inspect crystallizer state")
parser.add_argument("--state-file", default=None, help="Path to state.json")
parser.add_argument("--reset", action="store_true", help="Reset state to empty")
args = parser.parse_args()
if args.reset:
The skill documents file-reading and file-writing behavior, plus persistent state management, but does not declare any explicit tool scope or permissions boundaries. In a system that auto-grants or infers capabilities from skill content, this can cause the agent to access or modify local files beyond what a user would reasonably expect, especially because the workflow includes state resets and direct edits.
The description contains broad trigger phrases such as recurring tasks, workflow patterns, optimize my workflows, and what should be automated, which can match ordinary conversation and cause over-invocation. Because this skill reads memory logs and proposes automations, accidental activation can expose historical user data to unnecessary processing or lead to unsolicited workflow changes.
The skill emphasizes persistent state, direct editing of state.json, and full reset capability, but does not prominently warn that these actions can alter or erase stored history and decision records. This is risky because the stored suggestions, acceptance/rejection history, and cached events influence future behavior, so accidental or uninformed edits can corrupt state, lose data, or change downstream automation recommendations.
The draft skill template instructs the agent to populate trigger phrases from clustered keywords without requiring narrowing constraints, exclusions, or user-approval gates. In a skill that mines memory logs and proposes automations, broad triggers can cause accidental over-invocation of future skills on loosely related prompts, increasing the chance of unintended actions or unsafe automation from weakly matched patterns.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
def save_state(state: dict, path: Optional[str] = None) -> None:
"""Write state to disk atomically."""
p = Path(path) if path else DEFAULT_STATE_PATH
p.parent.mkdir(parents=True, exist_ok=True)
tmp = p.with_suffix(".tmp")
The footer text formats the generation time with a fixed 'ET' suffix regardless of the user's locale or actual system timezone. This is a natural-language locale choice imposed by the skill output, and the file does not offer opt-in, configurability, or justification for using that specific locale/timezone.
This code performs a file write via Path(args.output).write_text(report). While the CLI exposes an --output flag, the implementation has no confirmation prompt or inline comment/docstring warning at the write site about overwriting or modifying a file, which is the kind of user-affecting operation covered by this rule for code files.