Listen to this Post
How the CVE Works
The vulnerability occurs in `modelscope/ms-swift` due to unsafe deserialization of YAML files using `yaml.load()` with yaml.FullLoader. An attacker can craft a malicious YAML file containing Python object constructions, which, when parsed, execute arbitrary code. The `tests/run.py` script loads user-supplied YAML via --run_config, allowing RCE if an attacker controls the input file. The exploit leverages PyYAML (≤ 5.3.1) deserialization flaws, where specially crafted YAML triggers dangerous Python operations like `exec` or os.system.
DailyCVE Form
Platform: modelscope/ms-swift
Version: pre-5.4 PyYAML
Vulnerability: RCE via YAML
Severity: Critical
Date: 2021-08-10
Prediction: Patch expected 2021-09-15
What Undercode Say
Check PyYAML version
pip show pyyaml
Exploit test (malicious YAML)
echo '!!python/object/new:type\nargs: ["z", !!python/tuple [], {"extend": !!python/name:exec }]\nlistitems: "<strong>import</strong>(\'os\').system(\'touch HACKED\')"' > exploit.yaml
python3 tests/run.py --run_config exploit.yaml
How Exploit
1. Attacker crafts malicious YAML with `!!python/object` directives.
2. Victim loads YAML via `yaml.load()` in `tests/run.py`.
3. Payload executes arbitrary OS commands.
Protection from this CVE
- Replace `yaml.load()` with
yaml.safe_load(). - Upgrade PyYAML to ≥ 5.4.
Impact
- Full system compromise via arbitrary command execution.
- Risk: Unauthorized access, data theft, or malware deployment.
🎯Let’s Practice Exploiting & Learn Patching For Free:
Sources:
Reported By: github.com
Extra Source Hub:
Undercode

