CVE-2025-41419: Ms swift Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-7c78-rm87-5673
CWE-117
Published
Advisory Summary

CVE-2025-41419 is a MODERATE remote code execution vulnerability (CWE-117: Improper Output Neutralization for Logs) affecting Ms swift libraries in the PyPI ecosystem. The issue involves ms swift web-ui rce vulnerability. Remediation is available by upgrading affected packages to version 3.7.0.

CVE-2025-41419 at a Glance

CVE Identifier CVE-2025-41419
GHSA Identifier GHSA-7c78-rm87-5673
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-117: Improper Output Neutralization for Logs
Affected Product Ms swift
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2025-41419

To remediate this vulnerability, upgrade all affected Ms swift dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

ms-swift fixed: 3.7.0
pip install ms-swift>=3.7.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show ms-swift

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2025-41419, inspect your installed packages using pip:

pip show ms-swift

Analyze the terminal output to locate any version of Ms swift in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.7.0), your application is affected.

Note: The pip show ms-swift command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-117: Improper Output Neutralization for Logs, where the product constructs a log message from external input, but it does not neutralize or incorrectly neutralizes special elements when the message is written to a log file. In Ms swift, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

**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. 1. Install ms-swift ``` pip install ms-swift -U ``` 2. Start web-ui ``` swift web-ui --lang en ``` 3. After startup, access through browser at [http://localhost:7860/](http://localhost:7860/) to see the launched fine-tuning framework program 4. 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 5. 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 6. 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:** 1. The swift.ui.llm_train.llm_train.LLMTrain#train() method should not directly concatenate parameters with commands after receiving commands from the frontend 2. 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](https://github.com/TencentAISec) * Contact: *[security@tencent.com](mailto:security@tencent.com)*

CVE-2025-41419 Affected Ms swift Versions

1 component(s)
Fixed Versions:
3.7.0
Product / Package Ecosystem Affected Versions Fixed Version
ms-swift
PyPI
< 3.7.0
3.7.0

References

Frequently Asked Questions

What is CVE-2025-41419?
CVE-2025-41419 is a security vulnerability in Ms swift involving MS SWIFT WEB-UI RCE Vulnerability under CWE-117: Improper Output Neutralization for Logs.
Which Ms swift versions are affected?
Affected versions include releases prior to 3.7.0 across affected packages: ms-swift.
What version fixes CVE-2025-41419?
Upgrading to 3.7.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ms-swift affected?
Yes, ms-swift is affected in releases prior to 3.7.0. Upgrade your dependency to 3.7.0 or later.
What CWE is associated with CVE-2025-41419?
CVE-2025-41419 is classified under CWE-117: Improper Output Neutralization for Logs (The product constructs a log message from external input, but it does not neutralize or incorrectly neutralizes special elements when the message is written to a log file.).
How can I check PyPI dependencies for CVE-2025-41419?
Run the dependency tree command: 'pip show ms-swift'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7c78-rm87-5673",
  "modified" : "2025-10-23T17:42:54Z",
  "published" : "2025-07-31T14:04:24Z",
  "aliases" : [ "CVE-2025-41419" ],
  "summary" : "MS SWIFT WEB-UI RCE Vulnerability",
  "details" : "**I. Detailed Description:** \n\nThis 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.\n\n1. Install ms-swift\n   ```\n   pip install ms-swift -U\n   ```\n\n2. Start web-ui\n   ```\n   swift web-ui --lang en\n   ```\n\n3. After startup, access through browser at [http://localhost:7860/](http://localhost:7860/) to see the launched fine-tuning framework program\n\n4. Fill in necessary parameters\n   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\n\n5. Click Begin to start training. Capture packets and modify the parameter corresponding to --output_dir\n\n   You can see the concatenated command being executed in the terminal where web-ui was started\n\n6. 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\n\n**II. Vulnerability Proof (Write POC here):**\n```\n/tmp/xxx'; touch /tmp/inject_success_1; #\n```\n\n**III. Fix Solution:**\n1. The swift.ui.llm_train.llm_train.LLMTrain#train() method should not directly concatenate parameters with commands after receiving commands from the frontend\n2. 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\n\n## Author\n\n* Discovered by: [TencentAISec](https://github.com/TencentAISec)\n* Contact: *[security@tencent.com](mailto:security@tencent.com)*",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N/E:P"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "ms-swift"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.7.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/modelscope/ms-swift/security/advisories/GHSA-7c78-rm87-5673"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelscope/ms-swift/commit/32f09e9b0a44f19d44210e2b5b47c58ab01740e1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/modelscope/ms-swift"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-117" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-07-31T14:04:24Z",
    "nvd_published_at" : null
  }
}