OTP Bypass
Introduction
One-Time Passwords (OTP) are commonly used for authentication and verification in account registration, login, and critical actions. However, poor OTP implementations can lead to authentication bypass, account takeover, and unauthorized access.
This document outlines various OTP bypass techniques, including response manipulation, rate limit exploitation, default OTP usage, and session validation flaws.
OTP Bypass via Response Manipulation
Method 1: Manipulating OTP Verification Response
Steps:
Register an account with a mobile number and request an OTP.
Enter an incorrect OTP and capture the request using Burp Suite.
Intercept and modify the server's response:
Original response:
Change to:
Forward the manipulated response.
The system authenticates the account despite the incorrect OTP.
Impact:
Full account takeover without providing a valid OTP.
Method 2: Changing Error Response to Success
Steps:
Go to the login page and enter your phone number.
When prompted for an OTP, enter an incorrect OTP.
Capture the server response:
Modify it to:
Forward the response.
If the server accepts this modification, you gain access without entering a valid OTP.
Impact:
Authentication bypass leading to account takeover.
Method 3: OTP Verification Across Multiple Accounts
Steps:
Register two different accounts with separate phone numbers.
Enter the correct OTP for one account and intercept the request.
Capture the server response and note status:1 (success).
Now, attempt to verify the second account with an incorrect OTP.
Intercept the server response where the status is status:0 (failure).
Change status:0 to status:1 and forward the response.
If successful, you bypass OTP authentication.
Impact:
Bypassing OTP verification for multiple accounts.
OTP Bypass Using Form Resubmission in Repeater
Steps:
Register an account using a non-existent phone number.
Intercept the OTP request in Burp Suite.
Send the request to Repeater and forward it.
Modify the phone number in the request to your real number.
If the system sends the OTP to your real number, use it to register under the fake number.
Impact:
Unauthorized account registration using someone else's OTP.
Bypassing OTP with No Rate Limiting
Steps:
Create an account and request an OTP.
Enter an incorrect OTP and capture the request in Burp Suite.
Send the request to Burp Intruder and set a payload on the OTP field.
Set payload type as numbers (
000000
to999999
).Start the attack.
If no rate limit is enforced, the correct OTP will eventually match.
Impact:
Complete OTP bypass through brute force.
Additional OTP Bypass Test Cases
1. Default OTP Values
Some applications use default OTP values such as:
Test common default values to check for misconfigurations.
2. OTP Leakage in Server Response
Some applications leak OTPs in API responses.
Intercept OTP request responses and check if OTP is present.
3. Checking if Old OTP is Still Valid
Some systems allow the reuse of old OTPs.
Test if previously used OTPs are still accepted.
Rate Limiting Attack on OTP Verification
Steps:
Navigate to the OTP verification endpoint:
Enter an invalid OTP (e.g.,
000000
).Intercept the request and send it to Intruder.
Set the OTP field as the payload position.
Use payload type: numbers and define a range (000000 - 999999).
Start the attack.
Identify a response length change, which may indicate the correct OTP.
Impact:
Brute-force attack leading to OTP bypass and account takeover.
Contributors
Enhanced and reformatted for HowToHunt repository by remonsec
Last updated