Any open-source, good VM?

Status
Not open for further replies.

NullPointerException

Level 12
Thread author
Verified
Aug 25, 2014
580
You might not believe this, but I've never used a VM in my life. I never actually "tested" malware. Because Assembly is too low-level, complicated language, I never bothered to reverse-engineer. Now that I want to do so, are there any free, and opens-source VMs? Do I need to have a copy of my operating system (ex. Windows 8?)? Anything I should know before using?
 
  • Like
Reactions: Cowpipe

Cowpipe

Level 16
Verified
Well-known
Jun 16, 2014
781
Assembly is too low-level and complicated? :p :D It's easy to understand once you have basic grasp of it (which admittedly takes a lot of effort!!), and from there, even machine code becomes easy to understand (and this, you can read shellcode without assembling).

Hmm, I'm not familiar with it personally but isn't XEN open source?

http://wiki.xen.org/wiki/Xen_Project_Software_Overview

Going completely off topic....
A simple bit of shellcode for you:
Code:
\x31\xC0\xB8\x01\x00\x00\x00\x89\xC3\xCD\x80

Each instruction is a set number of bytes.

For example the first instruction is 2 bytes:

Code:
0x31 0xC0

For example:
0x31 is the machine code representation of the instruction XOR which means Exclusive OR (you know, 1 xor 1 = 0...0 x 1 = 0 etc).

0xC0 is a little more complicated. But machine code opcodes are split into bits or 'parts' if you like. To keep things simple and save this post getting way too technical, let's just say that in this case, C0 represents the register eAX. Some instructions are obviously more sizeable than others, for example in our shellcode, B8 moves a value into the eAX register, which we read as:

B8 01 00 00 00 (mov eax, 1) with 00 for padding.

So reading it all together we get a simple code to exit from our process.

Code:
xor eax, eax ; clear register eax. 2 bytes compared with 5 bytes for mov eax, 0
mov eax, 1 ; move 0x1 into eax register
mov ebx, eax ; move the value held in eax into ebx
int 0x80 ; call an 'interrupt' (80) to exit the process. the exit code will be determined by the eax and ebx values :)

Simple :D
 

Ink

Administrator
Verified
Staff Member
Well-known
Jan 8, 2011
22,361

Cowpipe

Level 16
Verified
Well-known
Jun 16, 2014
781
Make sure that you're aware of the limitations of testing malware in a virtual machine though. Whilst it's becoming rarer for split personality malware to appear in the wild (that is, malware which behaves differently if detects it's being run in a VM), it can still appear, as can malware which has a payload delay which will execute innocent instructions or behaviour for an idle period for a set amount of time or until a specified number of actions are taken, such as so many mouse clicks.

I know you said you weren't into static analysis and wading through machine code, but don't forget static analysis can be done on a pretty high level. Just getting a copy of the API table to see what APIs the malware is calling can be very informative, as can looking through the binary for strings and using a fake DNS (eg: ApateDNS).

If you want to dig into malware analysis but really want to avoid learning even some basic assembly, then I'd recommend picking up a copy of OllyDBG with malware analysis plugins, for example ready made unpackers (eg RunPE unpack), anti-anti VM/sandbox etc. These will help you prepare your sample for effective malware analysis without stepping through instructions and manually dumping processes etc.

Anyway, that's just some advice for starters, there are many more options besides ;)

Best of luck! We're here if you need more pointers (null pointers or otherwise) :D
 

NullPointerException

Level 12
Thread author
Verified
Aug 25, 2014
580
Assembly is too low-level and complicated? :p :D It's easy to understand once you have basic grasp of it (which admittedly takes a lot of effort!!), and from there, even machine code becomes easy to understand (and this, you can read shellcode without assembling).

Hmm, I'm not familiar with it personally but isn't XEN open source?

http://wiki.xen.org/wiki/Xen_Project_Software_Overview

Going completely off topic....
A simple bit of shellcode for you:
Code:
\x31\xC0\xB8\x01\x00\x00\x00\x89\xC3\xCD\x80

Each instruction is a set number of bytes.

For example the first instruction is 2 bytes:

Code:
0x31 0xC0

For example:
0x31 is the machine code representation of the instruction XOR which means Exclusive OR (you know, 1 xor 1 = 0...0 x 1 = 0 etc).

0xC0 is a little more complicated. But machine code opcodes are split into bits or 'parts' if you like. To keep things simple and save this post getting way too technical, let's just say that in this case, C0 represents the register eAX. Some instructions are obviously more sizeable than others, for example in our shellcode, B8 moves a value into the eAX register, which we read as:

B8 01 00 00 00 (mov eax, 1) with 00 for padding.

So reading it all together we get a simple code to exit from our process.

Code:
xor eax, eax ; clear register eax. 2 bytes compared with 5 bytes for mov eax, 0
mov eax, 1 ; move 0x1 into eax register
mov ebx, eax ; move the value held in eax into ebx
int 0x80 ; call an 'interrupt' (80) to exit the process. the exit code will be determined by the eax and ebx values :)

