📕
Blog
  • 🐞Vulnerabilities & Techniques
    • Web Vulnerabilities
      • Open Redirect
      • HTTP Parameter Pollution (HPP)
      • Host Header Injection (HHI)
      • XSS
      • HTML-Injection
      • clickjacking
      • S3
      • EXternal Xml Entity (XXE)
      • XSS prevention | CSP
      • DOM-XSS
      • SQL Injection | SQLI
      • Response Manipulation Technique & How Burp Suite Works
    • API Vulnerabilities
      • Mass Assignment Vulnerability
  • 🚩CTF
    • ASCWG
  • ✍️Writeups
    • Read Writeups
      • REST API WriteUps
      • Web Vulnerabilities WriteUps
    • Technical Writeups
      • Reset Password Poisoning Via Host Header Injection Lead to (ATO)
      • OTP/2FA Bypasses
        • OTP bypasses
  • 😈TryHackMe
    • THM Advent of Cyber 3 (2021) NoSQL WriteUp
  • 🔱Web-CyberTalents
    • CyberTalents-Web-Easy
    • CyberTalents-Web-Medium
    • CyberTalents-Web-Hard
  • 🖇️Pentesting & Bug Hunting Tips
    • ATO Via Host Header Injection
    • OTP Bypass
    • OutLook Plugin Pentest Guide
  • 💻Port-Swigger Labs
    • XML external entity (XXE) injection
    • DOM-XSS
      • DOM XSS in the document.write sink using source location.search
      • Lab: DOM XSS in document.write sink using source location.search inside a select element
      • Lab: DOM XSS in innerHTML sink using source location.search
      • Lab: DOM XSS in jQuery anchor href attribute sink using location.search source
      • Lab: Reflected DOM XSS
      • Lab: Stored DOM XSS
    • SQL injection
      • Lab: SQL injection vulnerability in WHERE clause allowing retrieval of hidden data
      • Lab: SQL injection vulnerability allowing login bypass
      • Lab: SQL injection UNION attack, determining the number of columns returned by the query
      • Lab: SQL injection UNION attack, finding a column containing text
      • Lab: SQL injection UNION attack, retrieving data from other tables
      • Lab: SQL injection UNION attack, retrieving multiple values in a single column
      • Lab: SQL injection attack, querying the database type and version on Oracle
      • Lab: SQL injection attack, querying the database type and version on MySQL and Microsoft
      • Lab: SQL injection attack, listing the database contents on non-Oracle databases
  • 🛜Wireless Networks Penetration Testing
  • ⚔️Wi-Fi Attacks
    • 🕸️Network Scanning attack
    • 🌊DOS / Flooding
      • 1️⃣DoS - Frame Flooding (Deauth, EAPOL, Beacons)
      • 2️⃣DoS- Exploiting Countermeasures (MIC failure)
    • Jamming Attacks (هجمات التشويش)
    • Probe Requests Attack
    • Handshake Attacks
      • Dictionary Attack
      • Clientless Attack
      • KRACK Attack
      • Downgrad Attack
    • Rouge AP Attack
  • Lab Notes
  • RFID and NFC
  • Bluetooth
  • ZigBee
  • Google Map Test
Powered by GitBook
On this page
  • Open Redirect
  • 📚 What Is Open Redirect?
  • 🤔 Why does Open Redirect Happen?
  • 💥 Exploitation
  • ⚔ Impact
  • 🔎 How To Find
  • 🛠 Tools
  • ⚙ Remediation
  • 📕 Reference
  • 🔬 Labs
  1. Vulnerabilities & Techniques
  2. Web Vulnerabilities

Open Redirect

PreviousWeb VulnerabilitiesNextHTTP Parameter Pollution (HPP)

Last updated 2 years ago

Open Redirect

Content

📚 What Is Open Redirect ?

🤔 Why Open Redirect Happen ?

💥 Exploitation

⚔ Impact

🔎 How To Find

🛺 Automate

🛠 Tools

⚙ Remediation

📕 Referance

🔬 Labs

📚 What Is Open Redirect?

Open redirect is basically what the name says, Openly allow Redirects to any website.

