Hello Hackers,
Hope you guys Doing well and hunting lots of bugs and Dollars !
well, so for today we are going to talk about a very hot topic which is Multi-factor Authentication. Before jumping to this topic let’s understand some basic ideas about MFA.
What is Multi-factor Authentication?
This is also popular as Two-factor authentication (2FA ) which is also another way to verify your identity. Basically normally in single-factor authentication you just have to verify yourself by username and password to be authenticated. But for adding one more layer of security we use 2FA to verify the user twice. So that if anyhow attacker can get access to the username and password, he still requires one more way to verify his identity. This strengthens the security of the user’s account.
But it doesn’t mean that web application is completely secure by using 2FA, there are some methods to bypass it. so let’s start and learn how to look for bugs in this function.
Response Manipulation
In response, if “success”:false, change it to “success”:true
How to hunt :-
Status code manipulation
If Status Code is 4xx, try to change it to 200 OK and see if it bypass restrictions
How to Hunt:-
2FA code leakage in response
Sometimes the web application leaks the 2FA somewhere in the response body while initiating a request 2FA. It is always a good idea to read the response body and understand if there is any possible leakage that can lead to bypassing the MFA.
How to Hunt:-
2FA code Re-usability
When the application doesn’t invalidate a previously used OTP and the expiration time-frame is considerable say 1 day. It can be abused by an attacker to brute-force or guess for a valid (even complex) OTP and bypass the restriction.
How to Hunt:-
Lack of Brute-force protection
A brute force attack uses trial-and-error to guess login info, encryption keys, or find a hidden web page. Hackers work through all possible combinations hoping to guess correctly.
Due to lack of brute force protection or rate-limiting, an attacker can perform brute force to guess the actual 2FA code.
How to Hunt:-
Direct request/Forceful browsing
This is the flaw of broken access control where the web application fails to check authorization, which allows the attacker to access resources that they should not be able to access just by giving the path of the exact resource.
How to Hunt:-
Backup code Abuse / Time-based One-Time Password
Backup codes are a number of one-time codes you can generate specifically for your account when you have 2FA enabled. you need the backup codes in case you want to log in to your account and cannot access the primary one-time code generator.
How to Hunt:-
CSRF & clickjacking on 2FA disable Feature
you can perform CSRF or clickjacking to disable 2FA, if you can perform this then you can consider this as a vulnerability.
How to hunt:-
JS files analysis
Sometimes the application uses dynamic JavaScript files to store a copy of OTP, which is matched against the OTP received by the user to perform the check on the client-side and validate the user.
while triggering the 2FA code request, analyze all the js files that are included in the response to see if any JS file includes information that can support bypass the 2FA code.
Password & email change disable 2FA
How to Hunt:-
2FA bypass by sending blank code
This is a failure in the null check of the entered code. In simple terms, the 2FA while logging in can be bypassed by sending a blank code. This could be because of the incorrect comparison of entered code with true code. A pre-validation (may be null check) before comparing the codes would fix the issue.
How to Hunt:-
Enabling 2FA Doesn’t expire the Previous session
How to Hunt:-
Check these reports :-
That’s all about 2FA bypass, I have mentioned here some of my findings and all known open-source techniques.
Hope this is useful for you guys
Happy Hacking !