Back to skill

Security audit

WeChat Markdown Article

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward Markdown-to-WeChat HTML tool with an explicitly confirmed optional upload path, but users should only process trusted content.

Install only if you are comfortable with a shell tool that can send reviewed article content and optional cover images to a configured WeChat Official Account. Keep WeChat secrets in environment variables or a real secret store, do not paste them into chat or files, and only convert Markdown from trusted sources because generated preview HTML is not sanitized.

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
wechat-article.sh:44
Finding

Unsanitized Markdown and Metadata Permit Active HTML Injection

Content
View full analysis

\1<\/h2><\/div>/g' "$input" | sed 's/^## \(.*\)/

\1<\/strong><\/p>/g' | sed 's/^### \(.*\)/

\1<\/strong><\/p>/g' | sed 's/^[-*] \(.*\)/

· \1<\/p>/g' | sed 's/^[0-9]\+\. \(.*\)/

\0<\/p>/g' | sed 's/^> \(.*\)/

\1<\/strong><\/p>/g' | sed 's/\*\*\([^*]*\)\*\*/\1<\/strong>/g' | sed 's/\*\([^*]*\)\*/\1<\/em>/g' | sed 's/^\([^<].*\)$/

\1<\/p>/g' } ``` ```bash generate_tags() { local tags=$1 local html="" local tag for tag in $tags; do html="${html}${tag}" done printf '%s' "$html" } ``` ```bash content=$(convert_markdown "$input_file") tags_html=$(generate_tags "$tags") date=$(date +%Y-%m-%d) html=$(sed \ -e "s/{{TITLE}}/${title}/g" \ -e "s/{{SUBTITLE}}/${subtitle}/g" \ -e "s/{{DATE}}/${date}/g" \ -e "s/{{FOOTER_TEXT}}//g" \ -e "s#{{TAGS}}#${tags_html}#g" \ "$SCRIPT_DIR/template.html") html=$( awk ' FNR == NR { content = content $0 ORS ...[truncated 3358 chars]

Remediation
View remediation
`, ``, `<object>`, `<embed>`, and similar active elements. - Event-handler attributes such as `onclick`, `onload`, and `onerror`. - Dangerous URL schemes such as `javascript:` and unintended `data:` URLs. - Remote resources unless they are explicitly required and approved. 4. Do not construct `sed` replacement programs from untrusted values. If `sed` remains in use, escape all replacement and delimiter metacharacters before substitution, though a proper template engine is preferred. 5. Treat local preview as a security boundary. Consider generating a restrictive Content Security Policy for local previews that blocks scripts, frames, plugins, and network access. 6. Revalidate and sanitize the final HTML immediately before upload rather than assuming that WeChat will remove dangerous markup. 7. If raw HTML support is intentionally retained, disable it by default and require an explicit unsafe option accompanied by a warning before preview or upload. 8. Add regression tests using payloads containing raw scripts, event handlers, remote images, iframes, dangerous URL schemes, closing tags, and `sed` replacement metacharacters. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (7)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

md
- 凭据只从环境变量或系统密钥存储读取;不要在聊天、命令行、日志或仓库中保存凭据。
- 上传前先检查生成的 HTML、封面和目标账号。
- 只有同时传入 `--upload --confirm-upload` 才会发送文章 HTML 和可选封面到微信 API。
- 脚本不打印 access token,也不包含删除草稿能力。
- 若旧版本曾包含真实 App Secret,应立即在微信公众平台轮换。

## 本地生成

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · lib/wechat-api.sh (reported line 38)May include surrounding context.

sh
- 凭据只从环境变量或系统密钥存储读取;不要在聊天、命令行、日志或仓库中保存凭据。
- 上传前先检查生成的 HTML、封面和目标账号。
- 只有同时传入 `--upload --confirm-upload` 才会发送文章 HTML 和可选封面到微信 API。
- 脚本不打印 access token,也不包含删除草稿能力。
- 若旧版本曾包含真实 App Secret,应立即在微信公众平台轮换。

## 本地生成

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill advertises shell-based operation but does not declare any explicit tool scope or permissions boundary. That makes the runtime capabilities ambiguous and can lead to overbroad shell access when the skill is invoked, increasing the chance of unintended command execution or misuse in environments that rely on manifest-declared restrictions.

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 · lib/wechat-api.sh (reported line 25)May include surrounding context.

sh
local response
    response=$(
        {
            printf 'url = "https://api.weixin.qq.com/cgi-bin/token"\n'
            printf 'silent\n'
            printf 'show-error\n'
            printf 'get\n'

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 · lib/wechat-api.sh (reported line 54)May include surrounding context.

sh
local response
    response=$(
        {
            printf 'url = "https://api.weixin.qq.com/cgi-bin/token"\n'
            printf 'silent\n'
            printf 'show-error\n'
            printf 'get\n'

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 · lib/wechat-api.sh (reported line 68)May include surrounding context.

sh
local response
    response=$(
        {
            printf 'url = "https://api.weixin.qq.com/cgi-bin/token"\n'
            printf 'silent\n'
            printf 'show-error\n'
            printf 'get\n'

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · lib/wechat-api.sh (reported line 71)May include surrounding context.

sh
printf 'url = "https://api.weixin.qq.com/cgi-bin/draft/add?access_token=%s"\n' "$encoded_token"
        printf 'silent\n'
        printf 'show-error\n'
    } | curl --config - \
        -X POST \
        -H "Content-Type: application/json" \
        --data-binary "@${json_file}"

Static analysis

No suspicious patterns detected.