-- Practice Final
Nikitha Adira, Shweta Sugnani, Amrit Sandhu, Nanthana Thanonklin, Mirat Panchal
8. Briefly explain the following two website attacks and explain how to avoid them (a) SQL Injection, (b) target blank attack.
a. SQL injection attacks are a type of injection attack, in which SQL commands are injected into web-page input in order to effect the execution of predefined SQL commands (to gain access to resources or make changes to data). Can be avoided by: (i) using PHP commands like mysqli_escape_string() or add slashes around posted var to prevent this problem. (ii) Or better yet, use prepared statements rather than ad hoc queries- they are both faster and safer.
b. "When a website uses target="_blank" on their links in order to open a new tab or window, that website gives the new page access to the existing window through the window.opener API, allowing it a few permissions. Some of these permissions are automatically negated by cross-domain restrictions, but window.location is fair game."
Some older websites that implement the target="_blank" attribute on links or older browsers that have target="_blank" are leaving visitors open to data theft and phishing attacks.
How to fix
To prevent the attack, should set as rel="noopener noreferrer". I.e.,
<a href="http://somewhere.com/" target="_blank" rel="noopener noreferrer">Go Somewhere</a>
(
Edited: 2016-12-12)
Nikitha Adira, Shweta Sugnani, Amrit Sandhu, Nanthana Thanonklin, Mirat Panchal
8. Briefly explain the following two website attacks and explain how to avoid them (a) SQL Injection, (b) target blank attack.
a. SQL injection attacks are a type of injection attack, in which SQL commands are injected into web-page input in order to effect the execution of predefined SQL commands (to gain access to resources or make changes to data). Can be avoided by: (i) using PHP commands like mysqli_escape_string() or add slashes around posted var to prevent this problem. (ii) Or better yet, use prepared statements rather than ad hoc queries- they are both faster and safer.
b. "When a website uses target="_blank" on their links in order to open a new tab or window, that website gives the new page access to the existing window through the window.opener API, allowing it a few permissions. Some of these permissions are automatically negated by cross-domain restrictions, but window.location is fair game."
Some older websites that implement the target="_blank" attribute on links or older browsers that have target="_blank" are leaving visitors open to data theft and phishing attacks.
How to fix
To prevent the attack, should set as rel="noopener noreferrer". I.e.,
<a href="http://somewhere.com/" target="_blank" rel="noopener noreferrer">Go Somewhere</a>