Tuesday, October 14, 2014

Analysis of SandWorm (CVE-2014-4114) 0-Day

Background

iSIGHT Partners, working with Microsoft, today published details of a 0day vulnerability (CVE-2014-4114) used in a possible Russian cyber-espionage campaign targeting NATO, the European Union, the Telecommunications and Energy sectors.

In this blog, we will provide a quick analysis of an exploit payload targeting this vulnerability, presently in the wild and showcase Zscaler's APT detection capabilities.

CVE-2014-4114
A vulnerability in Windows Object Linking and Embedding (OLE) package manager could allow an attacker to perform remote code execution on the target system. The attacker exploits this vulnerability via a specially crafted Microsoft Office file with embedded OLE files from a remote location. The remote files in the SandWorm exploit hilighted by iSIGHT Partners include a malicious executable from a known malware family, namely the BlackEnergy Trojan. BlackEnergy malware family first appeared in year 2007 and has been involved in multiple targeted attack campaigns this year.

The exploit payload involved in this case is a PowerPoint Open XML Slide Show file named spiski_deputatov_done.ppsx. This file contains two malicious embedded OLE objects which point to remote files as seen below:
CVE-2014-4114: Embedded OLE Object 1
 The embedded OLE Object 1 contains the remote location of the BlackEnergy Trojan pretending to be an image GIF file.

CVE-2014-4114: Embedded OLE Object 2
The embedded OLE Object 2 contains the remote location of the setup information file - INF file that contains information used by Windows to install drivers. In this case, the INF file slides.inf contains information to rename and execute the BlackEnergy Trojan executable file slide1.gif as seen below:

CVE-2014-4114: slide.inf file
The process flow for this infection cycle looks like below:

CVE-2014-4114: Process flow during a successful exploit cycle
The end user will be completely oblivious to this infection cycle and will see a slide show containing the following images upon execution:



CVE-2014-4114: Exploit payload PPSX images seen by user


Zscaler APT detection

The Zscaler Behavioral Analysis engine accurately flags this 0-day exploit payload as malicious and blocks it as seen in the report below:





Conclusion

All the supported versions of Microsoft Windows and Windows Server 2008 & 2012 operating systems are vulnerable. It is extremely important for the enterprises to install the latest Microsoft security patches to avert these attacks. More information about this vulnerability patch is available here:
Zscaler ThreatLabZ has deployed multiple levels of security countermeasures to protect the customers against these 0-day exploits.

Deepen Desai

Tuesday, October 7, 2014

#BASHed Evolution of Shellshock Attack payloads

Background
We recently blogged about the GNU Bash arbitrary code execution vulnerability (CVE-2014-6271) dubbed as Shellshock and covered some initial attacks that we captured in the wild during the first week of this vulnerability disclosure. We have continued to monitor the Shellshock exploit attacks and the malicious payloads that were getting dropped over past two weeks.

In this blog, we wanted to share a summary of new exploit attacks and new tricks that cybercriminals have deployed to increase the chances of infection.

Shellshock Attack analysis

The first attack, as reported in our previous blog, involved download and installation of a Linux Backdoor Trojan with DDoS capability detected by us as Unix/Flooder.AN.

Here the attack pattern was straight forward, if the bash exploit was successful then a malware payload was getting downloaded and installed.

Perl IRC bots

Next we saw a series of exploit attempts where a Perl based IRC bot was getting downloaded and executed on the target server. We will share two sample cases here.

In the first case, we saw a Base64 encoded Perl based IRC bot getting downloaded, decoded and executed on the target machine.

Shellshock exploit downloading Perl IRC bot

Base64 encoded Perl IRC bot

In the second case, we saw another Perl IRC bot getting downloaded and executed with a command-line argument which is the IRC server IP.

Shellshock exploit downloading Perl IRC bot

Perl IRC bot

