T09 · Insecure Skill Coding Practices
- Location
douyin.py:17- Finding
Server-Side Request Forgery Through Substring-Based Short-Link Validation
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Douyin downloader generally matches its purpose, but loose URL validation could make the user's machine contact unintended internal or attacker-controlled addresses.
Install only if you are comfortable running a browser-based downloader on trusted Douyin links. Avoid using arbitrary or shortened links from untrusted sources, run it in a network-restricted environment if possible, and review output paths before using download.py because it can write to caller-selected locations.
douyin.py:17Server-Side Request Forgery Through Substring-Based Short-Link Validation
download.py:22Browser and HTTP SSRF Through Unvalidated Input and Extracted Media URLs
The file’s title, docstrings, and CLI output are entirely in Chinese, and the script provides no option to select another language or indicate that it is intentionally limited to a Chinese-only compliance or regional context. This creates a natural-language policy issue because the skill imposes a specific language on users without opt-in.
The code derives download_url from untrusted network-controlled data: either the redirected short URL target or the src attribute of a remotely loaded page, then performs a server-side requests.get to that URL without validating scheme, host, or IP range. This creates an SSRF primitive that could be abused to make the host contact attacker-chosen endpoints, including internal services or unexpected external destinations, especially because Playwright loads and parses remote content first.
# 6. 下载视频
print(f"⬇️ 下载中...")
resp = requests.get(download_url, headers={
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15',
'Referer': 'https://www.douyin.com/'
}, timeout=60)
This code file contains natural-language descriptions and CLI messages that assume Chinese-only usage, starting with the module docstring and continuing throughout the script. Under the language/locale policy, forcing a specific language without user opt-in is a policy concern unless the locale restriction is clearly documented and justified.
The documentation omits a clear warning that the skill uses browser automation and network access to visit user-supplied Douyin URLs and fetch content. This matters because browser automation expands the attack surface and can surprise users in restricted or sensitive environments, even if the skill's stated purpose is video capture.
The skill description documents downloading and saving Douyin video content but does not clearly warn users that remote content will be written to the local filesystem. This is a real transparency and safety issue because users may invoke the skill without understanding that it performs persistent local writes from untrusted network input.
No suspicious patterns detected.