Tainted flow: 'run_args' from os.environ.get (line 117, credential/environment) → subprocess.run (code execution)
Medium
- Category
- Data Flow
- Content
if os.name == "nt" and args and args[0].lower().endswith((".cmd", ".bat")): run_args = [os.environ.get("COMSPEC", "cmd.exe"), "/c", *args] result = subprocess.run( run_args, capture_output=True, text=True,- Confidence
- 80% confidence
- Finding
- On Windows, the code trusts COMSPEC from the environment and executes it as the command processor when the resolved executable ends with .cmd or .bat. If an attacker can influence the environment of this process, they can replace COMSPEC with an arbitrary executable and gain code execution in the context of the skill.