The attacker performs following action here before downloading and running the bot:
  • Terminate all the PHP and PERL instances running on the server.
  • Attempts to delete all the content in the /tmp/ and /var/tmp/ directory.
  • Avoids hardcoding the Command and Control server IP in the bot file that gets downloaded.
Things became more interesting after this when we started seeing attacks involving tricks to add stealth and persistence to the infection. We also saw tricks used to prevent any further exploit attempts on the server by attempting to apply security patches to the server once the exploit infection was successful.

Linux.Tsunami C source code

In the attack case shown below, a bash script gets downloaded and executed on the target server upon successful exploit attempt.

Shellshock exploit downloading C IRC bot

Shell script payload downloaded upon successful exploit

The shell script will perform the following actions:
  • Downloads an IRC bot written in C programming language
  • Attempts to compile the C bot program using gcc compiler on the victim server
  • Executes the newly generated ELF IRC bot binary
  • Creates a crontab entry to download and infect the system on a weekly basis
This is a way of establishing persistence, even if the system administrator identifies and removes the culprit file the system will again get infected when the cronjob triggers. The attacker is also transferring a plain-text file as oppose to an ELF binary in an attempt to evade network perimeter defenses.

Linux.Tsunami ELF binary

In the most recent case, the attacker first ensures that the current bash session does not get recorded to the history file. It then also involved a shell script getting downloaded and executed on the target server as seen below:

Shellshock exploit attempt downloading Linux.Tsunami

Shell script payload downloaded upon successful exploit

The shell script will perform the following actions:
  • Downloads and executes a new variant of Linux.Tsunami DDoS bot
  • Create crontab entry to ensure future update and persistence
  • Attempts to download and patch the Bash vulnerability in an attempt to prevent new infections from competitors?
  • Uses shred command before deleting itself (downloaded shell script)
shred command Overwrite the specified FILE(s) repeatedly, in order to make it harder for even very expensive hardware probing to recover the data.

Conclusion

We have seen a quick evolution in the Shellshock exploit attack payloads that can be broadly classified into following categories:
  • Persistence - achieved by creating cronjob.
  • Evasion - payload Base64 encoding (Perl bot) and plain-text C source code transfer.
  • Stealth - prevents recording of bash session history, usage of shred and rm commands.
  • Competitive Advantage - removing other exploit payloads, installing new payload and applying security patches to prevent further exploit & infection attempts.
It is extremely important for the system administrators to test if their server is vulnerable and apply appropriate security patches as described in our previous blog. It is also important to check for the indicators of compromise mentioned in the above attack cases.

Zscaler customers are protected from this threat and the associated malware payloads. Zscaler ThreatLabZ is actively monitoring this threat and associated attacks in the wild.

Monday, September 29, 2014

Fiesta Exploit Kit: Live Infection


During our daily hunt for Exploit Kits (EK), we came across many live Fiesta exploit chains.
The infection started from the following compromised domains:
  •       orpi.com
  •       soyentrepreneur.com
  •       interfacelift.com

Compromised sites:

The attackers often leverage compromised sites to serve as the first level of redirection in the EK infection cycle. In the first Fiesta EK instance that we analyzed, the attacker after getting the root access has modified the “scripts.js” file present at location:
  •       hxxp://www[.]media[.]orpi[.]com/js/scripts.js
All the pages importing this JavaScript file will redirect the user to "nvplus[.]com/wp-content/".

Another variation of the initial loading page redirection was observed in the compromised site “interfacelift[.]com” at the following location:
  •       hxxp://interfacelift[.]com/wallpaper/downloads/date/any/   
In this case the attacker added a <script> tag with the location pointing to another redirection site at:
  •          hxxp://sunduk[.]biz/forum/docs/

A third variation of the initial redirection was observed on the compromised site
"soyentrepreneur[.]com", where the attacker created a new JavaScript file “funcionesCarga.js” at the following locations:
  •          hxxp://www[.]soyentrepreneur[.]com/assets/js/funcionesCarga.js
  •          hxxp://www[.]soyentrepreneur[.]com/assets/js/se2013/funcionesCarga.js
