Trusting the Client: A Flawed State Machine in a Banking Password Reset
2026
Why Password Reset Flows Deserve Extra Attention
Password reset is one of the few places where an application deliberately lets someone in without the password. Every reset flow is a small authentication system of its own: request a reset, prove you own the account (usually with an emailed or texted code), then set a new password. If any of those steps can be skipped or faked, the attacker does not need the password at all.
When I test a reset flow I map it as a sequence of states and ask one question for each transition: who decides that this step is complete, the server or the client? If the answer is ever "the client", that is where I start poking.
Background
During a web assessment of an online banking platform, the password reset flow looked solid on the surface. Request a reset, receive a one-time code, enter it, choose a new password. Entering a wrong code produced a clear error. The problem was not in what the server said, but in how much the application trusted what it heard back.
A state machine is a model where a process moves through a fixed set of states (for example: reset requested → code verified → password changed) and each transition has rules. A flawed state machine vulnerability happens when the application lets you reach a later state without the earlier state ever being legitimately completed, usually because the check that should gate the transition lives somewhere the attacker controls.
Establishing the Baseline
Before changing anything, I walked the flow honestly. I requested a reset for a test account, the application generated a token and sent a code, and I deliberately entered a wrong one (00000). The server did exactly what it should:
HTTP/1.1 400 Bad Request
Content-Type: application/json
{ "valid": false, "message": "Invalid code" }
The UI showed the error and stayed on the code screen. That baseline matters: it proves the server knows the code is wrong. Whatever happens next is not the server being fooled, it is the client being told to ignore the server.
Step 1: Flipping the OTP Verdict
I repeated the same wrong code, this time intercepting the response in Burp and rewriting it before it reached the browser:
HTTP/1.1 200 OK
Content-Type: application/json
{ "valid": true }
The application immediately moved to the "choose a new password" screen. Nothing new was requested from the server to confirm the transition. The client had been handed a boolean, and the boolean was the gate.
Step 2: Flipping the Final Step
As a control, I first submitted the new password without touching anything. The final endpoint rejected it, which is the correct behavior and shows the backend still had some awareness that the token was not valid.
Then I submitted it again and rewrote that final error response into a success. The application displayed its "password changed successfully" confirmation, completing the entire flow with a code that had never been valid at any point.
Response manipulation is not a vulnerability by itself: anyone can edit traffic on their own machine. It becomes one when a security decision is made from the response on the client side, or when the server later relies on a state that only the client asserted. The fix is never "make the response harder to tamper with", it is "stop letting the client decide".
What I Could and Could Not Prove
Being precise here is part of the job. The test clearly showed that the client-side flow could be driven end to end with an invalid code, and that neither checkpoint (OTP verification and password confirmation) was enforced by the client against the server's real answer.
Confirming that the new password was actually persisted for the account was muddied by a separate, inconsistent password invalidation behavior in the same application, so I reported the issue with that limitation stated explicitly instead of overclaiming. The root cause, a reset flow whose state transitions were decided by values the client reports, was the same either way, and it was rated and remediated as a critical design flaw.
Impact
- Account takeover potential: a reset flow that can be walked with an invalid OTP removes the only proof of account ownership in the process
- OTP neutralized: the second factor protecting the reset becomes decorative when its verdict is a value the client can rewrite
- Security decision in the wrong place: state was carried by the client between steps instead of being re-checked by the server at the moment it mattered
Remediation
- Re-validate on the server at the final step: the endpoint that changes the password must independently verify the token or OTP, and must not assume an earlier
"valid": truestill holds - Bind state to the server session: track which steps a reset has completed server-side, and reject any transition whose previous step was not recorded there
- Invalidate tokens atomically: once used, failed or expired, the token must be unusable on every subsequent request, not only in the first validation response
- Never gate a security transition on a client-reported value: booleans like
valid,verifiedorauthorizedcoming back from the client are input, not proof
Takeaway
When mapping any multi-step flow (reset, checkout, onboarding, MFA), write down each state and who enforces the transition into it. Then try to skip, repeat or forge each transition. The bugs live in the gaps between steps, not in the steps themselves.
Vulnerability details have been generalized to protect client confidentiality. The issue was reported during an authorized engagement and has since been remediated.