28, May 2012

Got Hacked, advise needed - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  Security
Topic: Got Hacked, advise needed
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: Got Hacked, advise needed  (Read 2959 times)
What's HTML?
****
Gender: Male
Posts: 408
2466 credits
Members referred : 2



« on: Apr 09, 2008, 02:04:58 pm »

One of my sites was found with spam links included in the index.php

the site has no database
just a simple contact form (that uses mail())

I found "prefer.php" file in my public_html/lib/
that was actually doing the insertion/injection in index.php
but how did it get there (I can send it if anyone wants to see it)

I am sanitizing/filtering all the inputs for email headers injection
but maybe not correctly for XSS attacks or PHP remote inclusion

are there some patterns I should be scanning for ??

should I include any directives in .htaccess ??

How can someone write a file on my server with
just exploiting a contact form ??

any pointers/advice would be greatly appreciated



Last blog : Offline Promotion Of Your Website
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #1 on: Apr 09, 2008, 02:53:50 pm »

So the prefer.php wrote  to the index.php?

In any case if something wrote to any page of your site, you should check the scripts that use the fopen() and fwrite() functions.

An other thing you should check is other directory index files (index.php on www root folders) that have the same problem. If this is the case then someone hacked the server and you should contact your hosting company (or let me know if it is your own server)

Good luck Smiley

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
What's HTML?
****
Gender: Male
Posts: 408
2466 credits
Members referred : 2



« Reply #2 on: Apr 09, 2008, 03:47:06 pm »

thanks for the reply Nikola,

the server is not mine so I also asked the admin
they told me that I should alwasy have my .php files as CHMOD 644
apparently I did not have them

Would that be enough for them to get access ??

I will check all my fopen, fwrite functions but I am pretty sure
the filenames for them are hardcoded
that does not cause a problem right ??

I did not understand this part though
----------
An other thing you should check is other directory index files (index.php on www root folders) that have the same problem.
---------


Last blog : Offline Promotion Of Your Website
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Apr 09, 2008, 04:42:08 pm »

sounds to me that the provider is hiding some problem, I had the same problem before with a shared hosting account.

look the hacker is not some stranger, I think it's another customer Wink

What's HTML?
****
Gender: Male
Posts: 408
2466 credits
Members referred : 2



« Reply #4 on: Apr 09, 2008, 05:17:23 pm »

Olaf thanks for you input,
It is indeed hosted on a shared host.

2 support guys concluded that keeping the .php files as 644
will prevent other attacks

They were both definite about that !!!
But never offered to explain how such a think could have happened !


Last blog : Offline Promotion Of Your Website
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Apr 09, 2008, 07:00:58 pm »

what permissions do you have for these files? a normal server will use 644 as default

What's HTML?
****
Gender: Male
Posts: 408
2466 credits
Members referred : 2



« Reply #6 on: Apr 09, 2008, 07:11:46 pm »

I never knew that I should be worried about this
but now I will, everything is turned to 644


Last blog : Offline Promotion Of Your Website
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Apr 09, 2008, 07:50:05 pm »

I never knew that I should be worried about this
but now I will, everything is turned to 644

if you upload a file this should be 644 automatically or the server is wrong configured

Bill Gates is my home boy
*****
Gender: Female
Posts: 710
4449 credits
Members referred : 2



« Reply #8 on: Apr 10, 2008, 07:24:38 am »

I feel for you Giorgios. One of my database driven sites apparently become a target on a Vietnamese hacker forum. It seemed that they figured out I was using a vulnerable script and encouraged their members to post that forum's banners and links on my site. Don't some folks have anything better to do with their time?

Hopefully, your problem is much easier to fix and you will get your site fully secure quickly.

www.yourmessageconsultant.com, providing online content and printed marketing materials.
www.helpforwebbeginners.com, Tutorials and how to's for new  webmasters.
www.CraftyTips.com, a unique Arts & Crafts Directory
www.nocans.com - Pet Food Recipe Site
www.petsiteguides.com - A New Pet Directory

Last blog : Spring Cleaning at Crafty Tips
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #9 on: Apr 10, 2008, 08:24:16 am »

This 3rd party script are big problems, even Wordpress is a risk since there are problems in the past. These days I bought a website with some custom script, it is so bad scripted that I think about to move the whole thing into the RB.

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #10 on: Apr 11, 2008, 02:31:31 pm »

These guys usually use an XSS vulnerability to include a remote script to your code. Then they use the /tmp folder to install an application that checks all the www directory index files (index.php on every site) and deface it.

In addition there is another vulnerability which may gives them the right to run their app as root, which means that your files will be defaced anyway (this is a problem with crontab)

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
What's HTML?
****
Gender: Male
Posts: 408
2466 credits
Members referred : 2



« Reply #11 on: Apr 12, 2008, 01:08:55 am »

I never knew that I should be worried about this
but now I will, everything is turned to 644

if you upload a file this should be 644 automatically or the server is wrong configured
I have probably changed the file permissions after uploading them.
The hosting company has been great so far, everything works as advertised and the support questions are usually answered within the hour.

These guys usually use an XSS vulnerability to include a remote script to your code. Then they use the /tmp folder to install an application that checks all the www directory index files (index.php on every site) and deface it.

In addition there is another vulnerability which may gives them the right to run their app as root, which means that your files will be defaced anyway (this is a problem with crontab)


Olaf and Nick
Its my own script, simple of course but does don't allow input with

content-type:
bcc:
cc:
document.cookie
onclick
onload
;
~
|

Anything else I should be checking at ??


Last blog : Offline Promotion Of Your Website
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #12 on: Apr 12, 2008, 11:35:35 am »

You should check if you are including files from $_GET or $_POST. For example :

 include $_GET['action'] . '.php';?>

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
What's HTML?
****
Gender: Male
Posts: 408
2466 credits
Members referred : 2



« Reply #13 on: Apr 12, 2008, 08:28:16 pm »

You should check if you are including files from $_GET or $_POST. For example :

 include $_GET['action'] . '.php';?>

Thanks Nikolas but I was not doing anything that dangerous !!


Last blog : Offline Promotion Of Your Website
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7687
Tags : attack html inclusion Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  Security
Topic: Got Hacked, advise needed
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 08:05:00 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.