Web security: more headers

Sixth post in the web security series.

Some more HTTP headers that can be used to increase your web application security.

X-Frame-Options

X-Frame-Options is a header sent by the server to tell the web browser what do to in case of the web application is displayed inside a frame (this is in order to prevent clickjacking).

The possible values for this header are:

This header is widely supported but will be soon obsolete. The same behavior will be possible with the frame-ancestor directive in CSP2 (I will talk about CSP in a later post).

X-XSS-Protection

A XSS filter is included in Internet Explorer since version 8. The filter (which obviously help preventing XSS attacks) can be disabled by the user. IE also provided the X-XSS-Protection header that can be send by servers to control the filter state. This header is now also supported in some other web browsers.

The values are:

X-Content-Type-Options

This header has only one value possible: nosniff. Some web browsers (Internet Explorer…) sometimes try to detect the type of file they are downloading from the file extension instead of the content type header sent by the server. This behaviors can be used for some attacks where the web browser try to execute a file that was not supposed to be executed.

So this header tells teh web browser to use the content type sent by the server (which also means that your web server must send the proper content type).

Works with Internet Explorer and Google Chrome.

Comments Add one by emailing me.