Back to skill

Security audit

WSB 热股日报

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says, but its scheduled Discord posting is documented with root-level paths and unsafe shared temporary files that make it worth reviewing carefully before installation.

Install only if you are comfortable with a cron job that automatically posts stock-market digests to a Discord channel. Run it as an unprivileged user, change the root-specific paths, use a private temporary directory instead of fixed /tmp paths, and confirm the target Discord channel before enabling the schedule.

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

Warning
Location
scripts/wsb-digest-trigger.sh:31
Finding

Predictable Shared Temporary Paths Permit File Overwrite and Data-Tampering Attacks

Content
View full analysis

Vulnerability Details

File Location: scripts/wsb-digest-trigger.sh, lines 31-34, 46-57, and 116
Vulnerability Type: Unsafe temporary-file and directory handling
Risk Level: Medium

Vulnerable Code

bash
LOG_FILE=/tmp/wsb-digest.log
RAW_FILE=/tmp/wsb-raw.out
JSON_FILE=/tmp/wsb-latest.json
CHUNK_DIR=/tmp/wsb-digest-chunks
bash
echo "[$(date '+%Y-%m-%d %H:%M:%S %Z')] Starting WSB Digest..." >> "$LOG_FILE"

# 1) Fetch data
if ! node "${SKILL_DIR}/scripts/apewisdom-wsb.js" > "$RAW_FILE" 2>> "$LOG_FILE"; then
  echo "[$(date '+%Y-%m-%d %H:%M:%S %Z')] ❌ Generator failed" >> "$LOG_FILE"
  exit 1
fi

# 2) Extract JSON
awk 'found{print} /^\{/{found=1; print}' "$RAW_FILE" > "$JSON_FILE"

# 3) Split into chunks
rm -rf "$CHUNK_DIR"
mkdir -p "$CHUNK_DIR"
bash
CHUNK_COUNT=$(cat "$CHUNK_DIR/count.txt")

Technical Analysis

The trigger script uses fixed, predictable names in the globally writable /tmp directory for logs, raw API output, parsed JSON, and a recursively removed chunk directory. It does not create a private temporary directory with mktemp, apply a restrictive umask, validate ownership, reject symbolic links, or securely open the files.

A local attacker can pre-create these paths as symbolic links or manipulate them between validation and use. Shell redirections such as > "$RAW_FILE", > "$JSON_FILE", and >> "$LOG_FILE" follow symbolic links. If the scheduled task runs with elevated privileges—as the root-specific paths and HOME=/root configuration anticipate—the writes occur with those elevated privileges.

The fixed chunk directory also creates a race window around rm -rf, mkdir, Node.js file creation, and subsequent reads. An attacker who can replace or manipulate this directory may alter generated chunks or interfere with processing.

Attack Path

  1. The attacker obtains local access sufficient to create entries in /tmp.
  2. Bef ...[truncated 1444 chars]
Remediation
View remediation

Remediation Suggestions

Create a unique private workspace for every invocation and store all intermediate files beneath it:

bash
umask 077
TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/wsb-digest.XXXXXX")
trap 'rm -rf -- "$TMP_DIR"' EXIT

RAW_FILE="$TMP_DIR/raw.out"
JSON_FILE="$TMP_DIR/latest.json"
CHUNK_DIR="$TMP_DIR/chunks"
mkdir -- "$CHUNK_DIR"

Additional hardening should include:

  1. Run the cron job under a dedicated, unprivileged service account rather than root.
  2. Remove the forced HOME=/root assignment and root-specific executable and installation paths.
  3. Store persistent logs in a dedicated directory owned by the service account, with permissions such as 0700 for the directory and 0600 for files.
  4. If logs must remain under /tmp, create them securely inside the invocation-specific directory or use a system logging facility such as logger.
  5. Avoid recursively deleting predictable paths in shared directories.
  6. Validate ownership and file type before reading any persistent path that another user could modify.
  7. Apply restrictive permissions before any API data or generated messages are written to disk.
Vulnerability Patterns
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • 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 (17)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The skill describes sending messages to Discord through an external OpenClaw binary and configurable channel ID while declaring no permissions. That creates a capability-disclosure gap: a reviewer may approve a data-fetching skill without realizing it can also perform outbound messaging/resource access through local tooling.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill describes sending messages to Discord through an external OpenClaw binary and configurable channel ID while declaring no permissions. That creates a capability-disclosure gap: a reviewer may approve a data-fetching skill without realizing it can also perform outbound messaging/resource access through local tooling.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 44)May include surrounding context.

md
编辑 `scripts/wsb-digest-trigger.sh`,修改以下变量:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 142)May include surrounding context.

md
编辑 `scripts/apewisdom-wsb.js`:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 154)May include surrounding context.

md
编辑 `scripts/apewisdom-wsb.js`:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

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).

Content

Scanner excerpt · references/install-guide.md (reported line 207)May include surrounding context.

md
# 删除 WSB Digest 相关的行

# 2. 删除 skill 文件
rm -rf ~/.openclaw/workspace/skills/wsb-digest

# 3. 清理日志 (可选)
rm /tmp/wsb-digest.log

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

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).

Content

Scanner excerpt · references/install-guide.md (reported line 207)May include surrounding context.

md
# 删除 WSB Digest 相关的行

# 2. 删除 skill 文件
rm -rf ~/.openclaw/workspace/skills/wsb-digest

# 3. 清理日志 (可选)
rm /tmp/wsb-digest.log

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

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).

Content

Scanner excerpt · references/install-guide.md (reported line 210)May include surrounding context.

rm -rf ~/.openclaw/workspace/skills/wsb-digest

3. 清理日志 (可选)

rm /tmp/wsb-digest.log

text

## 需要帮助?

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding

The skill documents network-dependent behavior and operational messaging to Discord, but it declares no explicit tool scope or permissions. This weakens reviewability and least-privilege controls, making it easier for a skill to gain or use capabilities that operators did not clearly approve.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file consistently presents all user-facing instructions and descriptions in Chinese, including the manifest description and operational steps. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This file contains user-facing instructions exclusively in Chinese and later shows a code example using toLocaleString('zh-CN', ...) as the default. Under the policy, forcing a specific language or locale without opt-in can be a natural-language policy violation unless the locale constraint is clearly documented and justified as region-specific.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 61)May include surrounding context.

步骤 4: 设置定时任务

bash
crontab -e

添加以下行:

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 125)May include surrounding context.

步骤 4: 设置定时任务

bash
crontab -e

添加以下行:

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

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.

Content

Scanner excerpt · references/install-guide.md (reported line 55)May include surrounding context.

步骤 4: 设置定时任务

bash
crontab -e

添加以下行:

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

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.

Content

Scanner excerpt · references/install-guide.md (reported line 203)May include surrounding context.

步骤 4: 设置定时任务

bash
crontab -e

添加以下行:

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The digest timestamp is always formatted with the zh-CN locale and Asia/Shanghai timezone, and the generated report labels it as Beijing time. This forces a specific language/locale presentation on all users without offering a choice 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
95% confidence
Finding

The file’s user-facing comments and setup instructions are written in Chinese, with no indication that another language is supported or that the user can choose their preferred locale. The policy explicitly flags language or locale constraints when they are imposed without opt-in.

Content

No source excerpt is available for this finding.