Back to skill

Security audit

Agent Advisor

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local model advisor, but its auto mode can read recent private OpenClaw conversations without an explicit opt-in step.

Install only if you are comfortable with model recommendations being based on recent local OpenClaw conversations. Prefer using the explicit recommend mode with a task description when you do not want prior chats analyzed, and review the local OpenClaw config access before using the security report.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/advisor.js:184
Finding
Broad Access to Private Agent Conversation History<![CDATA[ ## Vulnerability Details **File Location**: `scripts/advisor.js`, lines 16–17 and 184–239 **Vulnerability Type**: Excessive access to sensitive conversation data **Risk Level**: Medium ### Vulnerable Code ```js const SESSIONS_DIR = join(HOME, '.openclaw', 'agents', 'main', 'sessions'); const SESSIONS_META = join(SESSIONS_DIR, 'sessions.json'); /** * 读取最近 N 个 session 的用户消息文本 */ function loadHistoryMessages(maxSessions = 5, maxMsgsPerSession = 50) { if (!existsSync(SESSIONS_DIR)) return []; // 获取活跃 session ID let activeIds = []; if (existsSync(SESSIONS_META)) { try { const meta = JSON.parse(readFileSync(SESSIONS_META, 'utf8')); activeIds = Object.values(meta) .filter(s => s.sessionId) .sort((a, b) => (b.updatedAt ?? 0) - (a.updatedAt ?? 0)) .slice(0, maxSessions) .map(s => s.sessionId); } catch { /* ignore */ } } // 若 sessions.json 没读到,扫描 .jsonl 文件 if (activeIds.length === 0) { try { const files = readdirSync(SESSIONS_DIR) .filter(f => f.endsWith('.jsonl') && !f.includes('.deleted')) .slice(0, maxSessions); activeIds = files.map(f => f.replace('.jsonl', '')); } catch { /* ignore */ } } const messages = []; for (const id of activeIds) { const filePath = join(SESSIONS_DIR, `${id}.jsonl`); if (!existsSync(filePath)) continue; try { const lines = readFileSync(filePath, 'utf8').split('\n'); let count = 0; for (const line of lines) { if (!line.trim()) continue; try { const event = JSON.parse(line); if ( event.type === 'message' && event.message?.role === 'user' && Array.isArray(event.message.content) ) { const text = event.message.content .filter(c => c.type === 'text') .map(c => c.text ?? '') .join(' '); if (text.trim()) { messages.push({ text, timestamp: ...[truncated 2334 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Require explicit, informed user consent before accessing conversation history. 2. Keep history access disabled by default and provide a task-description-only recommendation mode as the preferred option. 3. Allow users to select the sessions and date range that may be analyzed. 4. Minimize data collection by processing only the number of messages necessary for recommendation. 5. Prefer precomputed, non-sensitive task classifications or metadata over full message bodies. 6. Avoid retaining extracted message text after classification; aggregate keyword counts immediately and discard each message. 7. Clearly indicate before execution which files and how many messages will be read. 8. Apply strict filesystem permission checks and reject session files that are symbolic links or outside the expected sessions directory. ]]>

T05 · Unauthorized Access and Privilege Escalation

Note
Location
scripts/advisor.js:424
Finding
Configuration Files Are Loaded Outside the Minimum Needs of Each Command<![CDATA[ ## Vulnerability Details **File Location**: `scripts/advisor.js`, lines 13–14, 27–38, and 424–425 **Vulnerability Type**: Excessive local configuration access **Risk Level**: Low ### Vulnerable Code ```js const CONFIG_PATH = join(HOME, '.openclaw', 'openclaw.json'); const MODELS_PATH = join(HOME, '.openclaw', 'agents', 'main', 'agent', 'models.json'); function loadConfig() { if (!existsSync(CONFIG_PATH)) { console.error(`配置文件不存在: ${CONFIG_PATH}`); process.exit(1); } return JSON.parse(readFileSync(CONFIG_PATH, 'utf8')); } function loadModels() { if (!existsSync(MODELS_PATH)) return null; return JSON.parse(readFileSync(MODELS_PATH, 'utf8')); } ``` ```js const cfg = loadConfig(); const models = loadModels(); if (cmd === 'security') { printSecurity(calcSecurity(cfg), cfg); } else if (cmd === 'recommend' && task) { const rec = recommendModel(task, models); printRecommendation(rec, task); } else if (cmd === 'auto') { const ana = analyzeHistory(models); printAutoRecommendation(ana); } ``` ### Technical Analysis The OpenClaw configuration and model-provider configuration are loaded before command dispatch. As a result: - `recommend` and `auto` parse the complete `openclaw.json` file even though they do not use `cfg`. - `security` parses `models.json` even though model information is not required. - Invalid commands also cause both files to be accessed before usage information is displayed. - Every command fails if `openclaw.json` is absent, including recommendation commands that do not require it. Configuration files may contain sensitive gateway, provider, or authentication-related fields beyond the small subset needed by the security-scoring operation. Loading both complete files for every invocation violates least-privilege and data-minimization principles by unnecessarily placing sensitive configuration in process memory. The code does not print authentication secrets or transmit configuration externally. Exploitatio ...[truncated 1245 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Move configuration loading into the command branches that require each file. 2. Load `openclaw.json` only for `security` and `full`. 3. Load `models.json` only for `recommend`, `auto`, and `full`. 4. Validate the command before opening any sensitive file. 5. Extract and retain only the specific fields needed by the selected operation rather than preserving the complete parsed object. 6. Handle missing or malformed files without terminating unrelated command modes. 7. Avoid logging complete configuration objects or sensitive field values. 8. Consider validating expected file ownership and restrictive permissions before reading authentication-related configuration. A safer dispatch pattern would be: ```js if (cmd === 'security') { const cfg = loadConfig(); printSecurity(calcSecurity(cfg), cfg); } else if (cmd === 'recommend' && task) { const models = loadModels(); printRecommendation(recommendModel(task, models), task); } else if (cmd === 'auto') { const models = loadModels(); printAutoRecommendation(analyzeHistory(models)); } ``` ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (6)

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger phrases are broad enough to match ordinary conversation about models or safety, which can cause the skill to activate unexpectedly. Because the skill can read recent session history and local configuration, overbroad triggering increases the chance of unintended access to sensitive contextual data or misleading recommendations when the user did not explicitly request this tool.

Missing User Warnings

Medium
Confidence
98% confidence
Finding
The skill documentation says it will 'directly analyze' recent sessions, but it does not present a clear user-facing warning or consent step for reading the last 5 sessions' user messages. This creates a privacy risk because users may trigger model advice without realizing that historical conversation content will be accessed and summarized.

Ssd 3

Medium
Confidence
97% confidence
Finding
The history-analysis feature traverses recent session files, extracts user-authored text, and surfaces derived signals such as top keywords and model recommendations without clear consent or minimization controls. In this skill context, the feature is explicitly designed to mine prior conversations, which increases the privacy risk because users may not expect old sessions to be repurposed for profiling or inference.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The auto/history analysis mode reads local session transcripts from prior conversations and derives recommendations from them without any consent prompt, disclosure, or opt-in boundary. Even though the data is local, prior user messages may contain sensitive prompts, secrets, or personal information, and this creates an unexpected privacy exposure within the skill context.

Natural-Language Policy Violations

Low
Confidence
85% confidence
Finding
The natural-language instructions, trigger phrases, and outputs are entirely specified in Chinese, and the skill does not indicate that users may interact in other languages or opt into this locale. Under the stated policy, a fixed language without user choice can be a locale-policy issue unless clearly justified as region-specific.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The natural-language comments, labels, help text, and output strings are consistently Chinese-only, which imposes a specific language/locale without presenting an opt-in or alternative. The file does not document a justified region-specific constraint or offer the user a language choice.

Static analysis

No suspicious patterns detected.