subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
if not cmd: return False try: rc = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=10) return rc.returncode == 0 except Exception: return False- Confidence
- 97% confidence
- Finding
- The code executes a string command with `subprocess.run(..., shell=True)` in `run_cmd`, and the command value comes from CLI arguments or environment variables (`--wake-cmd`, `--blank-cmd`, `PET_WAKE_CMD`, `PET_BLANK_CMD`). Any attacker who can influence those values can execute arbitrary shell commands with the daemon's privileges, making this a real command-injection surface rather than a harmless helper.
