Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

身份验证绕过漏洞 #8

Open
S2eTo opened this issue Oct 15, 2022 · 0 comments
Open

身份验证绕过漏洞 #8

S2eTo opened this issue Oct 15, 2022 · 0 comments

Comments

@S2eTo
Copy link

S2eTo commented Oct 15, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant