In 2-Factor Authentication when a user enters his password with the intention to log in the web application sends a temporary code to the user’s verified email address and when the user enters the code only then he will be able to interact with his account.
Many websites and organisations rely on single-factor authentication where a user can log into his account using only a password without any additional layer of security and validation. But as the social engineering attacks have become more and more sophisticated there is a dire need for an additional layer of security like 2 factor authentication.
Let’s discuss different techniques about bypassing 2-Factor Authentication:
1. 2-Factor Authentication Code Leakage in Response:
1. At 2-Factor Authentication Code Triggering request, such as Send OTP functionality, capture the request.
2. See the response of this request and analyze if the 2-Factor Authentication Code is leaked.
2. JS File Analysis:
While triggering the 2-Factor Authentication Code Request, Analyze all the JS Files that are referred in the response to see if any JS file contains information that can help bypass 2FA code.
3. Lack of brute-Force Protection:
This involves all sorts of issues which comes under security misconfigurations such as lack of rate limit, no brute-force protection, etc.
1. Request 2-Factor Authentication code and capture the request.
2. Repeat this request for 100–200 times and if there is no limitation set, that’s a rate limit issue.
3. At 2-Factor Authentication Code Verification page, try to brute-force for valid 2-Factor Authentication and see if there is any success.
4. You can also try to initiate, requesting OTP’s at one side and brute-forcing at another side. At some point, the OTP will coincide and may give you a quick result.
4. Password Reset / Email Change — 2FA Disable:
1. Assuming that you are able to perform sophisticated phishing campaigns, force the end user to do change the password.
2. 2-Factor Authentication is disabled after the email is changed or the password is reset. This could be an issue for some organizations. However, it depends on case by case basis.
5. Missing 2-Factor Authentication Code Integrity Validation:
1. Request a 2-Factor Authentication code from the attacker’s account.
2. Use this valid 2-Factor Authentication code in the victim 2FA Request and see if it bypasses the 2FA protection.
6. Direct Request:
1. Directly navigate to the page which comes after 2-Factor Authentication or any other authenticated page of the application and see if this bypasses the 2-Factor Authentication restrictions.
7. 2FA Refer Check Bypass:
1. Directly navigate to the page which comes after 2FA or any other authenticated page of the application.
2. If there is no success, change the refer header to the 2FA page URL. This may fool application to pretend as if the request came after satisfying 2FA condition.
8. Backup Code Abuse:
1. Apply same techniques used on 2FA such as Response/Status Code Manipulation, brute-force, etc. to bypass backup codes and disable/reset 2FA.
9. Enabling 2-Factor Authentication Doesn’t Expire Previous Session:
1. Login to the application in two different browsers and enable 2FA from 1st session.
2. Use 2nd session and if it is not expired, it could be an issue if there is an insufficient session expiration issue. In this scenario, if an attacker hijacks an active session before 2-Factor Authentication, it is possible to carry out all functions without a need for 2-Factor Authentication.
10. Clickjacking on 2FA Disable Feature:
1. Try to iframe the page where the application allows a user to disable 2-Factor Authentication.
2. If iframe attack vector is successful, try to perform a social engineering attack to manipulate the victim to fall in to your trap.
11. Response Manipulation:
1. Check response of the 2FA Request.
2. If you observe “Success”:false, change this to “Success”:true and see if it bypasses the 2FA.
3. You can also use Burp “Match & Replace” rules for this.
12. Status Code Manipulation:
1. If the Response Status Code is 4xx like 401, 402, etc.
2. Change the response Status Code to “200 OK” and see if it bypasses the 2FA.
13. 2-Factor Authentication Code Reusability:
1. Request a 2FA code and use it.
2. Now, re-use the same 2FA code in another session and if it authenticated successfully, that’s a potential issue.
3. Also, try requesting multiple 2FA codes, and see if previously requested codes expire or not when a new code is requested.
4. Also, try to re-use the previously used code after long time duration i.e 1 day or more. If it is successful, that is an issue since 1 day is more than enough for a sophisticated hacker to either brute-force or crack a 6-digit 2FA Code.
14. CSRF on 2FA Disable Feature:
1. Navigate to 2FA Page and click on “Disable 2FA” and capture this request with Burp Suite & generate a CSRF PoC.
2. Send this PoC to the victim, and check if CSRF happens successfully and remove the 2FA from the victim account.
3. Also, check if there is any authentication confirmation such as password or 2FA code required before disabling 2FA.
Common Bugs found in File Upload Functions