Simple :D
Thanks, friend. I'll check Xen out. It looks good, considering it promises to be the only opens-source VM. It also seems light, which is perfect for me.

As of Shellcode...
After having ten years of experience with C, this code seems simple. But in reality, it is not. Malware tends to have really more complicated instructions, which is a really Bad Thing. It goes beyond simple text processing, such as modifying drivers and keylogging the keyboard. For example, I know seven languages (C, Perl, C#, Python, Java, .NET) yet I cannot even write a single Assembly file. It just seems too...unfamilar to me.

You know, after you come from a heavy C background, you just cannot write System.Out.Println, you keep writing printf until few days in the beginning. I've only one reference book for Assembly, which I plan to finish in a few months, because I've other projects to handle now. Not to mention I've still yet to finish Effective Java, and Release It!.

I am glad you posted the Shellcode to me, I'll study it more and get familiar with the low-level details that are yet alien to me. I do have one question although, is eAX a pointer, or is it heap itself?
 
  • Like
Reactions: Cowpipe

NullPointerException

Level 12
Thread author
Verified
Aug 25, 2014
580
If you want to test your current system and not a clean install on a VM, then try Disk2VHD. There may be tools online to convert from VHD to other virtual drives.
http://technet.microsoft.com/en-gb/sysinternals/ee656415.aspx

Else you'll need the Windows 8 ISO:
http://www.eightforums.com/tutorials/18309-windows-8-windows-8-1-iso-download-create.html

Not sure if this is what you're after?? VirtualBox is open-source, https://www.virtualbox.org (see FAQ)
Ah, my current disk is about 20GB free only...I am not sure how 1.9TB is going to fit. Well then, then I think I need an ISO copy of Windows (Since Mac/Linux doesn't have much interesting samples, nor the many tools which Windows has to offer. Which is wrong in its own way...). Thanks for your help. What I dislike is, that Linux is pretty small and takes much less time to download, and no piracy required, yet it doesn't have any interesting malware. And I do not know if Ollydbgs or IDA (by Hex-rays) supports Linux, even after I get some samples to run.
 

NullPointerException

Level 12
Thread author
Verified
Aug 25, 2014
580
Make sure that you're aware of the limitations of testing malware in a virtual machine though. Whilst it's becoming rarer for split personality malware to appear in the wild (that is, malware which behaves differently if detects it's being run in a VM), it can still appear, as can malware which has a payload delay which will execute innocent instructions or behaviour for an idle period for a set amount of time or until a specified number of actions are taken, such as so many mouse clicks.

I know you said you weren't into static analysis and wading through machine code, but don't forget static analysis can be done on a pretty high level. Just getting a copy of the API table to see what APIs the malware is calling can be very informative, as can looking through the binary for strings and using a fake DNS (eg: ApateDNS).

If you want to dig into malware analysis but really want to avoid learning even some basic assembly, then I'd recommend picking up a copy of OllyDBG with malware analysis plugins, for example ready made unpackers (eg RunPE unpack), anti-anti VM/sandbox etc. These will help you prepare your sample for effective malware analysis without stepping through instructions and manually dumping processes etc.

Anyway, that's just some advice for starters, there are many more options besides ;)

Best of luck! We're here if you need more pointers (null pointers or otherwise) :D

I am aware of its limitations. ESET/Kaspersky blogs have often told of these pesky little worms (literally) that hide if they detect a VM. While I'm also aware of anti-debuggers (A common trick is having its own debugger, so that two debuggers cannot run at the same time), I am going to start slow by reverse-engineering adware (As almost everyone does. :) ), then I'll get to complicated stuff like trojans, worms and advanced malware like Ransomeware.

I've heard the rumors of, but I've never seen or experienced such thing, that some rare malware is able to break through VM and infect its host? Now, that'd be bad, because I don't have backups (It's rather intriguing I don't own an extra harddrive, because almost every shop in France is closed these days) , so is that true?

Nullpointers? I do have a catch block ready, although...
 
  • Like
Reactions: Cowpipe

Cowpipe

Level 16
Verified
Well-known
Jun 16, 2014
781
Thanks, friend. I'll check Xen out. It looks good, considering it promises to be the only opens-source VM. It also seems light, which is perfect for me.

As of Shellcode...
After having ten years of experience with C, this code seems simple. But in reality, it is not. Malware tends to have really more complicated instructions, which is a really Bad Thing. It goes beyond simple text processing, such as modifying drivers and keylogging the keyboard. For example, I know seven languages (C, Perl, C#, Python, Java, .NET) yet I cannot even write a single Assembly file. It just seems too...unfamilar to me.

You know, after you come from a heavy C background, you just cannot write System.Out.Println, you keep writing printf until few days in the beginning. I've only one reference book for Assembly, which I plan to finish in a few months, because I've other projects to handle now. Not to mention I've still yet to finish Effective Java, and Release It!.

I am glad you posted the Shellcode to me, I'll study it more and get familiar with the low-level details that are yet alien to me. I do have one question although, is eAX a pointer, or is it heap itself?

I hear you man, I'm a C programmer myself and being so familiar with the syntax I have repeatedly tried and failed to learn C++, it just seems completely unnatural. For me, I learned assembly at a young age so growing up with it and with low level concepts it seems natural. eAX is actually a register. You see AX is a register which can hold 16 bits (in 16 bit assembly). EAX can hold 32 bits (in 32 bit assembly) and RAX is the 64 bit version. So if you're decompiling on a 32 bit machine you'll see instructions pointing to eax.

As for what a register actually is, think of it as a form of memory slot, in which you can store values and retrieve them but much much faster than doing so from the computer's memory (with pointers and such). This is where the stack comes in ;) See here for a nice explanation: http://www.friedspace.com/assembly/cpuregs1.php

In malware, you do see more complicated instructions but of course, some instructions are the same from malware to malware. Here's a simple chunk of assembly which checks to see if we're being debugged by OllyDbg.

Code:
mov eax, fs:[30h]
movzx eax, byte ptr[eax+0x2]
or al,al
jz payload_
jmp killprocess_

So in this example, we find the segment 30h which contains something called the 'PEB' and we movzx the byte at 0x2 of segment 30h into eax (this is now a zero extended value which gives us access to the AL segment of it). The next instruction checks to see if AL is 0 (or Al,AL), and if it is (JZ - Jump if Zero), we execute our payload, otherwise we skip over and JMP to our killprocess function which either idles out or does kills our process and melts or something, whatever.

But those are the kind of code segments that you will gradually learn to identify. Of course I can't look through a program in a debugger and tell you exactly how it works just from the assembly code, but I can dive in, analyse it piece by piece and work out what it's doing and what states or values trigger that behaviour, and this is how you build a picture of the program (looking at the stack/heap/registers etc of course too).

As for breaking out of VM, yes it is possible. Malware it much more likely to break out of a sandbox than a virtual machine, and the reality is quite overhyped I'm afraid but yes malware can break out in rare cases. For example, if you mount a physical USB drive in your virtual machine (for example to transfer files), the malware gets access to that, and when you dismount and use it in your normal computer, there is a copy which has been brought out of the machine. There are other ways but they are much less common and I haven't encountered them in the wild myself (in realistic usage), I'm sure another member here will explain those before me :p

Hope that helps a bit ;)
 

jackuars

Level 27
Verified
Top Poster
Well-known
Jul 2, 2014
1,689
Is it not good to test for malware's running software virtualization techniques like ToolWiz TimeFreeze, that freezes your PC and revert all the changes you've made after a system restart? Instead of going for hardware virtualization
 
  • Like
Reactions: Cowpipe

NullPointerException

Level 12
Thread author
Verified
Aug 25, 2014
580
I hear you man, I'm a C programmer myself and being so familiar with the syntax I have repeatedly tried and failed to learn C++, it just seems completely unnatural. For me, I learned assembly at a young age so growing up with it and with low level concepts it seems natural. eAX is actually a register. You see AX is a register which can hold 16 bits (in 16 bit assembly). EAX can hold 32 bits (in 32 bit assembly) and RAX is the 64 bit version. So if you're decompiling on a 32 bit machine you'll see instructions pointing to eax.

As for what a register actually is, think of it as a form of memory slot, in which you can store values and retrieve them but much much faster than doing so from the computer's memory (with pointers and such). This is where the stack comes in ;) See here for a nice explanation: http://www.friedspace.com/assembly/cpuregs1.php

In malware, you do see more complicated instructions but of course, some instructions are the same from malware to malware. Here's a simple chunk of assembly which checks to see if we're being debugged by OllyDbg.

Code:
mov eax, fs:[30h]
movzx eax, byte ptr[eax+0x2]
or al,al
jz payload_
jmp killprocess_

So in this example, we find the segment 30h which contains something called the 'PEB' and we movzx the byte at 0x2 of segment 30h into eax (this is now a zero extended value which gives us access to the AL segment of it). The next instruction checks to see if AL is 0 (or Al,AL), and if it is (JZ - Jump if Zero), we execute our payload, otherwise we skip over and JMP to our killprocess function which either idles out or does kills our process and melts or something, whatever.

But those are the kind of code segments that you will gradually learn to identify. Of course I can't look through a program in a debugger and tell you exactly how it works just from the assembly code, but I can dive in, analyse it piece by piece and work out what it's doing and what states or values trigger that behaviour, and this is how you build a picture of the program (looking at the stack/heap/registers etc of course too).

As for breaking out of VM, yes it is possible. Malware it much more likely to break out of a sandbox than a virtual machine, and the reality is quite overhyped I'm afraid but yes malware can break out in rare cases. For example, if you mount a physical USB drive in your virtual machine (for example to transfer files), the malware gets access to that, and when you dismount and use it in your normal computer, there is a copy which has been brought out of the machine. There are other ways but they are much less common and I haven't encountered them in the wild myself (in realistic usage), I'm sure another member here will explain those before me :p

Hope that helps a bit ;)
So registers are just heaps?
I am sorry for a little late reply. Network administrating still gives me headache as it gave me twenty years ago.

Thank you. I think now I have better understanding of memory, and more importantly Assembly. I've just bought Programming From Groundup : Assembly (It was listed as the most recommended Assembly book over Stackoverflow). For now, i think we're going off-topic. But thank you for inspirting me to do some Assembly, and re-read C reference books. :). I do agree that programming is one of the worst re-learn things, because after years of practicing habits, you just can't leave them.

I'll try all the VMs. Thank you guys for helping me.
 
  • Like
Reactions: Cowpipe

Cowpipe

Level 16
Verified
Well-known
Jun 16, 2014
781
So registers are just heaps?
I am sorry for a little late reply. Network administrating still gives me headache as it gave me twenty years ago.

Thank you. I think now I have better understanding of memory, and more importantly Assembly. I've just bought Programming From Groundup : Assembly (It was listed as the most recommended Assembly book over Stackoverflow). For now, i think we're going off-topic. But thank you for inspirting me to do some Assembly, and re-read C reference books. :). I do agree that programming is one of the worst re-learn things, because after years of practicing habits, you just can't leave them.

