Jump to content


Photo

Hacked site through PHP?


  • Please log in to reply
24 replies to this topic

#21 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 10 June 2006 - 02:26 PM

if you want give me your host name, and I will call them and talk to them see if I can figure out some details, I am new at learnign the language, but I am working as security with a company now, on the side, and my MAIN study was security and performance, that is why I ask so much if you want, I can pour over your php.ini file and make sure they are at the secure default settings and check over the site to make sure it's all secure, and contact the host to get more information, I can probably do some to try and help make it more secure, it's worth an offer at least, let me know. I meant url of your hosting company by the way.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#22 XRayden

XRayden
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationQu├ębec

Posted 10 June 2006 - 07:15 PM

Your codes are good but it lack some... i dont know...

if the site he is working on need a new page, he will need to change de code.

my code is simpler and you cant hack it, and still, any change wont need change into the code.

my suggestion, add the extention yourself! and THEN proceed for a file check... like this :

if( isset( $_GET['z'] ) && file_exists( realpath(dirname(__FILE__)).$_GET['z'].'.php' ) ) {
    include(realpath(dirname(__FILE__)).$_GET['z'].'.php');
} else {
    include(realpath(dirname(__FILE__)).'home.php')
}
it will check if there is a z, and if the file your are trying to reach really exist on your server, then so it will include it...

with this kind of coding, if you add a section... no need to add the section in the code... if the file exist... !

with this you are not restrain to the root of the website, you still can call other folder like : index.php?z=/foleder/fileinfolder

as long as the extention if not written in the GET... the wont even know where your files are called from!

#23 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 10 June 2006 - 07:26 PM

homchz you don't need that switch statement. instead of this:
if((isset($_GET['page'])) && in_array($_GET['page'],$allowable_page))
{
    $page = $_GET['page'];

    switch($page)
    {
        case "register":
        include 'pages/register.php';
        break;
        case "login":
        include 'pages/login.php';
        break;
        case "welcome":
        include 'pages/welcome.php';
        break;
        case "validate":
        include 'pages/validate.php';
        break;
        case "profile":
        include 'pages/profile.php';
        break;
    }
}
do this:
if((isset($_GET['page'])) && in_array($_GET['page'],$allowable_page))
{
    $page = $_GET['page'];
     include ("pages/".$page.".php");
}

Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#24 mainewoods

mainewoods
  • Members
  • PipPipPip
  • Advanced Member
  • 685 posts
  • LocationMaine

Posted 10 June 2006 - 07:51 PM

This page explains how they might have been doing the exploit:

[a href=\"http://www.php.net/manual/en/security.filesystem.php\" target=\"_blank\"]http://www.php.net/manual/en/security.filesystem.php[/a]

#25 homchz

homchz
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts
  • LocationLee, New Hampshire

Posted 11 June 2006 - 01:32 PM

[!--quoteo(post=382307:date=Jun 10 2006, 03:26 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ Jun 10 2006, 03:26 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
homchz you don't need that switch statement. instead of this:
if((isset($_GET['page'])) && in_array($_GET['page'],$allowable_page))
{
    $page = $_GET['page'];

    switch($page)
    {
        case "register":
        include 'pages/register.php';
        break;
        case "login":
        include 'pages/login.php';
        break;
        case "welcome":
        include 'pages/welcome.php';
        break;
        case "validate":
        include 'pages/validate.php';
        break;
        case "profile":
        include 'pages/profile.php';
        break;
    }
}
do this:
if((isset($_GET['page'])) && in_array($_GET['page'],$allowable_page))
{
    $page = $_GET['page'];
     include ("pages/".$page.".php");
}
[/quote]

Thanks for that





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users