T09 · Insecure Skill Coding Practices
- Location
scripts/call_video_api.py:101- Finding
Unrestricted Local File Upload Through Storyboard Reference Paths
- Content
View full analysis
str: suffix = Path(image_path).suffix.lower().lstrip(".") mime = {"png": "image/png", "jpg": "image/jpeg", "jpeg": "image/jpeg", "webp": "image/webp"}.get(suffix, "image/png") with open(image_path, "rb") as f: b64 = base64.b64encode(f.read()).decode() return f"data:{mime};base64,{b64}" ``` ```python image_url = image_to_data_uri(image_path) print(f" → 提交任务(时长 {actual_duration}s,模型 {ARK_VIDEO_MODEL})...") try: task = client.content_generation.tasks.create( model=ARK_VIDEO_MODEL, content=[ {"type": "text", "text": text_with_flags}, {"type": "image_url", "image_url": {"url": image_url}}, ], ) ``` ```python ref_img = shot.get("reference_image") print(f"\n━━━ [{shot_id}] ({duration}s) ━━━") # 1. 优先用 storyboard.json 里记录的路径 if ref_img and Path(ref_img).exists(): print(f" 🖼 参考图: {ref_img}") ``` ### Technical Analysis The Base64 operation is necessary for the documented image-to-video API workflow and is not, by itself, evidence of a covert exfiltration channel. However, the source file selected for encoding is not sufficiently constrained. The `reference_image` field is read from an externally supplied storyboard JSON file. The script only verifies that the referenced path exists. It does not: - Restrict the path to an approved storyboard frames directory. - Reject absolute paths or traversal paths. - Resolve and validate symlinks. - Verify image file signatures. - Enforce a maximum input size. - Ask the user to confirm the exact file before transmitting it. The fallback MIME type is `image/png`, so a file wi ...[truncated 1352 chars]- Remediation
View remediation
