Categories: cPanelSecurity

How to avoid or prevent Symlink Attack .

Symlink Security issue is one of the critical problem of the any web hosting.

Here you can find , how attacker uses synlink to attack on your web site

For Instance ,

Attacker uses a perl / pythone scripts or uses a cron job symbalic link of top level directory ”/” typing: “ln -s / anydir” to gain the access of the file.

 

How to prevent symlink attack ?

There are many symlink attack solution are flowing over the internet. Here you will find comprehensive solution for this attack. We would like recommend the filesystem level solution and kernal + apache solution as given below.

 

1) Installation of CageFS : CloudLinux

 

 

CloudLinux is integrated with Apache (suexec, suPHP, mod_fcgid, mod_fastcgi) . This is core feature which will help you to avoid symlink attacks. You will have good control over your system. You can find here installation of the CageFS Cloud Linux here .

 

 

 

2) Jail Apache Virtual Hosts Via mod_ruid2 and cPanel Jailshell

When you enable this option from security tab from the WHM then, this action will run Apache virtual hosts in a chrooted environment.To enable this option you find the steps here

 

3) Kernal Patch solution :

To use this patch you required custom kernal and installation knowledge.

+config GRKERNSEC_SYMLINKOWN
+   bool "Kernel-enforced SymlinksIfOwnerMatch"
+   default y if GRKERNSEC_CONFIG_AUTO && GRKERNSEC_CONFIG_SERVER
+   help
+     Apache's SymlinksIfOwnerMatch option has an inherent race condition
+     that prevents it from being used as a security feature.  As Apache
+     verifies the symlink by performing a stat() against the target of
+     the symlink before it is followed, an attacker can setup a symlink
+     to point to a same-owned file, then replace the symlink with one
+     that targets another user's file just after Apache "validates" the
+     symlink -- a classic TOCTOU race.  If you say Y here, a complete,
+     race-free replacement for Apache's "SymlinksIfOwnerMatch" option
+     will be in place for the group you specify. If the sysctl option
+     is enabled, a sysctl option with name "enforce_symlinksifowner" is
+     created.

 

The above solution is recommend by the grsecurity

 

4) Install Secure link for apache :

The way it works, it makes sure that the file that will be served by Apache is owned by the same user, as the owner of VirtualHost. We pick up the owner of virtual host from SuexecUserGroup directive.
This makes the protection unbreakable via any race conditions, hard links or symbolic links.

 

How to install Secure Link for apache

These are the answer for how to prevent symlink attack .

 

Of course you don’t have to worry about your security issues,if uses one of the plans from Linux shared web hosting. Hostripples security team is already know the issues and countermeasures.

PS. If you liked this post please share it with your friends on the social network

 

 

 

 

 

 


Vishwajit Kale
Vishwajit Kale blazed onto the digital marketing scene back in 2015 and is the digital marketing strategist of Hostripples, a company that aims to provide affordable web hosting solutions. Vishwajit is experienced in digital and content marketing along with SEO. He's fond of writing technology blogs, traveling and reading.

Recent Posts

The Ultimate Guide to WordPress Maintenance: Tips and Tricks

When you’re running a business that relies on website traffic and sales to succeed. Then you need to keep it…

4 days ago

Migrate In 2024: Our Comprehensive Website Migration Manual to the Next Level

Migration! Yes, this word is very big in the web hosting industry and it has its importance. Especially for businesses…

6 days ago

Unveiling the Importance of Server Maintenance Plans: A Comprehensive Guide

The server is the backbone of the web hosting industry and it acts like a HERO in the web hosting…

2 weeks ago

IP Address is Blocked? A handpicked list of Solutions to Fix it?

Imagine you are on holiday having a cup of tea and browsing your website or blog.Then, what next?You will get…

3 weeks ago

Explained: Difference between Nameservers Vs. DNS

The web hosting industry is growing every minute, day, and year. It has many terminologies that are important to understand…

1 month ago