Skip to main content

Posts

Showing posts from February, 2020

Secure Apache from clickjacking attacks using X-FRAME-OPTIONS y Content Security Policy (CSP) frame-ancestors HTTP headers

In an earlier post , we wrote about clickjacking attacks: its definition, how to know if a website or a web application is vulnerable and different protection techniques [ 1 ]. In this post we will demonstrate how to configure the Apache web server in order to protect it against these kind of attacks. As we have seen, there is not a unique mechanism to protect Apache from all the possible clickjacking attacks, but a good alternative is the use of the  X-Frame-Options  header[ 2 ] together with the frame-ancestors directive of the  Content Security Policy (CSP) header [ 3 ]. Luckily, Apache can be configured to add both headers to all its HTTP/HTTPS responses in order not to depend on the programmer of the website or the web application to do it inside their code. To make Apache add these two HTTP headers in Debian-based distributions (Ubuntu included) the following has to be done: Step 1 : Activate the headers module in the Apache configuration, if not active already: # sudo

Proteger Apache contra ataques de clickjacking a través de las cabeceras X-FRAME-OPTIONS y Content Security Policy (CSP) frame-ancestors

En nuestro post anterior escribimos sobre los ataques de clickjacking: su definición, cómo saber si un sitio o aplicación web es vulnerable y diferentes técnicas de protección [ 1 ]. En este post vamos a ver como configurar el servidor web Apache para que esté protegido contra este tipo de ataque. Como vimos, no existe un único mecanismo que permita defenderse contra todos los posibles ataques de clickjacking, pero una buena medida es el uso de la cabecera  X-Frame-Options  [ 2 ] en conjunto con la directiva  frame-ancestors de la cabecera  Content Security Policy (CSP)  [ 3 ]. Por suerte, se puede configurar Apache para que agregue ambas cabeceras a todas sus respuestas HTTP/HTTPS, de forma no se depende de que el programador del sitio o la aplicación web lo haga dentro de su código. En las distribuciones basadas en Debian (incluidas Ubuntu) para hacer que Apache agregue estas dos cabeceras HTTP hay que hacer lo siguiente: Paso 1 : Si no está activado, activar el módulo head