Waraxe IT Security Portal
Login or Register
November 22, 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: 9144

People Online:
Visitors: 54
Members: 0
Total: 54
Full disclosure
APPLE-SA-11-19-2024-5 macOS Sequoia 15.1.1
Local Privilege Escalations in needrestart
APPLE-SA-11-19-2024-4 iOS 17.7.2 and iPadOS 17.7.2
APPLE-SA-11-19-2024-3 iOS 18.1.1 and iPadOS 18.1.1
APPLE-SA-11-19-2024-2 visionOS 2.1.1
APPLE-SA-11-19-2024-1 Safari 18.1.1
Reflected XSS - fronsetiav1.1
XXE OOB - fronsetiav1.1
St. Poelten UAS | Path Traversal in Korenix JetPort 5601
St. Poelten UAS | Multiple Stored Cross-Site Scripting in SEH utnserver Pro
Apple web content filter bypass allows unrestricted access to blocked content (macOS/iOS/iPadOS/visionO S/watchOS)
SEC Consult SA-20241112-0 :: Multiple vulnerabilities in Siemens Energy Omnivise T3000 (CVE-2024-38876, CVE-2024-38877, CVE-2024-38878, CVE-2024-38879)
Security issue in the TX Text Control .NET Server for ASP.NET.
SEC Consult SA-20241107-0 :: Multiple Vulnerabilities in HASOMED Elefant and Elefant Software Updater
Unsafe eval() in TestRail CLI
Log in Register Forum FAQ Memberlist Search
IT Security and Insecurity Portal

www.waraxe.us Forum Index -> How to fix -> waraxe-2005-SA#040 - how to fix
Post new topicReply to topic View previous topic :: View next topic
waraxe-2005-SA#040 - how to fix
PostPosted: Mon Feb 14, 2005 10:44 pm Reply with quote
waraxe
Site admin
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 Smile

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 Smile

See ya next time Wink


Last edited by waraxe on Sat Apr 16, 2005 2:50 pm; edited 1 time in total
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Fri Feb 18, 2005 3:50 pm Reply with quote
damned
Regular user
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?
View user's profile Send private message
PostPosted: Sat Apr 30, 2005 3:17 pm Reply with quote
maniaka
Beginner
Beginner
Joined: May 18, 2004
Posts: 1




Its only for 7.5 y i apply this patch for 7.6 its good?

Thx
View user's profile Send private message
waraxe-2005-SA#040 - how to fix
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

Post new topicReply 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-2024 Janek Vind "waraxe"
Page Generation: 0.036 Seconds