An API allows updating account details via PUT /account. The only requirement: a valid Bearer token in the Authorization header. No password confirmation required.
The developer reasoned: if you have a valid token, you're logged in, so you can edit your account. Seems logical. But it ignores what happens when a token is stolen.
Step 1: Attacker obtains a valid token — via phishing, XSS, a log leak, or a token exposed in a URL.
Step 2: PUT /account with body {"email": "attacker@evil.com"}. No password asked. Request succeeds.
Step 3: Attacker triggers "Forgot Password" for the account.
Step 4: Password reset link arrives at attacker@evil.com. Attacker sets a new password. The original owner is permanently locked out.