Is it a good practice to use an empty URL for a HTML form's action attribute? (action=“”)

后端 未结 11 2304
花落未央
花落未央 2020-11-22 01:50

I am wondering if anyone can give a \"best practices\" response to using blank HTML form actions to post back to the current page.

There is a post asking what a blan

11条回答
  •  春和景丽
    2020-11-22 02:19

    Not including the action attribute opens the page up to iframe clickjacking attacks, which involve a few simple steps:

    • An attacker wraps your page in an iframe
    • The iframe URL includes a query param with the same name as a form field
    • When the form is submitted, the query value is inserted into the database
    • The user's identifying information (email, address, etc) has been compromised

    References

    • Bypassing CSRF protections with ClickJacking and HTTP Parameter Pollution

提交回复
热议问题