RedKit Redirector Injected into Legitimate JavaScript Code

Posted: February 15th, 2013 | Author: | Filed under: IT Related | No Comments »


Nothing special and interesting but just to share some (old) info on this topic

I’ve read Sophos’s blog post yesterday on “Malware injected into legitimate JavaScript code on legitimate websites” and it seems like a familiar stuff to me. I’ve also been asked in the comment section of “RedKit Patterns – Additional Info to @fknsec Writeup” entry on something that is related to this issue so lets just blog about it

I’ve performed a quick search in URLquery and managed to get these samples:

  • hxxp://[dot]js
  • hxxp://[dot]js

You may found more sample of there. The point is there is no specific version of jquery targeted (as asked in the comment section) since in order for you to modify/edit the jquery file, you need to have the CMS/server compromised in the first place and jquery is not a CMS 🙂 . However, by looking at the version of the jquery, you will be able to predict the ‘age’ of the CMS used and the last update date. Mostly they are old (meaning that the CMS is not updated)

Viewing the content of the modified/compromised JavaScript  file (in this example, jquery) you can see the additional code in line no 1, (2 is a empty line), 3, second last, and last line of the JavaScript file. And the pattern will always be the same.

The JavaScript files which have been called will execute the injected script and write an (almost) invisible iframe redirecting victim to another compromised website which is hosting RedKit exploit kit. Most of the time, the host with the compromised JS will also have the RedKit files on it and waiting to be called by another compromised JS on another website

Some other characteristics that can help you to determine these injected code are by looking at these keywords:

  • iframe
  • name=Twitter
  • scrolling=auto
  • frameborder=no
  • align=center
  • height=2
  • width=2
  • a .htm or .html file in the web root directory in 4 char length and sometime came with query variable of ‘h’, ‘i’ or ‘j’ **scroll below to see update on 7 Mar**

Lets make a conclusion and write a simple regex for this

document\.write\('<iframe\ name=Twitter\ scrolling=auto\ frameborder=no\ align=center\ height=2\ width=2\ src=http:\/\/[\w\.\-]{4,}\/[a-z]{4}\.html?(\?[hij]=\d{7})?><\/iframe>'\);

Once you have 4 hits, you know it is RedKit redirector.

Yes you can modify it to be used as yara signature as well 🙂

Thats all from me for now

Thanks and stay safe

** Updated on 16 Feb **
According to Securi, this is a family of TDS

** Updated on 7 Mar **
Found new pattern that use PHP.. A quick yara rule would be:

rule iframeRedKit
		author = ""
		description = "Detection rule to detect compromised page injected with invisible iframe of Redkit redirector"
		ref = ""
		cve = "NA"
		version = "1.2"
		impact = 4
		hide = false
		$iRedKit_1 = /name\=['"]?Twitter['"]?/
		$iRedKit_2 = /scrolling\=['"]?auto['"]?/
		$iRedKit_3 = /frameborder\=['"]?no['"]?/
		$iRedKit_4 = /align\=['"]?center['"]?/
		$iRedKit_5 = /height\=['"]?2['"]?/
		$iRedKit_6 = /width\=['"]?2['"]?/
		$iRedKit_7 = /src\=['"]?http:\/\/[\w\.\-]{4,}\/(([a-z]{4}\.html?(\?[hij]=\d{7})?)|([a-z]{4,}\.php\?[a-z]{4,}\=[a-f0-9]{16}))['"]?/
		all of them

Leave a Reply