T09 · Insecure Skill Coding Practices
- Location
scripts/generate_video.py:78- Finding
Server-Controlled Task ID Enables Path Traversal and Arbitrary File Overwrite
- Content
View full analysis
str: if not media_url: raise GoAIError("download URL is required") output_path = Path(output_name).expanduser() if not output_path.is_absolute(): output_path = (Path.cwd() / output_path).resolve() output_path.parent.mkdir(parents=True, exist_ok=True) try: response = self._http.get(media_url) except httpx.RequestError: raise GoAIError(f"download failed: {media_url}") from None if response.status_code not in {200, 201}: raise GoAIError(f"download failed: {media_url}") output_path.write_bytes(response.content) return str(output_path) ``` ### Technical Analysis The `task_id` value originates in the remote API response and is accepted after only checking that it is nonempty. It is then interpolated directly into the local output filename. An attacker-controlled value can contain path separators and parent-directory components. For example, a task identifier shaped like `x/../../../target` produces an output ...[truncated 2162 chars]- Remediation
View remediation
