Back to skill

Security audit

微信公众号文章自动发布助手

Security checks for vulnerabilities and agentic risk

Overview

The skill broadly matches its WeChat article-publishing purpose, but it can upload files and publish account content with weak confirmation and broad network/credential handling.

Review carefully before installing. Use a controlled environment, avoid running publish commands automatically, keep --dry-run for review, limit which local files may be uploaded, restrict outbound network access where possible, and store provider and WeChat credentials with least privilege and spending/account controls.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/wechat_skill/extractors.py:119
Finding

Unrestricted URL Fetching Enables Server-Side Request Forgery

Content
View full analysis
bool: return bool(re.match(r"^https?://", (value or "").strip(), re.I)) ``` ```python def extract_from_url(url: str, timeout: int = 30) -> Article: response = requests.get(url, timeout=timeout, headers={"User-Agent": "Mozilla/5.0"}) response.raise_for_status() soup = BeautifulSoup(response.text, "html.parser") if "mp.weixin.qq.com" in url: return _extract_weixin_article(soup, url) return _extract_generic_article(soup, url) def load_article(input_value: str, timeout: int = 30) -> Article: if is_url(input_value): return extract_from_url(input_value, timeout=timeout) path = Path(input_value).resolve() if not path.exists(): raise RuntimeError(f"File does not exist: {path}") return _load_markdown_file(path) ``` The vulnerable function is directly reachable through the following CLI inputs: - `extract ` - `draft ` - `workflow --source-url ` ### Technical Analysis The URL check only verifies that the supplied value begins with `http://` or `https://`. It does not restrict the destination hostname, resolve and inspect the destination IP address, or reject loopback, private, link-local, multicast, and other reserved address ranges. The request also follows HTTP redirects under the default `requests` behavior. Consequently, checking only the original textual URL would not be sufficient: a public endpoint could redirect the request to a private service. The fetched response is parsed and can be written to generated Markdown or workflow assets. This makes the primitive useful not only for blind network probing but also, where the response resembles parseable HTML, for retrieving information from services accessible to the machine running the ...[truncated 1337 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/wechat_skill/covers.py:75
Finding

Bearer API Keys Can Be Transmitted to Arbitrary Configured Origins

Content
View full analysis
bytes: if not provider.api_key or not provider.model: raise CoverGenerationError("Doubao image-generation configuration is incomplete") base_url = provider.base_url or "https://ark.cn-beijing.volces.com/api/v3" response = requests.post( f"{base_url.rstrip('/')}/images/generations", headers={"Authorization": f"Bearer {provider.api_key}", "Content-Type": "application/json"}, json={"model": provider.model, "prompt": prompt, "size": size, "quality": quality, "response_format": "b64_json"}, timeout=120, ) response.raise_for_status() return _decode_image_data(response.json()) ``` ```python def _generate_with_qwen(provider: ProviderConfig, prompt: str, size: str) -> bytes: if not provider.api_key or not provider.model: raise CoverGenerationError("Qwen image-generation configuration is incomplete") base_url = provider.base_url or "https://dashscope.aliyuncs.com/api/v1" response = requests.post( f"{base_url.rstrip('/')}/services/aigc/text2image/image-synthesis", headers={ "Authorization": f"Bearer {provider.api_key}", "Content-Type": "application/json", "X-DashScope-Async": "enable", }, json={"model": provider.model, "input": {"prompt": prompt}, "parameters": {"size": size}}, timeout=120, ) response.raise_for_status() payload = response.json() task_id = payload.get("output", {}).get("task_id") if not task_id: raise CoverGenerationError(f"Qwen did not return a task ID: {payload}") status_url = f"{base_url.rstrip('/')}/tasks/{task_i ...[truncated 2528 chars]
Remediation
View remediation

T01 · Skill Instruction Hijacking

Error
Location
scripts/wechat_skill/creation.py:251
Finding

