From 22666de2ce01512c212ec26e68a4df0222b3dc76 Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Tue, 13 Oct 2026 07:01:42 -0400 Subject: [PATCH] =?UTF-8?q?--author:scott--date:20261013--for:=E3=80=90?= =?UTF-8?q?=E5=AE=89=E5=85=A8=20GHSA-wv6f-p5mv-2g6f=E3=80=91=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E5=AF=86=E7=A0=81=E7=9F=AD=E4=BF=A1=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E9=94=99=E8=AF=AF=E6=BB=A15=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E5=BA=9F=EF=BC=8C=E7=99=BB=E5=BD=95=E5=9B=BE=E5=BD=A2=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81=E4=B8=80=E6=AC=A1=E4=B8=80=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../modules/system/controller/LoginController.java | 3 +++ .../system/controller/SysUserController.java | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java index ee36b49fc..203a97a1a 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/LoginController.java @@ -983,6 +983,9 @@ public class LoginController { result.setCode(HttpStatus.PRECONDITION_FAILED.value()); return null; } + //update-begin---author:scott ---date:20261013 for:【安全】图形验证码校验通过后立即作废(一次一用),防止同一验证码被反复用于尝试登录----------- + redisUtil.del(realKey); + //update-end---author:scott ---date:20261013 for:【安全】图形验证码校验通过后立即作废(一次一用),防止同一验证码被反复用于尝试登录----------- return realKey; } } \ No newline at end of file diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java index 16a0d0cb3..e96906b3a 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java @@ -1380,7 +1380,19 @@ public class SysUserController { } if(!smscode.equals(object.toString())) { - result.setMessage("短信验证码不匹配!"); + //update-begin---author:scott ---date:20261013 for:【安全 GHSA-wv6f-p5mv-2g6f】验证码错误满5次即作废,防止暴力枚举验证码重置他人密码----------- + String errKey = redisKey + ":err"; + long errCount = redisUtil.incr(errKey, 1); + if (errCount == 1) { + redisUtil.expire(errKey, 600); + } + if (errCount >= 5) { + redisUtil.del(redisKey, errKey); + result.setMessage("短信验证码错误次数过多,请重新获取!"); + } else { + result.setMessage("短信验证码不匹配!"); + } + //update-end---author:scott ---date:20261013 for:【安全 GHSA-wv6f-p5mv-2g6f】验证码错误满5次即作废,防止暴力枚举验证码重置他人密码----------- result.setSuccess(false); return result; }