X Frame Options
In this lesson, we'll learn about Clickjacking attacks and the dangers of 3rd-party websites using your iFrames on your website to steal information. Then, we'll learn how X-Frame Options can mitigate these attacks.
We'll cover the following...
The X-Frame-Options HTTP header was introduced to mitigate an attack called Clickjacking. Clickjacking allows an attacker to disguise page elements such as buttons and text inputs by hiding their view behind real web pages which render on the screen using an iframe HTML element or similar objects.
Deprecation Notice: The X-Frame-Options header was never standardized as part of an official specification but many popular browsers today still support it. Its successor is the Content-Security-Policy (CSP) header which will be covered in the next section. Generally, you should focus on implementing CSP for newly built web applications.
The risk
Clickjacking attacks, also known as UI redressing, involve misleading the user to perform a seemingly harmless operation. In reality, the user is clicking buttons that secretly belong to other elements or typing text into an input field that is under the attacker’s control.
Common examples of employing a Clickjacking attack:
- If a bank or email account website doesn’t employ an