|
Menu |
|
|
Home |
| |
|
Discussions |
| |
|
Tools |
| |
|
Affiliates |
| |
|
Content |
| |
|
Info |
| | |
|
|
|
|
|
User Info |
|
Membership:
Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9144
People Online:
Visitors: 102
Members: 0
Total: 102
|
|
|
|
|
|
Full disclosure |
|
|
|
|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
waraxe-2005-SA#040 - how to fix |
|
Posted: Mon Feb 14, 2005 10:44 pm |
|
|
waraxe |
Site admin |
|
|
Joined: May 11, 2004 |
Posts: 2407 |
Location: Estonia, Tartu |
|
|
|
|
|
|
Wanna fix those ugly security holes? Let's begin...
First of all, open file "db/db.php" and you see this code in begin:
Code: |
global $forum_admin;
if ($forum_admin == 1) {
$the_include = "../../../db";
} elseif ($inside_mod == 1) {
$the_include = "../../db";
} else {
$the_include = "db";
}
|
Add code fragment, preventing from file direct access and additionally
delete some legacy code, so result will be as:
Code: |
if (eregi('db.php',$_SERVER['PHP_SELF']))
{
die('Direct access not allowed!');
}
global $forum_admin;
if ($forum_admin == 1) {
$the_include = "../../../db";
} else {
$the_include = "db";
}
|
Next let's open file "mainfile.php" and ~ line 100 we see this code:
Code: |
if ($forum_admin == 1) {
require_once("../../../config.php");
require_once("../../../db/db.php");
} elseif ($inside_mod == 1) {
require_once("../../config.php");
require_once("../../db/db.php");
} else {
|
We will delete legacy code, so result will be as:
Code: |
if ($forum_admin == 1) {
require_once("../../../config.php");
require_once("../../../db/db.php");
} else {
|
Now let's work with downloads module - open "modules/Downloads/index.php"
and find this code (~line 2354):
Code: |
switch($d_op) {
case "menu":
menu($maindownload);
break;
case "AddDownload":
AddDownload();
break;
|
and delete "menu" section from switch construction, so
result will be something like this:
Code: |
switch($d_op) {
case "AddDownload":
AddDownload();
break;
|
It's time for "newdownloadshowdays" sanityze, so let's find
this code (~ beginning of the file):
Code: |
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
if (isset($show)) {
$show = intval($show);
}
|
and let's add additional sanityze code, so result will be as:
Code: |
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
if (isset($show)) {
$show = intval($show);
}
if(isset($newdownloadshowdays))
{
$newdownloadshowdays = min(max(intval($newdownloadshowdays),1),30);
}
|
Finally, let's handle Web Links module probs -
open file "modules/Web_Links/indeks.php" and find code like
this (~line 2095):
Code: |
switch($l_op) {
case "menu":
menu($mainlink);
break;
case "AddLink":
AddLink();
break;
|
Delete "menu" section, as in case of downloads module, so
final result will be something like this:
Code: |
switch($l_op) {
case "AddLink":
AddLink();
break;
|
And one more thing - find this code from somewhere in file beginning:
Code: |
get_lang($module_name);
$pagetitle = "- "._WEBLINKS."";
require_once("modules/Web_Links/l_config.php");
function getparent($parentid,$title) {
global $prefix, $db;
|
and add some sanityze code, as in case of downloads module,
so the result will be something like:
Code: |
get_lang($module_name);
$pagetitle = "- "._WEBLINKS."";
require_once("modules/Web_Links/l_config.php");
if(isset($newlinkshowdays))
{
$newlinkshowdays = min(max(intval($newlinkshowdays),1),30);
}
function getparent($parentid,$title) {
global $prefix, $db;
|
That's it - congratulations, your website is now little bit more secure
P.S. All this tutorial is directly applicable to phpnuke 7.5 version, directly
downloaded from phpnuke.org website. If you will try to fix bugs in some
other phpnuke version or derivation, be prepared to somehow different
source code. But anyway, be creative and you will find way to apply fixes
to all other versions too. And if there are problems - don't hesitate to
post them here - this is what for this forum section is meant to be
See ya next time |
|
Last edited by waraxe on Sat Apr 16, 2005 2:50 pm; edited 1 time in total |
|
|
|
|
|
|
|
Posted: Fri Feb 18, 2005 3:50 pm |
|
|
damned |
Regular user |
|
|
Joined: Feb 18, 2005 |
Posts: 8 |
|
|
|
|
|
|
|
Congrats for its work. E the corrections for PNP 7,6 vc has? Now that the correction was divulged,
do you can pass exploit? |
|
|
|
|
Posted: Sat Apr 30, 2005 3:17 pm |
|
|
maniaka |
Beginner |
|
|
Joined: May 18, 2004 |
Posts: 1 |
|
|
|
|
|
|
|
Its only for 7.5 y i apply this patch for 7.6 its good?
Thx |
|
|
|
|
www.waraxe.us Forum Index -> How to fix
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
|
|
|
Powered by phpBB © 2001-2008 phpBB Group
|
|
|
|
|
|