subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
# 更新索引 try: import subprocess subprocess.run(["python3", str(MEMORY_DIR / "index.py")], capture_output=True) except: pass- Confidence
- 94% confidence
- Finding
- The code launches a Python subprocess on a script path derived from MEMORY_DIR, which itself is controlled by an environment variable. If an attacker can influence MEMORY_DIR or place a malicious index.py there, cleanup_expired() will execute attacker-controlled code. In an agent skill context, invoking external code during routine memory cleanup increases the attack surface beyond simple file management.
