Welcome!

Related Topics: Cloud Security

Cloud Security: Blog Post

Malware Analysis - A Cost Effective and Quick "How To"

Full time malware analysis is expensive, this method provides a fast and simplified approach that produces results.

Malware analysis can be a time consuming process, especially when dealing with a sample from skilled attackers with time and money on their side . There is no doubt that fully reversing malware and finding out how it works is the most effective way to learn how to defend against it, but most businesses don't have the time or the professional resources to do it.

There are ways in which you, a Computer Network Defender, can glean enough information from malware to be used in IDS and AV signature creation, DNS poisoning and blocking as well as sharing with the CND community. This can be accomplished in a cost effective manner (maybe even free) and in an efficient manner that can rival very long code based analysis.  There are even cases where in depth knowledge of how to fully reverse the sample is not needed.

It should be noted that this is a low tech, high level mechanism for capturing indicators from malware. It should not be considered a substitute for fully analyzing malicious software, as sophisticated samples can defeat a lab environment similar to this quite easily. I will not be covering anything related to debugging the malware, that is outside of the intention of this "How-to".

Requirements
Before we start, you will need to procure a few bits and pieces:

  • Host machine with enough storage and memory to run at least 2 virtual machines concurrently, 4GB of ram and at least 30GB would be the minimum requirement.
  • A virtualization platform, there are several on the market, some of them are free to use, VirtualBox and Xen to name a couple. I will be using VMWare Fusion for this demonstration.
  • A copy of "REMNUX", a reverse-engineering malware linux distribution available at http://zeltser.com/remnux/.
  • A licensed copy of MS Windows (this will be your victim host). I will be using WindowsXP for this demonstration.
  • Free and open source tools for analysis of the Windows host (Putty, RegShot, Sysinternals, etc etc)

Setting Up the Victim Host Machine
Something to consider when setting up your victim host machine is system and software patches. Depending on what you are testing on your victim host, it may only affect a certain version of Windows, or possibly only to a certain patch level. Something I like to do is to "snapshot" my "victim" host machines through various patch stages, that way if I need to roll back, it's as easy as choosing a snapshot and "rolling back". This also applies to the types of software you install on your victim, snapshot your host with different versions of java, flash and adobe reader to be able to quickly select a vulnerable configuration. Consider outfitting your malware analysis lab setup with hosts that mimic your native operating environment. If you only utilize Windows 7 and do not allow Firefox on your network, then set up your victim machines to match that configuration.

A screenshot of the VMWare Fusion "Snapshot" process

Once you have finished patching your host, downloading and installing various types of software to aid in allowing successful exploitation you are going to setup a new network adapter, and set it for "host-only". This will keep your host from accidentally reaching the Internet once infected. It will also allow you to send the traffic to another machine to analyze what your victim is trying to do once successful exploitation has taken place.

  • Set the IP on your victim host to a non-routable address, for instance 10.1.1.10.
  • Set your router or gateway to be 10.1.1.1, this will the IP address of your REMNUX virtual machine.

Setting Up the REMNUX Host Machine
One of the main purposes for the REMNUX virtual machine in this demonstration is simply to act as a catch-all for network traffic originating from your now exploited victim host. REMNUX has many uses and capabilities both for the beginner and advanced malware reverse engineer, but we want fast indicators from our malware sample so that we can start defending against it immediately.

The REMNUX virtual machine is ready to go once imported into your virtualization platform with minimal modifications.  We are simply going to add a network adapter in "host-only" mode and set the IP address to a non-routable IP. REMNUX will act as the internet "gateway" and DNS server for our victim machine. This will allow us to see all network requests and DNS requests that come from our infected victim host.

A screenshot of the "REMNUX" desktop
A screenshot of the "REMNUX" network interfaces config, modify to suite your needs.

Infecting the Host
Now that you have the infrastructure in place, test your connectivity between the victim virtual machine and the gateway virtual machine. Have Wireshark running on the gateway box to verify successful connectivity. Attempt to SSH from your victim host to the gateway using putty. You can use "pscp.exe" within the Putty suite to move the original malware, and any malicious files the malware creates or drops onto your victim. Once you have moved the file over to your REMNUX host, you can take the MD5 of the original malware, before it is run. This will help in creating virus signatures and give you the required information for sharing within the CND community.

