The Perl directory causes a very significant security vulnerability on cPanel servers. Shell files (C99, R57, etc.) can easily be uploaded to servers with the Perl directory open. The way to
prevent this is to close this directory. Of course, just closing this directory does not mean that shell files cannot be uploaded to your server. There are also different software operations that need to be done to definitively prevent shell files from being uploaded.
On servers with the Perl directory open, cPanel and webmail can be accessed via /cpanel and /webmail. Hosting companies generally close the Perl directory because they value server security. For this reason, cPanel and webmail can be accessed via ports like
domain.com:2082 instead of /cPanel. Although this may seem like a problem for some users, it is actually a good situation in terms of security. If you access cPanel via port at the hosting company you use, it means the Perl directory is closed and you are generally
receiving service from a secure server. Now let’s look at how to close the Perl Directory;
which perlWhen you type this command, you will get the /usr/local/bin/perl output.
ls -lh
/usr/local/bin/perlWhen you type this command, you will get Perl’s actual directory. A file path like /usr/local/bin/perl -> /usr/bin/perl* will appear and from here you can see the write permissions of the Perl directory.
chmod
700 /usr/local/bin/perlThe write permission the Perl directory needs to have to be closed is 700. With the above command, we set the Perl directory write permission to 700 and close Perl. When we apply this command, as mentioned above, you are now
blocking access to panels via /cPanel and /webmail. The operation that needs to be done now is to ensure that the Perl directory does not become writable again after any cPanel update. This way, the Perl directory will not be writable unless you manually open
it.
chattr -i /usr/bin/perl
chmod 700 /usr/bin/perl
chattr +i /usr/bin/perlWith these commands, we have prevented the Perl directory from becoming writable again. With the chattr command, you lock a file, and while the file is locked,
write operations cannot be performed on it. Now, after any update, the Perl directory write permissions will not change and therefore no security vulnerability will occur. If you do not apply the last locking commands above, the 700 write permission you gave will be
broken after the cPanel update and this file will revert to being writable again, i.e., revert to 777 write permission. To prevent this, you must lock the file.
Leave a Comment
* Your comment will be published after approval.
Comments
0No comments yet. Be the first to comment!