gz-yami / mall4j

⭐️⭐️⭐️ 电商商城 小程序电商商城系统 PC商城 H5商城 APP商城 Java商城 O2O商城 跨境商城
https://www.mall4j.com
GNU Affero General Public License v3.0
4.79k stars 1.29k forks source link

Lack of Backend Validation for Uploaded Image Size and Type #22

Open Xiqinger opened 7 months ago

Xiqinger commented 7 months ago

Lack proper validation for uploaded image files in the backend. While there is validation in the frontend component "index.vue," it is crucial to perform server-side validation as well. This vulnerability allows attackers to upload files of any type and size, potentially leading to XSS attacks or resource exhaustion, which can result in DDoS attacks.

Two interfaces are affected:

It is recommended to implement server-side validation for uploaded image files in String com.yami.shop.service.impl.AttachFileServiceImpl.uploadFile(MultipartFile file) . This includes checking the file size and verifying that the file type is allowed (e.g., image/jpeg, image/png). By implementing these validations in the backend, you can prevent the upload of malicious files, mitigate the risk of XSS attacks, and prevent resource consumption that could lead to DDoS attacks. image