CVE-2023-40183 (published 2023-09-21T15:15Z)

DataEase is an open source data visualization and analysis tool. Prior to version 1.18.11, DataEase has a vulnerability that allows an attacker to to obtain user cookies. The program only uses the `ImageIO.read()` method to determine whether the file is an image file or not. There is no whitelisting restriction on file suffixes. This allows the attacker to synthesize the attack code into an image for uploading and change the file extension to html. The attacker may steal user cookies by accessing links. The vulnerability has been fixed in v1.18.11. There are no known workarounds.

CVSS v3 base score: 5.3, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N)

Weakness information:
cwe_id: CWE-434
cwe_name: Unrestricted Upload of File with Dangerous Type
description: The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.
extended_description: 
            
            
            
            
            
         
         

Fix information:
repo_url: https://github.com/dataease/dataease
commit_details: repo_url: https://github.com/dataease/dataease
author: wangjiahao
author_date: 2023-09-13 18:20:55+08:00
msg: fix: 加强图片校验，防止恶意代码通过合成到图片上传到服务器中引起的攻击行为
repository: repo_url: https://github.com/dataease/dataease
repo_name: dataease/dataease
description: 🔥 人人可用的开源数据可视化分析工具，帆软、Tableau 等商业 BI 工具的开源替代。
repo_language: Java
owner: dataease
file_changes: filename: StaticResourceService.java
change_type: ModificationType.MODIFY
diff: @@ -24,6 +24,8 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Author: wangjiahao
@@ -65,9 +67,12 @@ public class StaticResourceService {
             LogUtil.error(e.getMessage(), e);
             return false;
         }
-        if (image == null || image.getWidth() <= 0 || image.getHeight() <= 0) {
+        Pattern pattern = Pattern.compile("\\.(png|jpg|jpeg|gif)$");
+        Matcher matcher = pattern.matcher(file.getOriginalFilename().toLowerCase());
+        if (image == null || image.getWidth() <= 0 || image.getHeight() <= 0 || !matcher.find()) {
             return false;
         }
+
         return true;
     }
 

programming_language: Java
filename: BackgroundOverall.vue
change_type: ModificationType.MODIFY
diff: @@ -110,7 +110,7 @@
           <el-col style="width: 130px!important;">
             <el-upload
               action=""
-              accept=".jpeg,.jpg,.png,.gif,.svg"
+              accept=".jpeg,.jpg,.png,.gif"
               class="avatar-uploader"
               list-type="picture-card"
               :class="{disabled:uploadDisabled}"

programming_language: HTML
filename: AppTemplateContent.vue
change_type: ModificationType.MODIFY
diff: @@ -86,7 +86,7 @@
           <el-col style="width: 148px!important;height: 148px!important;overflow: hidden">
             <el-upload
               action=""
-              accept=".jpeg,.jpg,.png,.gif,.svg"
+              accept=".jpeg,.jpg,.png,.gif"
               class="avatar-uploader"
               list-type="picture-card"
               :class="{disabled:uploadDisabled}"

programming_language: CoffeeScript