T09 · Insecure Skill Coding Practices
- Location
scripts/run.py:51- Finding
Unrestricted User-Controlled URL Resolution Enables Server-Side Request Forgery
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This appears to be a real Douyin transcription tool, but its downloader is too broadly scoped and can contact unexpected network targets or use unsafe temporary files.
Review this skill before installing. It is not showing clear malicious behavior, but you should only run it with trusted Douyin URLs and a TikHub token you are comfortable using. Avoid running it in privileged or shared environments until it validates URL destinations, limits download size, and uses private temporary directories.
scripts/run.py:51Unrestricted User-Controlled URL Resolution Enables Server-Side Request Forgery
scripts/run.py:139Unvalidated API-Controlled Media URL Allows Arbitrary Network Requests and Unbounded Downloads
scripts/run.py:186Predictable Files in the Shared Temporary Directory Permit Symlink-Based File Overwrite
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
def get_video_download_url(modal_id, token):
url = f"{TIKHUB_VIDEO_API}?aweme_id={modal_id}"
headers = {"Authorization": f"Bearer {token}"}
resp = requests.get(url, headers=headers, timeout=30)
resp.raise_for_status()
data = resp.json()
aweme_detail = data.get("aweme_detail", {})
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
def download_video(url, output_path):
headers = {"User-Agent": "Mozilla/5.0", "Referer": "https://www.douyin.com/"}
with requests.get(url, headers=headers, stream=True, timeout=120) as r:
r.raise_for_status()
with open(output_path, "wb") as f:
for chunk in r.iter_content(chunk_size=8192):
The skill declares capabilities that imply environment access, file read/write, network access, and shell execution, but it does not define any explicit tool scope or permission boundaries. This creates unnecessary ambiguity for an agent runtime and can enable over-privileged execution, especially because the workflow uses external binaries, local config secrets, and network-backed downloading.
The skill metadata and user instructions are written entirely in Chinese, with no indication that users may choose another language or that the skill is intentionally limited to a Chinese-speaking audience. Per the policy, forcing a specific language without opt-in is a natural-language policy violation unless the locale restriction is clearly documented and justified.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
'-acodec', 'libmp3lame', '-y', audio_path
]
try:
result = subprocess.run(cmd, capture_output=True, text=True, encoding='utf-8', errors='replace', check=False)
if result.returncode != 0:
if "ffmpeg: not found" in result.stderr or "不是内部或外部命令" in result.stderr:
raise FileNotFoundError("错误:'ffmpeg' 未在系统 PATH 中找到。请安装 ffmpeg 并将其添加到环境变量中。")
The code hard-codes language='zh' and a Mandarin-specific prompt in the Whisper transcription call. This imposes a specific language/locale policy on all inputs without offering user opt-in or documenting a region-specific constraint, which matches the natural-language policy violation criteria.
The skill sends user-supplied Douyin identifiers to a third-party service, TikHub, and relies on that external service to return the final media URL. In this context, the transmission is core functionality rather than overtly malicious, but it still introduces privacy, dependency, and trust-boundary risk because user activity and referenced content are disclosed to an external provider.
return None
# ==================== 抖音下载逻辑 ====================
TIKHUB_VIDEO_API = "https://api.tikhub.io/api/v1/douyin/web/fetch_one_video"
def get_config_value(key: str, default: Optional[str] = None) -> Optional[str]:
"""从 config.json 安全地读取配置值"""
The skill instructs users to configure an API token and submit Douyin URLs to an external service, but it does not disclose the privacy implications of transmitting video identifiers, request metadata, and potentially user-associated access patterns to a third party. While this is primarily a transparency and privacy issue rather than direct code execution, it can expose sensitive research interests or user activity if operators assume the process is fully local.
No suspicious patterns detected.