Arbitrary File Deletion via Path Traversal in image-edit.php
The image-edit.php script uses the unsanitised 'image_temp' parameter in a file deletion call, allowing path traversal. An authenticated attacker can delete arbitrary files, such as mainfile.php, causing denial of service.
- Triaged in 10 days
- Fixed in 13 months
- Disclosed after 14 months
Summary:
The vulnerability is located in the /libraries/image-editor/image-edit.php script:
161. if (@copy ( ICMS_IMANAGER_FOLDER_PATH . '/temp/' . $simage_temp, $categ_path . $simage->getVar ( 'image_name' ) )) {
162. if (@unlink ( ICMS_IMANAGER_FOLDER_PATH . '/temp/' . $simage_temp )) {
163. $msg = _MD_AM_DBUPDATED;
[...]
190. } else {
191. if (copy ( ICMS_IMANAGER_FOLDER_PATH . '/temp/' . $simage_temp, $categ_path . $imgname )) {
192. @unlink ( ICMS_IMANAGER_FOLDER_PATH . '/temp/' . $simage_temp );
193. }
User input passed through the "image_temp" parameter is not properly sanitized before being used in a call to the unlink() function at lines 162 and 192. This can be exploited to carry out Path Traversal attacks and delete arbitrary files in the context of the web server process.
NOTE: before being deleted, the file will be copied into the /uploads/imagemanager/logos/ directory. As such, by firstly deleting the index.html file in that directory, it might be possible to disclose the content of arbitrary files in case the web server allows for directory listing.
ImpressCMS branch :
The vulnerability has been tested and confirmed on ImpressCMS version 1.4.2 (the latest at the time of writing).
Steps To Reproduce:
- Login into the application as any user (this should work both for Webmasters and Registered Users)
- Go to:
http://[impresscms]/libraries/image-editor/image-edit.php?op=save&image_id=1&image_temp=../../../mainfile.php - The
mainfile.phpscript will be deleted, rendering the website unusable
Impact
This vulnerability might allow authenticated attackers to delete arbitrary files, potentially leading to a Denial of Service (DoS) condition or destruction of users data.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
Authenticated attackers could delete arbitrary files, potentially causing denial of service or destruction of user data.
What the attacker needed
Authenticated user account
How it was found
- Log in to the application as any user.
- Navigate to the image-edit.php URL with a crafted image_temp parameter containing path traversal sequences.
- The targeted file (e.g., mainfile.php) is deleted, rendering the website unusable.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
The website takes a filename from the user and deletes that file without checking it. By using '..' sequences, an attacker can point to files outside the intended folder and delete important system files, breaking the site.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.