Untrusted Reference Articles Are Embedded Directly Into Model Prompts

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/wechat_skill/markdown_tools.py:40
Finding

Insufficient HTML Sanitization Allows Active Content in Generated Previews

Content
View full analysis
str: return markdown.markdown( decode_escaped_unicode(text or ""), extensions=["extra", "tables", "nl2br", "codehilite", "sane_lists"], output_format="html", ) ``` The renderer removes only two tag types: ```python def optimize_for_wechat_html(content_html: str, template: str = "standard") -> str: template = (template or "standard").strip().lower() soup = BeautifulSoup(content_html, "html.parser") for tag in soup.find_all(["script", "style"]): tag.decompose() ``` Links are styled, but their URI schemes and other attributes are not validated: ```python for anchor in soup.find_all("a"): anchor["style"] = "color:#1f57c3;text-decoration:underline;word-break:break-all;" if anchor.get("href"): anchor["target"] = "_blank" ``` The resulting content is written to an HTML preview: ```python preview_path = output_dir / f"{slugify(article.title)}-wechat-preview.html" markdown_path = output_dir / f"{slugify(article.title)}.md" preview_path.write_text(article.html, encoding="utf-8") markdown_path.write_text(article.markdown, encoding="utf-8") ``` ### Technical Analysis Python Markdown can preserve raw HTML embedded in Markdown input. The subsequent renderer removes `script` and `style` elements but does not implement a complete allowlist sanitizer. Potentially unsafe content includes: - Event-handler attributes such as `onerror`, `onload`, or `onclick`. - Dangerous URI schemes such as `javascript:` or certain `data:` URLs. - Active elements such as iframes, objects, embeds, forms, or SVG ...[truncated 1541 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
scripts/requirements.txt:1
Finding

Dependency Installation Uses Unbounded Versions Without Integrity Pinning

Content
View full analysis
=2.31.0 beautifulsoup4>=4.12.0 markdown>=3.5.0 pyyaml>=6.0.0 Pillow>=10.0.0 markdownify>=0.13.1 ``` The CLI installs the mutable dependency set directly: ```python def _install_dependencies(upgrade: bool) -> int: import subprocess import sys req = Path(__file__).resolve().parent.parent / "requirements.txt" command = [sys.executable, "-m", "pip", "install"] if upgrade: command.append("--upgrade") command.extend(["-r", str(req)]) subprocess.check_call(command) write_json({"success": True, "installed": True, "requirements": str(req)}) return 0 ``` ### Technical Analysis Every requirement specifies only a minimum version. No upper bound, exact version, lockfile, or package hash is present. As a result, identical Skill installations at different times can resolve to different package and transitive-dependency versions. Python packages and their installation mechanisms execute code in the environment during installation or import. If a future release or transitive dependency is compromised, or if an incompatible release introduces a security regression, the documented `install` command can introduce that code into the Skill environment. No currently listed package was identified as a typographical imitation or known malicious package during this static review. The vulnerability is the mutable, unverified supply-chain process. ### Attack Path 1. A listed package or one of its transitive dependencies publishes a compromised future release, or its distribution account is taken over. 2. The malicious release still satisfies the broad minimum-version constraint. 3. A user runs `python scripts/publish_wechat.py install`, optionally with `--upgrade`. 4. `pip` r ...[truncated 782 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (56)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

从代码内容看,这是一个纯写作辅助模块,核心功能是生成公众号文章草稿、构建 prompt、推断写作 brief,以及对 Markdown 文章做基本校验。代码中没有网络请求、没有对 mp.weixin 链接的提取或解析、没有图片/封面生成逻辑,也没有与微信公众号草稿箱或发布接口交互的实现。因此,实际行为只匹配声明中的“智能创作/改写”部分,无法支撑其宣称的“提取文章、生成封面、创建草稿并发布”的完整工作流。属于描述范围明显大于该代码块实际能力的情况。

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This code directly runs pip install from within the skill, allowing the skill to change the executing environment by fetching and installing packages. In an automated agent setting, that creates a powerful capability unrelated to normal article publishing and could be leveraged to introduce unreviewed code or destabilize the environment.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The publish command performs an external publish action immediately, with no confirmation or warning, making accidental publication easy. In context, this is more dangerous than a simple draft save because publishing can be operationally irreversible, reputationally damaging, and may expose sensitive or incorrect content to the public.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

