Waraxe IT Security Portal  
  Login or Register
::  Home  ::  Search  ::  Your Account  ::  Forums  ::   Waraxe Advisories  ::  Tools  ::
March 29, 2024
Menu
 Home
 Logout
 Discussions
 Forums
 Members List
 IRC chat
 Tools
 Base64 coder
 MD5 hash
 CRC32 checksum
 ROT13 coder
 SHA-1 hash
 URL-decoder
 Sql Char Encoder
 Affiliates
 y3dips ITsec
 Md5 Cracker
 User Manuals
 AlbumNow
 Content
 Content
 Sections
 FAQ
 Top
 Info
 Feedback
 Recommend Us
 Search
 Journal
 Your Account



User Info
Welcome, Anonymous
Nickname
Password
(Register)

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

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

read more...
Log in Register Forum FAQ Memberlist Search
IT Security and Insecurity Portal

www.waraxe.us Forum Index -> PhpNuke -> New security flaws in phpnuke all versions!
Post new topic  Reply to topic View previous topic :: View next topic 
New security flaws in phpnuke all versions!
PostPosted: Thu Jun 03, 2004 10:37 am Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Original info is here:

http://groups.google.com/groups?selm=c9imp3%241dmq%241%40FreeBSD.csie.NCTU.edu.tw&output=gplain

So, security check against scripts direct access will fail on many cases in phpnuke. And thats for all the nuke versions.

Try this on nukecops site:

http://www.nukecops.com/modules/News/categories.php

and you see right message.

Now try this:

http://www.nukecops.com/modules/News/categories.php/modules.php

... and you see

Code:
Warning: main(mainfile.php): failed to open stream: No such file or directory in /usr/local/apache/htdocs/nukecops/modules/News/categories.php on line 19

Fatal error: main(): Failed opening required 'mainfile.php' (include_path='./:/usr/local/lib/php:/usr/lib/php:/usr/bin/:/usr/share/pear') in /usr/local/apache/htdocs/nukecops/modules/News/categories.php on line 19


This is VERY BAD security news for all the phpnuke webmasters Confused


Last edited by waraxe on Mon Feb 14, 2005 10:19 pm; edited 1 time in total
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Thu Jun 03, 2004 8:30 pm Reply with quote
Dogman
Beginner
Beginner
 
Joined: May 18, 2004
Posts: 2




Hm,...

first aid could be this one ( it worked for me ):

http://www.gijza.net/downloads-cat-1.html

But dont't forget to fix it... Very Happy --> http://www.waraxe.us/?modname=sa&id=010

Or you put an ".htaccess"-file like this:
Code:

ErrorDocument 401 http://www.YourDomain.com/error.html
ErrorDocument 403 http://www.YourDomain.com/error.html
ErrorDocument 404 http://www.YourDomain.com/error.html
ErrorDocument 500 http://www.YourDomain.com/error.html

in the Root of your PHPNuke...

You have to make your own "error.html"...

Dogman Cool
View user's profile Send private message
PostPosted: Thu Jun 03, 2004 8:34 pm Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Seems, that most of the phpnuke script files must be corrected against direct access possibilities, and this time permanently! I suggest to use phpBB style - first in mainfile.php some constant, like "IN_NUKE" will be defined, and then in any script beginning is check for it. Constants can't be injected from outside, so it will be bulletproof protection.
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Sat Jun 05, 2004 3:39 pm Reply with quote
Tank863
Regular user
Regular user
 
Joined: May 18, 2004
Posts: 5




waraxe...

can you show us 'non-coders' or newbie coders an example of how we can fix this?

Tank863
View user's profile Send private message
PostPosted: Sat Jun 05, 2004 11:09 pm Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Ok, first thing, open the mainfile.php and look at beginning:

Code:

<?php

/************************************************************************/
/* PHP-NUKE: Advanced Content Management System                         */
/* ============================================                         */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Additional security checking code 2003 by chatserv                   */
/* http://www.nukefixes.com -- http://www.nukeresources.com             */
/************************************************************************/

//Union Tap
//Copyright Zhen-Xjell 2004 http://nukecops.com
//Beta 3 Code to prevent UNION SQL Injections
unset($matches);
unset($loc);


Now add constant definition after copyright messages:

Code:

<?php

/************************************************************************/
/* PHP-NUKE: Advanced Content Management System                         */
/* ============================================                         */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Additional security checking code 2003 by chatserv                   */
/* http://www.nukefixes.com -- http://www.nukeresources.com             */
/************************************************************************/
define('IN_NUKE',1);
//Union Tap
//Copyright Zhen-Xjell 2004 http://nukecops.com
//Beta 3 Code to prevent UNION SQL Injections
unset($matches);
unset($loc);


Now you can secure all the affected scripts, mentioned in bugtraq advisory. For example "/modules/news/print.php". Open it:

Code:

<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/*         Additional security & Abstraction layer conversion           */
/*                           2003 chatserv                              */
/*      http://www.nukefixes.com -- http://www.nukeresources.com        */
/************************************************************************/

if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
   die ("You can't access this file directly...");
}
require_once("mainfile.php");


and now change original checking routine as here:

Code:

<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/*         Additional security & Abstraction layer conversion           */
/*                           2003 chatserv                              */
/*      http://www.nukefixes.com -- http://www.nukeresources.com        */
/************************************************************************/

