Tainted flow: 'mmdc' from os.getenv (line 17, credential/environment) → subprocess.run (code execution)
Medium
- Category
- Data Flow
- Content
# Try mmdc (Mermaid CLI) first — most reliable mmdc = os.getenv("MMDC_PATH", "mmdc") try: subprocess.run( [mmdc, "-i", mmd_path, "-o", output_path, "-b", format], check=True, capture_output=True )- Confidence
- 91% confidence
- Finding
- The executable path is taken from the MMDC_PATH environment variable and passed directly to subprocess.run. In agent or automation environments where attackers can influence environment variables, this can cause execution of an arbitrary program instead of the intended Mermaid CLI, resulting in code execution under the agent's privileges.
