Websense Security Labs Blog

Websense Security Labs discovers, investigates and reports on advanced Internet threats that traditional security
research methods miss.

The CVE-2012-4792 and the Spear-Phishing Rotary Domains (Part 1)

View all posts > 

The CVE-2012-4792 and the Spear-Phishing Rotary Domains (Part 1)

Posted: 31 Jan 2013 01:20 | Gianluca Giuliani | no comments


Thanks to Websense® ThreatSeeker® technology, it has been possible to detect a domain which we believe is involved in a spear phishing campaign against the users of a Rotary Club online service.  The Rotary Club (also called Rotary International) is an organization that provides humanitarian services, encourages high ethical standards in all vocations, and promotes charity actions. Since the Rotary Club is a worldwide organization, each country has a number of  local "clubs" for each region and they have also established an online service called  "Rotary eClub".  

 

Specifically, we discovered another attempt to exploit the Internet Explorer vulnerability CVE-2012-4792, which was discovered in a "water holing" attack against the USA Council of the Foreign Relations website (http://www.cfr.org). The results of our analysis were in accordance with those reported in this blog: apparently another worldwide campaign against several organizations which have in some way attracted the interest of the attackers due to the specific audiences for their sites. In this first part of the analysis, we will report our investigation into the obfuscated code and the exploit code detected. In the second part, we will present the analysis of the unusual mechanism implemented in the shellcode that runs the malware which is installed if the exploit is successful. We will also look at some details of the malware behavior and expose some details behind the involved domains and the infrastructure of this attack.  

 

The suspicious domain in our analysis is "rotary-eclubtw.com", which has apparently been registered to target the Taiwanese users of the Rotary eClub service as shown in the following screenshot:

 

 

 

To find more information about the Rotary eClub located in Taiwan , we used the regional "Club" locator available on the Rotary official Web site:

 

 

 

 

One of the interesting results from that research is as follows:

 

 

 

 

The comparison between the domain under investigation (hxxp://rotary-eclubtw.com) and the legitimate Web site http://www.rotaryeclub.org.tw appears to show a case of typo-squatting, and the maliciousness of that domain is confirmed by looking at the content, as shown below:

 

 

 

At first glance, the content seems to be split into two well-defined blocks. Further analysis confirms that the same page hosts the malicious script that is assigned to the JavaScript variable "c" as shown below, and an encoded stream assigned to the variable "THISISIT":

 

 

"THISISIT" is the container for a stream which at first glance seems to be a nonsense array of characters with a prefix "KKONG". In the next part of our analysis we will better understand the role of this specific "marker" and how it has been used by the attackers.

 

 

The main function which is called during the loading of the page is the function "download()" referenced in a HTML object named  "test":

 

 

By deobfuscating the value of the Javascript variable "c", we obtain the clear code and can see that the "download()" function is implemented in the first obfuscated block mentioned before. It uses the API XMLHttpRequest()  to detect the correct version of the Ajax dialect to use for dealing with the dynamic HTML modules of this exploitation mechanism:

 

 

We can also see the call to the function "callback()":

 

 

This is an Ajax convention to verify the availability of one file. The function callback() is called if available to gather information about the impacted system in order to guess the best pairs of parameters to start the exploitation process. For this reason, it is possible to detect the code used to guess the operating system version or, as reported below, for the detection of a Microsoft Office module available on Windows 7. This specific check is useful for the attackers because if one of the two ActiveX controls (SharePoint.OpenDocument.4 or SharePoint.OpenDocument.5) is present in the running operating system, they can use that to gain access to a specific DLL, distributed by default on Windows 7 systems, which permits the running of malicious code by bypassing memory randomization protection mechanisms such as ASLR:

 

 

To continue with the implementation of the "callback()" function, we notice a reference to another file named "DOITYOUR02.html" in each  "<object>" section:

 

 

The file DOITYOUR02.html looks like this:

 

 

which once decoded becomes:

 

 

The "load()" function is an Ajax function that loads data from a server and puts the returned data into the selected element. In this case the element is  "test": the same name as the HTML object mentioned before. This makes it as a unique HTML object used by all the dynamic HTML modules during the exploitation process. Following the code of the function "loader()", it is possible to detect the removal, through the regular expression, of the string "jj" from the obfuscated content stored in the file "DOITYOUR01.TXT". Following this step manually:

 

 

we obtained an hexadecimal stream:

 

 

which converted to ASCII became:

 

 

The code above is the exploit code which is responsible, due to an "user after free" bug, for triggering the Internet Explorer vulnerability (CVE-2012-4792). This vulnerability is also called "CButton IE 0day" and in the snippet of code above, the steps to reproduce the "user after free" bug are highlighted in red. By working backwards it is possible to see the big picture of the flow: if the conditions for exploiting this vulnerability are good, the Flash file named "logo229.swf" is executed, and in the meantime the exploitation code hosted using the HTML file "DOITYOUR02.html" is also executed as reported before. 

 

The SWF file contains the heapspray code which facilitates the arbitrary code execution if the exploit is successful. Looking into the SWF file, we can see that is not the real heapspray code that we expected, but just a loader of another SWF file created "in memory": 

 

 

The content above is the disassembled ActionScript code which, after Base64 decoding, created in memory and ran another SWF file. To obtain the original file we used this easy and dirty Python script:

 

 

From this SWF file, we finally got access to the ActionScript HeapSpray code as follows:

 

 

The call of the ActionScript class "ExternalInterface"  permits a straightforward communication between the ActionScript code executed by the FlashPlayer and the SWF container. In our case the container is the starting HTML which is provided when calling the suspicious Web site:

 


 

We can also see the use of the ID "test" as already highlighted several times. The value returned is assigned to the variable "_loc_3" and is used to detect the correct sequence of the ROP instructions and the shellcode to run. What follows is the use of the variable _loc_3 to select the best Windows7 conditions to run the malicious payload :

 

 

The malicious file to be executed is loaded by the shellcode looking in memory rather than for a file in the Web cache, as happened in the attack against the CIFR.ORG Web site. This is a interesting difference because it means that the chain of attack uses fewer files which can be detected by an AV for example. The shellcode has been extracted by the malicious SWF file obtained previously:

 

 

In the next part we will look at the shellcode and the dropped malware, discussing an interesting technique used in this attack to deliver malware using only the HTML content. This is a little bit different from the first attack where this Internet Explorer vulnerability was discovered, since for the cfr.org Web site attack, the malware was deployed on visitors' systems with a technique called "drive by cache", using a file with the extension ".jpg" (named "xsainfo.jpg") to contain the executed malware. In this case, it seems that the malicious file is retrieved from the rendered content in the memory of the initial HTML page. We will also look at exposing information and details about the infrastructure behind the involved hosts and domains. 

 

Websense customers are protected from these and other threats by Websense ACE (Advanced Classification Engine). 


Filed under:

Leave a Comment

(required)  

Email address: (required)