The OpenNET Project
 
Search (keywords):  SOFT ARTICLES TIPS & TRICKS SECURITY
LINKS NEWS MAN DOCUMENTATION


[KAPDA::#6] Punbb SQL Injection Vulnerability


<< Previous INDEX Search src Set bookmark Go to bookmark Next >>
Date: 14 Oct 2005 19:07:23 -0000
From: [email protected]
To: [email protected]
Subject: [KAPDA::#6] Punbb SQL Injection Vulnerability
X-Virus-Scanned: antivirus-gw at tyumen.ru

[KAPDA::#6] Punbb SQL Injection Vulnerability

Punbb search.php SQL Injection Vulnerability

KAPDA New advisory

Vulnerable products : Punbb ( V 1.2.8 and 1.2.7 are tested,Hopefully all other versions) 

Vendor: http://www.punbb.org/

Vulnerability: Sql injection

About Punbb
--------------------
   PunBB is a fast and lightweight PHP-powered discussion board. It is released under the GNU 

General Public License. Its primary goals are to be faster, smaller and less graphically intensive

as compared to other discussion boards. PunBB has fewer features than many other discussion

boards, but is generally faster and outputs smaller, semantically correct XHTML-compliant pages.

        Vendor`s description : http://punbb.org/about.php


Discussion :
----------------
  Scripts in page "Search.php" do not properly validate user-supplied input. A remote user can

create specially crafted parameter values that will execute SQL commands on the underlying

database.

  While "Global_register" of php.ini is set ON ,Remote user can poison local variables

of PHP pages to take control of web application or change its logical flow.
 
Vulnerabilities:
--------------------
In Search.php :

.......... start ...........

if ($db->num_rows($result))
{
while ($row = $db->fetch_row($result))
$old_searches[] = '\''.$db->escape($row[0]).'\'';
$db->query('DELETE FROM '.$db->prefix.'search_cache WHERE ident NOT IN('
.implode(',', $old_searches).')') or error('Unable to delete search results'
, __FILE__, __LINE__, $db->error());
}

.......... end ...........

 The 4th line of pasted code sets old_searches[] (array) to carefully validated data,

returned from database and then at next line it sends another query containing

old_searches[].

 If  "Global_register" of php.ini is set ON and there is no SQL injection filters ( or magic_quotes)

then poisoning old_searches can let remote users directly execute SQL commands.

Proof of Concepts:
--------------------
http://[site]/search.php?action=search&keywords=&author=d3vilbox&
forum=-1&search_in=all&sort_by=0&sort_dir=DESC&show_as=topics
&search=Submit&old_searches[]=[sql injection]


Solution:
--------------------
find :
.......... Start ...........


if ($db->num_rows($result))
        {
while ($row = $db->fetch_row($result))
                
$old_searches[] = '\''.$db->escape($row[0]).'\'';
.......... End ...........

and add "$old_searches=array();" before beginning of "While" to clear old_searches.

it should looks like :

.......... Start ...........


$old_searches = array();
 

if ($db->num_rows($result))
        {
while ($row = $db->fetch_row($result))
                
$old_searches[] = '\''.$db->escape($row[0]).'\'';
.......... End ...........

More Detail:
--------------------
http://www.kapda.ir/advisory-91.html
Visit above link for more details.

Credit :
--------------------
Devil_box of KAPDA
devil_box [at}  kapda.ir
Kapda - Security Science Researchers Insitute of Iran
http://www.KAPDA.ir
(PersianHacker.NET)

Original Advisory : http://www.kapda.ir/advisory-91.html
Special thanks to : Trueend and Irannetjob


<< Previous INDEX Search src Set bookmark Go to bookmark Next >>



Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2025 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру