Back to skill

Security audit

send-to-me

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to do the stated WeCom messaging job, but its documented credential handling could expose the WeCom application secret.

Review before installing. Prefer environment variables or a protected secret store instead of the -k/--corp-secret option, avoid sending to @all unless intended, pin python-dotenv to a reviewed version, and rotate the WeCom secret if it has been used in shell commands or logged automation.

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
SKILL.md:26
Finding

Unpinned Runtime Dependency Creates Supply-Chain Risk

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:26
Vulnerability Type: Unpinned third-party dependency
Risk Level: Medium

Vulnerable Code

bash
pip install python-dotenv

The installed package is imported and executed at runtime in scripts/send_message.py:21-28:

python
try:
    from dotenv import load_dotenv
except ImportError:
    raise ImportError(
        "缺少依赖: python-dotenv\n"
        "请运行: pip install python-dotenv\n"
        "或参考: https://xiaoqiangclub.blog.csdn.net/article/details/144614019"
    )

Technical Analysis

The installation command does not pin an audited package version, verify an artifact hash, or use a lock file. Consequently, the code installed under the python-dotenv package name may change after this Skill has been reviewed.

Because the package is imported whenever send_message.py runs, package-level code executes in the context of the invoking user. This context may contain the WeCom corporate ID, application secret, message content, and any other environment variables available to the process.

No malicious dependency is currently embedded in the project. Exploitation depends on a future upstream compromise, unsafe package source, or installation of an unreviewed release.

Attack Path

  1. An attacker compromises the upstream package, package maintainer account, distribution channel, or configured Python package index.
  2. The attacker publishes a malicious or backdoored release under the expected package name.
  3. A user follows the documented unpinned pip install python-dotenv command.
  4. The package manager selects the attacker-controlled or compromised release.
  5. The malicious package executes during import when send_message.py starts.
  6. The package can read process environment variables, including WeCom credentials, and act with the local permissions of the invoking user.

Impact Assessment

