T09 · Insecure Skill Coding Practices
- Location
scripts/send_feishu.py:41- Finding
Unrestricted Remote URL Fetching Enables SSRF and Resource Exhaustion
- Content
View full analysis
bytes: """From CDN URL download file""" resp = requests.get(url, timeout=60) resp.raise_for_status() return resp.content ``` The function is invoked for caller-controlled HTTP and HTTPS sources: ```python if source.startswith("http://") or source.startswith("https://"): content = download_file(source) else: content = _read_local_file(source) ``` The equivalent video path is: ```python if source.startswith("http://") or source.startswith("https://"): content = download_file(source) else: content = _read_local_file(source) ``` From `scripts/generate_image.py`, a URL returned by the remote generation service is downloaded without destination or size validation: ```python if "data" in data and len(data["data"]) > 0: cdn_url = data["data"][0]["url"] result["url"] = cdn_url if download: # Automatically download locally try: local_path = download_image(cdn_url) result["local_path"] = local_path except Exception as e: result["download_error"] = str(e) ``` ```python def download_image(url: str) -> str: """Download image to local /tmp/ directory""" resp = requests.get(url, timeout=60, headers={ "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36" }) resp.raise_for_status() ``` From `scripts/generate_video.py`, remote content is streamed to disk without a maximum byte count: ```python def download_video(url: str) -> str: """Download ...[truncated 3901 chars]- Remediation
View remediation
