Back to skill

Security audit

Moltbook Weekly Report

Security checks for vulnerabilities and agentic risk

Overview

This weekly-report skill is not clearly malicious, but it mixes business-data reporting and WeCom publishing with misleading automation claims and unsafe command/file handling.

Review generated reports before publishing, avoid copying generated shell commands when the title or report content may contain untrusted text, and treat /tmp report files as potentially exposed to other local users. Install only if you are comfortable with the skill reading the documented project data sources and using your configured WeCom/OpenClaw authority for any manual publishing step.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/create_weekly_report.py:132
Finding

Shell Command Injection Through the Report Title

Content
View full analysis

Vulnerability Details

File Location: scripts/create_weekly_report.py:132-139
Vulnerability Type: Shell command injection in generated operator instructions
Risk Level: Medium

Vulnerable Code

python
print(f"""
# 1. 创建文档
wecom_mcp call doc create_doc '{{"doc_type": 3, "doc_name": "{title}"}}'

# 2. 记录返回的 docid,然后编辑内容
wecom_mcp call doc edit_doc_content '{{"docid": "返回的DOCID", "content": "{content[:100]}...", "content_type": 1}}'
""")

Technical Analysis

The title value can be supplied through the --title command-line argument and is interpolated directly into a shell command enclosed in single quotes. The implementation performs neither JSON serialization nor shell escaping.

An attacker can include a single quote in the title to terminate the quoted JSON argument and append arbitrary shell syntax. Although the application only prints the command rather than executing it, the output is explicitly presented as a command for the operator to execute. This creates a command-injection path based on operator interaction.

The same unsafe command-construction pattern also appears in scripts/publish_to_wecom.py, including title and document-ID interpolation.

Attack Path

  1. An attacker provides or recommends a crafted report title containing a single quote and shell operators.
  2. The operator invokes the script with that title using --auto-publish.
  3. The script embeds the title into a displayed wecom_mcp shell command without escaping it.
  4. The operator copies and executes the generated command as instructed.
  5. The injected shell command executes with the operator's privileges.

Impact Assessment

Successful exploitation permits arbitrary command execution in the security context of the operator who follows the generated instructions. The attacker could access or modify files available to that user, invoke local tools, obtain credentials exposed to the process enviro ...[truncated 246 chars]

Remediation
View remediation

Remediation Suggestions

  • Do not construct or display executable shell commands using string interpolation.
  • Invoke the intended tool through a structured API or subprocess.run() with an argument list and shell=False.
  • Build request payloads with json.dumps() rather than manually constructing JSON.
  • If displaying a shell command is unavoidable, apply shlex.quote() to the entire serialized JSON argument.
  • Validate report titles against an appropriate length limit and character policy as defense in depth.
  • Apply the same protections to title and docid interpolation in scripts/publish_to_wecom.py.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/publish_to_wecom.py:80
Finding

Shell Command Substitution Through Untrusted Report Content

Content
View full analysis

Vulnerability Details

File Location: scripts/publish_to_wecom.py:80-82
Vulnerability Type: Shell command injection through incomplete escaping
Risk Level: Medium

Vulnerable Code

python
content_preview = markdown_content[:500].replace('"', '\\"').replace("\n", "\\n")
print(f'# 保存 markdown 到文件,然后引用')
print(f'echo "{content_preview}..." > /tmp/report.md')

Technical Analysis

The code escapes double quotes and newline characters but then places report content inside a double-quoted shell argument. Double-quoted shell strings still process command substitutions such as $(command) and backtick expressions. Backslashes and other shell-sensitive constructs are also not handled safely.

Report content is partly derived from /tmp/price_monitor_db.json, including product names, prices, and timestamps. A process or local user able to modify that file can introduce shell substitution syntax into the generated Markdown. If the malicious value occurs in the first 500 characters included in the preview, it becomes part of the displayed echo command.

The script presents the generated text as publishing instructions. Executing the displayed command therefore evaluates attacker-controlled shell syntax.

Attack Path

  1. An attacker or compromised local process writes a crafted value such as a command-substitution expression into /tmp/price_monitor_db.json.
  2. WeeklyReportGenerator.generate_markdown() incorporates the crafted value into the report.
  3. publish_report() includes the report value in content_preview.
  4. The script prints an echo command containing the unneutralized substitution expression.
  5. An operator copies and executes the displayed command.
  6. The shell evaluates the embedded expression and executes the attacker's command.

Impact Assessment

Exploitation can result in arbitrary command execution with the privileges of the operator executing the generated inst ...[truncated 292 chars]

Remediation
View remediation

Remediation Suggestions

  • Remove the generated echo command and write report files directly through Python file APIs.
  • If a shell representation must be shown, quote the entire content using shlex.quote() rather than replacing only quotes and newlines.
  • Treat all data loaded from temporary JSON files as untrusted.
  • Validate expected JSON types, lengths, and character sets before inserting values into reports or commands.
  • Store generated reports in securely created temporary files and provide the path instead of embedding report data in shell syntax.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/publish_to_wecom.py:96
