Code chống upload và run shell với .htaccess

ID Topic: 32676 • Có 1,270 lượt xem
Hình đại diện của thành viên
#1 - @427679
26/12/2015 09:51
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:
Mã:<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

AddType application/x-httpd-php-source .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>
(Cốc Cốc 52.2.98)
PM|Trích|Like|Sửa|Xóa|Báo cáo|Cảnh cáo
Sửa lần cuối: nghiammo1992 26/12/2015 09:57
------------
Những người đã like nghiammo1992 bởi bài viết có ích này (Tổng: 2):
Rating: 0.27%
Songoku2014Xaudios
_______________
Diễn đàn chia sẻ kiến thức máy tính:
KETNOI123.COM

Ấn hiện ra để xem chữ ký của mình:
Trả lời nhanh

Chủ đề tương tự