T09 · Insecure Skill Coding Practices
- Location
scripts/collector.py:363- Finding
Unredacted conversation excerpts are stored in plaintext with ambient file permissions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is transparent about personalization, but it reads and stores recent conversation history and can persistently change SOUL.md, so it needs careful review before installation.
Install only if you intentionally want local profiling of your recent OpenClaw conversations. Run the collector in dry-run/manual mode first, inspect the generated data, avoid enabling the daily cron job unless you accept automatic SOUL.md changes, and keep MEMORY.md writing disabled unless each memory update is reviewed.
scripts/collector.py:363Unredacted conversation excerpts are stored in plaintext with ambient file permissions
scripts/advisor.py:463Optional memory writer can persist unsanitized caller-controlled content into agent memory
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
**You are in control:**
- Disable the cron job anytime: `openclaw cron remove <job-id>`
- Delete the profile block manually from SOUL.md
- Clear all stored data: `rm -rf skills/behavior-persona/data/`
- MEMORY.md write is **disabled by default**
---
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
**You are in control:**
- Disable the cron job anytime: `openclaw cron remove <job-id>`
- Delete the profile block manually from SOUL.md
- Clear all stored data: `rm -rf skills/behavior-persona/data/`
- MEMORY.md write is **disabled by default**
---
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
To remove all stored data:
rm -f skills/behavior-persona/data/*.json skills/behavior-persona/data/*.md
This script is explicitly designed to analyze collected user messages and events to infer behavioral traits such as active hours, frustration signals, channel preferences, and work patterns. In the skill context, that is sensitive profiling: it transforms raw interaction history into reusable personality and behavior summaries without visible scope limitation, consent checks, or safeguards against misuse.
The report generator turns inferred traits and message-derived signals into human-readable artifacts, including frustration indicators, abandonment keywords, communication habits, and topic history. That materially increases privacy risk because the summaries are portable, easy to interpret, and suitable for secondary use beyond the original interaction context.
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
4. 晚间回复可以稍长一点(他有更多时间)
5. 新任务先给原型
"""
return prompt
def inject_to_soul(prompt):
"""注入到 SOUL.md"""
The skill is designed to read session and memory files and persist collected conversation content in local JSON storage for up to 30 days. Even with truncation and disclosure, this creates a real privacy and data-retention risk because sensitive user content is copied into an additional storage location that may be easier to access, back up, or misuse.
1. **Reads** your OpenClaw session files and memory files
2. **Stores** collected data in `data/collected_data.json` (messages truncated to ~200 chars)
3. **Modifies** your `SOUL.md` daily by injecting a user profile block at 18:00
4. **Does NOT** write to MEMORY.md by default (requires `WRITE_MEMORY=True` in code)
**Privacy implications:**
- Raw conversation content is stored (truncated)
The skill explicitly supports automated daily execution of a pipeline that reads conversation history, stores derived data, and modifies SOUL.md. Even though cron setup is opt-in, once enabled it performs persistent autonomous changes to agent behavior and prompt context without per-run user approval, increasing the risk of privacy erosion and unintended prompt manipulation over time.
/behavior insights # View key insights
### Auto Run
- **Not enabled by default** - You must manually create the cron job
- **Daily 18:00** (if cron is set up): Full pipeline: collect → analyze → generate profile → inject to SOUL.md
The scenario definition explicitly describes automatically recording repeated user content into MEMORY.md, which is a persistent file in the user's home workspace. Even though writes are disabled by default, the design encourages silent persistence of user-provided content and can be enabled without any consent, classification, or safeguards around sensitive information.
This code embeds natural-language behavioral instructions in Chinese, such as the action text for advice scenarios, and later uses those instructions to shape outputs. The file does not provide any opt-in or fallback for users who prefer another language, so it imposes a locale/language choice contrary to the policy criteria.
The personalized advisor prompt includes guidance to remember prior reminders and, in context with the rest of the file, normalize retention of user-specific behavioral traits and details for future responses. In an agent skill, encouraging persistent memory of user data without clear consent, minimization, or disclosure creates privacy risk and can lead to storage of sensitive preferences or conversation-derived personal information.
The generated advisor prompt consists of Chinese-language instructions that direct how the assistant should respond, including tone and timing guidance. Because this prompt is injected automatically and no language-choice mechanism is present, the skill enforces a specific language/locale behavior without documented user consent.
The adapt_response function prepends '📝 已记录这个要点。' for the repetitive_reminder scenario even though no write occurs there, and persistent writing is disabled by default elsewhere. This creates a deceptive state where the user is told their information was recorded when it was not, undermining trust and potentially causing incorrect operational assumptions about retained preferences or instructions.
The entire prompt content is written as mandatory behavioral guidance in Chinese, including response-style instructions, with no indication that the user can choose another language. This creates a natural-language locale constraint that may violate policy requiring language choice or explicit justification for a region-specific skill.
The code comments indicate a fixed local-time assumption ('Asia/Shanghai') while deriving activity-hour profiles from message timestamps. Even though the implementation does not actually convert timezones, the resulting analysis can misattribute a user's active hours and behavioral patterns, which is risky in a profiling script because misleading inferences may be reused as if they were accurate.
The script writes analysis outputs containing user-derived behavioral data to disk as JSON and Markdown without any user-facing notice, consent gate, retention control, or access restriction. Persisting these artifacts increases exposure because they can be copied, indexed, or read later by other local users, processes, backups, or tooling.
The module documentation states it extracts '用户行为数据' from session records, which implies user-behavior-focused collection. However, extract_messages explicitly stores both user messages as 'Roger' and assistant messages as 'Me', so the dataset includes AI responses in addition to user behavior data.
The skill is explicitly designed to collect and store natural-language session and memory content as 'behavior data,' which creates a direct pathway for sensitive conversational information to be extracted, normalized, and reused. In this context, the danger is amplified because the collector processes personal interaction history from multiple local sources and preserves excerpts in a consolidated artifact.
This code reads session transcripts and memory files from local OpenClaw storage and aggregates their contents without any user consent, notice, minimization, or access control checks. Because those sources can contain sensitive prompts, personal data, or secrets, silent collection materially increases privacy and data-handling risk within the skill context.
The collector persists conversation-derived data to a JSON file on disk, including message excerpts and inferred events, without warning the user that sensitive content may be stored long-term. Persisting derived conversational data expands exposure beyond the original session files and can make later unauthorized access, accidental sharing, or secondary use more likely.
The script persistently injects user profile attributes and behavioral instructions into a system-prompt-like file for reuse in future interactions. This is dangerous because it turns personal data and model-steering text into durable hidden context, increasing privacy risk and creating a persistent prompt-manipulation surface if the profile data is inaccurate, adversarial, or overly sensitive.
The generated prompt content is entirely in Chinese and prescribes reply behavior in that language/context, which can impose a locale/language preference on downstream assistant behavior. There is no opt-in, user choice, or documented justification that this skill is intended only for Chinese-language use.
The script derives the output path for SOUL.md from environment-controlled base directories and then opens that path for writing without validation. In an agent/runtime context, an attacker who can influence environment variables could redirect writes to an unintended file, causing prompt tampering or overwrite of arbitrary files accessible to the process.
# 添加到文件末尾
content += f"\n\n{marker_start}\n{prompt}\n{marker_end}\n"
with open(SOUL_FILE, 'w') as f:
f.write(content)
return True
The script silently writes personalized content into advisor_prompt.txt and SOUL.md, which appear to influence future model behavior, without user approval or a clear warning. In a prompt-driven agent system, unreviewed modification of context files can become persistent prompt injection and may alter downstream decisions or expose personal data more broadly than intended.
The markdown mostly uses English, but the cron invocation hard-codes a Chinese string in the scheduled message: "执行 Behavior Persona 每日更新...". This can impose a specific language/locale in skill behavior without user opt-in, which matches the natural-language policy violation criteria.
No suspicious patterns detected.