Off-topic, but interesting -- disassembling a virus
Posted: Mon May 17, 2004 11:00 pm
Just a few minutes ago, I got an email from someone saying "Important details!" with a zip attachment. I looked at a hex dump of the zip and saw in clear text (not compressed...), "This program cannot be run in DOS mode". Haha, right! I wonder what that is.
The import table says that it imports LoadLibraryA, GetProcAddress, VirtualAlloc and VirtualFree from the Windows kernel. Clearly it loads more code at run-time from DLLs that they don't want anyone to know about from the import table. They also stripped the relocations (obviously), so I can't find out where those imports are referenced.
At any rate, I disassembled the executable, but the assembly doesn't make sense. At the entry point (0x403e5f), there's the following code:
403e5f: b8 6e 3e 40 00 mov $0x403e6e,%eax
403e64: 80 00 28 addb $0x28,(%eax)
403e67: 40 inc %eax
403e68: 81 00 67 45 23 01 addl $0x1234567,(%eax)
403e6e: 90 nop
403e6f: cb lret
403e70: 76 39 jbe 0x403eab
403e72: ff 50 64 call *0x64(%eax)
403e75: ff 35 00 00 00 00 pushl 0x0
403e7b: 64 89 25 00 00 00 00 mov %esp,%fs:0x0
403e82: 33 c0 xor %eax,%eax
Look at that code right there: it modifies itself. Right now it looks like it's dead code (where the hell is it returning to with the lret instruction?), but in reality it changes itself. Sneaky... Unfortunately, I don't know what exactly it's doing. I assume it is is jumping somewhere else in the code. Can anyone else make any sense of it?
Here's the executable: http://flyswatter.dyndns.org/~michael/Details.exe
If you're running Windows, be careful not to run it. It is a virus after all. I' m running Linux, so I don't have to worry (as long as I don't invoke Wine)
The import table says that it imports LoadLibraryA, GetProcAddress, VirtualAlloc and VirtualFree from the Windows kernel. Clearly it loads more code at run-time from DLLs that they don't want anyone to know about from the import table. They also stripped the relocations (obviously), so I can't find out where those imports are referenced.
At any rate, I disassembled the executable, but the assembly doesn't make sense. At the entry point (0x403e5f), there's the following code:
403e5f: b8 6e 3e 40 00 mov $0x403e6e,%eax
403e64: 80 00 28 addb $0x28,(%eax)
403e67: 40 inc %eax
403e68: 81 00 67 45 23 01 addl $0x1234567,(%eax)
403e6e: 90 nop
403e6f: cb lret
403e70: 76 39 jbe 0x403eab
403e72: ff 50 64 call *0x64(%eax)
403e75: ff 35 00 00 00 00 pushl 0x0
403e7b: 64 89 25 00 00 00 00 mov %esp,%fs:0x0
403e82: 33 c0 xor %eax,%eax
Look at that code right there: it modifies itself. Right now it looks like it's dead code (where the hell is it returning to with the lret instruction?), but in reality it changes itself. Sneaky... Unfortunately, I don't know what exactly it's doing. I assume it is is jumping somewhere else in the code. Can anyone else make any sense of it?
Here's the executable: http://flyswatter.dyndns.org/~michael/Details.exe
If you're running Windows, be careful not to run it. It is a virus after all. I' m running Linux, so I don't have to worry (as long as I don't invoke Wine)