Daemon Of Hacking
  • WELCOME!
    • 👋/home/usr/KruKnight
  • METHODOLOGIES & RESOURCES
    • Passwords & Attacks
    • Post Exploitation
      • 👀Situational Awareness
      • 🖥️Privilege Escalation
        • Linux Privilege Escalation
        • Windows Privilege Escalation
  • Writeups
    • CyCtf 2024
      • Vending Machine
      • Aerospace
      • OhMyCell
    • Portswigger Labs
      • Authentication
        • Username enumeration via different responses
        • 2FA simple bypass
        • Password reset broken logic
        • Username enumeration via subtly different responses
        • Username enumeration via response timing
        • Broken Brute-Force Protection, IP Block
        • Username enumeration via account lock
        • 2FA broken logic
        • Brute-forcing a stay-logged-in cookie
        • Offline password cracking
        • Password reset poisoning via middleware
        • Password brute-force via password change
        • Broken brute-force protection, multiple credentials per request
      • Os Command Injection
        • OS command injection, simple case
        • Blind OS command injection with time delays
        • Blind OS command injection with output redirection
        • Blind OS command injection with out-of-band interaction
        • Blind OS command injection with out-of-band data exfiltration
      • Cross-Origin Resource Sharing (CORS)
        • CORS vulnerability with basic origin reflection
        • CORS vulnerability with trusted null origin
        • CORS vulnerability with trusted insecure protocols
      • Server-side template injection
        • Basic server-side template injection
        • Basic server-side template injection (code context)
      • Server-Side Request Forgery (SSRF)
        • Basic SSRF against the local server
        • Basic SSRF against another back-end
        • Blind SSRF with out-of-band detection
        • SSRF with blacklist-based input filter
        • SSRF with filter bypass via open redirection vulnerability
      • Path Traversal
  • 🟩HTB Writeups
    • Heal
Powered by GitBook
On this page
  • Lab Description
  • Walkthrough
  • Step 1: Initial Observations
  • Step 2: Understanding the Logic Flaw
  • Step 3: Brute Forcing the OTP

Was this helpful?

  1. Writeups
  2. Portswigger Labs
  3. Authentication

2FA broken logic

PreviousUsername enumeration via account lockNextBrute-forcing a stay-logged-in cookie

Last updated 5 months ago

Was this helpful?

Lab Description

Walkthrough

Step 1: Initial Observations

  • After logging in with the provided credentials wiener:peter, we are prompted for a 4-digit OTP (One-Time Password).

  • The 4-digit code is delivered to the email server, which we have access to.

Visiting the email client provided we find that it's a 4 digit code

Step 2: Understanding the Logic Flaw

  • When analyzing the GET request, it includes a verify parameter containing the username.

  • By changing the value of the verify parameter to carlos, the server generates a verification code for Carlos’s email.

Step 3: Brute Forcing the OTP

  1. Generating Carlos's OTP:

    • Modify the verify parameter to carlos and send the request. This generates the OTP for Carlos and sends it to his email.

Sending the POST Request to Burp Intruder:

  • Highlight the mfa-code parameter in the request.

  • Use Burp Suite's Intruder tool to brute force all possible 4-digit OTP combinations (0000–9999).

Filtering Successful Responses:

  • After running the brute-force attack, filter the responses based on status code 302, which indicates a successful login.

Step 4: Accessing Carlos’s Account

  • Use the successful OTP code and update the mfa-code parameter.

  • Since we don’t have Carlos’s password, we use Burp Suite to send the successful request to the browser session:

    • Right-click the request > Request in Browser > In Original Session.

Carlos’s account page is successfully accessed despite the 2FA mechanism.