The victim host pre-infection with Process Explorer running.

Utilizing "Regshot", take a snapshot of the "C:" drive pre infection, that way you will have something to compare after your host is infected. Regshot will record the current windows registry, all windows directories and files before infection, allow you to record again after infection, and then compare the changes made to the host.

The victim host running Regshot and Process Explorer

You can now move your malware sample to the victim host. Ensure that you are running the necessary services and tools on your REMNUX host to capture the traffic. If you are not looking to interact with the malware, Wireshark can provide a wealth of data with not much in-depth knowledge. If you are looking to interact however, please consult the REMNUX readme for more information on "honeyd", "farpd" and "fakedns".

I also recommend running some kind of process explorer on the victim host to monitor what the malware does, any new processes it may spawn or kill. Sysinternals suite has several great tools, Process Explorer and Process Monitor are my two favorites.

Capturing the Indicators
Once executed on your victim host, you can record the information being fed to ProcMon, allowing you to watch what the malware does. You may see new applications start, processes get killed and new processes start. These are all indicators of the malware, and essential data to capture.

The victim host has a new process running attached to an executable with PID 2168

Watch your REMNUX host, check to see if any callouts are being made by the malware and see if it attempts to resolve DNS addresses. Often times once the DNS has successfully resolved, you will witness the malware attempt to connect to the Command & Control domain over an HTTP/HTTPS port.

A screenshot of Wireshark capturing the first DNS resolution attempt by the malware.
A screenshot of Wireshark capturing the second DNS resolution attempt by the malware.

A Note on DNS Resolution with Malware
The malware may attempt to resolve a known good website, this can be for internet connectivity checking as well as an attempt to fool someone monitoring it. If the malware is unable to resolve lets say “google.com” it may simply die on the victim host, and never try to reach the real command and control domain (CnC). This is when you want to have “fakedns” running on your REMNUX host, it will resolve any domain asked, this will then give the malware the positive connectivity test it is looking for, at which point may try to resolve the actual CnC domain.

Once you are satisfied with the length of time you have let the malware run, 10 minutes or less usually suffices, you can take the second “Regshot’ of the system. This will capture any changes made to the system by the malware. Once it has completed the second pass, compare the two and analyze the output. “Regshot” will reveal any new files created, deleted or modified. It will show you if any new registry keys were added or changed and any services that were created. It is an essential tool in the analysis toolbox.

A screenshot of the "Regshot" compare results.

As you can see with the "dir /ah" command, the files that were hidden on the victim. These files were all dropped from the malicious word document.

A screenshot showing the hidden files added to the temp directory on the victim host.

Once you have located the dropped or newly added malware on the victim host, you should move them over to your "REMNUX" host for analysis. These files are also indicators of a positive infection and should be included in your analysis of the initial malware. The MD5 hashes of these files are just as relevant for blocking and signature development as the principle delivery of these files, e.g. malicious word document, can easily change in future attempts.

Share Your Findings - One of the Most Important Pieces to Computer Network Defense
From this quick, and high level analysis of the malicious word document you were presented with several indicators that can benefit other Computer Network Defenders. One thing that I  have learned is that not everyone catches or sees something the way I may I see it.  So when I look at a piece of malware, no matter how simple I think it may be, I share it with the hopes that the indicators could assist others.

It is essential that you share as much information as you are comfortable with, as it may help to thwart future attempts against other targets. Collaboration amongst teams can help to stop these types of infections and identify current infections if they exist within your network. If possible, share any Command & Control Domains, MD5 Hashes, IP addresses, File Names and Sizes and anything else you feel is relevant to the infection.

More Stories By Cory Marchand

Cory Marchand is a trusted subject matter expert on topics of Cyber Security Threats, Network and Host based Assessment and Computer Forensics. Mr. Marchand has supported several customers over his 10+ years within the field of Computer Security including State, Federal and Military Government as well as the Private sector. Mr. Marchand holds several industry related certificates including CISSP, EnCE, GSEC, GCIA, GCIH, GREM, GSNA and CEH.

