Repository navigation
Description
Nacos 用户名枚举漏洞 Issue(GitHub Issue 模板,可直接提交)
Describe the bug
The /v1/auth/login login endpoint returns different HTTP status codes and error messages for non‑existent users vs existing users with wrong passwords, leading to username enumeration vulnerability.
Attackers can distinguish valid usernames by observing response differences:
- When username does not exist: return
HTTP 500, response containsUser xxx not found - When username exists but password wrong: return
HTTP 403, generic error prompt
This side‑channel leakage allows unauthenticated attackers to brute‑force enumerate valid system accounts.
中文简述:Nacos 登录接口
/v1/auth/login,对不存在用户、存在用户但密码错误返回不一样的 HTTP 状态码与报错文本,造成用户名枚举漏洞。未授权攻击者可以根据返回状态码区分账号是否真实存在,批量爆破获取系统有效账号。
Expected behavior
Unify login failure responses:
- Whether the username exists or password is wrong, return identical HTTP status code (e.g.
401 Unauthorized) - Return the same generic error message, do not leak whether the user exists. Example:
Incorrect username or password - Do not output user‑existence details in response body.
Actually behavior
- Non‑existent user:
HTTP/1.1 500, body:caused: User testabc123 not found; - Valid username + wrong password:
HTTP/1.1 403, body:User not found! Please check user exist or password is right!
Different status code + different error text, leak user existence information.
How to Reproduce
- Deploy nacos‑server, enable auth authentication.
- Send POST request to
/v1/auth/loginwithapplication/x‑www‑form‑urlencodedbody.
Case1: Non‑existing username
curl -v -X POST http://<nacos‑ip>:8848/v1/auth/login -d "username=testabc123&password=123456"
- Response status:
500 Internal Server Error - Response body:
caused: User testabc123 not found;
Case2: Real username, wrong password
curl -v -X POST http://<nacos‑ip>:8848/v1/auth/login -d "username=nacos&password=wrongpass666"
- Response status:
403 Forbidden - Response body:
User not found! Please check user exist or password is right!
Compare the two responses, attacker can judge whether username is valid.
Desktop
- OS: CentOS / Windows
- Version: nacos‑server (affected multiple versions)
- Module: auth
- SDK: HTTP raw request(curl)
Additional context
Risk impact: Unauthenticated remote attackers can enumerate valid account list, prepare for subsequent password spraying / brute‑force attack.
Suggested fix:
- Unify HTTP status code for all login failures, e.g. use
401for both user‑not‑found and bad‑password scenarios. - Use unified generic error message like
Incorrect username or password, remove user‑specificUser xxx not founddetail. - Add rate‑limit / brute‑force protection on login endpoint to mitigate automated enumeration.
Activity
[ISSUE #15682] Prevent username enumeration during login (#15717)
[ISSUE #15682] Backport login enumeration fix to 3.2.4 (#15722)