T09 · Insecure Skill Coding Practices
- Location
scripts/migrator.py:59- Finding
Unsanitized Batch Script Generation Enables Command Execution
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This WizNote migration helper is mostly purpose-aligned, but it includes under-scoped Windows batch execution that could run arbitrary local commands.
Review this skill before installing. Use only the pure-Python migration path with source and target directories you choose, avoid passing script_path unless you have personally reviewed the batch file, and be aware that local paths or notes may be written to migration_log.json if the logging helper is used.
scripts/migrator.py:59Unsanitized Batch Script Generation Enables Command Execution
This mismatch includes undeclared execution of external batch scripts or subprocesses, which materially changes the trust and risk profile of the skill. Hidden or insufficiently disclosed process execution is dangerous because it can modify files recursively, access unintended paths, or be repurposed for arbitrary command execution if inputs or script contents are altered.
This mismatch includes undeclared execution of external batch scripts or subprocesses, which materially changes the trust and risk profile of the skill. Hidden or insufficiently disclosed process execution is dangerous because it can modify files recursively, access unintended paths, or be repurposed for arbitrary command execution if inputs or script contents are altered.
The entire skill description is presented in Chinese, including usage guidance and safety notes, with no indication that users may choose another language or that the skill is intended only for a Chinese-speaking or region-specific audience. Under the stated policy, forcing a specific language without opt-in is a natural-language policy violation.
The skill documents and encourages file reads, file writes, and shell execution, but it does not declare any explicit tool scope or permissions boundaries. This is dangerous because an agent/runtime may grant broader capabilities than users expect, enabling filesystem access or script execution without transparent consent or least-privilege constraints.
This markdown file uses Chinese for the manifest description, headings, usage instructions, and warnings throughout the entire skill documentation. Under the policy criteria, forcing a specific language without giving the user a choice or documenting a justified locale restriction is a natural-language policy violation.
The module docstring is entirely in Chinese and presents the skill's purpose and behavior without offering any language choice or documenting a justified locale restriction. This creates a natural-language locale policy issue because the skill appears to assume a fixed language for user-facing guidance.
The module description and generated guide content are entirely in Chinese, with no indication that the user can choose another language or opt in to this locale. Under the stated policy, hard-coding a language without user choice is a natural-language policy violation unless the locale constraint is explicitly justified.
The function persists export_dir and arbitrary free-form notes to a local JSON log without any notice, consent flow, retention policy, or sanitization. Export paths can reveal usernames, directory layouts, project names, or other sensitive local-environment details, and notes may contain personal or operational data that becomes quietly retained on disk.
This code contains natural-language documentation and CLI output exclusively in Chinese, including the module docstring and runtime messages. Because the file does not offer a language/locale choice or explain that it is intentionally region-specific, it violates the language/locale policy criteria.
This migration helper accepts an arbitrary batch-script path and executes it, which exceeds the stated purpose of copying attachments. In a skill context, this is dangerous because users may trust the tool to perform file migration, while it can actually run attacker-controlled Windows commands.
The code reads a batch script, writes a temporary .bat file, and executes it without an explicit warning or consent boundary. In a migration-assistance skill, this hidden capability increases social-engineering risk because users may not expect the tool to spawn an external command interpreter and run script content.
The code launches a batch file via subprocess.run with shell=True, which allows execution of external commands and increases the attack surface. Because script_path content is read, rewritten, and then executed as a .bat file, an attacker who can influence that path or file content can cause arbitrary command execution on Windows.
try:
print("正在运行批处理脚本...")
result = subprocess.run(
[str(temp_script)],
shell=True,
capture_output=True,
The docstring says this function is a simplified bulk-copy interface that returns statistics, but the call passes 'stats' as the third positional argument to run_attachment_migration, whose signature treats that position as 'script_path'. This means the function does not behave as documented and can fail before performing the advertised migration flow.
The only natural-language text in the file is a Chinese module docstring, which indicates a fixed language choice without any visible opt-in or justification. Under the policy, forcing a specific language without user choice can be a locale/language policy violation.
This file contains user-facing natural-language instructions exclusively in Chinese, including the feature summary and usage examples. Under the language/locale policy, forcing a specific language without user opt-in can be a policy concern when no alternative or opt-in is provided.
This code's natural-language content, including the module docstring and function documentation, is entirely in Chinese and does not offer any language or locale choice. Under the policy rule, forcing a specific language without user opt-in is a natural-language policy concern unless the locale restriction is explicitly justified.
The top-level docstring narrowly describes a guide generator that turns export requirements into a Markdown template. Later code adds a separate side-effecting logging function that writes migration_log.json, which is not just missing detail but a broader purpose than the module-level documentation states.
The module docstring and primary function describe generating a Markdown export guide, which matches the migration-assistance manifest. However, the additional append_migration_log function writes a persistent JSON log file recording export directory, status, and notes, which goes beyond merely generating guidance content.
The manifest description is written only in Chinese, with no indication that the skill is region-specific or that users may choose another language. This can violate language/locale policy expectations when a skill is presented to a broader audience without explicit opt-in or justification.
This Python file contains only Chinese natural-language strings in the docstring and all user-facing print messages. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified, which is not present here.