Open redirect refers to an attack method in which the attacker moves the user to the intended domain by using the redirect function based on the user’s input in the web service.

Ordinary people trust the domain when they see the URL of the web service, so they trust and click the link in the domain. It can be used sufficiently for XSS or account hijacking.

A basic URL is structured in this way:


🤔 Why does Open Redirect Happen?

This happens due to insufficient redirection checks in the back end, which means the server is not properly checking if the redirect URL is in their whitelist or not.

when a web application accepts untrusted input that could cause the web application to redirect the request to a URL contained within untrusted input.

Let’s look at a simple example of a web application written in PHP which is vulnerable to “OR”:

Enter the value of url parameter https://evil.com After submitting the following HTTP request:

The redirection can happen on the server side or the client side.

Server-Side: Request to redirect is sent to the server, then the server notifies the browser to redirect to the URL specified via the response.

Client-Side: Browser is notified to redirect to the URL specified directly without the intervention of the server.

Redirect status code

status code
Msg

301

Multiple Choices

302

Found

303

See Other

304

Not Modified

305

Use Proxy

307

Temporary Redirect

308

Permanent Redirec


💥 Exploitation

Let’s say there’s a well-known website - https://famous-website.tld/. And let’s assume that there’s a link like :

https://famous-website.tld/signup?redirectUrl=https://famous-website.tld/account After signing up you get redirected to your account, this redirection is specified by the redirectUrl parameter in the URL. What happens if we change the famous-website.tld/account to evil-website.tld?

https://famous-website.tld/signup?redirectUrl=https://evil-website.tld/account By visiting this URL, if we get redirected to evil-website.tld after the signup, we have an Open Redirect vulnerability. This can be abused by an attacker to display a phishing page asking you to enter your credentials.

Phishing

Basically, open redirect can be used for phishing. Because users only view and access links from trusted domains, they can steal information by moving them to a disguised page that tries to steal users’ information through redirects.

XSS Open redirect usually proceeds redirect in Location header or js stage.

Chaining with SSRF


⚔ Impact

By modifying untrusted URL input to a malicious site, an attacker may successfully launch a phishing scam and steal user credentials


🔎 How To Find

  1. Burp

  2. Give Some Attention

    1. Look at the code for every place that utilizes a redirect. If there is no kind of whitelist for the URL being redirected, the site is probably vulnerable.

    2. Crawl the site and save all pages that generate a redirect. If a parameter is changed, is the URL redirected to that as well? Again, if no whitelist seems to be implemented here the site is most likely vulnerable.

    3. Manually looking around and investigating all parameters that can be suspected to have something to do with redirects may feel like a waste of time, but can actually generate better results than one might expect.

  3. Some Magic tricks

    1. Visit every endpoint of the target to find these “redirect” parameters.

    2. View your proxy history, you might find something. Make sure to use filters.

    3. Bruteforcing helps too.

    4. You might uncover many endpoints by reading javascript code.

    5. Google is your friend, For example, query: inurl:redirectUrl=http site:target.com

    6. Understand and analyze where the redirection is needed in the target application like redirecting to the dashboard after login or something like that.

  4. Find open redirect with gf:


🛠 Tools


⚙ Remediation

There are a few possible ways to remediate this issue.

  1. try to avoid redirects altogether. In most cases, they are not needed.

  2. If a redirect is necessary, do not trust user input for its destination.

  3. Map the destination input to a value that the server then translates to the original value before doing the redirect. This prevents the attacker from changing it.

  4. Have a whitelist of URLs – this can be done with Regex if necessary. Be careful with this as it is easy to make mistakes without realizing it.


📕 Reference


🔬 Labs

ref Or you can be creative by using your tools

: Install this Machine and will have a lot of Labs like DVWA, BWAPP, Webgoat, etc

🐞
Using Burp to Test for Open Redirections
@ofjaaah
Open-Redirect-Payloads
OpenRedireX
Open-redirect-scanner
Open-redirect
Dalfox
Portswigger
OWASP
PayloadsAllTheThings
Hacktricks
Hackingarticles
Hahwul
S0cket7
Detectify
OWASP Broken Web Applications Project