So if I press Alt F4... What?
Gender:
Posts: 389
2352 credits Members referred : 2
« on: Apr 09, 2008, 03: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 ??
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 7931
40535 credits Members referred : 3
« Reply #1 on: Apr 09, 2008, 03: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)
So if I press Alt F4... What?
Gender:
Posts: 389
2352 credits Members referred : 2
« Reply #2 on: Apr 09, 2008, 04: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. ---------
I am a fanatic. So?
Gender:
Posts: 594
3697 credits Members referred : 2
« Reply #8 on: Apr 10, 2008, 08: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.
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6272
38458 credits Members referred : 374
It's time to use PHP5!
« Reply #9 on: Apr 10, 2008, 09: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:
Posts: 7931
40535 credits Members referred : 3
« Reply #10 on: Apr 11, 2008, 03: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)
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