subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
notify_cmd = os.environ.get("NOTIFY_COMMAND") if not notify_cmd: raise ValueError("NOTIFY_COMMAND not set for command channel") proc = subprocess.run([notify_cmd, target, message], capture_output=True, text=True) if proc.returncode != 0: err = (proc.stderr or proc.stdout or "").strip() raise RuntimeError(f"command notify failed: {err}")- Confidence
- 96% confidence
- Finding
- The command channel executes whatever binary path is provided in the NOTIFY_COMMAND environment variable, passing attacker-controllable target and message data. Even without shell=True, this is still arbitrary program execution if an attacker can influence environment configuration, which is especially risky in automation or agent environments where secrets and exchange credentials may be present.
