Today we're going to analyze Morto.A a malware which, in this weeks, is spreading in many Internet places. It's a worm that allows unauthorized access to an infected computer and tries to compromise administrator passwords for Remote Desktop connections, through RDP protocol, on a network. Indeed this threat infecting computers by targeting accounts that have "weak" passwords.
[ Contact me for sample. ]
Below I report how this malware is identified by some AV:
- AhnLab-V3 -> Win-Trojan/Npkon.49969
- AntiVir -> TR/Agent.49969.1
- Antiy-AVL -> Worm/Win32.Morto.gen
- Avast -> Win32:Malware-gen
- Avast5 -> Win32:Malware-gen
- AVG -> Agent3.ACOR
- BitDefender -> Win32.Worm.Morto.A
- ByteHero -> Trojan.Win32.Heur.Gen
- CAT-QuickHeal -> Worm.Morto.a
- ClamAV -> Worm.Morto
- Commtouch -> - Not detected
- Comodo -> TrojWare.Win32.Trojan.Agent.Gen
- DrWeb -> BackDoor.Tsclient.1
- Emsisoft -> Worm.Win32.Morto!IK
- eSafe -> Win32.Dropper
- eTrust-Vet -> Win32/Morto.A
- F-Prot -> - Not detected
- F-Secure -> Worm:W32/Morto.A
- Fortinet -> W32/Morto.B!worm.im
- GData -> Win32.Worm.Morto.A
- Ikarus -> Worm.Win32.Morto
- Jiangmin -> Backdoor/DsBot.dov
- K7AntiVirus -> Riskware
- Kaspersky -> Net-Worm.Win32.Morto.c
- McAfee -> W32/Morto
- McAfee-GW-Edition -> W32/Morto
- Microsoft -> Worm:Win32/Morto.gen!A
- NOD32 -> Win32/Morto.B
- Norman -> W32/Morto.D
- nProtect -> Worm/W32.Morto.49969
- Panda -> Trj/MereDrop.B
- PCTools -> Trojan.Dropper
- Prevx -> - Not detected
- Rising -> - Not detected
- Sophos -> Mal/Morto-A
- SUPERAntiSpyware -> - Not detected
- Symantec -> Trojan.Dropper
- TheHacker -> Trojan/Agent.syl
- TrendMicro -> - Not detected
- TrendMicro-HouseCall -> WORM_MORTO.SMA
- VBA32 -> - Not detected
- VIPRE -> Trojan.Win32.Generic!BT
- ViRobot -> Backdoor.Win32.DsBot.53076
- VirusBuster -> Trojan.Agent!MYoVp4jcZjs
This is Virustotal result: 37/ 44 (84.1%). Good rate detection, isn't it uh?
Other additional information are:
MD5 Hash: 2EEF4D8B88161BAF2525ABFB6C1BAC2B
SHA-1 HASH: 0BBB014657BF4459FAA2E6FAF11D0559B196187C
to uniquely identify our malware.
Power on your Virtual Machine, set up your best reversing malware tools, disable Drag'n'Drop and any Shared Folder, finally take a Snapshot of your clean machine so you can go back everytime you want.
Now take also another snapshot, this time of your Windows Registry so that you can compare it with another one after launching the malware, to see any change and every modification performed. For this RegShot is helpful ;)
So now that it's all ready let's start the malware analysis.
Before we run malware and make a dynamic analysis with SySAnalyzer, open morto.exe in CFF Explorer to see if it give us some interesting information. As you can see, Morto it's compiled with Microsoft Visual C++ 6.0. This inform us that it isn't packed/compressed (hopefully :P). You can also scan the executable with any packer detector for the sake of curiosity like PEiD, ProtectionID, RDG Packer Detector, etc...
Than let's go to the Import Directory and you notice 3 imported libraries:
Open SysAnalyzer, choose morto.exe and Start; morto.exe is running.
Make a second snapshot with RegShot and compare with the first one to see the differences.
- morto.exe is launched;
- clb.dll in C:\WINDOWS ( this is the payload );
- ntshrui.dll in C:\WINDOWS\temp;
- Sens32.dll in C:\WINDOWS\system32;
- 1.40_TestDdos in C:\WINDOWS\Offline Web Pages;
- cache.txt in C:\WINDOWS\Offline Web Pages;
- ~MTMP<4RandomDigits>.exe, example ~MTMP657C.exe.
- Operates some Registry modifications:
- rename at next reboot Sens32.dll to cache.txt through key HKLM\SYSTEM\ControlSet001\Control\Session Manager\PendingFileRenameOperations;
- hides any type of error message thorugh key HKLM\SYSTEM\ControlSet001\Control\Windows\NoPopUpsOnBoot;
- install ntshrui.dll and Sens32.dll as service;
Now that we have gathered enough information let's go to analyze our malware in OllyDbg.
Once opened it we land to the EP. Being builted with MFC Framework we must find WinMain function, indeed it's at 0x4019B3:
.text:004019A8 push eax ; nShowCmd .text:004019A9 push esi ; lpCmdLine .text:004019AA push ebx ; hPrevInstance .text:004019AB push ebx ; lpModuleName .text:004019AC call ds:GetModuleHandleA .text:004019B2 push eax ; hInstance .text:004019B3 call _WinMain@16 ; Jump to WinMain function .text:004019B8 mov [ebp+var_68], eax ; Dig Deeper .text:004019BB push eax ; Code .text:004019BC call ds:exit
Step into (F7) to dig deeper and we land here, at 401BE0 address in AfxWinMain like every application built with MFC:
.text:00401BE0 push [esp+nShowCmd] ; int .text:00401BE4 push [esp+4+lpCmdLine] ; char * .text:00401BE8 push [esp+8+hPrevInstance] ; struct HINSTANCE__ * .text:00401BEC push [esp+0Ch+hInstance] ; struct HINSTANCE__ * .text:00401BF0 ; AfxWinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int) .text:00401BF0 call ?AfxWinMain@@YGHPAUHINSTANCE__@@0PADH@Z .text:00401BF5 retn 10h
Step into (F7) when you arrive to the AfxWinMain. We land in the JMP NEAR DWORD PTR DS:[<&MFC42.#1576>], Step Over (F8) and we arrive into AfxWinMain function:
The call that execute important tasks is CALL NEAR DWORD PTR DS:[EAX+58], Step into...
Through call at address 40165F we obtain the address of a encrypted block. This encrypted block is the one which will be copied in wpa registry key and it is contained in morto.exe. This address in my PC is 8F1796. Step by step and you will understand more better all this. See follow:
- First it prepares ESI and EDI register with address of previously encrypted code and memory block allocated before respectively;
- Second it prepares ECX counter register for REP instruction.
Properly with 2 REP instuctions it moves the content of encrypted block into memory block allocated by malloc before; from 8F1796 to 8FC375 hence from 3339C0 to 33E59F. Take a look at the ESI and EDI registers and follow them in dump to verify!
The call at address 40169C do nothing of important, replace the content of some stack address with 0s.
Another important call is the call at address 4016b2, hence step into and when you meet next call F7 again and we land here in one important piece of code:
As you can see, first through a loop it's rewritten the encrypted block, then there is a VirtualAlloc API which commits a region of pages. In my PC the address of this committed page is 9F0000 with excecutable-read-write permits (XRW flag in LordPE). All this it's important because in this committed page there will be write the clb library, that is the payload. The next call instead writes some things into committed page. Let's continue the analysis.
As in all other cases, after VirtualAlloc API follow LoadLibrary and GetProcAddress to write IT (Import Table), step now into the call at address 40110D and you will see the code below:
Comments on the image and your debugging steps will be the icing on the cake to understand much more!
If you continue debugging you'll arrive to call EDX. This instruction call the dll (in this case cld.dll) which it was prepared through previously explained steps. Now it's time to use LordPE to dump the dll to analyze further. To do that, step into call EDX and we land here, EP of dll ;) :
009FE8A2 55 PUSH EBP 009FE8A3 8BEC MOV EBP, ESP 009FE8A5 53 PUSH EBX 009FE8A6 8B5D 08 MOV EBX, DWORD PTR SS:[EBP+8] 009FE8A9 56 PUSH ESI 009FE8AA 8B75 0C MOV ESI, DWORD PTR SS:[EBP+0C] 009FE8AD 57 PUSH EDI 009FE8AE 8B7D 10 MOV EDI, DWORD PTR SS:[EBP+10] 009FE8B1 85F6 TEST ESI, ESI 009FE8B3 75 09 JNE SHORT 009FE8BE 009FE8B5 833D 75D8A300 0 CMP DWORD PTR DS:[0A3D875], 0 009FE8BC EB 26 JMP SHORT 009FE8E4
Now, open LordPE -> select our morto.exe -> right click -> Dump Region and select the address 9F0000, the only with XRW flag. This is the memory region before being committed by VirtualAlloc (see above if you don't remember) Give a name at dump, then open it with one HexEditor and delete everything before MZ signature and save it, i.e. as clbDump.dll. As I said before this dll is the payload, that performs most of the main actions, said with simple words.
If you open it in CFF Explorer you can confirm that it's a dll, just look in File Header -> Characteristics -> 'File is a DLL' is checked.
Once call EDX is executed morto.exe "jump" into clb.dll to perform the most important features, but we'll deal with it in the next tutorial!
[ Update: 29/09/2012 ]
Ok, time is passed and I didn't write 2nd part of the Morto Analysis as I said in the last part of this tutorial. Write about it now doesn't make sense but, at least, I can list main payload operations once it's allocated in memory, decrypted, re-allocated again and started by dropper.
Below the operations:
- Morto tries to connect to infected computer and exploits Remote Desktop connection ( RDP protocol ) to the 3389 port. The usernames used are listed below
with follow passwords
It's clear now because I said "weak passwords". ;)
- Morto downloads r.reg file, and through it starts rundll32.exe with Administration privilege to execute clb.dll malicious DLL at next OS startup. All this by way of the \\tsclient\a
- Malicious domains contacted by Morto below
- Morto is also capables to download new components and new payload variants, which moreover it's installed also as Windows Service named 6o4.
- More, Morto has hardcoded string like these:
which is used to stop some processes of most popular security software.
Ok, I want to clinch that this update is only to conclude the post in different way because I hadn't time to publish the payload analysis made by me one year ago. Again, this update didn't add new informations compared to that you can find reading other analysis.
The new/last variant
The new Morto variant mainly has added file infection capability through Code Injection but the goal is the same of the first variant; compromise RDP connections with weak Admin password.
Morto Injects its code to svchost.exe Windows OS file system, then creates a Mutex, to avoid multiple injections to the same file, named Global\_PPIftSvc.
The file infected, after injection, has in the MZ Header PPIF string as Infection Marker.
Malicious domains contacted by Morto to download other files, updates, etc are:
In addition to these operations, there are no significant changes compared to the previous variant of the malware, so this is all.
Greetings goes to Quequero, Evilcry, Giada and all other UIC members! =)