By ThaboGoodDogs on
A drupal site that I installed on a university server has been hacked - it appears that a file sites.php has been uploaded in the hack and it's spitting out spammy pages from a .cache directory. So I've never had a drupal site hacked in 7 years of drupal usage so I'm trying to figure out what shat the bed - carless permissions, university sysadmin setup incorrect etc ....
here is a part of the code in sites.php / also uses a comm.php file:
<?php
// REVISION: $Rev: 1153 $
error_reporting(0);
ini_set('display_errors', 0);
header('Content-type: text/html; charset=utf-8');
set_magic_quotes_runtime(0);
class RemotePage
{
var $myUrl = 'http://your-domain.com/door_sample/';
//var $feedUrl = 'http://www.your-feed-domain.com/path/to/${key}/';
var $cacheDir = '.cache';
var $varName = 'bs';
var $waitTimeout = 60; // seconds
var $useCurl = 0;
var $googleRefNumToAllowRedirect = 100;
var $googleRefNumToAllowCloak = 100;
var $cloakMethod = 4; // 1 - 404 old, 2 - hides redirect for bots, 3 - 404 new, 4 - hides redirect for bots and non-google-refs
var $keywordSeparator = '-';
var $defaultPage = 'index';
var $searchReferers = 'live|msn|yahoo|google|ask|aol';
var $botIps = Array(
/* 2009-12-12 */ '66\.249\.[6-9][0-9]\.[0-9]+', '74\.125\.[0-9]+\.[0-9]+', '38\.[0-9]+\.[0-9]+\.[0-9]+', '70\.91\.180\.25', '65\.93\.62\.242', '74\.193\.246\.129', '213\.144\.15\.38', '195\.92\.229\.2', '70\.50\.189\.191', '218\.28\.88\.99', '165\.160\.2\.20', '89\.122\.224\.230', '66\.230\.175\.124', '218\.18\.174\.27', '65\.33\.87\.94', '67\.210\.111\.241', '81\.135\.175\.70', '64\.69\.34\.134', '89\.149\.253\.169', '69\.136\.208\.89', '83\.15\.211\.166', '78\.180\.145\.80', '78\.166\.111\.63', '64\.233\.1[6-8][1-9]\.[0-9]+', '64\.233\.19[0-1]\.[0-9]+', '209\.185\.108\.[0-9]+', '209\.185\.253\.[0-9]+', '209\.85\.238\.[0-9]+', '216\.239\.33\.9[6-9]', '216\.239\.37\.9[8-9]', '216\.239\.39\.9[8-9]', '216\.239\.41\.9[6-9]', '216\.239\.45\.4', '216\.239\.46\.[0-9]+', '216\.239\.51\.9[6-9]', '216\.239\.53\.9[8-9]', '216\.239\.57\.9[6-9]', '216\.239\.59\.9[8-9]', '216\.33\.229\.163', '64\.233\.173\.[0-9]+', '64\.68\.8[0-9]\.[0-9]+', '64\.68\.9[0-2]\.[0-9]+', '72\.14\.199\.[0-9]+', '8\.6\.48\.[0-9]+', '207\.211\.40\.82', '67\.162\.158\.146', '66\.255\.53\.123', '24\.200\.208\.112', '129\.187\.148\.240', '129\.187\.148\.244', '199\.126\.151\.229', '118\.124\.32\.193', '89\.149\.217\.191',
);
// !!! DO NOT CHANGE THIS !!!
var $seal = '7aY#4EwrU_eC2AbEcuP?8keYe&ruQuxE=R46eQ38eHE27aZeFr7W7eSp=752xen?';
So can someone tell me how they managed to upload this sites.php file and what code is this, it's obviously been renamed sites.php but looks like some generic hacker code that some script kiddy copied.
Comments
?
Who knows. Maybe the sysadmin were in a bad mood. Do you have a firewall? My server gets several brute force attacks a day, but the Cpanel lfd (login failure daemon) stops them. Avoid ftp (I like to disable ftp on the server, but even when it is running I don't use it). Don't let publicly accessible terminals store your passwords. I find it really hard to use different passwords everywhere, but you can use different passwords on sites where security is especially important, than the ones you use for logins on systems which are likely to be vulnerable such as wordpress.com or Facebook.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
Well ....
This site was on a pretty secure server only accessible via a VPN to a university network / no ftp - ssh2 only - always use different passwords for my accounts, I have hundreds of them.
The sysadmin has not had any accounts compromised on the box so it a appears that Drupal 7 got hacked via the bluemasters theme or some venerability in a module? Just curious how the hell the hacker was able to rewrite the sites.php file using just drupal. This is the first time I've installed on Drupal 7 on a box I don't control and I've never had a hacked site in 7 years. ( I do have some ip blocking in my httpd.conf file but not realtime).
It could of well been a permissions thing but still I'm wondering if the theme has something to do with it or some of the other modules.
:-(
It is beyond me. However I do know a friend who had a low-traffic Drupal site because it was slightly out of date was hacked. The guy who cleaned it up concluded the hacker had used a vulnerability which was described (?for the assistance of hackers :-/) on d.o. along with a Drupal security update. It was a lesson to me in the importance of keeping up to date. In that case though it was only the db that was hacked. I guess you have checked there is no (illegitimate) php in database?
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
pleas help
Hi,
I used Blue Motion theme and i have the same problem right now. I made the page and when i post the link to fcbook and click on it, it always show some wrong page 404 from some other pages i newer sow. And this problem will go on till i delete my cache files in my browser after the page is ok. But when i click again on link witch i posted on fcbook the wrong page show up again. And i have to delete the cache again. Otherwise tha page will not show properly even when i write the link right to browser. Im trying to find sites.php or comm.php to check the code but i cant find them in drupal folder or so.
Pleas can u help me. thanks
Is this really a hack? This
Is this really a hack? This is the behaviour of the so-called pharma hack, but normally the link will point away from your site and take people who click the link to a site selling viagra or insurance or something like that, with a different domain. If the link is pointing to a 404 on your own site, maybe there is some other fault.
However, if it is a hack, to find the suspect files you can search your installation for a file with a lot of examples of the string 'eva(base64*' in the code. How you search depends on your server setup of course, but the easiest way is probably to log in using ssh and use grep. If you are not comfortable using command line, and even if you are, another is option is to delete ALL your code (being careful to check you have also deleted hidden files) apart from your sites folder (and have a good look at that for suspect files including hidden files) then put in a fresh copy of the same code. This should clean out your hack if it is only in code. If it is also in database that is an additional problem, and it may be fixable if you can restore to a database backup which you took before the problem happened.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
Thanks for ur reply, but the
Thanks for ur reply, but the wrong page 404 its not on my server it is away. And its only happening if i post the link to fcbook or any other social network page and click on it. If u have time u can write www.divingbali.cz to ur browser and after tray to post it on the wall on fcbook and click on it. pls.
u will see how the page redirecting you to other 404 page straight away should be this one http://lykeslandinvestments.com/dtd.php and u will not see the front page correctly until u clear the cache even just from last hour in ur browser.
Thanks for ur help
OK. So it sounds like a real
OK. So it sounds like a real pharma hack. I advise you to follow my suggestions above for dealing with it. Hopefully it will not have affected the database.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors