CVE-2019-18818: strapi Password Reset Auth Bypass
The password reset endpoint did not validate the type of the reset code, so sending an empty object as the code made the database query return the first user without a reset token, typically the administrator. An attacker could then set a new password for that account and receive a valid login token.
amlw.dev
Published on amlw.dev
The strapi Auth.js controller allowed users to reset their password using the /auth/reset-password endpoint.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The endpoint passed the user-supplied reset code directly into a database query without checking that it was a string, so an object value changed the query's meaning.
Impact
An attacker could take over the administrator account by setting its password and obtaining a valid login token.
What the attacker needed
Network access to the Strapi instance; no authentication required
How it was found
- Send a password reset request to the reset-password endpoint with a new password, its confirmation, and an empty object as the code.
- The server returns a success response containing a login token and the administrator user details.
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 write-up has not been written yet. The Original tab links to the source.
A password reset form normally checks a secret code to make sure the person asking is the real account owner. Here the server accepted a strange value (an empty object) instead of a normal text code, and that confused the database into picking the first account it found. The attacker could then choose a new password for that account, which in this case was the administrator.
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.