Back to skill

Security audit

JS X Monitor

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it claims, but it has misleading privacy language and unsafe handling around scheduled jobs and local state files.

Review this skill carefully before installing. Use it only with non-sensitive monitored accounts and notification channels, because configured providers can receive tweet content and account identifiers. Avoid manually adding unusual account names to config.json, and be aware that start/stop manages OpenClaw cron jobs until the implementation narrows job matching and avoids shell interpolation.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/lib/utils.js:25
Finding

Path Traversal Through Unvalidated Account Names

Content
View full analysis
getUsername(a).toLowerCase() === cleanUsername.toLowerCase() ); if (exists) { console.log(`⚠️ @${cleanUsername} 已在监控列表中`); return; } config.accounts.push({ username: cleanUsername, enabled: true, addedAt: new Date().toISOString() }); ``` ```javascript // scripts/lib/utils.js:25-38 async function loadState(username) { const stateFile = path.join(STATE_DIR, `${username}.json`); try { const data = await fs.readFile(stateFile, 'utf8'); return JSON.parse(data); } catch { return { tweets: [], lastCheck: null }; } } async function saveState(username, state) { await fs.mkdir(STATE_DIR, { recursive: true }); const stateFile = path.join(STATE_DIR, `${username}.json`); await fs.writeFile(stateFile, JSON.stringify(state, null, 2)); } ``` ### Technical Analysis The account-management command removes a leading `@` and surrounding whitespace but does not verify that the resulting value conforms to the permitted X.com username syntax. Directory separators and traversal components such as `../` therefore remain accepted. The unvalidated account name is persisted in the configuration and later passed directly to `path.join()` when constructing a state filename. `path.join()` normalizes traversal components; it does not ensure that the final path remains inside `STATE_DIR`. Consequently, a value such as `../../target` can resolve outside `~/.openclaw/x-monitor/state/`. The flaw affects both `loadState()` and `saveState()`. The read operation a ...[truncated 2153 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/stop.js:15
Finding

Shell Command Injection Through Unvalidated Cron Job IDs

Content
View full analysis
j.name.includes('x-monitor')); if (monitorJobs.length === 0) { console.log('⚠️ 没有运行中的监控任务'); return; } for (const job of monitorJobs) { await execAsync(`openclaw cron remove --id ${job.id}`); console.log(`✅ 已停止: ${job.name}`); } ``` ### Technical Analysis The script obtains cron metadata from the output of an external executable, parses it as JSON, and interpolates each matching `job.id` directly into a command executed with `child_process.exec()`. `exec()` invokes a command shell. If `job.id` contains shell metacharacters such as `;`, `&&`, command substitution, redirection, or quoting characters, the shell interprets them as command syntax rather than as part of a single argument. The implementation does not verify: - That `jobs` is an array. - That `job.name` and `job.id` have the expected types. - That the identifier conforms to the exact format generated by OpenClaw. - That the command output is from an uncompromised executable or trusted cron store. Although exploitation requires control over OpenClaw cron metadata, command output, or executable resolution, crossing this trust boundary through a shell unnecessarily converts compromised metadata into arbitrary command execution. ### Attack Path 1. An attacker causes `openclaw cron list --json` to return a job whose name contains `x-monitor` and whose `id` contains shell syntax. This may occur through malicious cron metadata, a compromised OpenClaw executable, or executable-path manipulation. 2. The user invokes `openclaw x-monitor stop`. 3. The script parses the malicious object and selects it because its name contains `x-monitor`. 4. ...[truncated 926 chars]
Remediation
View remediation
job && typeof job.name === 'string' && typeof job.id === 'string' && job.name === 'x-monitor-check' ); ``` 3. Validate `job.id` against the exact identifier format documented by OpenClaw, such as a UUID or numeric-only expression. Do not invent an overly broad regular expression. 4. Match the exact expected task name instead of using `includes('x-monitor')`, reducing the chance of deleting unrelated or attacker-created tasks. 5. Use an absolute, trusted path to the OpenClaw executable when the deployment environment permits it, or otherwise ensure that `PATH` cannot be modified by less-trusted inputs. 6. Apply timeouts and output-size limits to child processes to reduce denial-of-service exposure. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (23)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

A description-behavior mismatch is a security problem because users may authorize or run the skill based on an innocuous monitoring description while the implementation also manipulates scheduler/cron state. Undisclosed job removal or scheduler management can disrupt other automations, create persistence changes, or hide the skill’s real operational footprint.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

