We recently had a website hacked, where some PHP code was injected into the index.php file that looked something like:
The code was causing another php file (cnfg.php) to be included, which was causing some pharmaceutical-related spam to be displayed (but only visible to googlebot et al). This looks like the pharma hack for wordpress, except we're not running said software. The code has since been removed, but I'd like to prevent such occurrences from happening in the future.
I realize this is a pretty broad problem and there could be a myriad of security holes which could be responsible, but thought I'd put this out there in case anyone has had experience with such a problem in the past.
What are some potential security holes that would allow these php files to be uploaded? And what can I do to prevent this from happening in the future?