subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
f.write(new_cron) # 安装 crontab result = subprocess.run(["crontab", temp_file], capture_output=True, text=True) if result.returncode == 0: print("✅ 定时任务安装成功!")- Confidence
- 86% confidence
- Finding
- The script writes cron contents to a predictable world-accessible path `/tmp/cron_temp.txt` and then passes that file to `crontab`. A local attacker on the same system could race or preposition a symlink/hardlink at that path to alter the installed cron contents or cause unintended file overwrite, leading to persistence or modification of scheduled tasks.