This is a markdown file, so SQP-2 applies to omitted warnings in the skill description. The commands for write and workflow are presented as direct next steps toward draft creation and preview, but the guide does not disclose potential effects on user data or local/project state, which could matter if files or drafts are created automatically.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document explicitly sets the output target to '中文 Markdown', which is a language constraint. Because the file does not offer a language choice, opt-in, or a documented region-specific justification, this is a natural-language policy violation under the language/locale rule.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill advertises capabilities that imply file access, shell execution, and network operations, but it does not declare any explicit tool scope or permission boundaries. In a publishing workflow that can read local files, call external services, and execute commands, missing scope declarations increases the risk of overbroad execution and accidental or unauthorized side effects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The workflow description says removing --dry-run will create a WeChat draft, but it does not clearly warn that article text, images, and related assets may be uploaded to external services. This creates a data-handling risk: sensitive or unpublished content could be transmitted off-system without informed consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill documents a command path that can directly publish content to a WeChat official account but does not include an explicit warning about irreversible or account-affecting external side effects. This is dangerous because a user or agent may trigger publication without fully understanding that content will be transmitted to a third-party platform and may become publicly visible under the user's account.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest advertises automatic publication to the WeChat draft box but does not warn users that the skill may perform a content-publishing action. Even though this targets a draft box rather than final public posting, it still creates a material action in a connected account and can lead to accidental publication workflows, reputational issues, or unauthorized use of organizational channels.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The default activation prompt is very broad: it invites writing, rewriting, cover generation, and publishing without explicit user-confirmation gates or narrow trigger conditions. In a skill that can publish to a WeChat Official Account draft box, this increases the chance of unintended content generation or draft publication from ambiguous user requests.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The CLI exposes an install command that can modify the Python environment even though the skill's stated purpose is article extraction, generation, and WeChat publishing. In an agent-skill context, environment-changing capabilities expand the trust boundary and can be abused to alter dependencies or system state unexpectedly.

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/wechat_skill/cli.py (reported line 120)May include surrounding context.

python
if upgrade:
        command.append("--upgrade")
    command.extend(["-r", str(req)])
    subprocess.check_call(command)
    write_json({"success": True, "installed": True, "requirements": str(req)})
    return 0

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The workflow path can automatically create drafts and optionally publish content to WeChat, transmitting article text, metadata, and media to an external service without an explicit execution-time warning. In a skill ecosystem, silent external transmission increases the risk of users or upstream agents sending sensitive or copyrighted content unintentionally.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The material command uploads arbitrary local files to WeChat with no execution-time disclosure or confirmation. That is dangerous because users may unintentionally exfiltrate local content, and the command accepts a broad file path input that could include sensitive files if invoked incorrectly by an agent or user.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The draft creation flow uploads article content and cover media to WeChat without explicit runtime disclosure. Because this command can transmit both generated/extracted content and local files, it creates a meaningful risk of unintentional data leakage in agent-driven or unattended use.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The raised RuntimeError messages are written in Chinese (配置文件不存在 and 配置文件缺少 wechat 配置). This hardcodes a specific language for user-visible output without any opt-in, fallback, or indication that the skill is intentionally limited to Chinese-speaking users.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The templates and prompt text explicitly require Chinese output, such as 'modern Chinese business magazine' and the Chinese-language generation prompt, but the file does not offer opt-in language selection or explain that the skill is intentionally limited to a Chinese locale. This can violate language/locale policy when users are not given a choice.

