Bug Summary
In backend/controllers/auth.controller.js, when a signup attempt uses an already-registered email, the endpoint echoes the existing user's email back in the response:
const existing = await User.findOne({ email });
if (existing) {
return res.json({ email: existing.email });
}
This leaks registered email addresses. Any caller can enumerate which email addresses are registered by attempting signup and checking whether the response includes an email field. The response also returns HTTP 200 instead of HTTP 409 Conflict.
Steps to Reproduce
- Register an account with
test@example.com.
- Attempt to register again with the same email.
- Observe the response:
{ "email": "test@example.com" } with HTTP 200.
- The presence of the
email field confirms the address is registered.
Expected Behavior
The endpoint should return a generic error without revealing whether the email is registered:
if (existing) {
return res.status(409).json({ error: 'Registration failed. Please try a different email.' });
}
Actual Behavior
The response body contains the exact email address of the existing user. This enables email enumeration attacks.
Environment
- Backend: Node.js / Express / Mongoose
- File:
backend/controllers/auth.controller.js, function: signup
Additional Context
Expected NSOC points: NSOC'26 level2 (medium complexity security bug - email enumeration)
Suggested labels: bug, NSOC'26, level2
Checklist:
Bug Summary
In
backend/controllers/auth.controller.js, when a signup attempt uses an already-registered email, the endpoint echoes the existing user's email back in the response:This leaks registered email addresses. Any caller can enumerate which email addresses are registered by attempting signup and checking whether the response includes an
emailfield. The response also returns HTTP 200 instead of HTTP 409 Conflict.Steps to Reproduce
test@example.com.{ "email": "test@example.com" }with HTTP 200.emailfield confirms the address is registered.Expected Behavior
The endpoint should return a generic error without revealing whether the email is registered:
Actual Behavior
The response body contains the exact email address of the existing user. This enables email enumeration attacks.
Environment
backend/controllers/auth.controller.js, function:signupAdditional Context
Expected NSOC points: NSOC'26 level2 (medium complexity security bug - email enumeration)
Suggested labels:
bug,NSOC'26,level2Checklist: