subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
with open(tmp_js, 'w') as f: f.write(script) result = subprocess.run(["node", tmp_js], capture_output=True, text=True) # 清理临时文件 os.remove(tmp_html)- Confidence
- 90% confidence
- Finding
- The script generates a JavaScript file embedding unescaped file paths into string literals, then executes it with Node. If output_path or the temporary HTML path contains quotes or crafted characters, the generated JS can break out of the string and execute attacker-controlled code on the host.
