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
- 95% confidence
- Finding
- The code builds a shell command with unquoted data from config.json and executes it via `bash -c`. If `ros_setup_path` contains shell metacharacters or command substitutions, an attacker who can modify the config file can achieve arbitrary command execution before the wrapper runs the intended ROS command. The skill context claims to be a strict safety wrapper, so using a shell here is especially risky because it undermines the sandboxing/read-only trust model.
