Kamis, 13 September 2012

Anti Hacking WordPress


 Kali ini saya ingin berbagi cara untuk meminimalisasikan celah keamanan pada blog wordpresss, agar parahacker tidak bisa atau minimal susah untuk menghack blog kita. Tips ini saya dapatkan dari forum indonesianhacker.or.id dari thread yang dibuat oleh mas kod0k, tapi saya ambil garis besarnya saja.

 Sebelumnya silahkan dulu buka notepad atau program text editor lainnya seperti Dreamweaver, saran saya lebih baik pake Notepad++ bisa didownload di mari http://notepad-plus-plus.org/download. Bisa juga di edit langsung dari cPanel.
1. Buka wp-comment-post.php, cari kode:
$comment_author = ( isset($_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null;
$comment_author_email = ( isset($_POST['email']) ) ? trim($_POST['email']) : null;
$comment_author_url = ( isset($_POST['url']) ) ? trim($_POST['url']) : null;
$comment_content = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null;

Lalu replace dengan kode ini:
$comment_author = ( isset($_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null;
$comment_author_email = ( isset($_POST['email']) ) ? trim(strip_tags(mysql_real_escape_string($_POST['email']))) : null;
$comment_author_url = ( isset($_POST['url']) ) ? trim(strip_tags(mysql_real_escape_string($_POST['url']))) : null;
$comment_content = ( isset($_POST['comment']) ) ? trim(strip_tags(mysql_real_escape_string($_POST['comment']))) : null;

fungsinya untuk menghilangkan spasi diawal dan diakhir input form, menghilangkan Tag HTML dan mengamankan dari SQL Inject.
2. Buka wp-config.php, dibawah kode: <? php tambahkan kode ini:
error_reporting(0);
gunanya untuk menghilangkan pesan error yang muncul, agar username hosting tetap aman
- terus masuk ke cPanel, ganti permision wp-config.php menjadi CHMOD 400
3. Ubah .htaccess anda menjadi seperti ini:
# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
RewriteRule . /index.php [L]
</IfModule>

<files .htaccess>
order allow,deny
deny from all
</files>

<files /wp-config.php>
order allow,deny
deny from all
</files>

Options All -Indexes
Redirect 301 /wp-config.php http://fbi.gov

# END WordPress
4. Hapus/rename install.php

5. Hapus/rename setup-config.php
6. Buka function.php yang ada di direktori theme yang sedang digunakan atau bisa via theme editor yang ada di dashboard wordpress. Setelah kode <? php tambahkan kode ini:
remove_action('wp_head', 'wp_generator');
7. Install plugin Lockdown WP Admin dan WordPress Firewall, untuk konfigurasi pengaturannya silahkan cari sendiri ya

Incoming search terms for the article:

Tidak ada komentar: