How to Protect Site from Clickjacking Attack in Nginx

This time i will review about Protect site from clickjacking attact in nginx, or also known as "UI redress attact" are attacks that utilize transparent layer which aims to trick so that when the user clicks a button or a link on other sites such as the original site. And then the attacker intended to hijack the site by routing them to another site, most likely owned by another application, domain, or both. A common technique they do is with iframe technique.

Protect Site from Clickjacking Attack in Nginx
Nginx

This article I will give some tips and tricks about securing your site for users Nginx. By utilizing the function of the X-Frame-Options header site.

Preparation
  • Make sure you have installed Nginx on your server.
  • Then go to Settings in:
  • For Users Debian/Ubuntu:
$ sudo nano /etc/nginx/sites-availables/default
  • For Users Fedora/CentOS/RHEL:
$ sudo vi /etc/nginx/nginx.conf
  • Then add:
server {
...
add_header X-Frame-Options "SAMEORIGIN";
...
}

See the picture below.

Protect Site from Clickjacking Attack in Nginx

Here are three options in setting the X-frame-options:
  • SAMEORIGIN
This setting allows only the page itself or the page original.
  • DENY
These settings will reject a page that displays your site in frame or iframe.
  • ALLOW-FROM URI
This setting only allow displays of specific links original pages.

(See also: Optimizing in VPS Low Spec)

If you've finished, just you restart or reload your Nginx.

$ sudo service nginx restart
$ sudo systemctl restart nginx


Checking

Try to create an HTML file with the code below:

<DOCTYPE html>
<head>
<title>Test</title>
</head>
<frameset rows="100%,*" border="0">
<frame src="http://yoursite.com" frameborder="0" />
</frameset>
</html>


If only displays whitescreen (white pages) means that you have been successful.

May be useful, if you are still confused, please write your comments below :)
loading...
loading...

Comments

Popular posts from this blog

Dunia Yang Menakjubkan

Natural Beauty Of Western Sumatera Indonesia

6 Games Terminal Linux-based CLI

OverClock Adalah Cara Efektif Untuk Meningkatkan Kinerja Komputer

Differences in Language Java And C++ Program