Yoga Class Registration System 1.0 - RCE
9,1
Critical
Discovered by

Offensive Team, Fluid Attacks
Summary
Full name
Yoga Class Registration System 1.0 - RCE
Code name
State
Public
Release date
23 jun 2023
Affected product
Yoga Class Registration System
Affected version(s)
Version 1.0
Vulnerability name
Remote command execution
Vulnerability type
Remotely exploitable
Yes
CVSS v3.1 vector string
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H
CVSS v3.1 base score
9.1
Exploit available
Yes
CVE ID(s)
Description
Yoga Class Registration System version 1.0 allows an administrator to execute commands on the server. This is possible because the application does not correctly validate the thumbnails of the classes uploaded by the administrators.
Vulnerability
The application allows administrators to upload classes to the platform. Among all the possible fields that we have at the moment of creating the class, there is a very interesting one called "thumbnail"
. In this field, we can upload an image that will be shown as the cover of the class.
The vulnerability lies in the way the server processes the uploaded image in the class. uploaded in the class. The following is a fragment of the code that is in charge of processing the image:
In the above fragment we see that the image name is used to construct the final path where the image will be stored. the final path where the image will be stored.
This means that we can define the extension that the file will have, as well as the path where it will be stored on the server. This looks very well, however we have certain restrictions on the content of the file. It happens that the server performs the following operations on the image uploaded by the user. uploaded by the user.
The imagecreatefromjpeg
and imagecreatefrompng
functions create new images (compressed to level 9 with the zlib library) from the image uploaded by the user. This process removes the image comments and most of the image fragments except for one called PLTE
.
On the other hand the imagescale
function resizes the image if necessary. This function removes the PLTE
fragment. However, if we send an image that does not need to be resized, the image will retain the PLTE
fragment. To achieve this we only need to upload an image whose width is less than or equal to 640 and whose height is less than or equal to 480.
Exploitation
To exploit the above vulnerability we need to be administrators. For that we just need to exploit the CVE-2023-1722. Once we manage to be admin, we must build a malicious image that survives the transformations and resizing performed by the server. To achieve this I have written the following exploit:
Exploit.php
Now we just have to run the exploit:
Our security policy
We have reserved the ID CVE-2023-1721 to refer to this issue from now on. Disclosure policy
System Information
Version: Yoga Class Registration System 1.0
Operating System: GNU/Linux
Mitigation
There is currently no patch available for this vulnerability.
References
Timeline
IA generativa
30 mar 2023
Vendor contacted
30 mar 2023
Vendor replied
30 mar 2023
Public disclosure
23 jun 2023