report icon indicating copy to clipboard operation
report copied to clipboard

身份验证绕过漏洞

Open S2eTo opened this issue 2 years ago • 0 comments

This is the Chinese report, the English report is in(这是中文的漏洞报告,英文的在): 身份验证绕过漏洞

漏洞描述

程序使用固定的 JWT 密钥,存储的 Redis 密钥使用用户名格式字符。 任何在一小时内登录的用户。 可以用他的用户名伪造 JWT Token 以绕过身份验证

登录接口

com.anjiplus.template.gaea.business.modules.accessuser.controller.AccessUserController#login

image-20221015111709407

使用用户名创建格式化字符作为 Redis 存储的键值使用,虽然使用了 uuid 但 uuid 并没有参与到身份验证中。

com.anjiplus.template.gaea.business.modules.accessuser.service.impl.AccessUserServiceImpl#login

com.anjiplus.template.gaea.business.constant.BusinessConstant#GAEA_SECURITY_LOGIN_TOKEN

image-20221015112014779

使用了固定的 JWT 密钥

spring-boot-gaea-2.0.5.RELEASE.jar!com.anji.plus.gaea.utils.JwtBean#createToken

spring-boot-gaea-2.0.5.RELEASE.jar!com.anji.plus.gaea.GaeaProperties.Security#getJwtSecret

image-20221015112804990

在 TokenFilter 中进行身份验证

com.anjiplus.template.gaea.business.filter.TokenFilter#doFilter

image-20221015113222257

通过修改 "username" 字段来伪造不同用户的Token

{
    "type": 0,
    "uuid": "",
    "tenant": "tenantCode",
    "username": "admin"
}
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXBlIjowLCJ1dWlkIjoiIiwidGVuYW50IjoidGVuYW50Q29kZSIsInVzZXJuYW1lIjoiYWRtaW4ifQ.ce3xqqUypEinA_ZCSky9AptKjkG8qFm8ESMuCunqe6Y

image-20221015122659078

S2eTo avatar Oct 15 '22 04:10 S2eTo