
Summary A critical remote OS command injection vulnerability has been identified in the Llama Factory training process. This vulnerability arises from improper handling of user input, allowing malicious actors to execute arbitrary OS commands on the host system. The issue is caused by insecure usage of the Popen function with shell=True, coupled with unsanitized user input. Immediate remediation is required to mitigate the risk. Affected Version Llama Factory versions <=0.9.0 are affected by this vulnerability. Impact Exploitation of this vulnerability allows attackers to: Execute arbitrary OS commands on the server. Potentially compromise sensitive data or escalate privileges. Deploy malware or create persistent backdoors in the system. This significantly increases the risk of data breaches and operational disruption. Root Cause The vulnerability originates from the training process where the output_dir value, obtained from the user input, is injected into the popen function without any sanitization. Furthermore, popen is invoked in a unsafe way by enabling the interact shell (shell=True), leading to remote OS command injection vulnerability. Vulnerable snippet: “`python https://github.com/hiyouga/LLaMA-Factory/blob/bd639a137e6f46e1a0005cc91572f5f1ec894f74/src/llamafactory/webui/runner.py#L304-L323 def _launch(self, data: Dict["Component", Any], do_train: bool) -> Generator[Dict["Component", Any], None, None]: … args =…Read More
