Skip to content

Insecure HTTP Header Setting: X-Frame-Options

Insecure HTTP Header Setting: X-Frame-Options

Description

The X-Frame-Options HTTP header field indicates a policy that specifies whether the browser should render the transmitted resource within a frame or an iframe. Servers can declare this policy in the header of their HTTP responses to prevent clickjacking attacks, which ensures that their content is not embedded into other pages or frames.

Recommendation

  • Sending the proper X-Frame-Options in HTTP response headers instructing the browser not to allow framing from other domains.
    • X-Frame-Options: DENY It completely denies being loaded in frame/iframe.
    • X-Frame-Options: SAMEORIGIN allows only if the site which wants to load has the same origin.
    • X-Frame-Options: ALLOW-FROM URL grants a specific URL to load itself in an iframe. However, please pay attention to that; not all browsers support this.
  • Employing defensive code in the UI to ensure that the current frame is the top-level window.

Standards