A description-behavior mismatch is a security problem because users may authorize or run the skill based on an innocuous monitoring description while the implementation also manipulates scheduler/cron state. Undisclosed job removal or scheduler management can disrupt other automations, create persistence changes, or hide the skill’s real operational footprint.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation promotes real-time notifications to third-party messaging platforms but does not prominently warn that monitored tweet data will be transmitted off-host. In this skill's context, operators may monitor sensitive accounts or internal watchlists, so silent external sharing creates a meaningful confidentiality and compliance risk.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README states that data 'does not leave the local system' while elsewhere it explicitly describes pushing tweet content and summaries to Feishu/WeChat/Discord. This is a misleading privacy claim that can cause operators to enable the skill under false assumptions and unintentionally transmit monitored content to third-party services.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding

The skill declares no explicit tool scope or permissions even though it clearly depends on environment/runtime capabilities and external state such as a logged-in browser session and local config/state files. Missing scope declarations weaken user visibility and policy enforcement, increasing the chance the skill accesses resources beyond what a user expects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documentation does not adequately warn users that the skill depends on an authenticated X.com browser session, reads account content on a schedule, and forwards derived content to third-party notification channels. Insufficient disclosure can lead to unintended data access, privacy exposure, or policy violations when users enable continuous monitoring without understanding the data flow.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

A natural-language policy issue is present because the skill documentation forces a specific language/locale for all readers with no opt-in or alternative. The file does not indicate that the skill is region-specific or provide a language choice, so the language constraint is undocumented and mandatory.

Content

No source excerpt is available for this finding.

File System Enumeration

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.

Content

Scanner excerpt · docs/QUICKSTART.md (reported line 113)May include surrounding context.

md
A: 检查消息渠道配置,确保 OpenClaw 的 channel 已正确配置

### Q: 状态文件写入失败
A: 检查目录权限:`ls -la ~/.openclaw/x-monitor/`

## 获取帮助

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code emits all user-facing CLI messages in Chinese, including errors and usage guidance, with no indication that the skill is intended only for Chinese-speaking users or that another locale is supported. That creates a natural-language policy risk under the locale-choice rule because the user is forced into a specific language without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The formatted notification hard-codes the zh-CN locale via toLocaleString('zh-CN'), which forces Chinese date formatting regardless of user preference or system locale. This is a natural-language/locale policy issue because the file does not offer a language or locale choice or document a justified region-specific constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code formats dates using the fixed locale 'zh-CN' and the script's user-facing messages are written in Chinese, which enforces a specific language/locale choice. The policy allows locale constraints only when users are given a choice or when the restriction is clearly documented and justified, neither of which appears in this file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script's natural-language output and date formatting are hard-coded to Chinese, including toLocaleString('zh-CN') and multiple Chinese status messages. This enforces a specific language/locale without offering the user a choice or documenting that the tool is intentionally region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script's comment and all user-facing console messages are written in Chinese, with no mechanism to select another language or defer to user locale. This creates a natural-language policy concern if organizational policy requires avoiding forced language selection without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script’s natural-language strings and formatting are hard-coded in Chinese, and later output explicitly uses the zh-CN locale for timestamps. This imposes a specific language/locale on all users without offering an alternative or documenting a justified region-specific constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The skill documentation is written entirely in Chinese and does not indicate that the locale is optional or region-specific. Per the policy, forcing a specific language without user opt-in can be a natural-language policy violation when no justification or alternative is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The natural-language user-facing description and usage guidance are presented in Chinese, and the file does not indicate that this is optional, configurable, or region-specific. That can violate a language/locale policy when a skill forces a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

This markdown file documents openclaw x-monitor start and notes that the monitoring task runs every hour, but it does not clearly warn users that enabling monitoring will create ongoing automated activity and local state/config under ~/.openclaw/x-monitor/. For a skill that affects system behavior over time and writes user-local files, the quickstart should disclose that behavior explicitly before activation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The manifest’s human-facing description and command/tool descriptions are consistently written in Chinese, with no indication that the skill supports other languages or that Chinese is a justified region-specific requirement. Under the policy rule for natural-language violations, forcing a specific language without user opt-in can be a locale policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code explicitly formats the timestamp using the zh-CN locale, and the script's user-facing logs and comments are entirely in Chinese. That creates a language/locale constraint without offering the user a choice or documenting a region-specific justification, which matches the policy's language/locale violation category.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file’s natural-language content, including the header comment and all CLI messages, is written only in Chinese. This imposes a specific language on users without any visible opt-in, fallback, or documented region-specific justification, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file's comments and console messages are written entirely in Chinese, including operational status and failure output. This imposes a specific language on users without any opt-in, selection mechanism, or documented region-specific justification, which matches the locale policy violation criteria.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The script invokes a subprocess via execAsync('openclaw cron list') to inspect scheduled task state, but there is no nearby comment, docstring detail, or user-facing message disclosing that an external command will be executed. Although this operation is not obviously destructive, code-file guidance says subprocess execution should be flagged when it lacks any form of user disclosure and is not clearly explained as part of the skill's stated purpose in this file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

The call to toLocaleString('zh-CN') explicitly forces Chinese locale formatting regardless of user preference. Per policy, locale constraints should be optional or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.