Bug #17
openJWT Tokens Remain Valid After Password Change
Description
After changing the account password using the /api/admin/password endpoint, previously issued JWT tokens remain valid and can still be used to access protected API endpoints.
This behavior allows any attacker who has obtained a valid JWT token to continue accessing the account even after the legitimate user changes their password.
For sensitive accounts such as Admin / Super Admin, this poses a significant security risk because password change does not effectively terminate existing authenticated sessions.
Steps to Reproduce
- Login as an admin user and obtain a JWT token.
- Send a password change request:
POST /api/admin/password - After the password is successfully changed, continue using the same JWT token to access protected API endpoints.
- Observe that the requests are still accepted.
Actual Result
Previously issued JWT tokens remain valid even after the password is changed.
Expected Result
All previously issued JWT tokens should be invalidated after a password change to ensure that any potentially compromised tokens cannot continue to access the account.
Security Impact
If an attacker obtains a valid JWT token through:
XSS attacks
Token leakage
Browser storage access
Network interception
they will retain access to the account even after the user changes their password.
The request has been added to the Postman team workspace for easier replay and API verification.
Files
Updated by Adhi Narayanan about 1 month ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
We have Done like
Access token expires → refresh silently → user stays logged in
🎯 This EXACTLY matches your requirement
✔ Auto refresh when possible
✔ Auto logout when refresh fails
🧠 Final Architecture
🔐 Tokens
Access Token → short-lived (2 min) // for deevelopment we have made it to 2 min
Refresh Token → long-lived (7 days, stored in httpOnly cookie)
🔄 Flow (What happens internally)
- User logs in → gets access token + refresh cookie
- API request → uses access token
- Access token expires → backend sends 401
- Frontend intercepts → calls /refresh-token
- New access token received
- Original request retried automatically
- User never notices anything
🚪 What happens when user logs out?
👉 When user clicks Logout, you must:
✅ 1. Delete refresh token from DB
✅ 2. Clear refresh token cookie
✅ 3. Remove access token from frontend (memory)
Updated by Vivek Kumar about 1 month ago
- Status changed from Resolved to In Progress
Updated by Adhi Narayanan about 1 month ago
- Status changed from In Progress to Resolved