Thursday, June 14, 2012

Digging Inside Tinba Malware - A Walkthrough


Two weeks back, Tinba malware hit the internet. Though our team spent some time in looking at the various artifacts of Tinba malware. Zeus and SpyEye have given birth to new breed of botnets. The upcoming generation of botnets are extensively utilizing the tactics introduced by Zeus and SpyEye. Tinba is a small notorious malware that aimed specifically for stealing information from the browsers. For more details about Man-in-the-Browser (MitB), one can read our paper on FormGrabbing here - http://www.virusbtn.com/virusbulletin/archive/2011/11/vb201111-form-grabbing.

Other researchers have presented details about Tinba which can be found here - http://www.csis.dk/en/csis/news/3566/

We looked specifically at communication patterns of Tinba. As we know, bots are hooking browsers and performing Web Injects to gain control over the browser communication channel. Other interesting facts about Tinba is as follows:

  • The accompanied binary is written in MASM/TASM and having size of 20 KB. Compiling with MASM reduces the size of the binary to great extent.
  • The binary executes as : tinba.exe --- bin.exe --- readme.exe --- winver.exe The dropper actually installs the bin.exe file in the application directory and then deletes the wrapper (binary). File bin.exe resides in the directory permanently.
  • Adds run entry here - HKCU\Software\Microsoft\Window\CurrentVersion\Run
  • Tinba hooks browser processes and make them unstable, so there is a possibility that users might encounter several crashes in browsers while running or surfing internet. The browser works   fine when the system is rebooted.
  • As the tinba injects in explorer.exe, the binding occurs very fast when bot has to send SYN packet and to receive reply from the C&C server. The connection is continuous but TCPView is not fruitful in this case because the connection open and closes readily. TDIMon tools gives you the low level traffic details by inspecting the Transport Driver Interface as presented below:
explorer.exe:168    TDI_CONNECT    TCP:0.0.0.0:2552    82.165.37.127:80    SUCCESS       
explorer.exe:168    TDI_SEND    TCP:0.0.0.0:2552    82.165.37.127:80    SUCCESS-2941    Length:353    
explorer.exe:168    TDI_SEND    TCP:0.0.0.0:2552    82.165.37.127:80    SUCCESS-2942    Length:9    
explorer.exe:168    TDI_EVENT_CHAINED_RECEIVE    TCP:0.0.0.0:2552    82.165.37.127:80    SUCCESS       
explorer.exe:168    TDI_EVENT_DISCONNECT    TCP:0.0.0.0:2552    82.165.37.127:80    SUCCESS    RELEASE
explorer.exe:168    TDI_SEND    TCP:0.0.0.0:2545    82.165.37.127:80    SUCCESS    Length:353    
explorer.exe:168    TDI_SEND    TCP:0.0.0.0:2545    82.165.37.127:80    SUCCESS    Length:9    
explorer.exe:168    TDI_EVENT_RECEIVE    TCP:0.0.0.0:2545    82.165.37.127:80    SUCCESS        
explorer.exe:168    TDI_EVENT_DISCONNECT    TCP:0.0.0.0:2545    82.165.37.127:80    SUCCESS    RELEASE    

   
One can notice that the events are happening very fast. The below presented figure shows the TCP/IP pattern in injected explorer.exe process.

Tinba Hooking Explorer - TCP/IP Pattern

When forms are submitted over HTTP/HTTPS, the Firefox raises an alert box for notifying user about communication protocol in use. Internet explorer uses the concept of Zones. So we looked at this pattern in Tinba. No doubt for Internet Explorer, Tinba modifies the registry entry to disable configuration of Zones.as follows:

\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3

Tinba also manipulates the Firefox behavior by tampering user.js (preferences) file as follows

[C] user_pref("security.warn_submit_insecure",false);
Browser does not raise an alert box when information in sent over HTTP while submitting forms.

[C]
user_pref("security.warn_viewing_mixed",false); : 
Remove the warning of supporting mixed content over SSL.


The aim behind this modification is to remove the ambiguity in the communication channel used by Tinba. Let's have a look at the traffic communication:


Tinba Sending POST Requests
Tinba Sending GET Requests
Encrypted Reply
The communication is encrypted and well managed in this case. Another interesting thing we noticed during analysis is that, when you reboot your infected system with Tinba, it raises windows integrity check which shows that Tinba has seriously altered the integrity of system32 files such as winver.exe


Window Integrity Check on System Infected with Tinba on Every Reboot
This adds some more information on the Tinba malware.

Some more next time !

Wednesday, June 13, 2012

LinkedIn Phishing Attack - Dissecting Attack and Used Exploit

Recently, after the successful intrusion of linked-in network by attackers, phishers also started exploiting the trust of users by sending phishing emails with embedded malicious links. The linked-in is on bit roll nowadays by attackers but it is always good to analyze the phishing attack. Our team received the phished linked-in emails. Of-course if you are in malware analysis field you are always targeted one or the other way. It happens. Let's discuss the exploit in action in this phishing attack. The users receive following email as presented in the figure below:


The users who received this email are presented below:


The malicious links accompanied with this email are presented as:

