MS SWIFT WEB-UI RCE Vulnerability
链接: https://github.com/advisories/GHSA-7c78-rm87-5673
仓库 Star: 9003
参考链接:
https://github.com/modelscope/ms-swift/security/advisories/GHSA-7c78-rm87-5673
https://github.com/modelscope/ms-swift/commit/32f09e9b0a44f19d44210e2b5b47c58ab01740e1
描述:
I. Detailed Description:
Install ms-swift
1
pip install ms-swift -U
Start web-ui
1
swift web-ui --lang en
After startup, access through browser at http://localhost:7860/ to see the launched fine-tuning framework program
Fill in necessary parameters
In the LLM Training interface, fill in required parameters including Model id, Dataset Code. The –output_dir can be filled arbitrarily as it will be modified later through packet captureClick Begin to start training. Capture packets and modify the parameter corresponding to –output_dir
You can see the concatenated command being executed in the terminal where web-ui was started
Wait for the program to run (testing shows it requires at least 5 minutes), and you can observe the effect of command execution creating files
II. Vulnerability Proof:
1 |
|
III. Fix Solution:
- The swift.ui.llm_train.llm_train.LLMTrain#train() method should not directly concatenate parameters with commands after receiving commands from the frontend
- The swift.ui.llm_train.llm_train.LLMTrain#train_local() method should not use os.system for execution, but should be changed to subprocess.run([cmd, arg1, arg2…]) format
Author
- Discovered by: TencentAISec
- Contact: security@tencent.com