newbee-ltd / newbee-mall

🔥 🎉newbee-mall是一套电商系统,包括基础版本(Spring Boot+Thymeleaf)、前后端分离版本(Spring Boot+Vue 3+Element-Plus+Vue-Router 4+Pinia+Vant 4) 、秒杀版本、Go语言版本、微服务版本(Spring Cloud Alibaba+Nacos+Sentinel+Seata+Spring Cloud Gateway+OpenFeign+ELK)。 前台商城系统包含首页门户、商品分类、新品上线、首页轮播、商品推荐、商品搜索、商品展示、购物车、订单结算、订单流程、个人订单管理、会员中心、帮助中心等模块。 后台管理系统包含数据面板、轮播图管理、商品管理、订单管理、会员管理、分类管理、设置等模块。
https://item.jd.com/12890115.html
GNU General Public License v3.0
11.1k stars 2.71k forks source link

Replace MD5 Usage to Improve Security #93

Closed MarkLee131 closed 2 weeks ago

MarkLee131 commented 2 weeks ago

Really appreciate your dedication and hard work in developing and maintaining this project!@ZHENFENG13

However, the current framework uses MD5 for password hashing and session token generation, which poses significant security risks.

Some of my observed affected areas:

  1. MD5Util.java: MD5 is used as a general-purpose hashing utility (similar to SystemUtil.java). https://github.com/newbee-ltd/newbee-mall/blob/613a662adf1da7623ec34459bc83e3c1b12d8ce7/src/main/java/ltd/newbee/mall/util/MD5Util.java#L34

  2. tb_newbee_mall_user table: The password_md5 column stores MD5-hashed passwords.

https://github.com/newbee-ltd/newbee-mall/blob/613a662adf1da7623ec34459bc83e3c1b12d8ce7/src/main/resources/newbee_mall_schema.sql#L1005

  1. PersonalController.java: MD5 is used to hash passwords during login.

  2. MallUser.java: The passwordMd5 field stores user passwords as MD5 hashes.

  3. AdminUserServiceImpl.java: Admin passwords are hashed with MD5 during login and password updates.

MD5 is vulnerable to collision and brute-force attacks, making it unsuitable for protecting sensitive data. Will this project consider replacing MD5 with a secure hashing algorithm, such as bcrypt, to ensure better protection for user credentials and sensitive data? It will greatly enhance the overall security and resilience of the system and benefit the numerous users of this framework.

Looking forward to your reply. Thanks!

References: [1] https://cwe.mitre.org/data/definitions/327.html [2] https://owasp.org/www-project-mobile-top-10/2023-risks/m10-insufficient-cryptography.html

ZHENFENG13 commented 2 weeks ago

your idea is good, but this project tends to be a learning project. if u want to enhance it, u can modify it by yourself.