subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
subprocess.run(["systemctl", "--user", "stop", svc], capture_output=True) # 解压还原 result = subprocess.run( ["tar", "-xzf", str(backup_file), "-C", str(OPENCLAW_DIR.parent)], capture_output=True, text=True )- Confidence
- 88% confidence
- Finding
- Restoring by extracting a tar archive into the application parent directory is dangerous because archive contents are not validated before extraction. A malicious or tampered backup can overwrite arbitrary files within the extraction scope, introduce symlinks, or restore unsafe content, turning rollback into a code or configuration replacement mechanism.
