T09 · Insecure Skill Coding Practices
- Location
scripts/foley.py:20- Finding
Local File Disclosure Through curl Multipart Form Argument Injection
- Content
View full analysis
str: """Submit text-to-audio task. Returns task_id.""" import subprocess cmd = [ "curl", "-s", "-X", "POST", f"{API_BASE}/api/v1/v2a/submit", "-F", f"model={model}", "-F", f"prompt={prompt}", "-F", f"duration={duration}", "-F", f"cfg_strength={cfg_strength}", "-F", f"count={count}", ] if negative_prompt: cmd += ["-F", f"negative_prompt={negative_prompt}"] if seed is not None: cmd += ["-F", f"seed={seed}"] ``` The same unsafe pattern is present in the video submission function: ```python cmd = [ "curl", "-s", "-X", "POST", f"{API_BASE}/api/v1/v2a/submit", "-F", f"model={model}", "-F", f"file=@{video_path}", "-F", f"cfg_strength={cfg_strength}", "-F", f"count={count}", ] if prompt: cmd += ["-F", f"prompt={prompt}"] if negative_prompt: cmd += ["-F", f"negative_prompt={negative_prompt}"] if reference_audio and os.path.isfile(reference_audio): cmd += ["-F", f"reference_audio=@{reference_audio}"] ``` ### Technical Analysis Although `subprocess.run` receives an argument list and therefore does not invoke a shell, the values are still interpreted by curl's multipart form parser. The `-F`/`--form` option gives values beginning with `@` or `<` special local-file semantics. Consequently, an attacker-controlled textual field such as `prompt`, `negative_prompt`, or `model` can cause curl to read a local file rather than transmit the value as literal text. For example, a prompt value of `@/home/use ...[truncated 1293 chars]- Remediation
View remediation
