subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def run_cmd(cmd): """Run command and return output""" try: result = subprocess.run(cmd, shell=True, capture_output=True, text=True, check=True) return result.stdout.strip() except subprocess.CalledProcessError as e: return f"Error: {e.stderr.strip()}"- Confidence
- 98% confidence
- Finding
- The code executes shell commands with shell=True, which is dangerous because several callers build the command string using untrusted argv-derived model_id values. An attacker who can influence model_id can inject additional shell syntax and execute arbitrary commands with the privileges of the skill process.