The website pages importing these JavaScript files will redirect the user to the Fiesta loading site.

All three initial redirection methods are fairly stealth and can remain unnoticed for days to the web administrators. We found this approach to be more effective and completely opposite from a RIG EK compromise that we recently analyzed where the attacker changed the home page of the website to ensure redirection. 

Fiesta EK:

Some of the recent live Fiesta EK loading sites found in the wild are:
  •        nvplus[.]com/wp-content/
  •        son-ko[.]com/scripts/bundles/login.php
  •        sunduk[.]biz/forum/docs/login.php
  •        toringaz[.]com/images/
  •        barferoase[.]de/blog/wp-content/themes/
  •        www.artlen[.]com/assets/cache/rss/
  •        www.courieru[.]com/cache/joomsef/
  •        www.roofstroy[.]com/stroy/js.php
  •        ticketstolisbon[.]com/dumper/
  •        cic.com[.]ua/dok/
  •        talktyme[.]com/flash/
Apart from the usual EK redirection chain, it checks for the user's browser as well as presence of application plugins for Microsoft Silverlight and Adobe Flash.

It checks if Silverlight plugin is installed by creating the following ActiveXObject object:
  •  ActiveXObject("AgControl.AgControl") 
The presence of Flash plugin is ensured by creating the following object:
  • swfobject.embedSWF()
If both the above object creation functions generate an exception, then the exploit cycle terminates. But if the vulnerable versions are found, it takes the user to the EK landing page.

Redirection to Fiesta EK Landing page

Fiesta Landing Page:

Initially, the malicious Silverlight and Flash files are downloaded for which the plugin checks have already been performed.

AV detection for the downloaded malicious files:

  •       rtu.swf: 2/55 (Generic Exploit)
  •       rtp.xap: 2/54 (CVE-2013-0074)

Following this, the main controller of Fiesta EK is called. Example in one of the Fiesta EK instance we analyzed:
  •        hxxp://hjwqk.ianlar[.]in/pofrj4l/1
It generates the following GET requests to the same domain during the course of the Exploit cycle:

·         hxxp://hjwqk.ianlar[.]in/pofrj4l/321eabf3f523be344045575e50595404020b045e5500560806060006515a5e04;120000;0
·         hxxp://hjwqk.ianlar[.]in/pofrj4l/6ea46961ad8578015717000f07020406075c540f025b060a0351505706010e06
·         hxxp://hjwqk.ianlar[.]in/pofrj4l/7a77e441c530b7c15419520c540f06060658020c5156040a02550654550c0c06;1;2@@
·         hxxp://hjwqk.ianlar[.]in/pofrj4l/1b88a025c530b7c1521a5d03500b0002005b0d035552020e0456095b51080a02;1;3@@
·         hxxp://hjwqk.ianlar[.]in/pofrj4l/675e60f2d4cb58ae5c59595e070b5405070e005e025256090303040606085e05
·         hxxp://hjwqk.ianlar[.]in/pofrj4l/2a78dd2dfa898b9d5b045b03555f0053035802035006025f0755065b545c0a53
·         hxxp://hjwqk.ianlar[.]in/pofrj4l/33603690d9fdeed05f5a540b020d0b07020a030b0754090b06070753030e0107;900
·         hxxp://hjwqk.ianlar[.]in/pofrj4l/2a7f53d52bfa0822410d415d040856020358025d0151540e07550605050b5c02;5061118
·         hxxp://hjwqk.ianlar[.]in/pofrj4l/61295aeb0e3b886755415902045a575507080702010355590305035a05595d55;5;1
·         hxxp://hjwqk.ianlar[.]in/pofrj4l/3bb805820e3b886750120903010e0a05025b5703045708090656535b000d0005;6;1
·         hxxp://hjwqk.ianlar[.]in/pofrj4l/535c3355fb26fbd956435e5802080702040a00580751050e00070400030b5405;1;1



