Back to skill

Security audit

Wechat API Lite

Security checks for vulnerabilities and agentic risk

Overview

This WeChat publishing helper is mostly purpose-aligned, but it handles powerful account credentials in ways that could expose them through files or logs.

Review before installing on shared machines or logged agent environments. Use it only with a WeChat account you intend the agent to access, protect config.env with owner-only permissions, avoid running the token command where output is logged, and verify every file path and draft JSON before upload because content is sent to WeChat servers.

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/wechat_api.py:103
Finding

Access Token Cache Created Without Restrictive File Permissions

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/wechat_api.py:295
Finding

Bearer Access Token Disclosed Through Standard Output

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
config.env.example.txt:1
Finding

Credential Setup Can Produce Unprotected or Accidentally Committed Secrets

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (27)

Tainted flow: 'req' from os.environ.get (line 78, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

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

python
req.add_header("Content-Type", "application/json; charset=utf-8")

    try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            result = json.loads(resp.read().decode())
    except urllib.error.HTTPError as e:
        body = e.read().decode()

Tainted flow: 'req' from os.environ.get (line 78, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

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

python
req.add_header("Content-Type", "application/json; charset=utf-8")

    try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            result = json.loads(resp.read().decode())
    except urllib.error.HTTPError as e:
        body = e.read().decode()

Tainted flow: 'req' from os.environ.get (line 78, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

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

python
req = urllib.request.Request(url, data=b"".join(body_bytes), method="POST")
    req.add_header("Content-Type", f"multipart/form-data; boundary={boundary}")

    with urllib.request.urlopen(req, timeout=60) as resp:
        result = json.loads(resp.read().decode())

    if result.get("errcode") == 0 or "media_id" in result:

Tainted flow: 'req' from os.environ.get (line 78, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

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

python
req = urllib.request.Request(url, data=b"".join(body_bytes), method="POST")
    req.add_header("Content-Type", f"multipart/form-data; boundary={boundary}")

    with urllib.request.urlopen(req, timeout=60) as resp:
        result = json.loads(resp.read().decode())

    if result.get("errcode") == 0 or "media_id" in result:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · README.md (reported line 81)May include surrounding context.

Token 过期,清除缓存后重试:

bash
rm ~/.hermes/skills/wechat-api-lite/scripts/.token_cache

图片用 url 还是 media_id?

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · README_zh.md (reported line 81)May include surrounding context.

Token 过期,清除缓存后重试:

bash
rm ~/.hermes/skills/wechat-api-lite/scripts/.token_cache

图片用 url 还是 media_id?

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · SKILL.md (reported line 141)May include surrounding context.

Token 过期,清除缓存后重试:

bash
rm ~/.hermes/skills/wechat-api-lite/scripts/.token_cache

图片用 url 还是 media_id?

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

Most of the code aligns with the declared purpose: it retrieves access tokens, uploads media, and creates drafts using standard library networking only. However, it also includes an additional capability to query draft counts/list (draft-list / get_draft_list), which is not mentioned in the declared description. Separately, the code comments/docstring state '发布等' (publishing, etc.), but no publish function or CLI command exists in the supplied code, indicating an internal description/behavior inconsistency. This is not a severe mismatch in primary purpose, but there is a material undeclared capability and a stated-but-unimplemented capability.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · README.md (reported line 43)May include surrounding context.

Returns thumb_media_id

text

**3. Create a draft**

```bash
python3 ~/.hermes/skills/wechat-api-lite/scripts/wechat_api.py \

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill documents commands that read environment-based secrets, access local files, and make outbound network requests to WeChat, but it does not declare any explicit tool scope or permission boundaries. This increases the chance that an agent or user invokes the skill without understanding its access to credentials, local content, and remote upload behavior.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger phrase '创建草稿' is broad enough to match unrelated user requests, which could cause an agent to invoke this skill in the wrong context. Because the skill can upload article content and local media to a remote WeChat service, accidental invocation can lead to unintended data disclosure or unintended remote-side state changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill instructs users to upload local files and article content to WeChat but does not prominently warn that data is sent to a third-party remote service. In an agent setting, missing disclosure materially increases the risk of users unintentionally exposing sensitive local documents, images, or unpublished content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The natural-language strings and usage text are entirely in Chinese, which imposes a specific language/locale on users without any opt-in or alternative. Under the policy, forced language constraints should either offer user choice or be explicitly 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_api.py (reported line 73)May include surrounding context.

python
print("错误:请先在 config.env 中填入 WECHAT_APP_ID 和 WECHAT_APP_SECRET")
        sys.exit(1)

    url = f"https://api.weixin.qq.com/cgi-bin/token"
    result = wechat_request("GET", url, token=False)

    # Build URL manually

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_api.py (reported line 138)May include surrounding context.

python
print("错误:请先在 config.env 中填入 WECHAT_APP_ID 和 WECHAT_APP_SECRET")
        sys.exit(1)

    url = f"https://api.weixin.qq.com/cgi-bin/token"
    result = wechat_request("GET", url, token=False)

    # Build URL manually

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_api.py (reported line 180)May include surrounding context.

python
print("错误:请先在 config.env 中填入 WECHAT_APP_ID 和 WECHAT_APP_SECRET")
        sys.exit(1)

    url = f"https://api.weixin.qq.com/cgi-bin/token"
    result = wechat_request("GET", url, token=False)

    # Build URL manually

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_api.py (reported line 220)May include surrounding context.

python
print("错误:请先在 config.env 中填入 WECHAT_APP_ID 和 WECHAT_APP_SECRET")
        sys.exit(1)

    url = f"https://api.weixin.qq.com/cgi-bin/token"
    result = wechat_request("GET", url, token=False)

    # Build URL manually

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_api.py (reported line 243)May include surrounding context.

python
print("错误:请先在 config.env 中填入 WECHAT_APP_ID 和 WECHAT_APP_SECRET")
        sys.exit(1)

    url = f"https://api.weixin.qq.com/cgi-bin/token"
    result = wechat_request("GET", url, token=False)

    # Build URL manually

External Transmission

Medium
Category
Data Exfiltration
Confidence
84% confidence
Finding

The access token request embeds APP_ID and APP_SECRET directly into the URL query string. Secrets placed in URLs are more likely to be exposed through logs, debugging output, proxy records, browser/history equivalents, or monitoring systems, increasing credential leakage risk beyond the intended TLS-protected transmission.

Content

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

python
result = wechat_request("GET", url, token=False)

    # Build URL manually
    full_url = f"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={APP_ID}&secret={APP_SECRET}"
    req = urllib.request.Request(full_url, method="GET")
    with urllib.request.urlopen(req, timeout=30) as resp:
        result = json.loads(resp.read().decode())

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script stores a bearer access token in a local plaintext cache file without setting restrictive permissions or warning the user. On multi-user systems or in permissive working directories, another local user or process could read and reuse the token to act against the associated WeChat account until expiry.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The README instructs users to place AppID and AppSecret into a local config file but provides no warning about protecting that file, avoiding commits, or setting restrictive permissions. While common in setup docs, omission of basic secret-handling guidance increases the risk of accidental credential exposure through source control, backups, or shared environments.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The workflow line labels wechat-api-lite create-draft (publish), which states that the command publishes content. However, earlier instructions say the tool only creates drafts and that users must manually preview and publish on mp.weixin.qq.com, so this line actively contradicts the documented behavior.

Content

No source excerpt is available for this finding.