Skip to content
Account takeover Write-up Intermediate

OTP Bypass through Session Manipulation

The OTP verification page created a session cookie by combining two request parameters (PIDM and WEBID) and Base64-encoding them, without a server-side check that the OTP was valid. An attacker could submit any OTP, craft the cookie manually, and manipulate the response to gain access to the dashboard.

n4if Follow

Published on medium.com

I’m excited to share my journey into the world of OTP bypass vulnerabilities. Recently, I discovered a subtle but impactful flaw in a web login system that allows attackers to bypass OTP verification through session manipulation.

Naif Al-anazi, on medium.com

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

Likely the server trusted client-supplied PIDM and WEBID parameters to construct the session cookie and did not verify that a valid OTP had been submitted before issuing it.

Impact

An attacker could bypass OTP verification and gain unauthorised access to the dashboard, though the exploit required the ability to intercept and modify the server response.

What the attacker needed

Valid credentials; ability to intercept and modify responses

The fix

The server should not build session cookies from client-supplied parameters and must verify a valid OTP server-side before issuing a session.

How it was found

  1. Log in with valid credentials to reach the OTP page.
  2. Submit any OTP and capture the POST request.
  3. Combine the PIDM and WEBID values and Base64-encode them to form a session cookie.
  4. Intercept the server response and add the crafted session cookie.
  5. The manipulated response redirects to the dashboard, bypassing OTP verification.

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 one-time password (OTP) is a code sent to your phone or email to prove it's you. The website was supposed to check that code before letting you in, but it built the 'you are logged in' cookie from two numbers that the browser sends, without checking the code. So someone could skip the code and still get in by making that cookie themselves.

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.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.