T09 · Insecure Skill Coding Practices
- Location
backend/main.py:276- Finding
Server-Side Request Forgery Through Unrestricted Video URLs
- Content
View full analysis
str: """Resolve a short URL to its destination.""" import requests try: resp = requests.get( url, allow_redirects=True, timeout=10, headers={"User-Agent": "Mozilla/5.0"}, ) return resp.url except Exception: return url ``` ```python process = await asyncio.create_subprocess_exec( *cmd + [url], stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, ) ``` ### Technical Analysis The API validates only that the submitted string begins with `http://` or `https://`. It does not restrict destination hostnames to the supported video platforms, resolve and reject non-public IP addresses, or validate redirect destinations. The URL is subsequently passed to `yt-dlp`. In the Douyin fallback path, it may also be requested directly with `requests.get()` while redirects are enabled. Consequently, an unauthenticated caller can cause the server to initiate HTTP requests to attacker-selected destinations from the server's network context. The following destination classes are not blocked: - Loopback addresses such as `127.0.0.1` and `::1` - Private network ranges - Link-local addres ...[truncated 1301 chars]- Remediation
View remediation
