subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
"""运行单个检查,返回(是否成功, 标准输出, 标准错误)""" print(f"\n🔍 开始检查: {check['name']}") try: result = subprocess.run( check["command"], shell=True, capture_output=True,- Confidence
- 94% confidence
- Finding
- The code executes shell commands via subprocess.run(..., shell=True), which is dangerous because shell parsing enables command injection if any part of the command list becomes attacker-controlled through later code changes, config files, environment manipulation, or path/module hijacking. In this skill, the commands invoke maintenance and security tooling with broad filesystem access, so compromise of the command string or execution context could lead to arbitrary code execution under the agent's privileges.
