Back to skill

Security audit

wechat-summary2

Security checks for vulnerabilities and agentic risk

Overview

The skill is a WeChat article summarizer, but its automatic fallback can fetch arbitrary URLs from the agent environment without validation or user confirmation.

Review before installing. This skill should be limited to trusted WeChat article URLs, ideally only https://mp.weixin.qq.com, and should not run in an environment where the agent can reach internal services or sensitive metadata endpoints. The fallback should require user confirmation and URL validation before use.

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/fetch_article.py:42
Finding

Unrestricted Server-Side URL Fetching Enables SSRF

Content
View full analysis

Vulnerability Details

File Location: scripts/fetch_article.py:42, 181-184
Vulnerability Type: Server-Side Request Forgery (SSRF)
Risk Level: Medium

Vulnerable Code

python
response = requests.get(url, headers=headers, timeout=30)
python
url = sys.argv[1]
output_json = '--json' in sys.argv

result = fetch_wechat_article(url)

Technical Analysis

The script accepts a URL from the command line and passes it directly to requests.get() without validating the URL scheme, hostname, port, resolved IP address, or redirect destinations. Although the skill is primarily intended for mp.weixin.qq.com articles, its instructions explicitly permit attempts to summarize non-WeChat URLs.

Because the requests library follows HTTP redirects by default, validating only the initial hostname would not be sufficient. An attacker could supply either a direct internal URL or an external URL that redirects to a loopback, private-network, link-local, or cloud metadata address.

The response is also loaded fully into memory through response.text without a response-size limit. This creates an additional denial-of-service risk when the target returns an excessively large body.

Attack Path

  1. An attacker asks the agent to summarize a crafted URL.
  2. The URL points directly to an internal service, such as a loopback or private-network address, or points to an attacker-controlled server that redirects to such an address.
  3. The agent invokes scripts/fetch_article.py with the attacker-controlled URL.
  4. The script issues the request from the host or container running the agent.
  5. If the response resembles parseable article content, portions may be extracted and printed. Otherwise, response-derived metadata or errors may still reveal information about the internal target.
  6. Repeated requests can be used for internal service discovery. A very large response may also consume excessive memory.

Impact Assessment

Successful exploitation ...[truncated 623 chars]

Remediation
View remediation

Remediation Suggestions

  1. Restrict accepted destinations to the skill's intended domain:

    • Permit only HTTPS.
    • Normalize the hostname before comparison.
    • Allow only mp.weixin.qq.com, or a narrowly documented set of required WeChat hosts.
    • Reject embedded credentials, unexpected ports, and malformed URLs.
  2. Defend against DNS-based bypasses:

    • Resolve all destination addresses before connecting.
    • Reject loopback, private, link-local, multicast, unspecified, reserved, and other non-public address ranges for both IPv4 and IPv6.
    • Ensure the connection uses the validated destination to reduce DNS rebinding risk.
  3. Disable automatic redirects or validate every redirect hop with the same scheme, hostname, port, and resolved-address policy:

python
response = requests.get(
    validated_url,
    headers=headers,
    timeout=(5, 15),
    allow_redirects=False,
    stream=True,
)
  1. Enforce response controls:

    • Require an expected HTML content type.
    • Stream the response rather than loading it all at once.
    • Stop reading after a strict maximum byte count.
    • Set separate connection and read timeouts.
    • Call response.raise_for_status() before parsing.
  2. Align SKILL.md with the implementation's trust boundary. Remove the instruction to fetch arbitrary non-WeChat links, or route such links through a separately protected fetch service with equivalent SSRF controls.

  3. Add security tests covering direct private addresses, IPv6 loopback, alternative numeric IP representations, attacker-controlled redirects, DNS rebinding scenarios, unexpected ports, and oversized responses.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill is presented as a summarization tool, but its workflow includes direct content acquisition and a fallback path intended to bypass access restrictions such as anti-bot verification. That mismatch is dangerous because reviewers and users may approve a low-risk summarizer while the skill actually performs broader remote retrieval and extraction behaviors, creating hidden network and compliance risk.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill uses network-capable behavior to retrieve remote article content, including a fallback Python script, but does not declare any explicit tool scope or allowed tools. This weakens governance and review because the skill can access external resources without a clear permission boundary, increasing the chance of unintended data access or policy bypass.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The description says the skill applies to requests like '帮我看看这篇文章讲什么' and '总结一下这个链接', which are common phrases that could refer to many kinds of content. Although the line mentions mp.weixin.qq.com links, it also states '只要看到 mp.weixin.qq.com 的链接并且用户想了解内容,就应该使用这个 skill' without negative examples or clearer boundaries, making invocation scope broader than necessary.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill instructs the agent to execute a Python subprocess automatically when WebFetch encounters anti-bot checks, without user disclosure or confirmation. Silent fallback to local code execution increases operational risk, reduces transparency, and may enable policy circumvention or unsafe handling of attacker-controlled URLs through a less-audited execution path.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The output rules state '中文输出', which forces a specific language regardless of the user's preference. This is a natural-language policy concern because no language choice, negotiation, or opt-in is offered.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The Accept-Language header is hard-coded to prefer zh-CN and zh, which imposes a specific locale behavior on all users. The file does not offer locale selection or explain that the tool is intentionally region-specific, so this is a natural-language policy concern under the language/locale rule.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script accepts any command-line URL and sends it directly to requests.get, even though the skill is intended only for mp.weixin.qq.com article links. In an agent context, this can be abused as a server-side request primitive to reach unintended internal or external endpoints, making the issue more dangerous than a simple input-validation bug.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This code file performs a network request to a remote site using the provided URL, which can transmit user-provided data and system request metadata such as headers. Although the function docstring describes fetching article content, the script provides no explicit user-facing warning, confirmation, or disclosure about outbound network access.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.