if(!defined('IN_NUKE'))
{
   die('<html><header><title>Stop!</title></header><body><a href="http://www.waraxe.us">Secured by waraxe</a></body></html>');
}

require_once("mainfile.php");


Offtopic remark - this line

Code:

require_once("mainfile.php");

is nonsense in all of the not directly accessed scripts by my opinion, because mainfile is allready processed in index.php,admin.php or modules.php . Just useless piece of code... , or am i wrong? Any opinions?
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Sun Jun 06, 2004 9:33 am Reply with quote
Tora
Regular user
Regular user
 
Joined: May 19, 2004
Posts: 9
Location: Germany




Quote:
is nonsense in all of the not directly accessed scripts by my opinion, because mainfile is allready processed in index.php,admin.php or modules.php . Just useless piece of code... , or am i wrong? Any opinions?
Hi Smile
That is correct. This line is redundant and useless.
View user's profile Send private message Visit poster's website
PostPosted: Sun Jun 06, 2004 5:45 pm Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Seems, that its time for PhpNuke 8.0 to come out - with all the patches and code rewrites, and hopefully md5 hash in user cookies will be replaced with session ID-s, like in case of phpBB.
View user's profile Send private message Send e-mail Visit poster's website
a
PostPosted: Sun Jun 06, 2004 7:57 pm Reply with quote
SteX
Advanced user
Advanced user
 
Joined: May 18, 2004
Posts: 181
Location: Serbia




I dont think that php-nuke will be relased soon...

_________________

We would change the world, but God won't give us the sourcecode...
....Watch the master. Follow the master. Be the master....
-------------------------------------------------------
View user's profile Send private message
PostPosted: Tue Jun 08, 2004 10:16 am Reply with quote
Good CO
Beginner
Beginner
 
Joined: Jun 08, 2004
Posts: 2




I'm completely new to the security side of php nuke (thank you for the wakeup call), so forgive me if this is a stupid question, but can you not deal totally with the path disclosure issue using php.ini?:

; Print out errors (as a part of the output). For production web sites,
; you're strongly encouraged to turn this feature off, and use error logging
; instead (see below). Keeping display_errors enabled on a production web site
; may reveal security information to end users, such as file paths on your Web
; server, your database schema or other information.
display_errors = Off
View user's profile Send private message
PostPosted: Tue Jun 08, 2004 10:51 am Reply with quote
waraxe
Site admin
Site admin
 
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Its true, that this works, and its good style for silence error messages for finalized website, but IF something will fail in future and you cant see error messages, then it is not so good. So i think, that website engine must silence error messages, but log them all to some file/database for debugging purposes, through error handling function. Or this option - admin/webmaster can browse website with additional GET parameter ("debug=1" is too obvious, but how about "letmesee4errors=1") and in this situation error messages will be shown, so webmaster can be sure, that all the site runs smoothly and without visual error messages.
View user's profile Send private message Send e-mail Visit poster's website
Apache Mod_access / deny from etc
PostPosted: Thu Jun 10, 2004 8:43 am Reply with quote
Good CO
Beginner
Beginner
 
Joined: Jun 08, 2004
Posts: 2




Another idea which I haven't seen discussed and once again please bear in mind I'm new to this.

I've been reading with despair the nuke problems and in particular about the coppermine gallery, which I'm keen to keep if at all possible. Most problems seem to be related to direct file access / XSS.

Can I defeat this totally (ish) using the httpd.conf file in apache as follows?:

<Directory "/mypath/html/modules/coppermine">
deny from all
<Files scripts.js>
allow from all
</Files>
<Files jspw.js>
allow from all
</Files>
</Directory>

<Directory "/mypath/html/modules/coppermine/albums">
allow from all
</Directory>
<Directory "/mypath/html/modules/coppermine/images">
allow from all
</Directory>
<Directory "/mypath/html/modules/coppermine/themes/maze">
deny from all
<Files style.css>
allow from all
</Files>
</Directory>
<Directory "/mypath/html/modules/coppermine/themes/maze/images">
allow from all
</Directory>
View user's profile Send private message
PostPosted: Tue Jun 15, 2004 12:07 pm Reply with quote
DaveTomneyUK
Beginner
Beginner
 
Joined: Jun 15, 2004
Posts: 2




Would a simple htaccess file stop this with this contents in the file?

Code:
deny from all


put inside the modules/news/ folder.
View user's profile Send private message
PostPosted: Fri Jun 18, 2004 1:36 am Reply with quote
5y573m f41lur3
Regular user
Regular user
 
Joined: May 25, 2004
Posts: 9




so the concerning of this Bug is "Full Path Disclosure" ?
View user's profile Send private message
PostPosted: Thu Jul 08, 2004 8:56 pm Reply with quote
genoxide
Regular user
Regular user
 
Joined: Jun 14, 2004
Posts: 15




so if we replace
the old
Code:
if (!eregi("admin.php", $_SERVER['SCRIPT_NAME'])) { die ("Access Denied"); }

or
Code:
if (!eregi("modules.php", $_SERVER['SCRIPT_NAME'])) {
    die ("You can't access this file directly...");
}


with
Code:

if ( !defined('IN_NUKE') )
{
        die("Hacking attempt");
        exit;
}


it's ok Wink
View user's profile Send private message
New security flaws in phpnuke all versions!
  www.waraxe.us Forum Index -> PhpNuke
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Post new topic  Reply to topic  




Powered by phpBB © 2001-2008 phpBB Group






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.203 Seconds