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 alre...