subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
"""执行 mcporter 命令""" args_json = json.dumps(args_dict, ensure_ascii=False) cmd = f'{MCPORTER_PATH} call wecom-doc.{command} --args \'{args_json}\' --output json' result = subprocess.run(cmd, shell=True, capture_output=True, text=True) if result.returncode != 0: print(f"Error running mcporter: {result.stderr}")- Confidence
- 98% confidence
- Finding
- The code builds a shell command string using dynamic values (`command` and JSON-serialized `args_dict`) and executes it with `subprocess.run(..., shell=True)`. Because task fields such as names, descriptions, remarks, and URLs can contain quotes or shell metacharacters, an attacker can break out of the quoted `--args` value and achieve command injection, causing arbitrary local command execution under the skill's privileges.