The Fiesta EK is performing the following exploitation attempts which are resulting in the multiple GET requests:

Adobe Flash
  • Checks if Adobe Flash is installed and gets the application version.
  • It then generates a GET request to fetch the run-time parameters for the previously downloaded SWF file "rtu.swf".
  •       A sample object of type “application/x-shockwave-flash” with dynamic run-time parameters to run the exploit payload is created as shown below:
“<object width=10 height=10 id='swf_id' type='application/x-shockwave-flash'><param name='movie' value='FnkwX'/><param name='allowScriptAccess' value='always'/><param name='FlashVars' value='wetsgk=MWYzH'/><param name='Play' value='0'/></object>"

Microsoft Silverlight 
  • Checks if Microsoft Silverlight is installed in browser and gets the application version.
  • It then generates a GET request to fetch the run-time parameters for the previously downloaded XAP file "rtp.xap".
  • A sample object of type "application/x-silverlight" with dynamic run-time parameters to run the exploit payload is created as shown below:
"<object data='data:application/x-silverlight-2,' type='application/x-silverlight-2' width=10 height=10><param name='source' value='LVSDE'/><param name='initParams' value=<LONG_STRING_VALUE></object>"


Java
  • Check if Java plugin is installed and enabled in the browser.
  • Downloads a malicious Java archive (JAR) based on the installed version:
    • JAR File -> ianlar.jar: 4/55 (CVE-2012-1723)
  • It then generates a subsequent GET request to fetch parameter values required to execute the malicious JAR payload.
  • Creates a custom applet tag utilizing the run-time parameter values to run the exploit payload as seen below:

Adobe Reader
  •        Checks for the presence of the Adobe Reader plugin.
  •        Downloads and executes the malicious PDF file: 
    •        PDF File -> Ianlar.pdf: 8/55  

Post-Infection

Upon successful exploitation, Fiesta EK was observed installing a new variant of Zemot Trojan from the following location:
  •       hxxp://warzine[.]su/b/shoe/54602
This is a well known Click-Fraud Botnet family which will soon start click-fraud activity on the victim machine, making money for the malware authors.

This Click-Fraud malware family appears to be connected to many other EKs in addition to Fiesta. Some of the domains involved in the Click-Fraud activity:
  • num-lnkd.com
  • syserty-war.com
  • turend-hureft.com
  • service-search.com
  • fifa-seargh.com
  • enjoy-result.com
  • oak-search.com
  • phantom-search.com
  • companies-search.com
  • calimera-search.com

The above domains were resolving to the following two servers located in Russia and Ukraine respectively:
  • 46.161.41.220
  • 192.162.19.34
 A GET request to any of these domains look like this:



- Sameer Patil

Thursday, September 25, 2014

Shellshock attacks spotted in wild [Updated Sept 26]

[Updated Sept 26, 2014: added new analysis and exploit attempts]

Background

GNU Bash is susceptible to an arbitrary code execution vulnerability (CVE-2014-6271) dubbed as Shellshock. The vulnerability is due to failure to properly handle environment variables.

A remote attacker can exploit this flaw by interacting with an application that uses BASH environment variables to override or bypass environment restrictions to execute shell commands. If an attacker can control the value of an environment variable, then code execution can be achieved in the context of the application using the environment variable.

A public advisory was released regarding this vulnerability here:

http://seclists.org/oss-sec/2014/q3/650
https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-6271

Shellshock Attacks - CVE-2014-6271

Within hours of the public disclosure of this vulnerability, we have started seeing incidents of attacks targeting this vulnerability in the wild to download additional malware. It appears that Nginx and Apache web servers configured to use mod_cgi are two potentially vulnerable services that are actively being targeted in the wild. One such incident that we were able to confirm through mining our logs is shown below:


The server involved in the above case was found to be compromised and hosting ELF binaries which belongs to the same Linux Backdoor Trojan family with DDoS capabilities. We believe that the vulnerable Apache servers were resulting in the download of an ELF binary named "apache" whereas vulnerable Nginx servers were getting the ELF binary named "nginx". The only difference we saw in these two binaries was the hardcoded Command and Control server information.

