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

LOW
Advisory Identifier: GHSA-fm6c-f59h-7mmg
CVSS 9.8
CWE-502
Published
Advisory Summary

CVE-2025-50460 is a LOW (CVSS 9.8) remote code execution vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Ms swift libraries in the PyPI ecosystem. The issue involves ms swift remote code execution via unsafe pyyaml deserialization. Remediation is available in the latest vendor maintenance releases.

CVE-2025-50460 at a Glance

CVE Identifier CVE-2025-50460
GHSA Identifier GHSA-fm6c-f59h-7mmg
Severity LOW
CVSS v3.1 Base Score 9.8
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Ms swift
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2025-50460

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: Latest secure release
pip install ms-swift>=Latest secure release
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-50460, 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 the patched release), 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-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. 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

## Description A Remote Code Execution (RCE) vulnerability exists in the [modelscope/ms-swift](https://github.com/modelscope/ms-swift) project due to unsafe use of `yaml.load()` in combination with vulnerable versions of the PyYAML library (≤ 5.3.1). The issue resides in the `tests/run.py` script, where a user-supplied YAML configuration file is deserialized using `yaml.load()` with `yaml.FullLoader`. If an attacker can control or replace the YAML configuration file provided to the `--run_config` argument, they may inject a malicious payload that results in arbitrary code execution. ## Affected Repository - **Project:** [modelscope/ms-swift](https://github.com/modelscope/ms-swift) - **Affect versions:** latest - **File:** `tests/run.py` - **GitHub Permalink:** https://github.com/modelscope/ms-swift/blob/e02ebfdf34f979bbdba9d935acc1689f8d227b38/tests/run.py#L420 - **Dependency:** PyYAML <= 5.3.1 ## Vulnerable Code ```python if args.run_config is not None and Path(args.run_config).exists(): with open(args.run_config, encoding='utf-8') as f: run_config = yaml.load(f, Loader=yaml.FullLoader) ``` ## Proof of Concept (PoC) ### Step 1: Create malicious YAML file (`exploit.yaml`) ```yaml !!python/object/new:type args: ["z", !!python/tuple [], {"extend": !!python/name:exec }] listitems: "__import__('os').system('mkdir HACKED')" ``` ### Step 2: Execute with vulnerable PyYAML (<= 5.3.1) ```python import yaml with open("exploit.yaml", "r") as f: cfg = yaml.load(f, Loader=yaml.FullLoader) ``` This results in execution of `os.system`, proving code execution. ## Mitigation * Replace `yaml.load()` with `yaml.safe_load()` * Upgrade PyYAML to version 5.4 or later ### Example Fix: ```python # Before yaml.load(f, Loader=yaml.FullLoader) # After yaml.safe_load(f) ``` ## Author * Discovered by: Yu Rong (戎誉) and Hao Fan (凡浩) * Contact: *\[[anchor.rongyu020221@gmail.com](mailto:anchor.rongyu020221@gmail.com)]*

CVE-2025-50460 Affected Ms swift Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
ms-swift
PyPI
≤ 3.6.3

References

Frequently Asked Questions

What is CVE-2025-50460?
CVE-2025-50460 is a security vulnerability in Ms swift involving MS SWIFT Remote Code Execution via unsafe PyYAML deserialization under CWE-502: Deserialization of Untrusted Data.
Which Ms swift versions are affected?
Affected versions include releases prior to current release patches across affected packages: ms-swift.
What version fixes CVE-2025-50460?
Upgrading to current release patches (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 Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2025-50460?
CVE-2025-50460 has a CVSS v3.1 base score of 9.8 (LOW) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2025-50460?
CVE-2025-50460 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check PyPI dependencies for CVE-2025-50460?
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-fm6c-f59h-7mmg",
  "modified" : "2025-08-01T18:35:43Z",
  "published" : "2025-07-31T14:02:34Z",
  "aliases" : [ "CVE-2025-50460" ],
  "summary" : "MS SWIFT Remote Code Execution via unsafe PyYAML deserialization",
  "details" : "## Description\n\nA Remote Code Execution (RCE) vulnerability exists in the [modelscope/ms-swift](https://github.com/modelscope/ms-swift) project due to unsafe use of `yaml.load()` in combination with vulnerable versions of the PyYAML library (≤ 5.3.1). The issue resides in the `tests/run.py` script, where a user-supplied YAML configuration file is deserialized using `yaml.load()` with `yaml.FullLoader`.\n\nIf an attacker can control or replace the YAML configuration file provided to the `--run_config` argument, they may inject a malicious payload that results in arbitrary code execution.\n\n## Affected Repository\n\n- **Project:** [modelscope/ms-swift](https://github.com/modelscope/ms-swift)\n- **Affect versions:** latest\n- **File:** `tests/run.py`\n- **GitHub Permalink:** https://github.com/modelscope/ms-swift/blob/e02ebfdf34f979bbdba9d935acc1689f8d227b38/tests/run.py#L420\n- **Dependency:** PyYAML <= 5.3.1\n\n## Vulnerable Code\n\n```python\nif args.run_config is not None and Path(args.run_config).exists():\n    with open(args.run_config, encoding='utf-8') as f:\n        run_config = yaml.load(f, Loader=yaml.FullLoader)\n```\n\n## Proof of Concept (PoC)\n\n### Step 1: Create malicious YAML file (`exploit.yaml`)\n\n```yaml\n!!python/object/new:type\nargs: [\"z\", !!python/tuple [], {\"extend\": !!python/name:exec }]\nlistitems: \"__import__('os').system('mkdir HACKED')\"\n```\n\n### Step 2: Execute with vulnerable PyYAML (<= 5.3.1)\n\n```python\nimport yaml\n\nwith open(\"exploit.yaml\", \"r\") as f:\n    cfg = yaml.load(f, Loader=yaml.FullLoader)\n```\n\nThis results in execution of `os.system`, proving code execution.\n\n## Mitigation\n\n* Replace `yaml.load()` with `yaml.safe_load()`\n* Upgrade PyYAML to version 5.4 or later\n\n### Example Fix:\n\n```python\n# Before\nyaml.load(f, Loader=yaml.FullLoader)\n\n# After\nyaml.safe_load(f)\n```\n\n\n## Author\n\n* Discovered by: Yu Rong (戎誉) and Hao Fan (凡浩)\n* Contact: *\\[[anchor.rongyu020221@gmail.com](mailto:anchor.rongyu020221@gmail.com)]*",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "ms-swift"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "3.6.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/modelscope/ms-swift/security/advisories/GHSA-fm6c-f59h-7mmg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-50460"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelscope/ms-swift/pull/5174"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelscope/ms-swift/commit/b3418ed9b050dc079553c275c5ed14cfb2b66cf7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Anchor0221/CVE-2025-50460"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-6757-jp84-gxfx"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/modelscope/ms-swift"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelscope/ms-swift/blob/main/tests/run.py#L420"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-07-31T14:02:34Z",
    "nvd_published_at" : "2025-08-01T16:15:41Z"
  }
}