anti-hack

Seams like we are experiencing “new” age of hacking in a mass scale recently. The target is the server side apps. First when I found injection on websites I’m currently working on I thought it’s a WP hole, but supposedly all happened during the unencrypted ftp connections, I dare to say, I made from Windows system. What have I read is that there is a worm or horse or whatever animal who catches the user & password data, it either downloads each index (text file) from server or inject it’s code directly in server during or else after the ftp session.

Solution seams to be so far.
Do not use Windows :), no seriously, run the Antivir in windows safe mode, then change the ftp password, clean up the infected files and never use simple ftp again. Use SFTP only!

If you found “little iframe”, run the first command on the server (you have to have SSH access, if you don’t ask for it, and if they don’t give it to you I suggest change hosting, or ask them if they can do it for you (they have to give you sftp access anyway). Run the command bellow. It founds infected files.

find . | xargs grep "google-stat"

Then if it founds the injection then, clean it up.

find ./* -type f -exec sed -i 's/<iframe src="http:\/\/google-stat.com\/tomi\/?t=2" width=0 height=0 style="hidden" frameborder=0 marginheight=0 marginwidth=0 scrolling=no><\/iframe>//g' {} \;

here is another help(.httacess)
RewriteCond %{QUERY_STRING} ^.*(;|<|>|'|"|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark).* [NC]
RewriteRule .* - [F]

if you are on Dreamhost and even if you are not look here

http://wiki.dreamhost.com/Troubleshooting_Hacked_Sites

references:

Comments
  • Harry @ 03/05/2009 -

    If I don’t want to change the time/date of all the files, which aren’t infected – how do I do that?

  • 2046 @ 06/08/2009 -

    I think it won’t change the file if it doesn’t find the text..I haven’t checked it though, so do not take me seriously..The only way I can think of is to find the infected files, then run the command with the name of the file after the find. In the example there is find /* … (it does for all files)and in your case it supposed to be find /the/path/to/file … but this will be probably really tiring to do one by one.
    …btw sorry for the huuuuge delay.

  • write a note if you dare


    o—-o.info

    All the content but a few exceptions on this website are under Aggressive Copyright license. By clicking on the button "Yes I do" you agree with the license and you understand all consequences.