Upon successful exploitation of CVE-2014-6271 vulnerability, the attacker is able to download and install the malicious ELF binary on the target Linux system. The malware connects to a predetermined Command and Control (C2) server on a specific port and awaits further instructions from the attacker. The C2 information can be seen hardcoded in the binary:


The malicious ELF binary named "apache" is leading to a different C2 location "162.253.66.76:53".

This malware family is capable of performing the following actions:
  • BusyBox command injection exploit attempts
  • Collect and send sensitive system information
  • Perform Denial of Service attacks
  • Brute force authentication attempt 
  • Opens a Backdoor connection for remote attacker
List of commands supported by this bot:


The screenshots below show sample command and control communication from this bot:
Initial call back message and command to get system IP address
Shell command & JUNK flooding attempt

Active Shellshock exploit attempts [Updated - September 26, 2014]

Below is a sample list of suspicious headers that we captured in past 12 hours attempting to exploit the Shellshock vulnerability (CVE-2014-6271). While majority of these appear to be testing attempts, some of them look malicious.



Check if your server is vulnerable:

It is extremely important for the system administrators to apply appropriate security patch depending on the Linux distribution they are running. Below is a code snippet posted by Redhat that you could use to determine whether your BASH version is vulnerable or not:

env x='() { :;}; echo vulnerable'  bash -c "echo this is a test"

Conclusion

We rate the severity of this vulnerability to be as critical as that of Heartbleed vulnerability discovered earlier this year. We are still investigating the level of impact associated with this threat.

Zscaler customers are protected from this threat and associated malware family. Zscaler ThreatLabZ is actively monitoring this threat and associated attacks in the wild.

Friday, September 19, 2014

Malvertising campaign leading to Zemot


Malvertising has become a serious problem for advertisers and their clients alike. Times of Israel has been affected already by such an attack. During our analysis, we discovered multiple other legitimate websites affected by the same malvertising campaign. We have informed the website owners to take action. Below is a brief timeline of attack.

A legitimate site leveraging zedo advertisements is the first victim in this attack.  The malicious redirect chain goes to zedo[.]com which will redirect the user to static[.]thebutton[.]com/d2.php?ds=true&dr=.  

The Malicious Redirect chain timeline.


The obfuscated url that is being hidden is static[.]the-button[.]com

The next link in the redirection chain goes to a Swedish site.

The redirect chain then leads the victim to inter[.]wiab-service[.]se/geobalancer/geo2.php?acc=[xyz]
&nrk=.  This is the final redirect that takes the user to [xyz][.]uni[.]me/ site where the Exploit Kit (EK) and eventually payload are sent to the victim.

The Obfuscation here is the final link to the Nuclear Exploit Kit.

Part 1: Nuclear Exploit Kit
Part 2: Nuclear Exploit Kit
The whole purpose of this broad attack is to download the final payload which happens to be a variant of Zemot. It gets downloaded via a Kuluoz variant which has been tied to Zemot click fraud activity in the recent days.

Kuluoz/Zemot infection phone home activity.
If you are unfortunate to have visited one of the many sites which have been compromised by this threat, one strong indicator of infection will be the existence of a batch file which matches the below format:

C:\Users\WIN7\AppData\Local\Temp\tmp37cd8110.bat

This malvertising campaign has been highly effective thus far and no site, despite its good intentions, appears to be given any quarter.

Zscaler is actively monitoring this threat and notifying any sites of compromise.

Thursday, September 18, 2014

Nuclear exploit kit - complete infection cycle

Zscaler ThreatLabZ has been seeing a steady increase in the Nuclear Exploit Kit (EK) traffic over the past few weeks. The detection of malicious activity performed by this EK remains low, due to usage of dynamic content and heavy obfuscation. In this blog, we will walk you through a complete Nuclear EK infection cycle with a live example. We will also share details of the identified payload, which had very low Anti-Virus (AV) detection rates.

