subprocess module call
- Category
- Dangerous Code Execution
- Confidence
- 89% confidence
- Finding
This subprocess invocation executes an external binary chosen via PATH fallback ('libreoffice') and conditionally enables shell=True on Windows. While the argument list limits classic command injection, PATH hijacking or shell parsing on misconfigured systems could cause execution of an unintended executable, which is risky in a document-processing skill that handles attacker-supplied files.
- Content
python use_shell = platform.system() == 'Windows' and ' ' in libreoffice_cmd # 使用 libreoffice 转换 result = subprocess.run( [ libreoffice_cmd, '--headless', '--convert-to', 'docx', '--outdir', str(tmpdir), str(file_path)
