T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/analyze_usage.py:23- Finding
Excessive Access to Complete Main-Agent Conversation History
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill appears to do what it says, but it reads all local OpenClaw session history and saves ongoing usage summaries without enough activation or opt-out controls.
Review this before installing if your OpenClaw session history may contain sensitive conversations, command output, paths, or credentials. Use it only when you intentionally want an all-history report, and consider deleting or restricting access to ~/.qclaw/workspace/memory/usage_stats_latest.md and usage_stats_history.json after use. A safer version would require explicit confirmation, support date/session filters, offer no-persist output, and sanitize markdown fields.
scripts/analyze_usage.py:23Excessive Access to Complete Main-Agent Conversation History
scripts/analyze_usage.py:530Stored Markdown Injection Through Unescaped Session Metadata
The skill clearly describes capabilities that require reading session files, writing reports/history, and likely invoking a script, but it does not declare an explicit tool scope such as permissions or allowed-tools. This creates a mismatch between documented behavior and enforceable constraints, increasing the risk of over-privileged or unintended file and shell access when the skill is invoked.
The trigger phrases include very broad terms like '统计', 'usage', 'report', and '我用了多少', which can appear in ordinary conversation and cause accidental activation. Because the skill reads all local session records and writes persistent output, an unintended invocation can expose private usage history or modify local memory files without sufficiently specific user intent.
The skill description tells the user it can 'run usage stats' but does not prominently warn that it will read all local session records under the user's home directory and write both a latest report and a history snapshot. This is a transparency and consent problem: users may reasonably expect a lightweight summary, not comprehensive local log processing and persistent storage of derived metadata.
The instruction '直接告诉我…我调用脚本生成报告' explains how to use the skill but does not define boundaries for when it should or should not activate. In context, the skill performs broad local log analysis and persistence, so ambiguous invocation rules raise the risk of the agent launching file-reading and file-writing actions based on weak or inferred intent.
The skill is designed to generate persistent reports, historical snapshots, and memory updates derived from session records. Even if intended for analytics, this creates session persistence beyond the original logs, potentially retaining sensitive behavioral metadata, error details, and usage patterns in additional files that may be accessed later or kept longer than expected.
## 核心功能
- ✅ **Token 统计**:input / output / cacheRead / cacheWrite / 总计
- ✅ **费用估算**:基于 usage 数据计算总费用
- ✅ **模型分布**:各模型的调用次数和 token 消耗
- ✅ **缓存命中率**:cacheRead / (cacheRead + cacheWrite)
The skill is designed to generate persistent reports, historical snapshots, and memory updates derived from session records. Even if intended for analytics, this creates session persistence beyond the original logs, potentially retaining sensitive behavioral metadata, error details, and usage patterns in additional files that may be accessed later or kept longer than expected.
## 核心功能
- ✅ **Token 统计**:input / output / cacheRead / cacheWrite / 总计
- ✅ **费用估算**:基于 usage 数据计算总费用
- ✅ **模型分布**:各模型的调用次数和 token 消耗
- ✅ **缓存命中率**:cacheRead / (cacheRead + cacheWrite)
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.
### 新增功能
- **Token 统计**:完整解析 input / output / cacheRead / cacheWrite / totalTokens
- **费用估算**:基于 usage.cost 字段计算总费用
- **模型分布**:按模型分组统计 token 消耗和调用次数
- **缓存命中率**:cacheRead / (cacheRead + cacheWrite) × 100%
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.
### 新增功能
- **Token 统计**:完整解析 input / output / cacheRead / cacheWrite / totalTokens
- **费用估算**:基于 usage.cost 字段计算总费用
- **模型分布**:按模型分组统计 token 消耗和调用次数
- **缓存命中率**:cacheRead / (cacheRead + cacheWrite) x 100%
The heading explicitly defines the output-format specification in Chinese, which imposes a language/locale expectation in the skill documentation. The file does not indicate that language is user-selectable or that the Chinese-only requirement is justified by a region-specific constraint.
The script scans all session logs and persists aggregated data about user and assistant activity, including tool usage, timing, errors, and text-volume characteristics, into durable files under workspace memory. In the context of a usage-stats skill, broad cross-session aggregation is related to functionality, but persisting derived conversation metadata still creates a real privacy and surveillance risk if users are not informed or if other components can read those files.
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.
total_output = 0
total_tokens = 0
cache_read = 0
cache_write = 0
total_cost = 0.0
msg_count = 0
turns = 0
The skill advertises usage statistics generation, but it also creates and retains a separate history file containing longitudinal snapshots of session-derived metrics. This expands data retention beyond a one-time report and can surprise users by persisting behavioral metadata over time without clear consent or retention limits beyond a rolling window.
The script writes a markdown report and a JSON history file derived from all sessions into persistent workspace storage without any user-facing notice or consent step. Persisting conversation-derived analytics silently increases privacy risk, especially because the data is gathered from all session logs rather than only the current interaction.
This markdown file contains user-facing natural language content exclusively in Chinese, including feature descriptions and technical details. Under the policy, forcing a specific language without user opt-in or clear justification is a natural-language policy violation.
The top-level docstring describes the skill entirely in Chinese, indicating a fixed language/locale presentation rather than offering a user-selectable language. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern unless the locale constraint is documented and justified.
The code parses raw session content to extract structured error details and later derives message text-length analytics, which goes beyond narrow token/cost accounting. Although it does not store full message bodies in the final history, it inspects conversation/tool output content and may surface snippets of errors that can contain sensitive paths, identifiers, or operational details.
No suspicious patterns detected.