The infection cycle begins with an unsuspecting user visiting a legitimate site that was compromised by the attackers. The compromised site in the example covered in this blog is www[.]cornwallmusiceducationhub[.]org that further redirects the victim to the Exploit Kit hosting server [80.85.86.133]. Nuclear EK is notorious for exploiting most popular browser plugins.

The following screenshot shows the malicious iframe injected on the compromised website.
Malicious iframe in compromised domain


The malicious iframe leads the users to a loading site, which in this case performs a second level redirection as shown below, eventually leading the victim to the Nuclear EK's landing page.
Redirecting to the Nuclear EK landing page







Redirection Chain observed in our example:
Compromised site : www[.]cornwallmusiceducationhub[.]org/tag/heartlands-pool/
Second level redirection site: fluersutel[.]tecnopes[.]com[.]ar/miksopulp16[.]html
EK Landing site: actudismatik[.]e-xms[.]com[.]ar/2150b060shv/1/9ffbf35e4190fbba62f70c8477fa3964[.]html
Redirection Chain















The Exploit kit landing page is heavily obfuscated to evade detection by AV and Intrusion Prevention Systems as seen below:
Landing Page













Now we will step through the complete dobfuscation of the landing page that was captured in above example. We leveraged the open source JavaScript beautifier to structure the landing page JavaScript code. Upon structuring the code, we determined that there were 51 unused variable declarations to confuse the researchers.

Going further, we observed that the following three functions VV8Y6W,wL3, and Fp4Ovo were responsible for the dynamic de-obfuscation of the EK landing page code. We have noted the action performed by each function in the following screenshot.


The following routine leverages the aforementioned functions to generate a key PluginDetect (V 0.8.8) script which we will discuss later. 

Upon successful execution of the above code, the variable KKa will store the PluginDetect script. The following code will execute the script.

PluginDetect

This script is derived from the well-known JavaScript library PluginDetect. This library is used by the exploit kit authors to do a detailed reconnaissance of victim's browser plugins. We will walk you through various actions performed by this script before executing the exploit payload.

First the detectPlatform function will check for the operating system running on the victim machine:


Subsequently, the script will also check the version of well-known browser plugins, which includes Java, Adobe Reader, Adobe Flash, and Silverlight. 


It then leverages the XML DOM information leakage vulnerability to enumerate through the system driver files residing in the C:\Windows\System32\drivers\ directory. If it finds any AV driver files, the script will terminate the infection cycle.

Next, the script will check for the vulnerable versions of the loaded plugins and accordingly run the identified application exploit function.







The following screenshot shows the application specific exploit functions:


Below are the exploit payloads that were getting served if the related application plugin version was found to be vulnerable by the Nuclear EK instance that we analyzed. AV detection for the payloads delivered by this variant remained poor at the time of blog publication.

Silverlight Exploit:
CVE:2013-0074
actudismatik[.]e-xms[.]com[.]ar/2959962158/2/1410771180[.]xap
MD5: 94ef35e1ecf0a486ab790957ad794a85
Size: 9139
VT: 2/55

Flash Exploit:
CVE:2014-0515
http://actudismatik[.]e-xms[.]com[.]ar/2959962158/2/1410771180[.]swf
MD5: da5d57c700ebec211a6a57166700e796
Size: 5832
VT: 1/55

PDF Exploit:
http://actudismatik[.]e-xms[.]com[.]ar/2959962158/2/1410771180[.]pdf
MD5: 3676bf357f0678a609df6831b7a870a0
Size: 9769
VT: 1/54


If the exploit attempt is successful, then the EK code will silently download and install the following malware payload on the victim machine.

Malware:
http://actudismatik[.]e-xms[.]com[.]ar/f/2/1410771180/2959962158/7
MD5:acd0fe0c2ce27b8b9fa8741e23e39b81
Size:319488
VT:4/55



Dhruval