GraphQL sessions aren't immediately invalidated when user password is changed
The GraphQL token and session cookie used for a password change request remained valid after the user signed out, allowing the request to be replayed. An attacker who captured the request could change the password again without logging in.
- Triaged in 11 days
- Fixed in 33 days
- Disclosed after 33 days
Summary:
While changing password, once user clicks on "Change password" button after giving necessary values, on https://hackerone.com/settings/pass/edit, the session expires and the user is redirected to https://hackerone.com/users/sign_in for logging in again with the updated/changed password. A graphql mutation is used to change password. But, it is observed that the user can still change password with same graphql token and same session id, used in previous graphql request even after signing out. Inshort graphql token nor host session expires.
Description:
Sorry if I categorized this into wrong weakness category. Also apologize for the complicated title.
When clicking on "change password" after supplying values for current password, password and confirm password, user is directed to sign_in page to log in again with changed password.
The password change takes place through graphql mutation request that contains graphql token and session id.
It was observed that after capturing the above request with the help of a web debugging tool (charles proxy), the above request could be replayed with same graphql token x-auth-token and host session __Host-session, with appropriate password values after sign out and the password is changed.
Inshort A user can change password even after he/she is signed out or session expires, without having to login again, with the help of previously captured graphql request.
Impact
An attacker could simply change the password again by capturing previous request. As the change can be done even after sign out or expired session, it is more severe.
Remedy
Must enforce graphql token expiration. Also check for host_sesssion cookie value.
Steps To Reproduce
- Login to the account and navigate to https://hackerone.com/settings/pass/edit to change password.
- Input necessary values and click "Change password" button. Capture the request using a proxy. (User is now logged out and redirected to sign_in page)
- Repeat the previous "graphql mutation" request using proxy with changed password. Password is changed again without having to login.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the GraphQL token and host session cookie were not invalidated on sign-out or password change, so the password-change mutation could be replayed.
Impact
An attacker who captured the request could change the password again even after the user signed out or the session expired, making the issue more severe.
What the attacker needed
Attacker captures the password-change request; victim has signed out or session expired
How it was found
- Log in and go to the password change page.
- Enter current and new passwords, click change password, and capture the request with a proxy.
- Replay the captured GraphQL mutation request with the new password after being signed out.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you change your password on a website, the site should log you out and invalidate the secret token used for that action. Here, the token and session cookie kept working even after logout, so anyone who saw the request could reuse it to change the password again.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.