subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
if os.path.exists(zshrc): try: import subprocess result = subprocess.run( ["bash", "-c", f"source {zshrc} && echo $NVIDIA_API_KEY"], capture_output=True, text=True, timeout=5 )- Confidence
- 93% confidence
- Finding
- The code spawns `bash -c` to source `~/.zshrc`, which executes arbitrary shell code from a user-controlled startup file merely to recover an API key. This turns credential discovery into code execution and can trigger unintended commands, side effects, or abuse if the shell rc file is malicious or modified.
