Waraxe IT Security Portal  
  Login or Register
::  Home  ::  Search  ::  Your Account  ::  Forums  ::   Waraxe Advisories  ::  Tools  ::
September 30, 2023
 Members List
 IRC chat
 Base64 coder
 MD5 hash
 CRC32 checksum
 ROT13 coder
 SHA-1 hash
 Sql Char Encoder
 y3dips ITsec
 Md5 Cracker
 User Manuals
 Recommend Us
 Your Account

User Info
Welcome, Anonymous

Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9145

People Online:
Visitors: 406
Members: 0
Total: 406
PacketStorm News
·301 Moved Permanently

[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


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))



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:


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:



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

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 \computernamesharefilename 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:


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


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!


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


Janek Vind "waraxe"

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

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

Copyright © by Waraxe IT Security Portal All Right Reserved.

Published on: 2005-01-06 (21270 reads)

[ Go Back ]
Top members by posts
waraxe  waraxe - 2407
vince213333  vince213333 - 737
pexli  pexli - 665
Mullog  Mullog - 540
demon  demon - 485
shai-tan  shai-tan - 477
Cyko  Cyko - 375
tsabitah  tsabitah - 328
y3dips  y3dips - 281
Currently there is a problem with headlines from this site

Space Raider game for Android, free download - Space Raider gameplay video - Zone Raider mobile games
All logos and trademarks in this site are property of their respective owner. The comments and posts are property of their posters, all the rest (c) 2004-2020 Janek Vind "waraxe"
Page Generation: 0.131 Seconds