recently I had an issue with my site - someone managed to modify my .js file and injected a malicious code there. I have no idea how :(. I was just wondering how to prevent it from happening. i cleaned the file and changed my password but I am feeling that is not enough.
Do you monitor your files for changes (cron script), do you use any monitoring software? The worst thing is detecting that not early enough. That really can shutdown your business
As I mentioned in your other thread, setting all file permissions to read-only is a good start.
I've used CrawlProtect to help block attacks. It also records problem IP addresses, so you can choose to block them completely - and it makes it easy to see which files have been modified and to change the file permissions when necessary.
You can log you file modify time. Then you can detect if some of files were edited not by you
This has been asked before and got a long series of good responses including:
For more (including commercial apps to aide in these efforts, look back a couple of months.