Blog | G5 Cyber Security

Open Redirect Bypass: Blackbox URL Matching

TL;DR

An open redirect vulnerability occurs when a web application redirects users to URLs specified by user input without proper validation. A common mitigation is blacklisting known malicious domains or patterns. This guide explains how attackers can bypass these blacklists and demonstrates techniques to exploit the vulnerability.

Understanding the Problem

Blackbox URL matching attempts to prevent open redirects by checking if a provided URL contains disallowed strings (e.g., ‘evil.com’). However, this method is often flawed due to encoding issues, case sensitivity, and variations in domain representations. Attackers can craft URLs that pass these checks but still redirect to malicious sites.

Bypass Techniques

  1. URL Encoding:
  • Case Sensitivity:
  • Unicode Encoding:
  • Domain Variations:
  • IP Address Representation:
  • Mixed Encoding:
  • Trailing Characters/Whitespace:
  • URL Fragments (#):
  • Double Encoding:
  • Using Punycode:
  • Exploitation Steps

    1. Identify the Redirect Parameter: Determine which URL parameter controls the redirection.
    2. Initial Test: Try a simple malicious URL (e.g., evil.com) to confirm the vulnerability exists.
    3. Blacklist Discovery: Attempt various bypass techniques, observing the application’s response to identify patterns in the blacklist.
    4. Craft Payload: Create a URL that passes the blacklist but redirects to your malicious site.
    5. Verify Exploitation: Confirm the redirect occurs as expected and leads to the attacker-controlled domain.

    Mitigation

    Exit mobile version