{"id":3159,"date":"2016-06-08T16:01:12","date_gmt":"2016-06-09T02:01:12","guid":{"rendered":"http:\/\/westoahu.hawaii.edu\/cyber\/?p=3159"},"modified":"2016-07-08T13:23:44","modified_gmt":"2016-07-08T23:23:44","slug":"building-a-vulnerability-malware-test-lab","status":"publish","type":"post","link":"https:\/\/westoahu.hawaii.edu\/cyber\/vulnerability-research\/vulnerability-tutorials\/building-a-vulnerability-malware-test-lab\/","title":{"rendered":"Building a Vulnerability\/Malware Test Lab"},"content":{"rendered":"<p><strong>Introduction<\/strong><\/p>\n<p>A good way to understand how malicious software works is to drop the malware in a controlled environment, a vulnerability or malware test lab that you can infect to observe and analyze how the malware behaves on the system without affecting your production system.<\/p>\n<p>Although you can use old PCs and hardware to create a lab environment, the better and more flexible way is to use virtualization software which allows you to use one PC to run multiple operating systems. Another advantage of\u00a0 virtualization is that you can instantly take snapshots of the machine&#8217;s state and revert back easily which is useful when you want to infect a machine and restore it to pristine condition after the malware is analyzed.<\/p>\n<p><strong>Virtualization Options<br \/>\n<\/strong><\/p>\n<p>There are several options for virtualization software, the most popular are:<\/p>\n<ul>\n<li>VMWare&#8217;s <a href=\"http:\/\/www.vmware.com\/products\/workstation\/\">Workstation<\/a>\/<a href=\"http:\/\/www.vmware.com\/products\/player\/\">Player<\/a> \/<a href=\"http:\/\/www.vmware.com\/products\/vsphere-hypervisor\/\">vSphere Hypervisor (ESXi)<\/a><\/li>\n<li>Oracle&#8217;s <a href=\"https:\/\/www.virtualbox.org\/\">Virtualbox<\/a><\/li>\n<li>Window&#8217;s <a href=\"http:\/\/www.microsoft.com\/en-us\/evalcenter\/evaluate-hyper-v-server-2012-r2\">HyperV Server<\/a><\/li>\n<li><a href=\"http:\/\/xenserver.org\/overview-xenserver-open-source-virtualization\/download.html\">XenServer<\/a><\/li>\n<\/ul>\n<p>If you are going to run your virtualized lab as a server (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Hypervisor#Classification\">Type-I bare metal hypervisor<\/a>) I suggest vSphere Hypervsior.\u00a0 If you are going to run it on your PC along side your operating system (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Hypervisor#Classification\">Type-II hosted hypervisor<\/a>) I suggest Virtualbox.\u00a0 In this tutorial I used Virtualbox to setup the lab.<\/p>\n<p>The machine you use to host your hypervisor should have plenty of RAM, at least 4GB &#8211; 8GB and lot of hard drive space to store all of the VMs.\u00a0 The PC I used in this lab has the following specifications:<\/p>\n<ul>\n<li>Intel Xenon E5-1603 @ 2.80GHz<\/li>\n<li>16GB RAM<\/li>\n<li>1TB Hard Drive<\/li>\n<\/ul>\n<p><strong>Setup Virtualization Lab<\/strong><\/p>\n<p>Now that you have your virtualization software of choice installed and running on your host, you must setup your virtual machines for your lab.\u00a0 It&#8217;s a good idea to have several VM&#8217;s running a many different versions of operating systems such as Windows Sever 2012, Server 2008, Windows 10, 8.1, 7 and maybe even XP.\u00a0 It also wouldn&#8217;t hurt to have VM&#8217;s with Linux distros or even OSX to test vulnerabilities on those operating systems.\u00a0 My lab for this tutorial consists of Windows 7, Windows 10, Server 2012 and Ubuntu.<\/p>\n<p>Once you have the discs or .ISO files for your operating systems, refer to your virtualization software&#8217;s manual for specifics on how to install the virtual machine.\u00a0 Below is an example of how I created a\u00a0 Windows 7 VM in Virtualbox.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-medium wp-image-3213\" src=\"http:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/1-300x225.jpg\" alt=\"1\" width=\"300\" height=\"225\" srcset=\"https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/1-300x225.jpg 300w, https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/1-768x576.jpg 768w, https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/1.jpg 785w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<ol>\n<li>Open Virtualbox and click on New in the upper left corner.\u00a0 A window pops up and enter a name for your VM. I just named mines &#8220;Windows 7&#8221;. Click Next.<\/li>\n<\/ol>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-3214\" src=\"http:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/2-300x259.jpg\" alt=\"2\" width=\"300\" height=\"259\" srcset=\"https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/2-300x259.jpg 300w, https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/2.jpg 437w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>2. Select the amount of memory to allocate to the VM. Windows 7 needs at least 1-2GB. I allocated 4GB to my VM. Click Next.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-3216\" src=\"http:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/3-300x131.jpg\" alt=\"3\" width=\"436\" height=\"190\" srcset=\"https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/3-300x131.jpg 300w, https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/3-768x336.jpg 768w, https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/3.jpg 967w\" sizes=\"(max-width: 436px) 100vw, 436px\" \/><\/p>\n<p>3. For the hard disk, select &#8220;Create a virtual hard disk now&#8221;.\u00a0 I selected VDI as hard disk file type. VDI is the file type of VM hard disk used by virtualbox.\u00a0 VMDK is the file type used\u00a0 by VMware and VHD is the file type used by Microsoft. You can create your disk to be those file types if you want the disk to be compatible their virtualization software. After you click next, it asks you if you want the virtual hard disk to grow dynamically or be a fixed size.\u00a0 Dynamic storage means it will only use space on your physical HDD as the virtual hard disk grows fixed means it will already reserve the space on your physical HDD. I selected dynamic. Lastly it asks you for the location you want to store the virtual hard disk and the size of it. I chose default location and sized it to 25GB. Click Create. Your virtual machine is now created.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3223\" src=\"http:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/4-300x166.jpg\" alt=\"4\" width=\"300\" height=\"166\" srcset=\"https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/4-300x166.jpg 300w, https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/4-768x424.jpg 768w, https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/4.jpg 893w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>4. Now that the VM is created, you need to have it boot into the OS installation to install it on the VM&#8217;s virtual hard disk.\u00a0 Right click your newly created VM &gt; Select Settings. A window should pop up and in the left pane select storage. Under the Controller select &#8220;Empty&#8221;, which should be a disc icon, this means its a virtual optical drive.\u00a0 On the right side of the window under attributes, there should be another disc icon, click it. If you have a physical disc with the operating system, insert the disc into your host machine and click on &#8220;Host Drive.\u00a0 If you have an ISO file click on &#8220;Choose Virtual Optical Disk File&#8221;.\u00a0 I have an ISO of Windows 7 so I selected the latter.<\/p>\n<p>5. Now you can start your VM. A new window should pop up, this is the console for your VM. The VM should automatically boot into the OS installation. Just install your OS like normal and once it is installed.<\/p>\n<p><strong>Isolate Lab Network from Production Network<\/strong><\/p>\n<p>It is a good idea to isolate your lab network to mitigate the risk of any malicious software escaping into your production network.\u00a0 An easy way of doing this is setting up your virtual network as host only.\u00a0 Host only networking allows your guest VMs to see and communicate with each other and your host can see these guests too but any other physical machine on your physical network cannot see the VMs.<\/p>\n<p>To setup Host-only networking in Virtualbox:<\/p>\n<ol>\n<li>Right click on your virtual machine, in my case &#8220;Windows 7&#8221; VM, and click on settings<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3230\" src=\"http:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/5-300x165.jpg\" alt=\"5\" width=\"300\" height=\"165\" srcset=\"https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/5-300x165.jpg 300w, https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/5-768x422.jpg 768w, https:\/\/westoahu.hawaii.edu\/cyber\/wp-content\/uploads\/2016\/06\/5.jpg 1311w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/li>\n<li>In the right panel click on &#8220;Network&#8221;. Click on the &#8220;Adapter 1&#8221; tab and on &#8220;attached to&#8221; select &#8220;Host-only Adapter&#8221;<\/li>\n<\/ol>\n<p>For added protection you can also configure a network firewall that will filter connections to and from your host machine.\u00a0 Also be sure to keep up with the latest patches for your hypervisor as any vulnerabilities that may allow malware from escaping the VM to infect your host maybe fixed in these patches.<\/p>\n<p><strong>Malware Analysis Tools<\/strong><\/p>\n<p>Before you start infecting your virtual lab with malware, it is a good idea to install some malware analysis and monitoring tools in order to observe how the malware affects the system. Malware analysis tools can be separated into two categories: Behavioral analysis and code analysis.<\/p>\n<p>Behavioral analysis:<\/p>\n<ul>\n<li>File System Monitoring:<a href=\"https:\/\/technet.microsoft.com\/en-us\/sysinternals\/processmonitor.aspx\"> Process Monitor<\/a> or <a href=\"http:\/\/www.procdot.com\/\">ProcDOT<\/a><\/li>\n<li>Process Monitoring:<a href=\"https:\/\/technet.microsoft.com\/en-us\/sysinternals\/bb896653.aspx\"> Process Explorer<\/a> or <a href=\"http:\/\/processhacker.sourceforge.net\/\">Process Hacker<\/a><\/li>\n<li>Network Monitoring: <a href=\"https:\/\/www.wireshark.org\/\">Wireshark<\/a> or <a href=\"http:\/\/www.tcpdump.org\/\">tcpdump<\/a> or <a href=\"https:\/\/blogs.technet.microsoft.com\/messageanalyzer\/\">Microsoft Message Analyzer<\/a><\/li>\n<li>Registry Change Comparison: <a href=\"https:\/\/sourceforge.net\/projects\/regshot\/\">regshot <\/a>or <a href=\"http:\/\/www.torchsoft.com\/en\/rw_information.html\">Registry Workshop<\/a><\/li>\n<\/ul>\n<p>Code analysis:<\/p>\n<ul>\n<li>Disassembler and debugger: <a href=\"http:\/\/www.ollydbg.de\/\">OllyDbg<\/a> or <a href=\"https:\/\/www.hex-rays.com\/products\/ida\/support\/download_freeware.shtml\">IDA Pro Freeware<\/a> or <a href=\"http:\/\/www.microsoft.com\/whdc\/devtools\/debugging\/default.mspx\">WinDbg <\/a><\/li>\n<li>Memory dumper: <a href=\"https:\/\/github.com\/NtQuery\/Scylla\">Scylla<\/a>\u00a0and <a href=\"http:\/\/low-priority.appspot.com\/ollydumpex\/\">OllyDumpEx<\/a><\/li>\n<\/ul>\n<p>Lastly there are several free online analysis tools in which you can upload the malware to the website and it will analyze it:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.threatexpert.com\/submit.aspx\">ThreatExpert<\/a><\/li>\n<li><a href=\"http:\/\/www.virustotal.com\">VirusTotal<\/a><\/li>\n<li><a href=\"https:\/\/www.file-analyzer.net\/\">Joe Sandbox File Analyzer<\/a><\/li>\n<li><a href=\"https:\/\/malwr.com\/submission\/\">Malwr<\/a><\/li>\n<\/ul>\n<p><strong>Conclusion<\/strong><\/p>\n<p>Now that you have your lab setup you can begin to drop in malware into the lab and analyze its affects on the system.<\/p>\n<p id=\"site-title\"><span style=\"text-decoration: underline;\">References<\/span><\/p>\n<p>&#8220;<em>Building an InfoSec lab, on the cheap<\/em>&#8220;. Irongeek.com. Retrieved from http:\/\/www.irongeek.com\/i.php?page=security\/building-an-infosec-lab-on-the-cheap<\/p>\n<p>Ckirsch. (2013 Mar. 5). &#8220;<em>How To Set Up A Penetration Testing Lab<\/em>&#8220;. Message posted to https:\/\/community.rapid7.com\/docs\/DOC-2196<\/p>\n<p>Zeltser, Lenny. (2015 Mar. 15). &#8220;<em>5 Steps to Building a Malware Analysis Toolkit Using Free Tools<\/em>&#8220;.\u00a0 Lenny Zeltser (Weblog). https:\/\/zeltser.com\/build-malware-analysis-toolkit\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction A good way to understand how malicious software works is to drop the malware in a controlled environment, a vulnerability or malware test lab that you can infect to observe and analyze how the malware behaves on the system without affecting your production system. Although you can use old PCs and hardware to create &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/westoahu.hawaii.edu\/cyber\/vulnerability-research\/vulnerability-tutorials\/building-a-vulnerability-malware-test-lab\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Building a Vulnerability\/Malware Test Lab&#8221;<\/span><\/a><\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[31],"tags":[],"class_list":["post-3159","post","type-post","status-publish","format-standard","hentry","category-vulnerability-tutorials","entry"],"acf":[],"_links":{"self":[{"href":"https:\/\/westoahu.hawaii.edu\/cyber\/wp-json\/wp\/v2\/posts\/3159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/westoahu.hawaii.edu\/cyber\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/westoahu.hawaii.edu\/cyber\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/westoahu.hawaii.edu\/cyber\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/westoahu.hawaii.edu\/cyber\/wp-json\/wp\/v2\/comments?post=3159"}],"version-history":[{"count":14,"href":"https:\/\/westoahu.hawaii.edu\/cyber\/wp-json\/wp\/v2\/posts\/3159\/revisions"}],"predecessor-version":[{"id":3239,"href":"https:\/\/westoahu.hawaii.edu\/cyber\/wp-json\/wp\/v2\/posts\/3159\/revisions\/3239"}],"wp:attachment":[{"href":"https:\/\/westoahu.hawaii.edu\/cyber\/wp-json\/wp\/v2\/media?parent=3159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/westoahu.hawaii.edu\/cyber\/wp-json\/wp\/v2\/categories?post=3159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/westoahu.hawaii.edu\/cyber\/wp-json\/wp\/v2\/tags?post=3159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}