Back to skill

Security audit

Markdown 发布为微信公众号草稿(wenyan-cli;主题、代码高亮)。公众号发布。

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says, but it automatically installs a global npm tool and handles WeChat secrets in ways users should review carefully before installing.

Install only if you are comfortable with a skill that can upload selected Markdown and images to WeChat, use your WeChat AppID/AppSecret, and install a global npm package if wenyan is missing. Prefer preinstalling a pinned wenyan-cli version yourself and provide credentials through a safer secret mechanism instead of storing real secrets in TOOLS.md.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T08 · Insecure Dependencies

Warning
Location
scripts/publish.py:29
Finding

Automatic Global Installation of an Unpinned npm Dependency

Content
View full analysis
bool: """检查 wenyan-cli 是否安装,未安装则自动安装""" if shutil.which("wenyan") is None: print(f"{RED}wenyan-cli 未安装!{NC}") print(f"{YELLOW}正在安装 wenyan-cli...{NC}") try: subprocess.run( ["npm", "install", "-g", "@wenyan-md/cli"], check=True, capture_output=False, ) print(f"{GREEN}wenyan-cli 安装成功!{NC}") except (subprocess.CalledProcessError, FileNotFoundError): print(f"{RED}安装失败!请手动运行: npm install -g @wenyan-md/cli{NC}") return False return True ``` The same unpinned command is also recommended in `SKILL.md`, lines 50-51, and `references/troubleshooting.md`, lines 33-42. ### Technical Analysis When the `wenyan` executable is unavailable, ordinary Skill execution automatically runs: ```bash npm install -g @wenyan-md/cli ``` No exact package version, lockfile, package integrity hash, or trusted artifact digest is specified. Consequently, the code installed depends on the package registry's current state rather than the version that was reviewed with this project. npm packages may execute lifecycle scripts during installation. A compromised package release, maintainer account, transitive dependency, or registry response could therefore cause arbitrary code to execute during installation. The global `-g` option also modifies the invoking user's global Node.js environment outside the project directory. The npm child process inherits the parent process environment by default. This may expose WeChat credentials and other unrelated environment variables to malicious package lifecycle scripts. ### Attack Path 1. An attacker compromises `@wenyan-md/cli`, one of its dependencies, i ...[truncated 1154 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/publish.py:44
Finding

WeChat API Secret Stored and Loaded from a Plaintext Workspace Document

Content
View full analysis
tuple[str, str]: app_id = os.environ.get("WECHAT_APP_ID") app_secret = os.environ.get("WECHAT_APP_SECRET") if app_id and app_secret: return app_id, app_secret if os.path.isfile(TOOLS_MD): print(f"{YELLOW}从 TOOLS.md 读取凭证...{NC}") with open(TOOLS_MD, encoding="utf-8") as f: content = f.read() def _extract(key: str) -> str: m = re.search(rf"export\s+{key}=([^\s#]+)", content) return m.group(1).strip("'\"") if m else "" app_id = _extract("WECHAT_APP_ID") or app_id or "" app_secret = _extract("WECHAT_APP_SECRET") or app_secret or "" return app_id or "", app_secret or "" ``` The plaintext file is configured at `scripts/publish.py`, line 20: ```python TOOLS_MD = os.path.expanduser("~/.openclaw/workspace/TOOLS.md") ``` The use of `TOOLS.md` for credentials is also explicitly documented in `SKILL.md`, lines 31-32. ### Technical Analysis The Skill supports retrieving a long-lived `WECHAT_APP_SECRET` from `~/.openclaw/workspace/TOOLS.md`, a general workspace documentation file rather than a dedicated secret store. The entire file is read into process memory and searched for shell-style export statements. Workspace documents commonly have a broader exposure surface than credential stores. They may be accessible to other agents, tools, indexing systems, backups, synchronization services, or source-control operations. Encouraging users to place an API secret in such a file increases the probability of accidental disclosure. After loading the values, `check_env()` writes them into `os.environ`. The subsequently executed `wenyan` process legitimately needs these credentials, but every child process launched a ...[truncated 2095 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (8)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill invokes shell commands and consumes sensitive environment variables, but it does not declare any explicit tool scope such as allowed tools or permissions. That creates an authorization gap: an agent or runtime may permit broader command execution or env access than users expect, which is especially risky here because the workflow handles publication actions and WeChat credentials.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill instructs the agent to publish Markdown and images to a WeChat public-account draft, but it does not prominently warn that article content and local images will be uploaded to an external platform. This can lead to unintended disclosure of sensitive or unpublished material, especially because the workflow also downloads and localizes generated images before uploading them.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This troubleshooting guide is written entirely in Chinese and gives no indication that other languages are supported or that Chinese is required for a region-specific reason. Under the policy for natural-language constraints, forcing a specific language without opt-in or justification is a locale-policy violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Auto-installing a global npm package gives the skill software installation capability beyond its stated purpose and can lead to arbitrary third-party code execution during install hooks or dependency resolution. In a publishing skill, this context makes the behavior more suspicious because users would not normally expect the tool to modify the system globally just to publish markdown.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
91% confidence
Finding

The script automatically performs a global npm install of an external package at runtime, which executes code from the package supply chain with the user's privileges. In an agent skill context, this expands behavior from publishing content to installing software, creating supply-chain and unexpected code-execution risk if the package, registry, or dependency chain is compromised.

Content

Scanner excerpt · scripts/publish.py (reported line 33)May include surrounding context.

python
print(f"{RED}wenyan-cli 未安装!{NC}")
        print(f"{YELLOW}正在安装 wenyan-cli...{NC}")
        try:
            subprocess.run(
                ["npm", "install", "-g", "@wenyan-md/cli"],
                check=True,
                capture_output=False,

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script reads WeChat credentials from ~/.openclaw/workspace/TOOLS.md, a general local file outside the script's direct configuration boundary. This broadens secret access beyond normal environment-variable usage and can unintentionally consume secrets from an unrelated workspace file, increasing the blast radius if the skill is run in a privileged agent environment.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

Parsing sensitive credentials from a markdown file without clear security boundaries or warnings encourages unsafe secret storage practices and may expose credentials to unintended readers, backups, or tooling that processes workspace docs. In this skill, the practice is more dangerous because the script normalizes loading secrets from a non-secret documentation file and then exports them into the process environment.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/publish.py (reported line 108)May include surrounding context.

python
print("")

    try:
        result = subprocess.run(
            ["wenyan", "publish", "-f", filepath, "-t", theme, "-h", highlight],
            check=False,
        )

Static analysis

No suspicious patterns detected.