T09 · Insecure Skill Coding Practices
- Location
scripts/transcribe.py:61- Finding
Arbitrary Code Execution Through Dynamically Generated Python Source
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill’s video transcription purpose is coherent, but its helper script has a real local code-execution flaw and disables TLS checks for downloads.
Install only if you are comfortable reviewing or fixing the script first. At minimum, remove the generated python -c execution pattern, keep TLS certificate verification enabled, use pinned dependencies in a virtual environment, and treat video URLs and prompts as untrusted input.
scripts/transcribe.py:61Arbitrary Code Execution Through Dynamically Generated Python Source
scripts/transcribe.py:26TLS Certificate Verification Disabled for Video Downloads
SKILL.md:14Unpinned Third-Party Runtime Dependencies
Using --no-check-certificates disables TLS certificate validation for video downloads, making the tool susceptible to man-in-the-middle attacks and content spoofing. An attacker on the network path could tamper with the downloaded media or redirect requests to malicious content, which is especially risky because the skill processes untrusted remote resources automatically.
cmd = [
"yt-dlp", url,
"-o", output_path,
"--no-check-certificates",
"--no-update"
]
print("[1/2] 正在下载视频...")
The skill advertises shell, environment-variable, and file access behavior but does not declare any tool scope or permissions boundaries. That increases the chance an agent may invoke it with broader capabilities than the user expects, especially because the workflow downloads files, installs dependencies, and reads persistent configuration.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
pip install yt-dlp openai-whisper winget install ffmpeg # Windows
## First-time Setup
The skill recommends creating persistent global yt-dlp configuration under user profile directories, which changes future downloader behavior outside this skill session. Persistent config can surprise users, affect unrelated workflows, and increase the blast radius if unsafe options are later added or if sensitive paths are exposed.
# Windows: Create %APPDATA%\yt-dlp\config (one line):
-o X:\video_downloads\%(title)s.%(ext)s
# macOS/Linux: Create ~/.config/yt-dlp/config (one line):
The skill description does not clearly warn that it will download remote video content and save files locally. Users may provide untrusted URLs without realizing the skill performs network retrieval and persistent local storage, which can create privacy, disk-usage, and policy-consent issues.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"--no-update"
]
print("[1/2] 正在下载视频...")
result = subprocess.run(cmd, capture_output=True, text=True, encoding='utf-8', errors='replace')
if result.returncode != 0 and "already downloaded" not in result.stderr:
print(f"下载失败: {result.stderr}")
sys.exit(1)
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
"--no-update"
]
print("[1/2] 正在下载视频...")
result = subprocess.run(cmd, capture_output=True, text=True, encoding='utf-8', errors='replace')
if result.returncode != 0 and "already downloaded" not in result.stderr:
print(f"下载失败: {result.stderr}")
sys.exit(1)
The embedded Whisper call hard-codes language='zh', which enforces a specific language/locale behavior for all inputs. The file does not offer an opt-in, parameter, or justification for this restriction, so it fits the policy category for language or locale constraints without user choice.
The script dynamically builds Python source code with f-string interpolation and executes it via python -c. User-controlled prompt and the discovered video_path are inserted directly into Python string literals, so crafted input containing quote/newline sequences can break out of the string and execute arbitrary Python code in the spawned interpreter.
print('---FULLTEXT---')
print(result['text'])
"""
result = subprocess.run(
["python", "-c", python_code],
capture_output=True, text=True, encoding='utf-8', errors='replace'
)
This is a true code-execution issue because environment-derived WHISPER_DOWNLOAD_ROOT and video_path are interpolated into a Python program string that is then executed with python -c. An attacker controlling the environment or influencing the file name/path can inject Python statements and achieve arbitrary code execution.
print('---FULLTEXT---')
print(result['text'])
"""
result = subprocess.run(
["python", "-c", python_code],
capture_output=True, text=True, encoding='utf-8', errors='replace'
)
The manifest description is written only in Chinese while the rest of the skill documentation is in English, which can impose a language assumption on users or tooling consuming the manifest. There is no indication that the skill is intentionally region-specific or that users can choose their preferred language.
清单描述强调的是从视频链接下载并转录为文字,通常可理解为以转录为目的的处理中间步骤。代码在完成转录后明确保留视频文件并输出保存路径,实际行为包含本地持久化媒体内容,而不仅是为转录临时下载。
No suspicious patterns detected.