Back to skill

Security audit

Autothink 1.0.0

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its purpose of managing OpenClaw thinking modes, but its CLI has unsafe shell execution and the documentation gives conflicting expectations about automatic behavior.

Review this before installing. The main concern is not hidden exfiltration, but unsafe local execution: messages passed through the CLI may be interpreted by a shell. Install only after the publisher removes shell:true, validates inputs, narrows invocation scope, and aligns the docs with the actual v2 behavior.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (1)

T09 · Insecure Skill Coding Practices

Error
Location
src/cli.js:13
Finding
OS Command Injection Through Shell-Backed OpenClaw Invocation## Vulnerability Details **File Location**: `src/cli.js`, lines 13-26 **Vulnerability Type**: OS command injection through attacker-controlled process arguments **Risk Level**: High ### Vulnerable Code ```javascript function runAgentWithThinking(message, thinkingLevel, sessionId = null) { const args = ['agent', '--thinking', thinkingLevel]; if (sessionId) { args.push('--session-id', sessionId); } args.push('--message', message); console.log(`[AutoThink] 使用 thinking=${thinkingLevel} 处理消息...\n`); return new Promise((resolve, reject) => { const proc = require('child_process').spawn('openclaw', args, { stdio: 'inherit', shell: true, env: { ...process.env } }); ``` The affected values originate from user-controlled CLI arguments and environment variables elsewhere in the same file: ```javascript let sessionId = process.env.OPENCLAW_SESSION_ID || null; ``` ```javascript case '--session-id': sessionId = args[++i]; break; ``` ```javascript const rawMessage = messageParts.join(' '); cleanedMessage = engine.cleanPrefix(rawMessage); runAgentWithThinking(cleanedMessage, thinkingMode, sessionId) ``` ### Technical Analysis The code correctly uses an argument array with `child_process.spawn()`, but then enables `shell: true`. This causes Node.js to execute the command through the operating-system shell. Attacker-controlled `message` and `sessionId` values can consequently be interpreted as shell syntax instead of being passed exclusively as literal arguments to `openclaw`. Both affected inputs are insufficiently constrained: - `message` is assembled directly from command-line input. - `sessionId` can be supplied through `--session-id` or the `OPENCLAW_SESSION_ID` environment variable. - Neither value is validated or escaped before reaching the shell. - The full inherited environment is also passed to the resulting process. Shell metachara ...[truncated 2096 chars]
Remediation
## Remediation Suggestions 1. Remove shell execution and preserve direct argument passing: ```javascript const proc = require('child_process').spawn('openclaw', args, { stdio: 'inherit', shell: false, env: { ...process.env } }); ``` Omitting `shell` is also safe because its default value is `false`. 2. Validate `thinkingLevel` with a strict allowlist before process creation: ```javascript const allowedLevels = new Set(['low', 'medium', 'high']); if (!allowedLevels.has(thinkingLevel)) { throw new Error('Invalid thinking level'); } ``` 3. Validate session IDs using an allowlist appropriate to OpenClaw, such as a bounded set of letters, digits, underscores, and hyphens. Reject missing values after `--session-id`. 4. Apply reasonable length limits to messages and session IDs to reduce resource-exhaustion and malformed-input risks. 5. Do not treat shell escaping as the primary fix. Correct escaping is platform-dependent and error-prone; direct execution with `shell: false` prevents shell interpretation entirely. 6. Add regression tests that pass command separators, substitutions, redirections, quotes, spaces, and platform-specific shell characters as messages and session IDs. Verify that they are received by `openclaw` only as literal argument content and never create secondary commands. 7. Consider constructing a minimal child-process environment rather than forwarding all of `process.env`, especially when the CLI may run in privileged automation.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (27)

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding
Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The design explicitly states the skill no longer performs automatic complexity analysis, which directly contradicts the advertised behavior of intelligent automatic mode switching. This mismatch can mislead users and integrators into trusting automation that is not actually present, causing incorrect assumptions about how prompts are handled and when higher-cost reasoning is applied.

Vague Triggers

Medium
Confidence
93% confidence
Finding
Persisting a previously selected mode across all later messages without clear scope boundaries can cause unintended carryover of behavior between unrelated tasks in the same session. This is especially risky for agent skills because stateful overrides can silently alter future handling, including sensitive or trivial prompts, in ways the user may not expect.

Intent-Code Divergence

Medium
Confidence
97% confidence
Finding
Declaring that automatic analysis is disabled and the feature is now 'pure state management' conflicts with the stated purpose of the skill. In security-sensitive agent ecosystems, documentation/behavior drift is dangerous because users may rely on nonexistent safeguards or decision logic when routing sensitive or complex requests.

Vague Triggers

Medium
Confidence
89% confidence
Finding
Using high mode as the implicit default for unspecified messages is ambiguous and broad, but it is more of a predictability and resource-governance issue than a direct security flaw. The main risk is silent activation of a stronger reasoning mode where the user did not explicitly request it, potentially increasing cost or changing behavior unexpectedly.

Intent-Code Divergence

Medium
Confidence
99% confidence
Finding
The document itself acknowledges that SKILL.md still describes old semantics, confirming that deployed documentation may currently misrepresent the skill. That creates a supply-chain style trust issue where operators may enable the skill under false assumptions about what it does.

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The release guidance to remove 'automatic analysis' from SKILL.md confirms current contradiction between intent and implementation. Such discrepancies are operationally risky because they can affect policy, cost controls, and user expectations around automatic reasoning selection.

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Description-Behavior Mismatch

