Chủ đề: Code chống upload và run shell với .htaccess
![]() | ![]() ![]() ![]() 11:13 / 26.12.2015 |
Như các bạn đã biết thì rất nhiều hacker lợi dụng chức năng upload của mã nguồn để upload shell lên website nhằm deface, hack, drop data,... Các hacker up nhiều loại shell như r57.php.jpg, c99.php.jpg,...
Và để chống việc các hacker up shell lên mà không run được, các bạn chỉ cần tạo file .htaccess trong thư mục upload, rồi thêm đoạn code sau vào file .htaccess:
''.highlight('
<Files *>
Order Allow,Deny
Deny from All
</Files>
RemoveHandler .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml .png.phtml .jpg.phtml .gif.phtml .bmp.phtml .psd.phtml .jpeg.phtml .png.php .jpg.php .gif.php .bmp.php .psd.php .jpeg.php .png.php3 .jpg.php3 .gif.php3 .bmp.php3 .psd.php3 .jpeg.php3 .png.php4 .jpg.php4 .gif.php4 .bmp.php4 .psd.php4 .jpeg.php4 .png.php5 .jpg.php5 .gif.php5 .bmp.php5 .psd.php5 .jpeg.php5 .png.php6 .jpg.php6 .gif.php6 .bmp.php6 .psd.php6 .jpeg.php6 .png.phps .jpg.phps .gif.phps .bmp.phps .psd.phps .jpeg.phps .png.pl .jpg.pl .gif.pl .bmp.pl .psd.pl .jpeg.pl .png.asp .jpg.asp .gif.asp .bmp.asp .psd.asp .jpeg.asp .png.aspx .jpg.aspx .gif.aspx .bmp.aspx .psd.aspx .jpeg.aspx .png.shtml .jpg.shtml .gif.shtml .bmp.shtml .psd.shtml .jpeg.shtml .png.shtm .jpg.shtm .gif.shtm .bmp.shtm .psd.shtm .jpeg.shtm .png.fcgi .jpg.fcgi .gif.fcgi .bmp.fcgi .psd.fcgi .jpeg.fcgi .png.fpl .jpg.fpl .gif.fpl .bmp.fpl .psd.fpl .jpeg.fpl .png.jsp .jpg.jsp .gif.jsp .bmp.jsp .psd.jsp .jpeg.jsp .png.htm .jpg.htm .gif.htm .bmp.htm .psd.htm .jpeg.htm .png.html .jpg.html .gif.html .bmp.html .psd.html .jpeg.html .png.wml .jpg.wml .gif.wml .bmp.wml .psd.wml .jpeg.wml
<Files ~ ”\.(inc|sql|php|cgi|pl|asp|aspx|jsp|txt|phtml|php3|php4|php5|php6|phps|shtml|shtm|fcgi|fpl|htm|html|wml)$”>
order allow,deny
deny from all
</Files>
').''
Và để chống việc các hacker up shell lên mà không run được, các bạn chỉ cần tạo file .htaccess trong thư mục upload, rồi thêm đoạn code sau vào file .htaccess:
''.highlight('
<Files *>
Order Allow,Deny
Deny from All
</Files>
RemoveHandler .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml .png.phtml .jpg.phtml .gif.phtml .bmp.phtml .psd.phtml .jpeg.phtml .png.php .jpg.php .gif.php .bmp.php .psd.php .jpeg.php .png.php3 .jpg.php3 .gif.php3 .bmp.php3 .psd.php3 .jpeg.php3 .png.php4 .jpg.php4 .gif.php4 .bmp.php4 .psd.php4 .jpeg.php4 .png.php5 .jpg.php5 .gif.php5 .bmp.php5 .psd.php5 .jpeg.php5 .png.php6 .jpg.php6 .gif.php6 .bmp.php6 .psd.php6 .jpeg.php6 .png.phps .jpg.phps .gif.phps .bmp.phps .psd.phps .jpeg.phps .png.pl .jpg.pl .gif.pl .bmp.pl .psd.pl .jpeg.pl .png.asp .jpg.asp .gif.asp .bmp.asp .psd.asp .jpeg.asp .png.aspx .jpg.aspx .gif.aspx .bmp.aspx .psd.aspx .jpeg.aspx .png.shtml .jpg.shtml .gif.shtml .bmp.shtml .psd.shtml .jpeg.shtml .png.shtm .jpg.shtm .gif.shtm .bmp.shtm .psd.shtm .jpeg.shtm .png.fcgi .jpg.fcgi .gif.fcgi .bmp.fcgi .psd.fcgi .jpeg.fcgi .png.fpl .jpg.fpl .gif.fpl .bmp.fpl .psd.fpl .jpeg.fpl .png.jsp .jpg.jsp .gif.jsp .bmp.jsp .psd.jsp .jpeg.jsp .png.htm .jpg.htm .gif.htm .bmp.htm .psd.htm .jpeg.htm .png.html .jpg.html .gif.html .bmp.html .psd.html .jpeg.html .png.wml .jpg.wml .gif.wml .bmp.wml .psd.wml .jpeg.wml
<Files ~ ”\.(inc|sql|php|cgi|pl|asp|aspx|jsp|txt|phtml|php3|php4|php5|php6|phps|shtml|shtm|fcgi|fpl|htm|html|wml)$”>
order allow,deny
deny from all
</Files>
').''
Bạn vui lòng Like bài viết để không xem được nội dung