T09 · Insecure Skill Coding Practices
- Location
check_file.py:32- Finding
Unescaped User-Controlled Values in Generated Message-Tool Command
- Content
View full analysis
[optional_message]") sys.exit(1) file_path = sys.argv[1] message = sys.argv[2] if len(sys.argv) > 2 else "" info, error = check_file(file_path) if error: print(f"❌ Error: {error}") sys.exit(1) print(f"✅ File OK: {info['name']}") print(f" Size: {info['size_mb']:.2f} MB") print(f" Path: {info['path']}") print() print("Send command:") print(format_send_command(info, message)) ``` ### Technical Analysis The script incorporates the resolved file path and optional command-line message directly into a command-like string: ```python cmd = f'message action=send filePath="{file_info["path"]}"' cmd += f' message="{message}"' ``` Neither value is escaped or encoded before interpolation. An attacker-controlled message—or a path containing quotation marks, line breaks, or syntax meaningful to the consuming Agent/tool parser—can terminate the intended quoted field and introduce additional arguments or commands. The Python script prints the resulting string rather than executing it directly. Exploitation therefore depends on a user, Agent, or automation component subsequently interpreting the generated text as a trusted tool command. This usage is consistent with the helper's documented purpose, so the output may reasonably reach such a consumer. No evidence establishes direct operating-system command execution. The confirmed risk is man ...[truncated 1730 chars]- Remediation
View remediation