Medium
Confidence
97% confidence
Finding
The metadata promises automatic complexity-based switching, while the body describes a manual persistent selector with no ongoing analysis. This mismatch can mislead users and downstream systems about the skill's behavior, causing incorrect trust assumptions, inappropriate routing, or policy decisions based on nonexistent safeguards.

Vague Triggers

Medium
Confidence
91% confidence
Finding
The trigger phrase 'thinking mode' is broad and likely to appear in ordinary conversation, which raises the risk of accidental skill activation. In an agent environment, unintended activation can alter behavior or session state unexpectedly, potentially causing user confusion, policy bypass of intended invocation flow, or persistence of an undesired mode across subsequent interactions.

Vague Triggers

Medium
Confidence
86% confidence
Finding
The Chinese trigger '智能思考' is also broad and semantically common, making accidental invocation plausible in regular conversation. Because this skill persists state across a session, an accidental trigger can have effects beyond a single message, increasing the practical risk compared with a non-persistent skill.

Natural-Language Policy Violations

Medium
Confidence
84% confidence
Finding
Natural-language policy review applies to all file types. Most user-facing instructions and examples are Chinese-only, while the skill does not state that it is region-specific or offer users an explicit language/locale option, which can amount to forcing a locale without opt-in.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The manifest says the skill will automatically adjust thinking based on 'message complexity' but provides no clear boundaries for when it activates, what content it inspects, or what exclusions apply. In an automation skill with session persistence, this ambiguity can lead to unintended invocation and persistent behavior changes across unrelated prompts, creating a prompt-scope and control-risk issue.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger phrase "thinking mode" is broad enough to match normal user conversation and can cause the skill to activate when the user did not intend to invoke it. In a message-preprocessor skill, unintended activation can alter model behavior persistently across a session, making this more than a cosmetic issue because it can influence downstream responses without clear user consent.

Natural-Language Policy Violations

Medium
Confidence
89% confidence
Finding
The keyword lists used to determine complexity are predominantly Chinese terms, which suggests the skill's behavior is tuned to one language. There is no visible opt-in, language selection, or justification that this skill is intended only for Chinese-language use, so this may violate language/locale policy expectations.

Natural-Language Policy Violations

Medium
Confidence
98% confidence
Finding
Natural-language strings in comments, help output, and status messages are written in Chinese throughout the CLI, with no option to select another language or indication that the tool is intentionally region-specific. This can violate language/locale policy when users are not given an explicit opt-in or choice.

Context-Inappropriate Capability

Medium
Confidence
96% confidence
Finding
The CLI launches `openclaw` via `child_process.spawn` with `shell: true`, which unnecessarily invokes a shell for user-influenced arguments such as `message` and `sessionId`. In a wrapper skill whose purpose is only to adjust thinking mode, this broad execution capability increases the risk of command injection or shell interpretation issues and exceeds the minimum privilege needed.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The subprocess inherits the full parent environment with `env: { ...process.env }`, which can expose API keys, tokens, and other secrets to the child process and anything it invokes. In combination with `shell: true`, this enlarges the blast radius because a compromised or unexpected child execution path gains access to all inherited credentials.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
When AUTOTHINK_DEBUG is enabled, the hook logs the first 50 characters of every user message to stdout. User messages can contain secrets, personal data, or sensitive prompts, and plugin logs are often collected centrally or viewed by operators without the user's awareness, making this an information disclosure risk.

Context-Inappropriate Capability

Medium
Confidence
87% confidence
Finding
The skill is described as adjusting thinking level based on message complexity with session persistence, which does not require subprocess control. Importing child_process.spawn adds an execution-capable primitive that is unjustified by this skill's purpose, even though it is not used elsewhere in this file.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The natural-language description and embedded operational text present the skill as Chinese-language-specific (for example, comments, keyword lists, and rationale strings are all written in Chinese) without offering a language choice or documenting that the skill is intentionally region-specific. This can violate language/locale policy when the broader environment expects multilingual or user-selected behavior.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
getStatus reports `autoAnalyze: false` with the comment `v2 关闭自动分析`, implying automatic complexity analysis is disabled. However, processMessage and detectThinkingMode still accept an `autoAnalyze` parameter and invoke analyzeComplexity when it is true, so the inline documentation contradicts actual behavior.

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
The file consistently presents user-facing descriptions, examples, and prompts only in Chinese, and does not indicate that language is selectable or that the skill is intentionally limited to a Chinese-speaking context. This can violate language/locale policy when a skill effectively forces one language without user opt-in.

Natural-Language Policy Violations

Low
Confidence
87% confidence
Finding
The skill description begins in Chinese and the rest of the usage guidance is primarily Chinese, while the commands and flags are English-oriented. This creates a language/locale policy concern because the documentation effectively assumes a Chinese-speaking user without stating that the skill is region-specific or offering an alternative language option.

Intent-Code Divergence

Low
Confidence
78% confidence
Finding
The snippet presents processMessage as handling a message and producing a thinking level, which suggests active message-based determination. Elsewhere, the documentation explicitly contrasts v2 against v1 by saying v2 performs zero ongoing analysis and simply reuses or switches a persisted mode, so the example is misleading about what drives the output.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
src/cli.js:22