subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
# Build the environment env_command = f"source {ros_setup_path} && env" try: env_proc = subprocess.run(['bash', '-c', env_command], stdout=subprocess.PIPE, text=True, check=True) ros_env = {} for line in env_proc.stdout.splitlines(): if '=' in line:- Confidence
- 94% confidence
- Finding
- The wrapper builds a shell command using a value loaded from config.json and executes it via `bash -c`. Because `ros_setup_path` is interpolated directly into `source {ros_setup_path} && env` without shell escaping, a malicious or tampered config value can inject arbitrary shell commands before the final ROS command even runs. In this skill context, that is especially dangerous because the script is presented as a "strict safety wrapper," so operators may trust it to safely mediate privileged ROS control actions.
