subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
msg_file = '/tmp/pubmed_intent_notify.msg' with open(msg_file, 'w') as f: f.write(message) subprocess.run([NOTIFY_SCRIPT, '-t', '文献综述', '-m', message], shell=False) os.remove(msg_file)- Confidence
- 93% confidence
- Finding
- The code executes an external program whose path is partially controlled by the NOTIFY_PATH environment variable. Even with shell=False, an attacker who can influence the runtime environment can redirect execution to an arbitrary binary or script, resulting in unintended code execution in the context of this service.
