T04 · Embedded Malicious Code
- Location
scripts/stock_pre.py:7- Finding
Hardcoded WeChat Recipient Causes Unauthorized Disclosure of Portfolio Data
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This stock alert skill is mostly consistent with its stated purpose, but it installs automatic root-level jobs and can send stock information to a hardcoded WeChat recipient unless users manually edit it first.
Review carefully before installing. Do not run the installer as-is on a real system unless you first remove the hardcoded WeChat ID, configure your own recipient and holdings in a safer configuration file, avoid root cron where possible, and verify any installed archive by hash or signature. Also check and remove /etc/cron.d/stock-monitor and /etc/logrotate.d/stock-monitor if you test it.
scripts/stock_pre.py:7Hardcoded WeChat Recipient Causes Unauthorized Disclosure of Portfolio Data
install.sh:51Installer Creates Persistent Scheduled Tasks That Execute Skill Code as Root
scripts/install.py:10Unverified Skill Archives Are Installed and Subsequently Executed by Root Cron Jobs
scripts/stock_pre.py:9Root Jobs Write to Predictable Log Files in a Shared Temporary Directory
The skill is presented as a general stock push and holdings assistant, yet the detected behavior indicates only a subset of promised functions plus undisclosed outbound messaging to a hardcoded target. In a security review context, that discrepancy increases the risk of covert data transfer and unauthorized automation under a misleading description.
The skill is presented as a general stock push and holdings assistant, yet the detected behavior indicates only a subset of promised functions plus undisclosed outbound messaging to a hardcoded target. In a security review context, that discrepancy increases the risk of covert data transfer and unauthorized automation under a misleading description.
The skill is presented as a general stock push and holdings assistant, yet the detected behavior indicates only a subset of promised functions plus undisclosed outbound messaging to a hardcoded target. In a security review context, that discrepancy increases the risk of covert data transfer and unauthorized automation under a misleading description.
The skill is presented as a general stock push and holdings assistant, yet the detected behavior indicates only a subset of promised functions plus undisclosed outbound messaging to a hardcoded target. In a security review context, that discrepancy increases the risk of covert data transfer and unauthorized automation under a misleading description.
Trigger phrases such as generic references to '推送' or '股票' are overly broad and can cause the skill to activate during ordinary conversation unrelated to consent for automated messaging or holdings disclosure. Because this skill can initiate stock-data processing and outbound WeChat transmission, over-triggering materially raises privacy and misuse risk.
The installer executes shell commands via os.system(), which invokes a shell and is unsafe as a general pattern in privileged installation code. In this file the current command strings are mostly constant and not directly attacker-controlled, so the immediate exploitability is limited, but the script runs as root and performs filesystem/archive operations, making any future variable interpolation or path manipulation especially risky.
LOGROTATE_CONF = "/etc/logrotate.d/stock-monitor"
def run(cmd):
r = os.system(cmd)
if r != 0:
print(f"❌ 命令失败: {cmd}")
sys.exit(r)
Using os.system() for syntax checking unnecessarily spawns a shell in a root-run installer. The interpolated path is currently derived from a fixed filename list, so this specific instance is not highly exploitable by itself, but it still normalizes unsafe command execution practices in a privileged script.
# 6. 验证脚本语法
for script in ["stock_pre.py", "stock_after.py", "stock_next.py"]:
path = f"/root/.openclaw/workspace/skills/stock-push/scripts/{script}"
r = os.system(f"python3 -m py_compile {path}")
if r != 0:
print(f" ❌ {script} 语法检查失败")
else:
The skill declares operational behavior involving network access, shell execution, and file writes, but does not declare any explicit tool scope or permissions. This undermines least-privilege controls and makes it harder for reviewers or runtime policy to understand and constrain what the skill is allowed to do.
The documentation describes automatic transmission of holdings and market information to WeChat but does not clearly warn users about the privacy implications or require explicit informed consent. Financial holdings data is sensitive, and silent or background forwarding to external messaging channels can expose personal investment positions.
The skill is presented primarily in Chinese and is tightly scoped to A-share workflows without offering the user a language or locale choice. This can violate language/locale policy when the skill effectively assumes a specific language and regional context without explicit opt-in or justification in the policy sense.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
#!/bin/bash
# =========================================================
# stock-push 一键安装脚本(单机版)
# 用法: bash <(curl -sL <url-to-this-script>)
# 或直接: bash install_stock_push.sh
# =========================================================
set -e
The installer writes persistent host-level configuration into /etc/cron.d and /etc/logrotate.d, which affects the whole system rather than only the skill's own workspace. For a stock notification skill, this is broader-than-necessary privilege and creates persistence outside the application boundary, increasing risk if the skill files are modified or later abused.
The script makes persistent system changes by creating cron and logrotate entries and attempting to restart cron, but it does not present an upfront warning or obtain consent before doing so. This is dangerous because users may run it as root without realizing it is modifying host-wide scheduling and logging behavior.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
# 次日关注:20:00(周一~四)
0 20 * * 1-4 root python3 /root/.openclaw/workspace/skills/stock-push/scripts/stock_next.py >> /tmp/stock_next.log 2>&1
CRONEOF
chmod 644 "$CRON_FILE"
echo " ✅ cron 已写入 $CRON_FILE"
# 4. 写 logrotate
Restarting the system cron service is a host-administrative action that impacts more than this skill alone and can affect unrelated scheduled jobs. Even if intended to activate the new schedule, doing so from a skill installer expands blast radius and assumes privileged control over the host.
The installer performs filesystem changes, archive extraction, and copying into privileged locations without explicit user confirmation. In a root context, unattended extraction and copying of remotely sourced content meaningfully increase risk, especially because archive contents are trusted implicitly and then used to establish persistent scheduled tasks later in the install flow.
The installer downloads a skill archive from a remote URL and installs it without any integrity verification such as a pinned hash or signature check. In the context of a root-run installer, this is dangerous because a repository compromise, DNS/TLS interception edge case, or URL substitution could result in arbitrary code being installed and then later executed by cron.
The installer performs broad system administration by writing files under /etc/cron.d and /etc/logrotate.d, creating persistent scheduled execution as root. That exceeds simple skill installation and materially increases blast radius: any malicious or compromised installed script will run automatically with elevated privileges on a recurring basis.
The script silently writes system cron and logrotate configuration files without prior confirmation or a clear upfront warning, creating persistence and changing host behavior. While this is not an exploit primitive by itself, it is a security-significant installation practice because it can surprise operators and make unauthorized recurring execution harder to notice.
The script contains a hardcoded WeChat recipient and automatically sends outbound messages without runtime consent, confirmation, or recipient verification. In an agent skill context, this can silently exfiltrate portfolio information or operational data to an unintended third party, especially if the skill is triggered broadly by stock-related prompts.
This Python file contains natural-language docstrings, logs, and outbound message content entirely in Chinese, but it does not offer any language/locale opt-in or explain that the skill is intended only for Chinese-speaking users. Under the policy, forcing a specific language without user choice is a natural-language policy violation.
This script automatically sends stock summaries to a hard-coded external WeChat recipient without runtime confirmation, opt-in, or clear disclosure in the code path. In an agent-skill context, silent outbound transmission can leak portfolio interests, monitoring habits, or other sensitive financial metadata to an unintended destination if the skill is reused, misconfigured, or triggered unexpectedly.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"""发送消息,带重试机制"""
for attempt in range(1, retries + 1):
try:
result = subprocess.run(
["openclaw", "message", "send",
"--channel", "openclaw-weixin",
"--target", USER_ID,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"""发送消息,带重试机制"""
for attempt in range(1, retries + 1):
try:
result = subprocess.run(
["openclaw", "message", "send",
"--channel", "openclaw-weixin",
"--target", USER_ID,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"""发送消息,带重试机制"""
for attempt in range(1, retries + 1):
try:
result = subprocess.run(
["openclaw", "message", "send",
"--channel", "openclaw-weixin",
"--target", USER_ID,
No suspicious patterns detected.