Finding

Predictable Temporary Report File Allows Symlink-Based File Overwrite

Content
View full analysis

Vulnerability Details

File Location: scripts/publish_to_wecom.py:96-100
Vulnerability Type: Unsafe predictable temporary-file creation
Risk Level: Medium

Vulnerable Code

python
timestamp = datetime.now().strftime("%Y%m%d_%H%M")
filepath = f"/tmp/weekly_report_{timestamp}.md"
with open(filepath, 'w') as f:
    f.write(markdown)

Technical Analysis

The report filename is predictable to the minute and is created in the shared /tmp directory using open(..., 'w'). This operation follows symbolic links and does not require exclusive creation.

A local attacker can predict the path and create a symbolic link at that location before the victim runs the script. When the script opens the path, Python follows the link and truncates the linked target if the victim has permission to write it. The absence of O_EXCL, O_NOFOLLOW, or a securely randomized filename enables the attack.

Attack Path

  1. A local attacker predicts the report filename from the current date and minute.
  2. The attacker creates that path in /tmp as a symbolic link to a file writable by the intended victim.
  3. The victim runs publish_to_wecom.py during the predicted minute.
  4. The script follows the symbolic link while opening the path in write mode.
  5. The target file is truncated and replaced with generated Markdown content.

Impact Assessment

The vulnerability allows overwrite of files that are writable by the victim running the script. If the script is run by a privileged account, the affected scope can include privileged configuration or application files. The report content is mostly fixed or sourced from local JSON files, so exploitation primarily provides destructive overwrite or targeted content replacement rather than unrestricted content control.

Exploitation requires local filesystem access and successful timing or repeated preparation of predictable filenames.

Remediation
View remediation

Remediation Suggestions

  • Create temporary reports using tempfile.NamedTemporaryFile() or tempfile.mkstemp() with a random filename.
  • Ensure the created file has restrictive permissions, such as mode 0600, when report contents may be sensitive.
  • If a stable filename is required, use low-level creation flags including O_CREAT, O_EXCL, and O_NOFOLLOW.
  • Avoid shared temporary directories where practical; use a private application directory owned by the executing user.
  • Verify that the destination is a regular file owned by the expected user before writing.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill promises automatic WeCom publishing and one-click behavior, but the described implementation instead produces local files and requires manual command execution. This is dangerous because it obscures local side effects and can mislead operators about where data is stored or how it is transmitted, increasing the chance of accidental exposure in temporary files.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill promises automatic WeCom publishing and one-click behavior, but the described implementation instead produces local files and requires manual command execution. This is dangerous because it obscures local side effects and can mislead operators about where data is stored or how it is transmitted, increasing the chance of accidental exposure in temporary files.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README explicitly advertises automatic publishing to an enterprise WeChat document, which implies external data transmission and a write-side effect to a third-party service, but it does not warn users about what data is sent, what credentials are required, or that remote content may be created or modified. In an automation skill, this can cause unintended disclosure of internal project data or unintended publication if users run the documented command without understanding the external effect.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises operational behavior that implies shell execution and local file read/write, but it does not declare any tool scope such as permissions or allowed-tools. This is dangerous because an agent or user may invoke the skill without clear boundaries, enabling unintended filesystem access or command execution beyond what the metadata communicates.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill describes automatic publication to WeCom documents without warning that report contents may be transmitted to an external service. For a weekly report tool that may aggregate operational metrics and internal project details, silent sharing can lead to unintended disclosure of sensitive business information.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file’s natural-language description and all user-facing strings are written exclusively in Chinese, indicating the skill is designed to operate in a fixed language. There is no visible opt-in, language selection mechanism, or documentation that this is a region-specific skill, so this may violate language/locale policy requirements.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill is presented as a generic weekly report generator, but it reads project-specific operational data from local files under /tmp and hardcodes status text about internal systems. This can expose unrelated internal information in generated reports and violates the principle of least surprise, especially if users expect a generic publishing utility rather than one that harvests local environment data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script writes the generated weekly report to /tmp, which is a shared, world-accessible location on many Unix-like systems and commonly used for transient files. If the report contains internal project updates, metrics, or sensitive business information, other local users or processes may read or recover it, and the code provides no warning, access restriction, or cleanup.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The natural-language instructions and descriptions are presented in Chinese, but the file does not indicate that the skill is region- or language-specific, nor does it offer an opt-in or alternative language. Under the stated policy, forcing a specific language without user choice 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
84% confidence
Finding

The natural-language description is presented in Chinese without indicating that other languages are supported or that the language is intentional and limited to a specific audience. Under the language/locale policy, forcing a single language without user opt-in can be a policy concern unless the locale restriction is clearly documented and justified.

Content

No source excerpt is available for this finding.