The phished email is embedded with more than 2 malicious links.The index.html retrieves 2 JS files from two different domains as presented below


 
On successfully loading of JS files, the webpage redirects to the target pointed by document.location call. The target URL is actually NGINX reverse proxy which communicates back with blacklisted IP serving malware. The attacker is almost using 3-4 hops to retrieve the malicious content. On detecting the hosts, we found that some of the links are now down or giving forbidden access. However, the targets can be accessed by querying directly with the IP address of the host and not the DNS. The exploit used during this campaign might vary with time but we encountered the script that triggered flash/adobe exploit that uses JavaScript heap spraying. The obfuscated script used in this case is bit complex but not a hard target to deobfuscate. The obfuscated script (redacted) looks like as presented below


The script is too big to paste here. So you can find it here - http://pastebin.com/MSpCtZH7
There are several tricks you can use to deobfuscate it, one of the methodology is discussed in our previous blog post on JavaScript Obfuscation -  http://secniche.blogspot.com/2012/04/javascript-obfuscation-manual-armor-1.html.

The deobfuscated script is available here - http://pastebin.com/yDjQRD0u. Some of the interesting code has been shown below, the rest you can scratch on the pastebin.

On successful, deobfuscation, we observed that

1. The script is fingerprinting plugins, OS, User-agent and other information
2. The malicious domain is running BlackHole BEP.
3. We accessed certain set of files on the domain, one of which is shown below


So, the BlackHole is still on fire but attackers now using modular way  of serving exploit. There are other interesting information that we found during analysis but not presenting here. If something more interesting comes up, we will update it here.

How to be secure?

1. Update plugins to the latest version.
2. Think twice before your click.

Be secure !


Tuesday, June 12, 2012

For Fun - XSS in ICE IX C&C Panel

Our team is working on ICE IX botnet analysis. We will be releasing a detailed paper about the working of ICE bot in coming time (very soon). However, this post is meant for some fun purposes but the provided information can be used to complete different tasks. We have detected an interesting XSS in main login page of ICE botnet C&C panel. It does not require any authentication as such though. The POC is presented in figure below


 So what exactly you have to do is to hack the below XML construct in order to trigger it
.

The interesting part is to understand the entry point in this as discussed.

Consider this, /adm/index.php?m=login , so usually "m" parameter in this URI is considered as an entry point which is true in certain sense. However, for this XSS, the entry point is present in /adm/index.php/ [Injection Point] ?m=login.

So, the point is, XSS finds its own entry points. :)

Browser Security Talk:
On additional note, the above presented screenshot shows that payload is sent in URL and Google Chrome parses it and then the payload becomes persistent. Seems like a bypass, yes it is. It depends whether Google Chrome team considers it or not.  IE and NoScript triggers an alert.

Enjoy !

Friday, June 8, 2012

NGR Bot Analysis - Virus Bulletin Paper [Download]

We have uploaded the paper on analysis of NGR bot. It is also available for download at http://secniche.org/released/VB_AKS_RB_RJE_NGR_BOT.pdf.

Wednesday, May 30, 2012

Malware Design Strategies (Part 2) - Virus Bulletin

   Last month, Malware Design Strategies (Part 1) paper  was published in virus bulletin magazine. Continuing from there, part 2 of the paper is published this month's. It is available here - http://secniche.blogspot.com/2012/05/malware-design-strategies.html.

In this paper, we have discussed about:-

1. Polymorphic and metamorphic encryption
2. Anti-debugging tricks
3. Ant-traffic analysis stuff
4. Deployed tactics to detect virulent code.

Right now, subscription is required to read paper. We will release it after couple of weeks.

Monday, May 14, 2012

IEEE Internet Computing (PrePrint) - Cybercrime - Dissecting the State of Underground Enterprise

Our paper on "Cybercrime - Dissecting the State of Underground Enterprise" is available in preprint is available at

http://www.computer.org/csdl/mags/ic/preprint/mic2012990274-abs.html

Abstract: Cybercrime’s tentacles are reaching deeply into the Internet. A complete, underground criminal economy has developed to steal money through the Web. We detail this underground enterprise showing how information, expertise and money flow through it. Understanding the structure of this economic enterprise is critical for fighting it.

We will update the information once it is out in hard copy.

Enjoy !

Thursday, May 3, 2012

Code Hiding in Images - JavaScript Manual Armor (3)

Attackers are always using interesting techniques of hiding code. Image files have been used extensively for hiding payloads in the headers and upon rendering, the payloads get executed. In the past, several applications have been pwned for XSS using this technique in which image header is used to inject the payload. Anyways, it works:). In this post, we came across a generic JavaScript code which is used to render an iframe for injecting code. However, the interesting part in this post is to understand the flow of infection.

We came across a website and found that the .js files that are used for JSON communication have been injected with some malicious code. At the bottom of the sample js file, we find the following code snippet


This JavaScript is not that heavy as it is using only unescape. However, the unescape has to be performed two times to get the URL. So we perform a simple step to tweak the code as follows

After doing this, we get the target URL as "http://incas.co.kr/image/k.jpg". The iframe is pointing to a image file. Interesting ! Let's see what we have


The image file is actually an ASCII file. We find that there is some hexadecimal code in it. So we clean the code and feed it to the converter as follows

So it is pointing to an image folder on  "http://www.spris.com/images/". On issuing a HTTP request to this URL, we are served with

The log.txt file is served only once to the IP.  When we fetch the page, it contains an iframe that is pointed to log.txt file.


Well, we do not find any data in the file. Anyways, that's not a problem :). The main point is to analyze the flow. Attackers can use hard obfuscated scripts and follow the same flow of infection.

Malware Design Strategies (Part 1) - Virus Bulletin

Our paper on "Malware Design Strategies (Part 1)" just got published in the may edition of virus bulletin magazine. In this paper,  we discuss some of the different techniques that are used by present-day malware to circumvent protection mechanisms. This paper delves into some of the most widely used tactics by malware to bypass protection solutions and to detect the presence of other type of malware in the system. In part 1 of this paper, we talk about following methods

1. Detection of windows x86 emulator for running 32 bit dlls on x64 bit systems.

2. Detailed information about various tactics of VM  code detection using memory, registry, Virtual
   Machine Configuration Interface (VMCI), Media Access Control (MAC), system processes etc.
   These  methods are typically used to design anti VM code.

3 DLL injections using Asynchronous Procedure Call (APC)

4. Mutex based detection

5. Explicit run time linking to verify the presence of specific DLLs.

For complete details fetch the paper (require subscription) from - http://www.virusbtn.com/virusbulletin/archive/2012/05/vb201205-malware-design-strategies

We will be continuing our discussion in the part 2 of this paper.

Enjoy!

Thursday, April 26, 2012

Flashback MAC OS X Malware - Can We Control It ?



Flashback malware has been used effectively to infect MAC OS X machines. Typically, it follows the process of drive-by-download attacks to exploit a vulnerability in a stealthy manner which results in downloading of bot in the MAC OS X machines. Several Java vulnerabilities have been used to execute this attack. Flashback scrutinizes the presence of several set of files on MAC OS X machines to detect if there are any anti malware tools installed. If the files are not found, it triggers the routine to install itself and connect back to the C&C server. The list of severs are generated after the successful verification of anti-virus tools. The infected machines are segregated using UUID strings which are unique in nature to manage and control the bots. More details can be found on following links about the behavior of this malware


http://news.drweb.com/show/?i=2341&lng=en&c=5

Our team conducted a small set of experiments and we wrote a detection signature that can be ported directly into IDS running as a peripheral network monitoring device by various ISPs. We are not disclosing the details of the signature but a quick test presented us with a list of IP addresses that are running C&C severs for flashback MAC OS X bots. Here are some of the IP addresses

23.21.71.54
142.165.4.26
174.129.221.183
208.67.216.146
212.154.192.98
50.116.35.158
50.62.12.103
67.215.65.132

208.86.225.38
82.141.230.155
91.233.244.102
68.178.232.100
So even the MAC OS X is not secure as believed. We will be doing some static analysis of this malware to understand the design from the core.

Wednesday, April 25, 2012

BlackHole BEP Still Rising High!

Last year at Virus Bulletin conference, we presented about the techniques and tactics used by Browser Exploit Packs (BEPs). We discussed about the functionality of BlackHole. The paper can be downloaded from http://www.secniche.org/papers/VB_2011_BRW_EXP_PACKS_AKS_RJE.pdf.

We also discussed about the exploit distribution mechanism in BEPs by presenting the study of Phoenix BEP in the HITB Ezine.The paper can be downloaded from http://magazine.hackinthebox.org/issues/HITB-Ezine-Issue-008.pdf.

However, we have not seen any decrease in the infection rate of BlackHole BEP. Our team conducted some tests and results are as expected. Deployed IDS signatures collected several IP addresses that are infected with BlackHole. We are not disclosing the details of our detection payloads. Here is a list of IP addresses as presented below

176.65.155.84  
199.230.54.74 
206.188.192.117      


195.39.12.62  
174.36.24.216   
206.188.192.129  
195.210.4.16 
205.178.145.119    

173.230.138.185  
115.249.190.46  
12.133.182.133 
206.188.192.37 

68.178.232.100
205.178.145.150   
74.207.249.7 
206.188.192.79   
205.178.145.125  
206.188.192.148

205.178.145.65  
195.39.12.61  
199.30.89.187 

206.188.192.116 
176.65.157.82   
205.178.145.142  
199.30.89.180   
205.178.145.140  

206.188.192.74  
188.190.98.79
205.178.145.124    
173.212.218.123  
206.188.192.188 
205.178.145.130 
 
184.173.73.174    
193.200.167.30   

206.188.192.13   
193.104.153.44   
206.188.192.21   
205.178.145.71  
206.188.192.40 

129.121.93.254  
141.136.16.116   
206.188.192.230  

206.188.192.244  
109.235.49.23  
206.188.192.89   



Most of these IP addresses are found to be in Canada and US. The point is, BlackHole BEP is still rising high. We are still in process of conducting more experiments to decipher the running behavior of BlackHole.