I'll try all the VMs. Thank you guys for helping me.

Yeah you're right in a way. Basically registers are just sections of physical memory built into the processor chip. As accessing RAM is quite slow for the processor, to make assembly operations fast, you store and work with values in these physical registers :)

Indeed we do seem to be going fairly off topic, but feel free to make a new thread or PM me if you need any more help and I'll do my best ;)
 

NullPointerException

Level 12
Thread author
Verified
Aug 25, 2014
580
Is it not good to test for malware's running software virtualization techniques like ToolWiz TimeFreeze, that freezes your PC and revert all the changes you've made after a system restart? Instead of going for hardware virtualization
Some rootkits bypass. Not to mention, my current identity (credit card, bank account, passwords etc.) will be almost certainly hacked. Also, how can I be so sure that I will not infect myself while using virtualization?
 
Last edited:

jackuars

Level 27
Verified
Top Poster
Well-known
Jul 2, 2014
1,689
Some rootkits bypass. Not to mention, my current identity will be at risk. Also, how can I be so sure that I will not infect myself?

Identity? What?

And rootkits? I dunno, but it's supposed to bring the system back to the state it was before virtualization ....
 

NullPointerException

Level 12
Thread author
Verified
Aug 25, 2014
580
Identity? What?

And rootkits? I dunno, but it's supposed to bring the system back to the state it was before virtualization ....
My internet makes me look like a rambling fool...

You know, it disconnects so often that I think that I've written the words I have not, once I repair it (temporarily) and start browsing.
 
Status
Not open for further replies.

About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top