Yesterday, while checking my ShortStats I found out that there is no much traffic in Nomadig.com. The reason was imminent when I opened the site. The front page sported a PHP error and journal was broken, too.
After logging in to the system, I quickly checked the files and noticed that the PHP files were mangled. Whitespaces were missing and the bigger files were cut above eight kilobytes.
The first thing to do was to close the site for maintenance, so I created a small static HTML file for the front page and the journal to inform visitors.
The second step was to request a full restore for the site. Fortunately I haven’t been working on the site for a while, so I wouldn’t loose any precious changes. This had a flipside, too, as my offline backup was done last August…
Glancing through the files, I find out some PHP injections that looked very odd. They collected user information from $_SERVER and then posted that information to user7.phpinclude.ru. The URL of the site was “hidden” using base64_decode.
I read a few discussion threads about this and learned that the site injects links to paysites inside your content. While they were trying to accomplish this, they broke my site completely. Thanks, guys.
Closer inspection to the files revealed a huge number of backdoors with names such as includes.php, time.php, users.php and so forth. Every directory that was writable with PHP was infected. I painstakingly cleaned them. First used grep to find the files and then remove those. I also copied old development files from my hard disk over infected files and little by little I could clean up the mess.
There were changes also in HTML and JS files. Fortunately those have been there for ages, so I just copied everything over them.
My hosting provider restored their backup a few minutes ago and everything seems to be ok now. The file and directory permissions are fixed now, but due to this probably some of my PHP admin stuff is broken. Needs to be investigated later.
I’d better also set up a cronjob to make a backup of the site as soon as I get a Linux server of my own. I cannot store the backups in Nomadig.com, as the space will run out in less than a week.