Friday, February 14, 2014

How to Setup WordPress to Hack Plugins

I'm using this post to document how to install WordPress 3.8.1 on Debian 7 for the purposes of testing plugins. I'm looking on how to do more vulnerability research and WP plugins seems as good of a place as any to start poking around. It's also a good exercise in creating a LAMP stack, albeit probably not the most ideal one.

I'll skim over the part about installing Debian 7 as a virtual machine since that's mostly click through and skip to the part once you first log in.

Updating Debian and Updating the Sudoers File

Once you login the first thing you should probably do is update and upgrade everything. To do that you would normally open up a terminal and type: sudo apt-get update && sudo apt-get dist-upgrade -y
However, the user you logged in as is probably not in the sudoers file so you'll get hit with a message like this:
So before we can actually run our update and upgrade let's add user to the sudoers file. First we'll swtich user by typing the command, su. Then we'll execute the visudo command and add the user account to the sudoers file.
That should open up the sudoers file using the nano editor. Add this line, user ALL=(ALL:ALL) ALL, to the file. I inserted this line after the entry for root and then save and exit. You'll get asked what to save it as. Just save it as /etc/sudoers
Now, let's exit out of our root shell and go back to the user account. Next, we'll update the file, /etc/apt/sources.list so that it'll update itself from the most update repository of software. I had to do this extra step because I didn't choose to update Debian from the network during my install. Edit the /etc/apt/sources.list file and if you have an uncommented line starting with, deb cdrom..., comment it out and add this line, deb stable main. Your sources.list file should look like this.

Then we'll attempt to re-run our update command again.

This may or may not take some time to complete while it updates all of the software on your machine depending on if updated software was installed when you installed Debian.

Installing Our LAMP Stack

Next, let's install the necessary software to support WordPress. If you Google how to install WordPress on Debian you'll probably get 10 different results on how many packages you'll have to install. This is what I used and what worked for me. You may have to install additional packages depending on your situation. I ran this command: sudo apt-get install apache2 mysql-server mysql-client php5 php5-mysql. You should get a list of packages that will get installed:

Once the install kicks off, you'll get asked for a password for the MySQL root:

Configure MySQL

Next we'll configure MySQL. Enter into a MySQL prompt by typing, mysql -u root -p. You'll get prompted for a password.

Then we'll create a database for WordPress to use by typing, create database wordpress;

Next we'll create a user named wpuser with a password of wordpress123 for WordPress to use by typing, grant all on wordpress.* to wpuser@localhost identified by 'wordpress123';

Lastly, we'll push our configuration changes by typing, flush privileges;

Another thing you'll want to do is enable logging for MySQL. This way you can see what kind of queries are being generated. This will be helpful in understanding how to abuse SQL queries if you are trying to perform SQL injections. Open the MySQL configuration file with your editor of choice like this, sudo vim /etc/mysql/my.cnf. Then, uncomment these two lines:
#general_log_file = /var/log/mysql/mysql.log
# general_log = 1

It should look like this:

Then restart MySQL by typing, sudo service mysql restart

For future reference, when you go to pentest a plugin, you can tail the log by typing, sudo tail -f /var/log/mysql/mysql.log. You'll then see all the queries that the plugin is making. It should look similar to this:

Install FTP

Installing an FTP server is also handy because WordPress can automatically install and delete plugins for you. To do this, we'll run the command, sudo apt-get install proftpd, to install the FTP server. During the installation, you will be asked if you want to run proftpd from inetd or standalone. Choose standalone. 

To see if proftpd is running fine we'll run, sudo service proftpd status, and it should report that it is.

Installing WordPress

Now let's download and install WordPress. The most up to date version is currently 3.8.1. You can always get the most up to date version at http:/// To download it we'll run, wget http:///

