Also, forgot to say... Prevention is a long winded post and I suggest you googling 'SECURING YOURCMS'
But best methods are, Don't used nulled software (Pirated) unless you know the source is good (Torrents, Newgroups is no good, unless you know what too look for)
Keep your CMS updated, and...