Content

No source excerpt is available for this finding.

Tainted flow: 'status_url' from requests.post (line 108, network input) → requests.get (network output)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/wechat_skill/covers.py (reported line 110)May include surrounding context.

python
status_url = f"{base_url.rstrip('/')}/tasks/{task_id}"
    for _ in range(30):
        poll = requests.get(status_url, headers={"Authorization": f"Bearer {provider.api_key}"}, timeout=60)
        poll.raise_for_status()
        result = poll.json()
        task_status = result.get("output", {}).get("task_status")

Tainted flow: 'results' from requests.get (line 115, network input) → requests.get (network output)

Medium
Category
Data Flow
Confidence
88% confidence
Finding

The code fetches a URL supplied in the provider's API response without validating host, scheme, or destination. If the upstream service, a misconfigured custom base_url, or a man-in-the-middle in a compromised environment returns an attacker-controlled URL, the process can be induced to make unexpected outbound requests, enabling SSRF-like behavior or retrieval of oversized/malicious content.

Content

Scanner excerpt · scripts/wechat_skill/covers.py (reported line 118)May include surrounding context.

python
results = result.get("output", {}).get("results") or []
            if not results or not results[0].get("url"):
                raise CoverGenerationError("通义千问任务成功但未返回图片 URL")
            image_response = requests.get(results[0]["url"], timeout=120)
            image_response.raise_for_status()
            return image_response.content
        if task_status in {"FAILED", "CANCELED"}:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The generated prompt includes the user-supplied title and is transmitted via HTTP requests to external providers in the qwen and doubao branches. This file contains no confirmation prompt, logging, comment, or docstring warning that user content will be sent to third-party services.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The prompt explicitly requires generating a Chinese article for WeChat and provides no mechanism for user opt-in or language selection. Under the policy, forcing a specific language is a natural-language locale violation unless the constraint is clearly documented and justified as region-specific.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/wechat_skill/wechat_api.py (reported line 13)May include surrounding context.

python
from .models import WeChatConfig
from .utils import trim_utf8_bytes

TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token"
DRAFT_ADD_URL = "https://api.weixin.qq.com/cgi-bin/draft/add"
PUBLISH_SUBMIT_URL = "https://api.weixin.qq.com/cgi-bin/freepublish/submit"
PUBLISH_GET_URL = "https://api.weixin.qq.com/cgi-bin/freepublish/get"

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/wechat_skill/wechat_api.py (reported line 14)May include surrounding context.

python
from .models import WeChatConfig
from .utils import trim_utf8_bytes

TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token"
DRAFT_ADD_URL = "https://api.weixin.qq.com/cgi-bin/draft/add"
PUBLISH_SUBMIT_URL = "https://api.weixin.qq.com/cgi-bin/freepublish/submit"
PUBLISH_GET_URL = "https://api.weixin.qq.com/cgi-bin/freepublish/get"

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/wechat_skill/wechat_api.py (reported line 15)May include surrounding context.

python
from .models import WeChatConfig
from .utils import trim_utf8_bytes

TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token"
DRAFT_ADD_URL = "https://api.weixin.qq.com/cgi-bin/draft/add"
PUBLISH_SUBMIT_URL = "https://api.weixin.qq.com/cgi-bin/freepublish/submit"
PUBLISH_GET_URL = "https://api.weixin.qq.com/cgi-bin/freepublish/get"

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/wechat_skill/wechat_api.py (reported line 16)May include surrounding context.

python
from .models import WeChatConfig
from .utils import trim_utf8_bytes

TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token"
DRAFT_ADD_URL = "https://api.weixin.qq.com/cgi-bin/draft/add"
PUBLISH_SUBMIT_URL = "https://api.weixin.qq.com/cgi-bin/freepublish/submit"
PUBLISH_GET_URL = "https://api.weixin.qq.com/cgi-bin/freepublish/get"