CVE-2025-41419 — ms-swift
Fix: modelscope/ms-swift@32f09e9CVE-2025-41419 is a security vulnerability in ms-swift. A fix is available for ms-swift — see the affected versions and patch details below.
MS SWIFT WEB-UI RCE Vulnerability
Real-World Exposure
ms-swiftReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
I. Detailed Description:
This includes scenarios, screenshots, vulnerability reproduction methods. For account-related vulnerabilities, please provide test accounts. If the reproduction process is complex, you may record a video, upload it to Taopan, and attach the link.
-
Install ms-swift
pip install ms-swift -U -
Start web-ui
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 capture
-
Click 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 (Write POC here):
/tmp/xxx'; touch /tmp/inject_success_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: [email protected]
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | ms-swift | all versions | 3.7.0pip install --upgrade 'ms-swift==3.7.0' |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for ms-swift, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update ms-swift to 3.7.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2025-41419 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2025-41419 can be triaged on real exposure rather than presence alone.
Tailored to CVE-2025-41419. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is CVE-2025-41419 in your dependencies?
O3 Security finds CVE-2025-41419 across PyPI dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.