Successful exploitatio ...[truncated 380 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin python-dotenv to a specifically reviewed version instead of installing the latest available release.
  2. Maintain a lock file containing exact transitive dependency versions.
  3. Require cryptographic hashes during installation, such as through a hash-locked requirements file and pip install --require-hashes.
  4. Obtain packages only from an explicitly configured and trusted package index.
  5. Use an isolated virtual environment with only the dependencies required by this Skill.
  6. Periodically review and update the pinned version after security testing.
  7. Consider removing the dependency entirely and relying exclusively on environment variables if .env parsing is not essential.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/send_message.py:211
Finding

WeCom Application Secret Can Be Exposed Through Command-Line Arguments

Content
View full analysis

Vulnerability Details

File Location: scripts/send_message.py:211-213; documented usage at SKILL.md:83
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: Medium

Vulnerable Code

python
parser.add_argument(
    "-k", "--corp-secret", help="企业微信应用密钥(默认使用 .env 中的配置)"
)

The documentation explicitly encourages passing the secret on the command line:

bash
python scripts/send_message.py "消息内容" -c corp_id -k corp_secret -a agent_id

Technical Analysis

Command-line arguments are not an appropriate channel for long-lived secrets. Depending on the operating system and execution environment, process arguments may be exposed through:

  • Process inspection tools and process metadata
  • Shell history files
  • CI/CD command logs
  • Terminal session recording
  • Job schedulers and monitoring agents
  • Diagnostic or crash reports

The application subsequently uses this value to request a WeCom access token. Therefore, disclosure of the command-line value may allow an attacker to authenticate as the configured WeCom application.

The actual token request at scripts/send_message.py:76-80 uses HTTPS and targets the official qyapi.weixin.qq.com service. That network operation is necessary for the declared messaging function and is not evidence of unrelated exfiltration. The weakness is the local method by which the application secret may be supplied.

Attack Path

  1. A user follows the documented example and invokes the script with -k or --corp-secret.
  2. The WeCom application secret becomes part of the process argument vector and may also be retained in shell or automation logs.
  3. A local user, log reader, monitoring integration, or other party with access to that metadata retrieves the secret.
  4. The attacker combines the application secret with the associated corporate ID.
  5. The attacker requests an access token from the official WeCom ...[truncated 700 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the -k and --corp-secret command-line options.
  2. Delete documentation examples that place credentials directly in shell commands.
  3. Prefer a dedicated secrets manager or protected environment variable supplied by the deployment platform.
  4. For interactive use, request the secret through getpass.getpass() so it is not echoed or placed in shell history.
  5. If a secret file is supported, require restrictive file permissions and avoid printing its contents or path in logs.
  6. Ensure CI/CD systems use masked secret variables and do not expand secrets into logged command lines.
  7. Rotate the WeCom application secret if it has previously been supplied through command-line arguments.
  8. Restrict the WeCom application to the minimum API permissions and recipient visibility required for message delivery.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (33)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description says this is a 企业微信消息发送工具, implying delivery of messages through WeCom and support for sender/touser targeting. However, the supplied code contains only a MessageFormatter class that generates formatted text strings for several message types. There is no API call, network access, WeCom integration, authentication, sender selection, recipient handling, or dispatch logic. While the formatted outputs are relevant to reports/notifications/alerts, the actual code represents a formatter utility, not a message-sending tool. Therefore the description materially overstates and misrepresents the implemented behavior.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
76% confidence
Finding

This line documents --corp-secret as a command-line parameter, which creates a realistic risk of secret exposure through shell history, terminal logging, job metadata, and process listings. In agent or multi-user environments, CLI-secret passing is materially less safe than environment variables or secret stores.

Content

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

md
| --------------- | ---- | -------------------- | ----------------- |
| `message`       | -    | 消息内容(必填)     | -                 |
| `--sender`      | `-s` | 消息发送来源         | .env 配置         |
| `--corp-id`     | `-c` | 企业微信 CorpID      | .env 配置         |
| `--corp-secret` | `-k` | 企业微信密钥         | .env 配置         |
| `--agent-id`    | `-a` | 企业微信应用 AgentID | .env 配置         |
| `--touser`      | `-t` | 接收用户             | @all 或 .env 配置 |

Credential Access

High
Category
Privilege Escalation
Confidence
76% confidence
Finding

This section continues to expose the design choice of accepting --corp-secret on the command line. The main danger is operational leakage of the Enterprise WeChat secret rather than malicious code execution, but compromise of that secret can enable unauthorized messaging through the enterprise account.

Content

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

md
| `message`       | -    | 消息内容(必填)     | -                 |
| `--sender`      | `-s` | 消息发送来源         | .env 配置         |
| `--corp-id`     | `-c` | 企业微信 CorpID      | .env 配置         |
| `--corp-secret` | `-k` | 企业微信密钥         | .env 配置         |
| `--agent-id`    | `-a` | 企业微信应用 AgentID | .env 配置         |
| `--touser`      | `-t` | 接收用户             | @all 或 .env 配置 |
| `--toparty`     | `-p` | 接收部门             | 空                |

Credential Access

High
Category
Privilege Escalation
Confidence
76% confidence
Finding

The documented CLI interface still includes a secret-bearing argument, preserving the same risk of exposure to local observers, logs, or orchestration systems. Because the skill sends to external recipients, compromise of the secret can directly facilitate unauthorized outbound communications.

Content

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

md
| `--sender`      | `-s` | 消息发送来源         | .env 配置         |
| `--corp-id`     | `-c` | 企业微信 CorpID      | .env 配置         |
| `--corp-secret` | `-k` | 企业微信密钥         | .env 配置         |
| `--agent-id`    | `-a` | 企业微信应用 AgentID | .env 配置         |
| `--touser`      | `-t` | 接收用户             | @all 或 .env 配置 |
| `--toparty`     | `-p` | 接收部门             | 空                |
| `--totag`       | `-g` | 接收标签             | 空                |

Credential Access

High
Category
Privilege Escalation
Confidence
76% confidence
Finding

Although the line is part of a parameter table, it still documents insecure handling of the corporate secret through CLI flags. This is more dangerous in automation and agent contexts, where command invocations may be centrally logged and retained.

Content

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

md
| `--corp-id`     | `-c` | 企业微信 CorpID      | .env 配置         |
| `--corp-secret` | `-k` | 企业微信密钥         | .env 配置         |
| `--agent-id`    | `-a` | 企业微信应用 AgentID | .env 配置         |
| `--touser`      | `-t` | 接收用户             | @all 或 .env 配置 |
| `--toparty`     | `-p` | 接收部门             | 空                |
| `--totag`       | `-g` | 接收标签             | 空                |

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · env_example.txt (reported line 71)May include surrounding context.

text
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · env_example.txt (reported line 72)May include surrounding context.

text
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · env_example.txt (reported line 74)May include surrounding context.

text
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · env_example.txt (reported line 76)May include surrounding context.

text
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · env_example.txt (reported line 78)May include surrounding context.

text
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/send_message.py (reported line 7)May include surrounding context.

python
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/send_message.py (reported line 39)May include surrounding context.

python
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/send_message.py (reported line 57)May include surrounding context.

python
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/send_message.py (reported line 114)May include surrounding context.

python
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/send_message.py (reported line 136)May include surrounding context.

python
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/send_message.py (reported line 195)May include surrounding context.

python
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/send_message.py (reported line 213)May include surrounding context.

python
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/send_message.py (reported line 217)May include surrounding context.

python
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/send_message.py (reported line 228)May include surrounding context.

python
本模块提供向企业微信发送文本消息的功能,支持多种配置方式和消息格式。

配置优先级:命令行参数 > 环境变量 > .env 文件 > 默认值

依赖:
    pip install python-dotenv