Pages

Thứ Tư, 31 tháng 10, 2012

Security Guidelines - Hướng Dẫn Bảo Mật Cho vBulletin

+ ) Trong Hướng Dẫn Này Mình sẽ đề Cập tới phương pháp Chmod cho thư mục với Cpanel , Giấu File Config.php bằng phương pháp Hã Móa file , Đổi tên thư mục admincp , modcp . . . .


phương pháp làm :


- mở file config.php trong thư mục includes


tìm dòng :


PHP Code:
$config['Misc']['admincpdir'] = 'admincp'$config['Misc']['modcpdir'] = 'modcp'


admincp đổi thành tên thư mục mới cho admincp ( vd: admincp --> quanlydiendan)


modcp đổi thành tên thư mục mới cho modcp (vd: quanlychomod)


tiếp theo đổi tên thư mục admincp thành tên bạn vừa đổi ở trong file config.php 
( làm tương tự với modcp )


Vẫn tại file config.php 


tìm dòng :


PHP Code:
$config['SpecialUsers']['undeletableusers'] = 'Ních của Admin trong database'


giải thích : là một phương pháp thiết lập ở config.php để ngăn chặn việc xóa, sửa hay thêm bớt thông tin tài khoản admin


- vào thư mục gốc của diễn đàn tạo một thư mục có tên đầu tiên bắt đầu bằng # ( vd : #baomat ) trong file này bạn để file config.php 


bạn xóa toàn bộ dữ liệu trong file config.php này rồi ghi code sau:


PHP Code:
<?php include "#data/usercp.php" ?>


#data/usercp.php 


bạn ghi file config.php thật của mình , mình khuyên các bạn nên đặt file config.php thật ở trong thư mục admincp hoặc 
modcp nhớ là phải tạo thư mục có tên bắt đầu bằng # !


đổi tên cofig.php thật với những tên tương tự gần giống với các file ( ví dụ : config.php đổi tên thật thành usercp.php )


- tại file config.php bạn download về rồi sử dụng công cụ mã hóa file Zend , 
( tốt hơn bạn chỉ mã hóa file config.php có code )
PHP Code:
<?php include "#data/usercp.php" ?>

sau khi mã hóa xong bạn lại upload file config.php lên 




( để đảm bảo an toàn hơn khi hacker có gắng đọc file class_core.php ta viết thêm .htaccess vào với code như sau )


và chmod cho nó 444
PHP Code:
<Files "class_core.php">Order Allow,DenyDeny from All</Files

- mở thư mục includes và tim file class_core.php 
tìm code :


PHP Code:
include(CWD '/includes/config.php');
if (
file_exists(CWD'/includes/config.php'))
die(
'<br /><br /><strong>Configuration</strong>: includes/config.php exists,
die('
<br /><br /><strong>Configuration</strong>: includes/config.php does not exist


includes/config.php 


tại đây bạn ghi file config.php 


có code :


PHP Code:
<?php include "[COLOR="#data/usercp.php" ?>


- chmod cho toàn bộ với những file và thư mục đã thực hiện ở trên 
config.php chmod thành 400 
class_core.php chmod thành 400
usercp.php chmod thành 400 ( file config.php thật )
chmod cho thư mục có chứa những file vừa thực hiện thành 100 ( ví dụ : includes )


-Phương pháp chống những kẻ tò mò tọc mạch
Bạn tạo một file index.html với nội dung tùy ý ở bất cứ folder nào trong host. (kể cả mục skin, imager, và những folder con trong folder , imager ..)


- Che dấu những folder nhạy cảm.
- Bạn có thể dùng .htaccess.
- Rename các folder nhạy cảm như data, databackup, mysqldumper...
- Tạo subdomain để vào VD: sql.yourdomain.com và trỏ tới mysqldumper


- cách phát hiện quá trình xâm nhập 
-Để làm được bạn lần lượt làm theo hướng dẫn ở các bước sau :
Bước 1: edit file login.php ( nó nằng ngang hàng với admincp , index.php )
Bạn tìm:
PHP Code:
$strikes verify_strike_status($vbulletin->GPC['vb_login_username']); 


Và add sau nó:
PHP Code:
$username $vbulletin->GPC['vb_login_username']; $fdate date('l, F jS, Y'); $ftime date('g:i:s a'); $fdatetime "Date/Time: $fdate at $ftime \r\n";$fscriptpath "Script: http://$_SERVER[HTTP_HOST]SCRIPTPATH "\r\n"$freferer 'Referrer: ' REFERRER "\r\n"$fusername "Username tried:$username \r\n"$fipaddress 'IP Address: ' IPADDRESS "\r\n"$iphostname "Host: " . @gethostbyaddr(IPADDRESS) . "\r\n"; if ($vbulletin->userinfo['userid'] > 0) { $realname "\nUSER ATTEMPT: " $vbulletin->options['bbtitle'] . " has identified this registered user as: " $vbulletin->userinfo['username'] . "\r\n"; } 


Bước 2: vẫn ở file login.php
Bạn tìm: 


PHP Code:
// log this error if attempting to access the control panel require_once (DIR . '/includes/functions_log_error.php'); 


Thêm sau nó:


PHP Code:
$fstrk "Strikes: $GLOBALS[strikes] out of 5 \r\n"; if ($vbulletin->GPC['logintype'] === 'cplogin') { $subject'WARNING: Failed Admin CP logon in ' $vbulletin->db->appname ' ' $vbulletin->options['templateversion'] . "\r\n\r\n"$message="Someone is trying to login to your " $vbulletin->options['bbtitle'] . " Admin CP!\n\n$fusername$fipaddress$iphostname$fstrk$f referer$fscriptpath$fdatetime$realname"; } else { $subject'WARNING: Failed Mod CP logon in ' $vbulletin->db->appname ' ' $vbulletin->options['templateversion'] . "\r\n\r\n"$message="Someone is trying to login to your " $vbulletin->options['bbtitle'] . " Mod CP!\n\n$fusername$fipaddress$iphostname$fstrk$f referer$fscriptpath$fdatetime$realname"; } vbmail($vbulletin->options['webmasteremail'], $subject,$messagetrue); 


webmasteremail các bạn chỉnh trongvb options nhé code sẽ tự động gởi mail thông báo quá trình xâm nhập cho bạn.


+ ) Phương pháp chống up shell wa plugin và edit plugin
Bạn chèn đoạn code này vào file config.php (sau dòng <?php)


PHP Code:
define('DISABLE_HOOKS'true); 


một số bạn quyên không xóa file validator.php đi nên bị lộ thông tin việc này chúng ta cũng nên chú ý nha !


Chú ý : phương pháp trên áp dụng cho Cpanel không áp dụng cho window .




Chúc Các Bạn Thành Công ! 

Không có nhận xét nào:

Đăng nhận xét