Back to skill

Security audit

胡田 OPC导师 视频号运营

Security checks for vulnerabilities and agentic risk

Overview

This is a Chinese-language WeChat video-channel operations skill with planning guides and a script generator, with one local file-save flaw users should treat cautiously.

Install only if you want a Chinese-language WeChat video/channel operations workflow. Treat scripts/script_generator.py as a local helper, not a hardened service: do not pass untrusted filenames to save_script unless it is fixed to restrict names to a safe basename.

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/script_generator.py:265
Finding

Caller-Controlled Path Traversal in Script File Saving

Content
View full analysis

Vulnerability Details

File Location: scripts/script_generator.py, lines 265–269
Vulnerability Type: Path traversal leading to an arbitrary relative-path file write
Risk Level: Medium

Vulnerable Code

python
def save_script(self, script: str, filename: str) -> str:
    """保存脚本到文件"""
    filepath = f"scripts/{filename}_{datetime.now().strftime('%Y%m%d_%H%M%S')}.txt"
    with open(filepath, 'w', encoding='utf-8') as f:
        f.write(script)
    return filepath

Technical Analysis

The save_script() method directly interpolates the caller-controlled filename value into a filesystem path. It does not reject path separators, absolute path components, or parent-directory sequences such as ../.

Consequently, an attacker who can control filename can cause the resolved destination to escape the intended scripts/ directory. The script argument supplies the file contents, so a caller controlling both arguments can create attacker-selected content at an unintended writable location.

The timestamp and .txt suffix make replacement of a precisely named existing file less straightforward, but they do not prevent directory traversal or unauthorized file creation. Exploitation remains subject to the operating system permissions of the process running the Skill.

Attack Path

  1. An attacker gains control over the filename argument passed to save_script().

  2. The attacker supplies a traversal value such as ../../shared/payload.

  3. The method constructs a path resembling:

    text
    scripts/../../shared/payload_YYYYMMDD_HHMMSS.txt
    
  4. The operating system normalizes the parent-directory components, placing the file outside the intended scripts/ directory.

  5. The function writes the supplied script content to that unintended location.

  6. If the destination is later trusted, processed, published, or executed by another component, the una ...[truncated 822 chars]

Remediation
View remediation

Remediation Suggestions

  1. Restrict filename to a simple basename using a strict allowlist, such as letters, digits, underscores, and hyphens.
  2. Reject empty names, absolute paths, .., /, \, null bytes, and platform-specific path separators.
  3. Build paths with pathlib.Path rather than string concatenation.
  4. Resolve the output directory and candidate destination, then verify that the destination remains inside the approved directory.
  5. Create the output directory explicitly and use restrictive filesystem permissions where appropriate.
  6. Consider generating the complete server-side filename rather than accepting a path-like caller value.

Example hardening:

python
import re
from pathlib import Path
from datetime import datetime

def save_script(self, script: str, filename: str) -> str:
    if not re.fullmatch(r"[A-Za-z0-9_-]{1,80}", filename):
        raise ValueError("Invalid filename")

    output_dir = Path("scripts").resolve()
    output_dir.mkdir(parents=True, exist_ok=True)

    timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
    destination = (output_dir / f"{filename}_{timestamp}.txt").resolve()

    if destination.parent != output_dir:
        raise ValueError("Destination escapes the output directory")

    destination.write_text(script, encoding="utf-8")
    return str(destination)

Add tests covering ../, absolute paths, Windows separators, nested paths, encoded traversal forms, empty names, and excessively long names.

Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • 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
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description presents a broad end-to-end video operations capability, but the implemented behavior reportedly narrows to content/script generation while also performing local file writes that are not disclosed. This mismatch can mislead users and downstream agents about what the skill actually does, increasing the risk of unintended file changes and unsafe trust decisions.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill appears to have file-writing capability without declaring any tool scope or permissions. Undeclared write access breaks least-privilege expectations and can enable unexpected local file modification by an agent or user who trusts the metadata.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The entire skill content, including templates, triggers, and operating guidance, is written exclusively in Chinese and assumes Chinese-language user interactions such as keyword replies and公众号搜索. There is no indication that users may choose another language or that the Chinese-only constraint is required for a region-specific compliance or platform limitation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module description and all generated script templates are hard-coded in Chinese, indicating the skill enforces a specific language output. There is no visible option for the user to choose another language or any documented justification that this skill is intentionally restricted to a Chinese-language context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The user-facing documentation is written entirely in Chinese, and there is no indication that users may choose another language or that the skill is intentionally limited to a Chinese-speaking or region-specific audience. Under the policy, a skill that effectively forces a specific language without opt-in can be considered a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This file presents all instructions, templates, and examples exclusively in Chinese, with no indication that users may choose another language or locale. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The entire file is written in Chinese and presents all guidance, labels, and instructions in that language only. There is no indication that the skill is region-specific or that users can choose another language, which can violate a language/locale choice policy for general-purpose skills.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest describes a data-driven full-process运营 tool covering topic planning through content publishing, which implies broader workflow capabilities. In this file, the implementation is limited to generating canned script text for several content types and writing the result to a local file, with no planning, analytics, or publishing behavior present.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The save_script method writes generated content to a local file, but there is no confirmation prompt, visible user disclosure, or warning around the filesystem side effect. While the method name implies saving, the code itself performs a write operation silently, which matches the missing-warning criterion for code files.

Content

No source excerpt is available for this finding.