T09 · Insecure Skill Coding Practices
- Location
scripts/send_gif.py:84- Finding
Redirect Allowlist Bypass and Unbounded Media Response Buffering
- Content
View full analysis
max_bytes: raise ValueError(f"media too large ({len(data)} bytes)") ext = infer_extension(url, content_type) if ext not in {".mp4", ".gif", ".webm"}: raise ValueError(f"unsupported content type: {content_type or 'unknown'}") ``` ### Technical Analysis The function validates only the hostname in the initial candidate URL. Python's `urllib.request.urlopen` follows HTTP redirects automatically, but the code does not validate `resp.geturl()` or otherwise confirm that the final response still belongs to an allowed host. Consequently, an approved media URL that redirects can cross the configured network trust boundary. This is relevant if an approved provider is compromised, returns an attacker-influenced redirect, or exposes an open-redirect behavior. The configured `maxBytes` limit also does not impose an actual download or memory limit. `resp.read()` buffers the entire response in process memory before `len(data)` is compared with `max_byte ...[truncated 1764 chars]- Remediation
View remediation
