subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
"""从 ~/.zshrc 加载环境变量,返回更新后的 env dict""" env = os.environ.copy() try: result = subprocess.run( ["bash", "-l", "-c", "env"], capture_output=True, text=True, timeout=10 )- Confidence
- 96% confidence
- Finding
- The code spawns a login shell (`bash -l -c env`) specifically to harvest shell-initialized environment variables. In this context, that is dangerous because shell startup files may execute arbitrary commands and expose unrelated secrets, turning a literature collection task into implicit command execution and credential harvesting.
