Back to skill

Security audit

wecomdrive

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches a WeCom document workflow, but its logged-in persistent browser helper can navigate to arbitrary URLs and return page details, which needs review before installation.

Install only if you expect the agent to handle WeCom/Tencent Docs content, QR login screenshots, local exports, and report uploads. Keep QR codes and generated reports private, clear the .state browser profile when finished, and avoid passing non-WeCom URLs to the helper unless the skill is changed to enforce a domain allowlist.

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/wecom-drive-browser.mjs:288
Finding
Unrestricted URL Navigation from a Persistent Authenticated Browser Context## Vulnerability Details **File Location**: `scripts/wecom-drive-browser.mjs:288-311, 347-350` **Vulnerability Type**: Server-Side Request Forgery–like browser navigation and insufficient destination validation **Risk Level**: Medium ### Vulnerable Code ```js const targetUrl = values.url || DEFAULT_LOGIN_URL; const timeoutMs = Number.parseInt(values["timeout-ms"] || "30000", 10); const qrPath = values["qr-path"] || defaultQrPath(); const jsonPath = values["json-path"]; const profileDir = values["profile-dir"] || DEFAULT_PROFILE_DIR; const headed = Boolean(values.headed); const keepOpen = Boolean(values["keep-open"]); let context; try { const executablePath = await resolveBrowserExecutable(); await mkdir(profileDir, { recursive: true }); await mkdir(DEFAULT_OUTPUT_DIR, { recursive: true }); context = await chromium.launchPersistentContext(profileDir, { executablePath, headless: !headed, viewport: { width: 1440, height: 960 }, locale: "zh-CN", args: ["--disable-dev-shm-usage"], }); const page = context.pages()[0] || (await context.newPage()); await page.goto(targetUrl, { waitUntil: "domcontentloaded", timeout: timeoutMs, }); ``` When authentication is not detected, page information is collected and included in the output: ```js if (!result.loginRequired) { const summary = await collectPageSummary(page); result.page.links = summary.links; result.page.editableElements = summary.editableElements; } ``` The result also contains text extracted during state detection: ```js page: { textHints: state.textHints, links: [], editableElements: [], }, ``` ### Technical Analysis The `--url` argument is accepted without validating its scheme, hostname, resolved IP address, or redirect destination. The supplied value is passed directly to `page.goto()` inside a persistent Chromium context. Although the Skill is documented as an interface to official WeCom and Tencent document services, the implementation does no ...[truncated 2492 chars]
Remediation
## Remediation Suggestions 1. **Enforce an explicit destination allowlist** - Accept only `https:` URLs. - Restrict hostnames to the official domains required by the Skill, such as precisely enumerated WeCom and Tencent document hosts. - Compare normalized hostnames exactly or by a safe subdomain rule; do not use substring matching. 2. **Block non-public network destinations** - Resolve the hostname before navigation. - Reject loopback, private, link-local, multicast, unspecified, and reserved IPv4 and IPv6 ranges. - Recheck DNS resolution immediately before connecting to reduce DNS rebinding risk. 3. **Validate redirects** - Inspect every navigation request and redirect destination. - Abort navigation if any destination falls outside the hostname allowlist or resolves to a prohibited address. - Validate `page.url()` again before extracting or returning page content. 4. **Isolate persistent authentication state** - Use the persistent profile only for validated official WeCom destinations. - Use a fresh, non-persistent browser context with no cookies or stored credentials for any explicitly supported external destination. - Consider disabling service workers and clearing unrelated site data from the persistent profile. 5. **Minimize returned page data** - Do not return body-text hints, links, or editable-element metadata until the final origin has passed validation. - Apply conservative length limits and redact potentially sensitive values. - Return a structured error when the destination is not approved. 6. **Add security tests** - Verify rejection of `http:`, `file:`, `data:`, loopback addresses, private IPv4 ranges, IPv6 loopback/link-local addresses, and cloud metadata destinations. - Test redirects from an approved-looking entry point to a prohibited destination. - Test deceptive hostnames such as `doc.weixin.qq.com.attacker.example`.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (18)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill claims broad WeCom web automation capabilities, including login-state handling, QR capture, downloading, exporting, and re-importing files, but the described implementation appears not to actually provide those controls while adding unrelated local XLSX-to-report processing. This mismatch is dangerous because operators may trust the skill to handle authentication and data movement safely when in reality behavior is incomplete or different, leading to unsafe manual workarounds, mishandling of sensitive enterprise documents, or unintended execution of unrelated processing logic.

Ae1

