cms icon indicating copy to clipboard operation
cms copied to clipboard

验证码机制存在重用漏洞

Open fsea opened this issue 1 year ago • 2 comments

在登录等需要验证码的地方,通过提交token和code的方式验证。 token是加密过的验证码,包含验证码和超时时间 code是用户输入的验证码。 存在的问题是提交时使用postman等工具,token永远提交一个相同的值,code也提交正确的值,则验证码功能将失效,直到验证码超时。 修改建议: 在服务端验证此验证码在有效期内是否已经被验证过,如果验证过,则不能重复使用。

fsea avatar Oct 13 '23 03:10 fsea

临时解决办法: D:\Project\SSCMS-szxc\src\SSCMS.Core\Utils\CaptchaUtils.cs中添加方法: image

在验证验证码是否正确的地方加上: CaptchaUtils.IsAlreadyUsed(captcha, _cacheManager) 如果返回true就不让通过。

最好在CaptchaUtils里有一个统一的方法负责验证验证码是否可用及过期,其他地方不用重复写代码了

fsea avatar Oct 13 '23 08:10 fsea

收到,我们会尽快修复。

starlying avatar Oct 17 '23 01:10 starlying