> For the complete documentation index, see [llms.txt](https://kathan19.gitbook.io/howtohunt/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kathan19.gitbook.io/howtohunt/open-redirection/find_openredirect_trick.md).

# Find OpenRedirect Trick

*"I apply this everytime while testing web applications and found many Open Redirects and even an XSS using this trick!"*

## Steps:

1. If the Applictaion have a user Sign-In/Sign-Up feature, then register a user and log in as the user.
2. Go to your user profile page , for example : samplesite.me/accounts/profile
3. Copy the profile page's URL
4. Logout and Clear all the cookies and go to the homepage of the site.
5. Paste the Copied Profile URL on the address bar
6. If the site prompts for a login , check the address bar , you may find the login page with a redirect parameter like the following
   * <https://samplesite.me/login?next=accounts/profile>
   * <https://samplesite.me/login?retUrl=accounts/profile>
7. Try to exploit the parameter by adding an external domain and load the crafted URL eg:- <https://samplesite.me/login?next=https://evil.com/> (or) <https://samplesite.me/login?next=https://samplesite.me@evil.com/> #(to beat the bad regex filter)
8. If it redirects to evil.com , thers's your open redirection bug.
9. Try to leverage it to XSS eg:- <https://samplesite.me/login?next=javascript:alert(1);//>

### Author:  [febinrev](https://twitter.com/febinrev)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kathan19.gitbook.io/howtohunt/open-redirection/find_openredirect_trick.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
