Back to skill

Security audit

Wechat Automation

Security checks for vulnerabilities and agentic risk

Overview

This WeChat automation skill can read and send private messages and contacts, and it generates unsafe Windows batch files without enough user controls.

Review carefully before installing. Use only on a Windows account and WeChat session you are authorized to automate, treat chat/contact output as sensitive, avoid bulk messaging unless recipients and content are explicitly reviewed, remove or control the hard-coded D:\code\pywechat3 import path, pin dependencies, and do not run generated .bat files with untrusted recipient or message text.

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)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate_bat.py:24
Finding

Windows Batch Command Injection Through Unescaped Message and Recipient Values

Content
View full analysis
nul echo ===================================== echo 微信RPA - 发送消息 echo ===================================== echo. echo 好友: {friend} echo 消息: {message[:50]}{'...' if len(message) > 50 else ''} echo. echo 正在执行,请勿移动鼠标键盘... echo. cd /d "{SKILL_DIR}" python "{SCRIPTS_DIR}\\send_message.py" "{friend}" "{message}" echo. echo 执行完成,按任意键退出... pause >nul ''' with open(output_path, "w", encoding="utf-8") as f: f.write(bat_content) ``` ### Technical Analysis The `friend` and `message` parameters are inserted directly into executable Windows batch-file content. Quoting values with double quotes does not safely isolate them in `cmd.exe`. An attacker can include a double quote followed by command separators or redirection characters such as `&`, `|`, `>`, `<`, or a newline to terminate the intended argument and introduce another command. The same untrusted values are also interpolated into `echo` commands, creating additional injection points. Windows-specific expansions such as `%VARIABLE%` can alter generated content at execution time. The implementation performs no validation, canonicalization, or CMD-compatible escaping before writing the `.bat` file. The dangerous operation does not occur while the file is generated. It occurs when the generated file is subsequently executed, as explicitly instructed by the script. ### Attack Path 1. An attacker influences the recipient or message passed to: ```text python generate_bat.py send ``` 2. The attacker supplies a value con ...[truncated 1020 chars]
Remediation
View remediation
`, `<`, parentheses, carriage returns, and newlines. ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/send_message.py:12
Finding

Unpinned Third-Party Dependencies and Unsafe Local Module Precedence

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (19)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill explicitly supports reading chat records, enumerating contacts, and monitoring new messages, but provides no privacy notice, consent model, retention limits, or data-handling restrictions. In context, this is especially dangerous because WeChat data is highly sensitive personal and business communication data, and automation makes bulk collection and surveillance easier.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README advertises capabilities to read chat history and extract contacts, which involve highly sensitive personal data, but it does not provide clear privacy, consent, retention, or handling guidance. In the context of a Windows UI automation skill for WeChat, this increases the chance that operators deploy invasive automation without understanding data exposure or the need for explicit user authorization.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The documentation promotes bulk messaging and auto-reply features without warning about account sanctions, accidental mass messaging, message leakage, or unintended automated actions. Because this skill targets WeChat automation specifically, these features can readily be used in spammy or unsafe ways, and the minimal compliance note at the end does not adequately mitigate operational or privacy risks.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill documents executable installation and local Python/script invocation, and its examples clearly imply shell execution plus file/system access, yet it declares no explicit tool scope or permission boundaries. In an agent setting, that mismatch can lead to overbroad execution authority, making it easier to install packages, run local scripts, and access local files without clear user-facing constraints.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The activation text is broad enough to trigger on many generic WeChat-related requests, including sensitive ones involving messaging, history access, monitoring, and automation. Overbroad routing increases the chance the agent invokes this powerful skill in contexts where the user did not clearly consent to desktop automation or access to private communications.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The FAQ instructs users to ensure the default input method is Chinese and to confirm WeChat's language is set to Simplified Chinese. This is a natural-language locale policy constraint presented as general guidance, but it does not offer user choice, opt-in, or a clear region-specific justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code's user-facing natural-language strings, including the module description and runtime output, are fixed to Chinese. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified.

Content

No source excerpt is available for this finding.

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/check_env.py (reported line 29)May include surrounding context.

python
import_name = package_name.replace("-", "_")

    try:
        __import__(import_name)
        print(f'  {ok} {package_name} 已安装')
        return True
    except ImportError:

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/check_env.py (reported line 37)May include surrounding context.

python
if alt_import:
        try:
            __import__(alt_import)
            print(f'  {ok} {package_name} 已安装 ({alt_import})')
            return True
        except ImportError:

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/check_env.py (reported line 89)May include surrounding context.

python
ok = '[OK]'
    warn = '[!]'
    try:
        result = subprocess.run(
            ["where", "WeChat.exe"],
            capture_output=True, text=True, timeout=5
        )

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/check_env.py (reported line 108)May include surrounding context.

python
ok = '[OK]'
    x = '[X]'
    try:
        result = subprocess.run(
            [sys.executable, "-m", "pip", "--version"],
            capture_output=True, text=True, timeout=10
        )

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This script generates Windows .bat files that trigger real-world WeChat automation for sending messages, exporting contacts, and reading chat history, but it provides only operational prompts like 'double-click to run' and 'do not move the mouse/keyboard' rather than clear consent, privacy, or account-risk warnings. In the context of a WeChat RPA skill, this increases the chance of accidental misuse, bulk messaging abuse, unauthorized data extraction from the local account session, or actions that violate platform policy once the batch file is executed outside the sandbox.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script enumerates a user's full WeChat contact list and prints personally identifiable information, including names, remarks, WeChat IDs, source, and region, directly to stdout. In an agent skill context, stdout may be exposed to logs, calling processes, or other observers without a clear consent step or privacy warning, creating a real risk of unintended data disclosure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script accesses and displays enterprise WeChat contacts, which may include business relationship data and corporate affiliations, without an explicit warning or access control. In the context of an automation skill designed to operate on a user's WeChat account, this increases the sensitivity because enterprise contact data can expose organizational and professional network information to logs or unauthorized viewers.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This script retrieves and prints recent WeChat chat history for an arbitrary contact or group without any privacy notice, consent check, access control, or confirmation step. In the context of a WeChat automation skill, exposing message contents to whoever can invoke the script materially increases the risk of unauthorized surveillance, accidental disclosure of sensitive conversations, and bulk privacy violations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The README content is presented entirely in Chinese and does not indicate that language is configurable or that alternative documentation is available. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring, CLI description, and runtime messages are written entirely in Chinese, which imposes a specific language on users without any opt-in or alternative locale. The policy explicitly calls for flagging language or locale constraints when the skill does not offer user choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring, usage text, and runtime messages are all presented only in Chinese, which imposes a fixed language on users. There is no opt-in, fallback, or documentation that this skill is intentionally limited to a Chinese-speaking or region-specific audience.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring and command-line help text are written exclusively in Chinese, and the skill does not indicate that language selection is optional or that the tool is intentionally restricted to a Chinese-speaking context. Under the policy for natural-language constraints, this is a locale/language restriction without user opt-in.

Content

No source excerpt is available for this finding.