T09 · Insecure Skill Coding Practices
- Location
scripts/download_transcribe.py:5- Finding
Unrestricted User-Controlled URL Retrieval
- Content
View full analysis
Vulnerability Details
File Location:
scripts/download_transcribe.py, lines 5-10
Vulnerability Type: Server-Side Request Forgery through unrestricted URL handling
Risk Level: MediumVulnerable code:
python parser = argparse.ArgumentParser() parser.add_argument('url') parser.add_argument('--out', default='reel-download') args = parser.parse_args() out = pathlib.Path(args.out); out.mkdir(parents=True, exist_ok=True) video_tpl = str(out / 'video.%(ext)s') subprocess.run(['yt-dlp', '-f', 'bv*+ba/best', '--merge-output-format', 'mp4', '-o', video_tpl, args.url], check=True)Technical Analysis
The positional
urlargument is accepted without validating its scheme, hostname, resolved IP address, redirect destination, or relationship to the social-video services described by the Skill. It is passed directly to the general-purposeyt-dlpdownloader.Using a subprocess argument array prevents shell metacharacters in the URL from becoming shell commands, but it does not prevent network-level abuse. An attacker can submit a URL targeting an internal service or an attacker-controlled endpoint that redirects to a private address. Whether a particular target can be downloaded depends on protocol support, server behavior, and
yt-dlpextraction behavior.Because downloaded data is subsequently passed to
ffmpeg, attacker-selected content also reaches a complex media parser. This expands the exposure beyond the intended TikTok, Instagram, X, and short-form-video use case.Attack Path
- An attacker provides a URL pointing to an internal HTTP service, loopback interface, cloud metadata endpoint, or an external server that redirects to such a destination.
- The Agent follows the documented workflow and invokes
download_transcribe.pywith that URL. - The script passes the unvalidated value to
yt-dlp. yt-dlpattempts to connect from the Agent host, potentially using network access u ...[truncated 870 chars]
- Remediation
View remediation
Remediation Suggestions
- Accept only
httpsURLs and reject URLs containing credentials or unsupported schemes. - Apply an explicit hostname allowlist for intended services, such as approved TikTok, Instagram, and X domains.
- Resolve the hostname before retrieval and reject loopback, private, link-local, multicast, unspecified, and reserved IPv4 and IPv6 ranges.
- Revalidate every redirect destination rather than validating only the original URL.
- Require explicit user confirmation before accessing a domain outside the intended provider list.
- Run the downloader and media parser in a sandbox with restricted outbound networking, filesystem access, CPU time, memory, and file-size limits.
- Keep
yt-dlpandffmpegpatched because attacker-controlled media is passed to both tools.
- Accept only