Once we unzip the file by typing, unzip, we should have a directory named, wordpress. Now we will create the sub-directory that we want our test blog to reside in. I'm going to name it blog so I'll first create the necessary directory by typing, sudo mkdir /var/www/blog, and then cp -R wordpress/* /var/www/blog

Let's update the permissions of the /var/www so that the apache user, www-data, will be able to update files as necessary by typing, sudo chown -R www-data:www-data /var/www

Change directory into /var/www/blog and create a wp-config.php file by copying the sample one provided by typing, cd /var/www/blog, then, sudo cp wp-config-sample.php wp-config.php

Next open up wp-config.php with your editor of choice and we'll update some values. Since we are interested in just doing vulnerability assessments and not hardening this install of WordPress we'll make some compromises in the interest of convenience in order to speed up the installation and testing of plugins. I would not advise doing this on an install that you actually care about. Taking snapshots of your virtual machine early and often is recommended. 
First, we will make it so that the admin panel is remote accessible by setting these properties. In my case, the IP of the virtual machine is and the url to the WordPress installation is /blog
define('WP_HOME', '');
define('WP_SITEURL', '');

Then, we'll disable the automatic updating feature in WordPress. WordPress will update plugins for you if it detects there is a new one available. This is normally nice, but if you're trying to install vulnerable plugins you found on exploitdb then you probably don't want this. The first property should be good enough to disable all updating that takes place, but I threw in the second property if you just want to disable the updating of plugins. 
define('auto_update_plugin', false);

Finally, we will set the properties that WordPress needs to connect to the MySQL database you created earlier and the user you created. 
define('DB_NAME', 'wordpress');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'wordpress123');
define('DB_HOST', 'localhost');

All in all, the properties you set should look like this:

Now we'll open up a web browser and point it to the WordPress install script to set up our blog. Navigate to, You should be presented with a welcome screen. If not, go back and recheck the properties you set in wp-config.php. You most likely messed up the database properties. 

Go ahead and fill in whatever values you'd like for the Site Title, Username, Password, and E-mail (it doesn't have to be valid). Once you're done hit the Install WordPress button and then login.

Installing Plugins Manually

We will start out with manually installing a vulnerable plugin found here, as an example. (Disclaimer: I chose this vulnerable plugin at random. I have no connection to the author of the exploit.) Download the vulnerable plugin and then click on Plugins, then Add New. From the Install Plugins screen, there should be a link that you can click on to upload a plugin in .zip format. 

In the next webpage, click on the Choose File button, select the file you just downloaded, and click the Install Now button. 

You'll be forwarded to another webpage indicating that the plugin has been uploaded, unpacked, and installed. Finally you'll want to activate the plugin by clicking the Activate Plugin link. 

Now, you'll be forwarded to the main Plugins page and you'll see that the vulnerable plugin is listed along with the Akismet and Hello Dolly plugins that came pre-installed. You should also see a ThinkIT Contact entry on the left hand side toolbar.

Replicating the Vulnerability

Excellent, now we can try to trigger the XSS vulnerability. From the description we know that we can trigger a XSS attack from this URL, wp-admin/admin.php?toitcf_current_id=[XSS]&page=toitcf. First we'll need to create a form so first, click on the ThinkIT Contact entry on the toolbar and then click on Create New Form. 

A default form will then appear. We don't care what entries these hold so we'll leave them as is and then go to the bottom and click the Save button. 

Once you hit Save, you'll be sent to the default page for the ThinkIT Contact plugin. You should now see an entry for the form you created. If you hover over the Edit link, you should notice that the link has the same format of the URL described in the exploitdb entry, Click the Edit link. 

The vulnerability description makes it sound like whatever value we pass in for toitcf_current_id parameter will get reflected. Let's try setting toitcf_current_id to have the value, 'hacked'. We should expect to see the word hacked somewhere in the webpage or perhaps in the source. Once you set toitcf_current_id to hacked in the URL load the webpage. By navigating to we were able to get the word hacked on the webpage.

The only thing left to do is to set toitcf_current_id to be some JavaScript and see if it will be executed. Navigate to<script>alert(1)</script>&page=toitcf and if all goes as planned you'll see a dialog popup with the text, 1.

And there you have it! You have been able to replicate the vulnerability described in the exploitdb entry. 

Now What...

Now you can feel free to manually install other vulnerable WordPress plugins to replicate the exploit or go through the Plugins -> Add New menu to install new plugins and do your own assessments of them to find your own vulnerabilities.

Edit: 2/16/2014 - Made updates to explain how to enable MySQL logging


  1. I think this is one of the most significant information for me. And i’m glad reading your article. But should remark on some general things, The web site style is perfect, the articles is really great : D. Good job, cheers
    WPEngine coupon

  2. Hacks in PVP are extremely regular and it is difficult to keep away from them. There is no real way to check players are making utilization of hacks in the event that it is a radar or autocombo include. You just should acknowledge it, or go along with them yourself. click it

  3. It’s hard to find educated people on this subject, however, you seem like you know what you’re talking about! Thanks, find more info!

  4. If there should be an occurrence of moderate wordpress web design, online dealers request more offices and utilization of most recent advances and that is additionally to the detriment of little speculation. Web Design Athens

  5. Cost effective Woocommerce development and store design services.

  6. SEOProfiler suits businesses of all sizes, and are perfect for a team based approach to SEO, as it supports multi-user accounts.ann arbor seo

  7. very interesting post.this is my first time visit here.i found so mmany interesting stuff in your blog especially its discussion..thanks for the post! UP Ration Card details

  8. A long time ago, when someone said WordPress, everyone automatically thought of blogging.woocommerce crm integration

  9. Wonderfully astonished to see this meshwork of stunning words.

  10. A month prior, I was hunting down a WordPress shopping basket module (programming) to manufacture an online store to advance and offer my items and administrations.swift member 2.0 review

  11. Almost since the invention of the video game there has been a way to enter a video game cheat code jailbreak roblox cheat

  12. Using WordPress for the development of website is one of the highly recommended methods of experts.  thrive content builder

  13. Many people have heard of WordPress, but do not understand the full capabilities of the system. Most people think that WordPress is a platform for blogging when, in fact, it is far more than that.

  14. As a home for your business, your website can showcase your skills, provide details of your experience, and give potential clients and customers a convenient way to get in touch.wordpress speed plugin


  15. There is no official version of the software available for Windows PC as it is developed by Apple and so only available for iPhone, iPad, iPod Touch and Mac devices Garageband for Windows Downloads If you want to download GarageBand on your Windows PC, then you can download GarageBand for Windows from RareSoftware

  16. Very informative post. I am sure that I am not the one who thinks that, it can really be hard to setup WordPress on Debian.

  17. Thanks a lot for sharing this amazing knowledge with us. This site is fantastic. I always find great knowledge from it. Modern secure coding practices

  18. Oi! Tudo bom? Seu material é muito bom e eu aprovei tudo o que você informou neste artigo de muito aprendizado! Parabéns pelo ótimo conteúdo e muito sucesso para você.

    OBS: Também tenho um Site para falar sobre dicas de saúde, dieta para diabéticos e saúde dos idosos. Caso queira fazer uma vizitinha, fica à vontade, pois será bem recebido.

  19. Smartphone market in India is very big but still 300m people still do not have access to smartphone In India and so JioPhone Next Specifications are the best.

  20. Wanna know details of Jio Phone ? Jio have not yet announced anything about this smartphone JioPhone Next Price
    and other details are not yet confirmed.

  21. Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man,Keep it up. Meanwhile visit our website for ntcc project amity university

  22. If you are planning to study or work abroad then you have to take the IELTS test to prove your English language efficiency. Then you have to join the best IELTS Coaching in Delhi for the preparation IELTS test. We aim to develop the student completely. Hence, Multilingua gives training for all the four sections of IELTS, that is, reading, writing, listening, and speaking. All the courses and training are majorly crafted to make you shine in your exam. Mastering all four sections will help you gain a good pointers.

  23. Do you need your credit fixed in order to qualify for a loan, I recommend 760Plus Credit score. They helped me achieve my long term dream of becoming a home owner. I think they are the best right now; they are highly rated in many credit forums. You can reach out to them today for any credit related issues, thank me later. Contact them via mail at 760pluscreditscore at gmail dot com.

  24. Are you in need of a credit specialist to help you fix your poor credit? Then I strongly recommend Metronet Credit Solution. I had a very poor credit which made it impossible for me to acquire an auto loan, but my problem was solved when I met Metronet Credit Solution on Reddit. They helped me erase every irregularity and boosted my score to 801, 780 and 775. With our new car life is a lot easier. You can contact them via email: or whatsapp: +16265140620