subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
OPEN_LOOPS = NOTES_DIR / "open-loops.md" def run(cmd): res = subprocess.run(cmd, shell=True, capture_output=True, text=True) return res.returncode, res.stdout, res.stderr def ensure_dirs():- Confidence
- 98% confidence
- Finding
- The helper uses subprocess.run with shell=True on a free-form command string, which is a classic command-injection sink. In this file, that sink is later fed a git commit command containing user-controlled commit_message data, so an attacker can inject additional shell metacharacters and execute arbitrary commands in the workspace context.