High
Category
analysis-evasion
Content
执行任何命令前,先根据当前 `SKILL.md` 的所在位置解析 `$SKILL_DIR`。在这个仓库里,包含本文件的目录就是技能根目录。
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node ./scripts/wecom-drive-browser.mjs \
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node ./scripts/wecom-drive-browser.mjs \
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The README explicitly promotes capturing a live enterprise login QR code and sending it to a user, but provides no warning about the sensitivity of that QR code, its short-lived authentication value, or safe handling requirements. In the context of a browser automation skill that preserves the same login session, mishandling or forwarding the QR code to the wrong party could enable unauthorized account access or session takeover.

Lp3

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding
The skill instructs use of shell commands, local file writes, environment-derived paths, and package installation, but it does not declare any explicit tool scope or permissions boundary. That creates an authorization and review gap: an agent or platform may grant broader capabilities than users expect, increasing the chance of unintended command execution, filesystem modification, or dependency installation.

Natural-Language Policy Violations

Medium
Confidence
86% confidence
Finding
This markdown file presents the skill's purpose and all operating instructions only in Chinese, which effectively forces a specific language on users or operators. The file does not offer an opt-in language choice or explain that the skill is intentionally limited to a Chinese-speaking or region-specific context.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The manifest explicitly instructs the agent to handle login state, capture and send a QR code, export/download enterprise documents, process them locally, and then re-import generated reports, but it provides no explicit warning, consent boundary, or privacy notice for these sensitive operations. In an enterprise file-storage context, this increases the risk of unintended disclosure, local persistence of confidential data, and user misunderstanding about what data leaves the web app and is stored or transformed on the local system.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The report includes IP/location-related fields from the workbook and writes them into HTML and DOCX outputs without any minimization, masking, or consent prompt. In the context of a WeCom/enterprise-drive skill, generated artifacts may be shared or re-imported into collaboration systems, increasing the risk of exposing personal or operationally sensitive data beyond the original audience.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The manifest describes a skill for interacting with WeCom Drive via the official web interface, including login-state checks, QR retrieval, download/export, and re-import through the webpage. This file instead reads a local XLSX workbook, performs standalone analytics, and writes report files to a local output directory, with no WeCom web automation or browser interaction present.

Context-Inappropriate Capability

Medium
Confidence
90% confidence
Finding
The code inventories editable inputs, textareas, and contenteditable elements on any visited page, which is a generic capability useful for profiling application workflows and sensitive forms. That behavior is not necessary for checking login state, QR capture, or file import/export in WeCom Drive, so it expands the skill into unnecessary page reconnaissance.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The script accepts an arbitrary --url, drives a persistent authenticated browser to that destination, and then enumerates page text hints, links, and editable elements when login is not required. In the context of a WeCom Drive skill, this exceeds the stated scope and can be used to inspect unrelated internal web apps using the user's existing browser session, creating a cross-site reconnaissance and data exposure risk.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The script launches a persistent browser profile under .state/chrome-profile, which retains cookies and authenticated session material across runs. Without a clear user-facing warning, lifecycle controls, or storage protections, this increases the chance of unintended reuse, local session theft, or surprise access to corporate resources in later executions.

Natural-Language Policy Violations

Low
Confidence
82% confidence
Finding
This markdown file presents its operational guidance entirely in Chinese, which can amount to a language-policy issue if the skill ecosystem expects language choice or neutral/default-language documentation. There is no visible note that the language is optional, user-selected, or limited to a specific Chinese-speaking audience.

Natural-Language Policy Violations

Low
Confidence
83% confidence
Finding
All user-facing manifest text is in Chinese and presents the workflow only in that language, with no indication that users can choose another language or that the skill is intentionally restricted to a Chinese-speaking/China-region audience. This can be a natural-language locale policy issue when no opt-in or justification is provided.

Unpinned Dependencies

Low
Category
Supply Chain
Content
"report:stutter": "python3 ./scripts/generate_stutter_report.py"
  },
  "dependencies": {
    "playwright-core": "^1.53.2"
  }
}
Confidence
40% confidence
Finding
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Intent-Code Divergence

Low
Confidence
98% confidence
Finding
The argparse description and help text frame the tool as producing a DOCX report from a workbook export. However, the implementation builds both HTML and DOCX outputs and writes both to disk, so the inline documentation understates the actual behavior.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The browser context is hard-coded to locale "zh-CN", which enforces a specific language/locale choice for all users. This is a natural-language policy concern because the script does not offer a user option to choose or opt into that locale.

Static analysis

No suspicious patterns detected.