subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
run_dir = output_root / case_id if run_dir.exists(): subprocess.run(["rm", "-rf", str(run_dir)], check=True) cmd = [ python_bin,- Confidence
- 91% confidence
- Finding
- The script performs recursive deletion via `rm -rf` on a path derived from user-controllable case data (`case_id` from JSON) and caller-controlled `output_root`. Although `sanitize_case_id` reduces obvious metacharacter abuse, it does not prevent dangerous path constructions when combined with arbitrary `output_root`, and using an external destructive command magnifies the blast radius if the target path is miscomputed or attacker-chosen.
