T09 · Insecure Skill Coding Practices
- Location
audio_summary_skill.py:7- Finding
Hard-Coded DashScope API Credential
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This audio/video summarizer has a clear purpose, but it ships with an exposed API key and unsafe command execution that could let crafted filenames run local commands.
Do not install this version unless you are prepared to review and patch it first. The embedded DashScope key should be revoked and replaced with a user-provided secret, ffmpeg should be called through subprocess with an argument list rather than os.system, temporary files should be unique/private, and the skill should clearly warn users before uploading audio or video-derived content to a third-party ASR provider.
audio_summary_skill.py:7Hard-Coded DashScope API Credential
audio_summary_skill.py:15OS Command Injection Through an Untrusted Media Path
audio_summary_skill.py:70Predictable Shared Temporary File Enables Races and Unsafe Overwrites
A hardcoded API key is embedded directly in the source code, which exposes a live credential to anyone who can view the file, logs, backups, or repository history. An attacker could reuse the key for unauthorized API access, incur charges, access associated resources, or pivot into related service abuse.
The skill builds a shell command with user-controlled input (video_path) and executes it via os.system, which invokes a shell. Quoting with double quotes is not sufficient to prevent shell metacharacter expansion such as command substitution, so a crafted filename could trigger arbitrary command execution on the host.
print(f"正在从视频提取音频并极致压缩: {video_path}")
# 压缩为 16k mono mp3, 32k 码率以确保 Base64 编码后不超过 10MB (约支持 10-15 分钟视频)
cmd = f'ffmpeg -y -i "{video_path}" -vn -ar 16000 -ac 1 -ab 32k "{audio_path}" -loglevel error'
os.system(cmd)
return os.path.exists(audio_path)
def transcribe_with_data_uri(audio_path):
The natural-language instructions throughout the skill file are Chinese-only, which can impose a language constraint on users without opt-in. The file does not state that the skill is intended only for Chinese-speaking users or provide an alternative language option.
The skill sends user-provided audio/video content to an external ASR provider, but the description does not warn about this data transfer or its privacy implications. Users may unknowingly submit sensitive conversations, meetings, or recordings to a third-party service, creating confidentiality, compliance, and consent risks.
In this skill context, shell execution is directly tied to processing attacker-influenced media paths, so the command-execution capability is not merely incidental. Because the feature is exposed in a summarization utility, users may supply untrusted filenames or files from shared locations, increasing the chance of command injection or unsafe execution flows.
The script's user-visible messages and the transcription instruction are written only in Chinese, and the model prompt directs output in that language context without any opt-in or locale selection. This can violate language/locale policy when users are not given a choice.
The skill base64-encodes local audio and transmits it to a third-party ASR endpoint without explicit user consent, warning, or data-handling notice. This can leak sensitive spoken content, personal data, or confidential business information, especially because summarization tools are often used on meetings or private recordings.