T09 · Insecure Skill Coding Practices
- Location
scripts/md2docx_with_images.py:207- Finding
Arbitrary Local File Inclusion Through Markdown Image References
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Markdown-to-Word skill is mostly purpose-aligned, but it needs Review because Markdown image paths can cause local image files to be embedded and its shared temporary-file cleanup is under-scoped.
Use this skill only for Markdown files you trust, or run conversion in a sandbox with access only to the intended input, image, and output folders. Be careful with image references, confirm output paths before batch conversion, install dependencies in a virtual environment, and avoid sudo unless you deliberately need system Python packages.
scripts/md2docx_with_images.py:207Arbitrary Local File Inclusion Through Markdown Image References
scripts/md2docx_with_images.py:156Predictable Shared Temporary Files and Overbroad Wildcard Cleanup
SKILL.md:62Unpinned Third-Party Dependency Installation
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
# 解码base64图片
echo "🖼️ 解码测试图片..."
base64 -d test_images/sample.jpg.base64 > test_images/sample.jpg
rm test_images/sample.jpg.base64
# 创建配置文件
echo "⚙️ 创建配置文件..."
L006-L007 仅说明“当用户需要将Markdown文件转换为Word文档时激活此技能”,这是功能描述式触发条件,而不是明确、受限的调用条件。文档没有提供具体触发短语、适用上下文或不应触发的负面示例,容易导致在泛泛提到转换需求时被误调用。
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
# Ubuntu/Debian
sudo apt-get install python3-pip python3-venv
# macOS
brew install python3
L074-L094 展示了多个将 Markdown 转换为 .docx 的命令用法,本质上会在指定路径创建或覆盖输出文件。虽然这是技能的核心用途,但当前说明缺少显式的用户提示,例如输出文件会写入磁盘、批量模式会在输出目录生成多个文件,以及应避免指向重要现有文件。
The shell script uses Chinese comments, status messages, and generated template/config text throughout, including Chinese style labels and instructions. This enforces a specific language/locale for users without any opt-in mechanism or indication that the skill is intentionally limited to a Chinese-language context.
The function docstring and CLI indicate that callers can control max_width, max_height, image_quality, and add_captions. However, _add_image hard-codes max_width=1200, max_height=800, quality=85 at L238-L243, and always adds captions when alt exists at L250-L253, so the documented intent contradicts actual behavior.
全文以中文编写,并以中文定义技能名称、说明、用法和输出示例,但没有说明该技能仅面向中文用户,或提供其他语言选项。若组织要求技能不应在未获用户选择时强制特定语言,这种单一语言呈现可能构成语言/locale 政策问题。
This code emits user-facing status, error, and CLI help text entirely in Chinese, including prints and argparse descriptions. Under the language/locale policy rule, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified.
This code file contains natural-language strings and docstrings exclusively in Chinese, beginning with the module docstring and continuing through CLI help text. Under the policy, forcing a specific language without opt-in can be a locale-policy violation when no alternative language choice or justification is provided.
This code ensures the output directory exists and then invokes a conversion routine that writes to the specified output path. Although file output is part of the tool's purpose, this file contains no confirmation prompt, visible logging, or explanatory comment/docstring warning the user that it will create directories and write files.
No suspicious patterns detected.