Latest Stories
SYS-CON Events announced today that Bsquare has been named “Silver Sponsor” of SYS-CON's @ThingsExpo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. For more than two decades, Bsquare has helped its customers extract business value from a broad array of physical assets by making them intelligent, connecting them, and using the data they generate to optimize business processes.
SYS-CON Events announced today that Commvault, a global leader in enterprise data protection and information management, has been named “Bronze Sponsor” of SYS-CON's 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Commvault is a leading provider of data protection and information management solutions, helping companies worldwide activate their data to drive more value and business insight and to transform moder...
DevOps at Cloud Expo – being held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA – announces that its Call for Papers is open. Born out of proven success in agile development, cloud computing, and process automation, DevOps is a macro trend you cannot afford to miss. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the world's largest enterprises – and delivering real results. Am...
Almost two-thirds of companies either have or soon will have IoT as the backbone of their business in 2016. However, IoT is far more complex than most firms expected. How can you not get trapped in the pitfalls? In his session at @ThingsExpo, Tony Shan, a renowned visionary and thought leader, will introduce a holistic method of IoTification, which is the process of IoTifying the existing technology and business models to adopt and leverage IoT. He will drill down to the components in this fra...
The vision of a connected smart home is becoming reality with the application of integrated wireless technologies in devices and appliances. The use of standardized and TCP/IP networked wireless technologies in line-powered and battery operated sensors and controls has led to the adoption of radios in the 2.4GHz band, including Wi-Fi, BT/BLE and 802.15.4 applied ZigBee and Thread. This is driving the need for robust wireless coexistence for multiple radios to ensure throughput performance and th...
SYS-CON Events announced today that Pulzze Systems will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Pulzze Systems, Inc. provides infrastructure products for the Internet of Things to enable any connected device and system to carry out matched operations without programming. For more information, visit http://www.pulzzesystems.com.
Enterprise IT has been in the era of Hybrid Cloud for some time now. But it seems most conversations about Hybrid are focused on integrating AWS, Microsoft Azure, or Google ECM into existing on-premises systems. Where is all the Private Cloud? What do technology providers need to do to make their offerings more compelling? How should enterprise IT executives and buyers define their focus, needs, and roadmap, and communicate that clearly to the providers?
SYS-CON Events announced today the Kubernetes and Google Container Engine Workshop, being held November 3, 2016, in conjunction with @DevOpsSummit at 19th Cloud Expo at the Santa Clara Convention Center in Santa Clara, CA. This workshop led by Sebastian Scheele introduces participants to Kubernetes and Google Container Engine (GKE). Through a combination of instructor-led presentations, demonstrations, and hands-on labs, students learn the key concepts and practices for deploying and maintainin...
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
There is little doubt that Big Data solutions will have an increasing role in the Enterprise IT mainstream over time. Big Data at Cloud Expo - to be held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA - has announced its Call for Papers is open. Cloud computing is being adopted in one form or another by 94% of enterprises today. Tens of billions of new devices are being connected to The Internet of Things. And Big Data is driving this bus. An exponential increase is...
DevOps at Cloud Expo, taking place Nov 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 19th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait for long dev...
Digital innovation is the next big wave of business transformation based on digital technologies of which IoT and Big Data are key components, For example: Business boundary innovation is a challenge to excavate third-party business value using IoT and BigData, like Nest Business structure innovation may propose re-building business structure from scratch, as Uber does in the taxicab industry The social model innovation is also a big challenge to the new social architecture with the design fr...
Data is an unusual currency; it is not restricted by the same transactional limitations as money or people. In fact, the more that you leverage your data across multiple business use cases, the more valuable it becomes to the organization. And the same can be said about the organization’s analytics. In his session at 19th Cloud Expo, Bill Schmarzo, CTO for the Big Data Practice at EMC, will introduce a methodology for capturing, enriching and sharing data (and analytics) across the organizati...
IoT is fundamentally transforming the auto industry, turning the vehicle into a hub for connected services, including safety, infotainment and usage-based insurance. Auto manufacturers – and businesses across all verticals – have built an entire ecosystem around the Connected Car, creating new customer touch points and revenue streams. In his session at @ThingsExpo, Macario Namie, Head of IoT Strategy at Cisco Jasper, will share real-world examples of how IoT transforms the car from a static p...
The many IoT deployments around the world are busy integrating smart devices and sensors into their enterprise IT infrastructures. Yet all of this technology – and there are an amazing number of choices – is of no use without the software to gather, communicate, and analyze the new data flows. Without software, there is no IT. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists will look at the protocols that communicate data and the emerging data analy...