Lets learn "Open Redirect - A web application vulnerability"
In this tutorial , we will be discusssing about a web application vulnerability known as Open Redirect . Redirections are normally done in web applications . For example : If in some website like amazon if session expires during time user is surfing for the products , the user is redirected to the login page which requires the user to login again the access some page . And once the user login again , the user is redirected to the page where he left during session expires . Actually after relogin the redirection url is passed as a parameters which tells the server about the url where user should be redirected if he is able to login successfully .
This redirection can impose a vulnerability on web application . If some attacker change the parameter (redirection url) , then after logging in the user is redirected to the page decided by the hacker which could be malicious . This is something most web application do not wants .
So...
Lets come to definition of Open Redirect .
What is Open Redirect ?
Open redirection vulnerabilities arise when an application incorporates user-controllable data into the target of a redirection in an unsafe way. An attacker can construct a URL within the application that causes a redirection to an arbitrary external domain. This behavior can be leveraged to facilitate phishing attacks against users of the application.
The ability to use an authentic application URL, targeting the correct domain and with a valid SSL certificate (if SSL is used), lends credibility to the phishing attack because many users, even if they verify these features, will not notice the subsequent redirection to a different domain.
Remediations to Open Redirect ?
If possible, applications should avoid incorporating user-controllable data into redirection targets. In many cases, this behavior can be avoided in two ways:
- Remove the redirection function from the application, and replace links to it with direct links to the relevant target URLs.
- Maintain a server-side list of all URLs that are permitted for redirection. Instead of passing the target URL as a parameter to the redirector, pass an index into this list.
If it is considered unavoidable for the redirection function to receive user-controllable input and incorporate this into the redirection target, one of the following measures should be used to minimize the risk of redirection attacks:
- The application should use relative URLs in all of its redirects, and the redirection function should strictly validate that the URL received is a relative URL.
- The application should use URLs relative to the web root for all of its redirects, and the redirection function should validate that the URL received starts with a slash character. It should then prepend http://yourdomainname.com to the URL before issuing the redirect.
- The application should use absolute URLs for all of its redirects, and the redirection function should verify that the user-supplied URL begins with http://yourdomainname.com/ before issuing the redirect.
Hope you are now able to understand what open redirect is , how it is harmful , and how to get rid of it.
For any queries or problems , please comment below .
Till then..
HAPPY HACKING !!
Comments
Post a Comment