subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def run_ontology_cmd(cmd): """Run ontology command and return parsed JSON""" full_cmd = f"python3 {ONTOLOGY_SCRIPT} {cmd}" result = subprocess.run(full_cmd, shell=True, capture_output=True, text=True) if result.returncode != 0: print(f"Ontology command failed: {full_cmd}\n{result.stderr}", file=sys.stderr) return None- Confidence
- 99% confidence
- Finding
- The code builds a shell command from a caller-controlled string and executes it with shell=True. Because create/query/update arguments ultimately embed untrusted fields such as title, url, path, and channel into cmd, an attacker can inject shell metacharacters and execute arbitrary commands in the context of the skill.
