subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def run(cmd: str, check: bool = True) -> None: """Run shell command""" print(f"→ {cmd}") result = subprocess.run(cmd, shell=True, check=check) if result.returncode != 0: sys.exit(result.returncode)- Confidence
- 98% confidence
- Finding
- The helper executes arbitrary shell strings with shell=True, which makes any caller-provided value part of a shell command line. In this file, user-controlled arguments such as version are interpolated into commands later, so an attacker can inject additional shell metacharacters and execute arbitrary commands on the local system.
